JP2011107883A - Debugging device - Google Patents

Debugging device Download PDF

Info

Publication number
JP2011107883A
JP2011107883A JP2009260931A JP2009260931A JP2011107883A JP 2011107883 A JP2011107883 A JP 2011107883A JP 2009260931 A JP2009260931 A JP 2009260931A JP 2009260931 A JP2009260931 A JP 2009260931A JP 2011107883 A JP2011107883 A JP 2011107883A
Authority
JP
Japan
Prior art keywords
information
history
variable
variable value
function
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
JP2009260931A
Other languages
Japanese (ja)
Inventor
Ichiro Isu
一郎 伊須
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Renesas Electronics Corp
Original Assignee
Renesas Electronics Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Renesas Electronics Corp filed Critical Renesas Electronics Corp
Priority to JP2009260931A priority Critical patent/JP2011107883A/en
Publication of JP2011107883A publication Critical patent/JP2011107883A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Debugging And Monitoring (AREA)

Abstract

<P>PROBLEM TO BE SOLVED: To provide a debugging device for increasing the efficiency of a debugging operation. <P>SOLUTION: With respect to a source file 407, a compiler processing part 408 generates a program and a line information table in which information indicating places where function names and variables are stored and information indicating variable names and substitution/reference are associated with each other. A variable value history management part 406 stores variable values and variable names when executing and stopping the program in the past as history information in a function history table. A variable value display control part 404 obtains the places of the variables substituted/referenced in the functions when the program is stopped as acquisition places from a line information table, and obtains variable values corresponding to the fetch places as acquisition variable values from a memory/register management part 405 in which the information showing the places of the plurality of variables and the plurality of variable values are stored, and obtains the history information pertinent to the acquisition variable values as the pertinent history information from the function history table, and displays it at a display device. <P>COPYRIGHT: (C)2011,JPO&INPIT

Description

本発明は、C言語で記述されたソースプログラム(以下、Cソースプログラムと称する)をデバッグする装置及び方法に関する。   The present invention relates to an apparatus and method for debugging a source program written in C language (hereinafter referred to as C source program).

既存のデバッガの機能の1つに、変数の値(以下、変数値と称する)を表示する機能(ウォッチ・ウインドウ、ローカル変数ウインドウetc)がある。この機能で表示される変数値は、最新の変数値のみである。プログラムをデバッグする際には、最新の変数値だけではなく、過去の変数値が必要な場合がある。   One of the functions of the existing debugger is a function (watch window, local variable window etc) for displaying variable values (hereinafter referred to as variable values). The variable values displayed by this function are only the latest variable values. When debugging a program, not only the latest variable values but also past variable values may be required.

プログラムをデバッグする際には、最新の変数値だけではなく、過去の変数値が必要な場合がある。過去の変数値を表示するものとして、任意の変数への代入を監視して履歴として保存/表示するデバック装置が、特開2007−34825号公報に記載されている。   When debugging a program, not only the latest variable values but also past variable values may be required. Japanese Patent Application Laid-Open No. 2007-34825 discloses a debugging device for displaying past variable values and monitoring / substituting an arbitrary variable and storing / displaying it as a history.

図1は、従来のデバック装置として、特開2007−34825号公報に記載されているデバック装置を示している。プロセッサ制御部102は、実行形式ファイル101中のプログラムをプロセッサ上で実行/停止する。   FIG. 1 shows a debugging apparatus described in Japanese Patent Application Laid-Open No. 2007-34825 as a conventional debugging apparatus. The processor control unit 102 executes / stops the program in the execution format file 101 on the processor.

プロセッサ制御部102は、プログラムのデバックを開始すると、命令をフェッチして実行する。この際、フェッチした命令がCソースプログラムの行(以下、Cソース行)の先頭の命令である場合、プロセッサ制御部102は、その時点でのプロセッサレジスタの内容(データ)をレジスタ履歴メモリ104に記録し、実行中のソースプログラムの行番号をソース行履歴メモリ105に記録して、変数監視部105を起動する。   When starting to debug a program, the processor control unit 102 fetches and executes an instruction. At this time, if the fetched instruction is the first instruction of a line of the C source program (hereinafter, C source line), the processor control unit 102 stores the contents (data) of the processor register at that time in the register history memory 104. The line number of the source program being recorded and recorded is recorded in the source line history memory 105, and the variable monitoring unit 105 is activated.

変数監視部105は、起動されると、Cソース行が代入文であるか否かを判定する。代入文の場合、それを変数履歴メモリ106に記録して、その動作を終了する。プロセッサ制御部102は、ブレーク・ポイントを検出するとプログラムを停止する。   When activated, the variable monitoring unit 105 determines whether the C source line is an assignment statement. In the case of an assignment statement, it is recorded in the variable history memory 106 and the operation is terminated. When detecting the break point, the processor control unit 102 stops the program.

レジスタ表示部107、プログラム表示部108、変数表示部109は、レジスタ履歴メモリ104、ソース行履歴メモリ105、変数履歴メモリ106に記録された内容に基づいて、履歴の結果を表示する。   The register display unit 107, the program display unit 108, and the variable display unit 109 display history results based on the contents recorded in the register history memory 104, the source line history memory 105, and the variable history memory 106.

特開2007−34825号公報JP 2007-34825 A

従来のデバック装置は、図2に示されるように、CソースプログラムのL7から実行を開始してL14で停止する。この場合に表示される変数の変更履歴は、図3のようになる。   As shown in FIG. 2, the conventional debugging device starts execution from L7 of the C source program and stops at L14. The variable change history displayed in this case is as shown in FIG.

変数に対する代入の履歴が全て表示されるため、プログラムをデバッグするための情報がある程度揃っているが、以下の面で、問題点がある。   Since all the history of substitution for variables is displayed, there is some information for debugging the program, but there are problems in the following aspects.

第1の問題点として、従来のデバック装置では、変数の代入に関する履歴しか保存/表示しないことである。図2に示されるように、CソースプログラムのL13にて、グローバル変数bの値をすぐに確認できない。確認するためには、L13の処理の直前のグローバル変数bへの代入を行っている箇所を探す必要がある。   The first problem is that the conventional debugging apparatus stores / displays only the history relating to the substitution of variables. As shown in FIG. 2, the value of the global variable b cannot be confirmed immediately at L13 of the C source program. In order to confirm, it is necessary to search for a place where the assignment to the global variable b immediately before the process of L13 is performed.

第2の問題点として、従来のデバック装置では、同名の変数を区別していないことである。図3では、変数名aの値にて、値1はグローバル変数aの値を表示し、値2はローカル変数aの値を表示している。図3の表示結果からは異なるスコープの変数値を表示していることが一目で分からない。確認するには、Cソースプログラムを見る必要がある。   As a second problem, the conventional debugging apparatus does not distinguish between variables having the same name. In FIG. 3, the value 1 represents the value of the global variable a and the value 2 represents the value of the local variable a. From the display result of FIG. 3, it cannot be seen at a glance that variable values of different scopes are displayed. To check, you need to look at the C source program.

第3の問題点として、従来のデバック装置では、全ての履歴を表示することである。図2に示されるように、Cソースプログラムのmain関数についてデバッグを行っている際には、main関数内にて代入/参照されている変数のみがデバッグに必要な情報となる。図3における変数名eに関する情報は、main関数についてデバッグを行っている際には、不要な情報である。   As a third problem, the conventional debugging apparatus displays all the history. As shown in FIG. 2, when debugging the main function of the C source program, only the variables assigned / referenced in the main function are information necessary for debugging. The information on the variable name e in FIG. 3 is unnecessary information when debugging the main function.

以下に、発明を実施するための形態で使用される符号を括弧付きで用いて、課題を解決するための手段を記載する。この符号は、特許請求の範囲の記載と発明を実施するための形態の記載との対応を明らかにするために付加されたものであり、特許請求の範囲に記載されている発明の技術的範囲の解釈に用いてはならない。   In the following, means for solving the problems will be described using the reference numerals used in the embodiments for carrying out the invention in parentheses. This symbol is added to clarify the correspondence between the description of the claims and the description of the mode for carrying out the invention, and the technical scope of the invention described in the claims. Must not be used to interpret

本発明のデバック装置は、コンパイラ処理部(408)と、メモリ/レジスタ管理部(405)と、実行制御部(402)と、変数値履歴管理部(406)と、変数値表示制御部(404)とを具備している。コンパイラ処理部(408)は、ソースファイル(407)に対して、プログラムとライン情報テーブルとを生成する。ライン情報テーブルには、関数名と変数が格納されている箇所を表す情報と変数名と代入/参照を示す情報とが複数対応付けられている。メモリ/レジスタ管理部(405)には、複数の変数が格納されている箇所を表す情報と複数の変数値とが格納されている。実行制御部(402)は、プログラムを実行/停止する。変数値履歴管理部(406)は、関数履歴テーブルを備え、実行制御部(402)が過去にプログラムを実行して停止したときの変数値と、その変数値に対する変数名とを履歴情報として、関数履歴テーブルに格納する。変数値表示制御部(404)は、プログラムが停止している時点での関数内で代入/参照されている変数の箇所を取得箇所としてライン情報テーブルから取得する。変数値表示制御部(404)は、メモリ/レジスタ管理部(405)に格納された複数の変数値の中から、取得箇所に対応する変数値を取得変数値として取得する。変数値表示制御部(404)は、関数履歴テーブルに格納された履歴情報の中から、取得変数値に該当する履歴情報を該当履歴情報として取得し、該当履歴情報を表示装置に表示する。   The debugging apparatus of the present invention includes a compiler processing unit (408), a memory / register management unit (405), an execution control unit (402), a variable value history management unit (406), and a variable value display control unit (404). ). The compiler processing unit (408) generates a program and a line information table for the source file (407). In the line information table, a plurality of information indicating function names and locations where variables are stored are associated with a plurality of variable names and information indicating substitution / reference. The memory / register management unit (405) stores information indicating a location where a plurality of variables are stored and a plurality of variable values. The execution control unit (402) executes / stops the program. The variable value history management unit (406) includes a function history table, and the variable value when the execution control unit (402) has stopped executing the program in the past and the variable name for the variable value are used as history information. Store in function history table. The variable value display control unit (404) acquires from the line information table, as the acquisition location, the location of the variable that is substituted / referenced in the function at the time when the program is stopped. The variable value display control unit (404) acquires a variable value corresponding to the acquisition location as an acquired variable value from among a plurality of variable values stored in the memory / register management unit (405). The variable value display control unit (404) acquires the history information corresponding to the acquired variable value from the history information stored in the function history table as the corresponding history information, and displays the corresponding history information on the display device.

従来では、第1の問題点として、変数の代入に関する履歴しか表示していなかったが、本発明では、変数の代入/参照箇所に関する情報を取得して、代入箇所だけでなく、参照箇所での変数値も表示装置に表示するようにしている。これにより、変数の代入先を探す作業を省くことができ、デバッグ作業の効率が上がる。   Conventionally, as a first problem, only the history relating to variable substitution has been displayed. However, in the present invention, information relating to variable substitution / reference location is acquired, and not only the substitution location but also the reference location. Variable values are also displayed on the display device. As a result, the work of searching for a variable assignment destination can be omitted, and the efficiency of the debugging work can be improved.

また、従来では、第2の問題点として、プログラム停止時点での全ての変数の変更履歴を表示しているため、同名の変数が区別しにくいが、本発明では、上記の取得変数値(デバッグ対象となっている関数にて代入/参照している変数値)に該当する履歴情報を該当履歴情報として、即ち、変更履歴として表示装置に表示するようにしている。これにより、スコープの異なる同名の変数が表示されなくなり、デバッグ時に異なる変数を参照することによる作業ミスを回避できる。   Conventionally, as a second problem, since the change history of all variables at the time of stopping the program is displayed, it is difficult to distinguish the variables with the same name. However, in the present invention, the acquired variable values (debugging) The history information corresponding to the variable value assigned / referenced by the target function is displayed on the display device as the corresponding history information, that is, as the change history. As a result, variables with the same name in different scopes are not displayed, and work errors caused by referring to different variables during debugging can be avoided.

また、従来では、第3の問題点として、全ての履歴が表示されているが、本発明では、デバッグ対象となっている関数のデバッグに必要な変数の変更履歴のみを表示装置に表示するようにしている。これにより、デバッグ作業の効率が上がる。   Conventionally, all the history is displayed as a third problem. However, in the present invention, only the change history of the variable necessary for debugging the function being debugged is displayed on the display device. I have to. This increases the efficiency of debugging work.

図1は、従来のデバック装置として、特開2007−34825号公報に記載されているデバック装置を示している。FIG. 1 shows a debugging apparatus described in Japanese Patent Application Laid-Open No. 2007-34825 as a conventional debugging apparatus. 図2は、Cソースファイル207の例である。FIG. 2 is an example of the C source file 207. 図3は、従来のデバック装置を用いたときの変数の変更履歴の表示結果を示している。FIG. 3 shows a display result of a variable change history when a conventional debugging device is used. 図4は、本発明の実施形態によるデバック装置の構成を示している。FIG. 4 shows a configuration of a debugging device according to an embodiment of the present invention. 図5は、実行制御部402の動作として、デバック処理を示すフローチャートである。FIG. 5 is a flowchart showing a debugging process as the operation of the execution control unit 402. 図6は、変数値表示制御部404の動作として、変数値表示処理を示すフローチャートである。FIG. 6 is a flowchart showing variable value display processing as the operation of the variable value display control unit 404. 図7は、変数値表示制御部404の動作として、変数値表示処理を示すフローチャートである。FIG. 7 is a flowchart showing variable value display processing as the operation of the variable value display control unit 404. 図8は、変数値履歴管理部406の動作として、第1変数値履歴管理処理を示すフローチャートである。FIG. 8 is a flowchart showing a first variable value history management process as the operation of the variable value history management unit 406. 図9は、変数値履歴管理部406の動作として、第2変数値履歴管理処理を示すフローチャートである。FIG. 9 is a flowchart showing a second variable value history management process as the operation of the variable value history management unit 406. 図10は、本発明を適用して、図2に示されるCソースファイル407のL7から実行を開始してL14で停止した場合に、変数値履歴管理部406が生成する関数履歴テーブルの例である。FIG. 10 is an example of a function history table generated by the variable value history management unit 406 when the present invention is applied and execution is started from L7 of the C source file 407 shown in FIG. 2 and stopped at L14. is there. 図11は、デバッグ情報管理部403の動作として、第1デバック情報管理処理を示すフローチャートである。FIG. 11 is a flowchart showing a first debug information management process as an operation of the debug information management unit 403. 図12は、デバッグ情報管理部403の動作として、第2デバック情報管理処理を示すフローチャートである。FIG. 12 is a flowchart showing the second debug information management process as the operation of the debug information management unit 403. 図13は、図2に示されるCソースファイル407に対して、コンパイラ処理部408によって生成されるライン情報テーブルの例である。FIG. 13 is an example of a line information table generated by the compiler processing unit 408 for the C source file 407 shown in FIG. 図14は、本発明を適用して、図2に示されるCソースファイル407のL7から実行を開始してL14で停止した場合に、変数値表示制御部404が表示装置に表示する表示結果の例である。FIG. 14 shows the display result displayed on the display device by the variable value display control unit 404 when the present invention is applied and the execution starts from L7 of the C source file 407 shown in FIG. 2 and stops at L14. It is an example.

以下に添付図面を参照して、本発明の実施形態によるデバック装置について詳細に説明する。   Hereinafter, a debugging apparatus according to an embodiment of the present invention will be described in detail with reference to the accompanying drawings.

[構成]
図4は、本発明の実施形態によるデバック装置の構成を示している。本発明の実施形態によるデバック装置は、コンピュータであり、図示しないCPU(Central Processing Unit)と、記録媒体である記憶部(図示しない)と、を具備している。記憶部には、コンピュータに実行させるためのコンピュータプログラムであるデバック用プログラムが記憶されている。CPUは、起動時などに記憶部からデバック用プログラムを読み取って実行する。デバック用プログラムは、ダウンロード部401、実行制御部402、デバッグ情報管理部403、変数値表示制御部404、メモリ/レジスタ管理部405、変数値履歴管理部406、コンパイラ処理部408を含んでいる。
[Constitution]
FIG. 4 shows a configuration of a debugging device according to an embodiment of the present invention. A debugging device according to an embodiment of the present invention is a computer, and includes a CPU (Central Processing Unit) (not shown) and a storage unit (not shown) that is a recording medium. The storage unit stores a debugging program that is a computer program to be executed by a computer. The CPU reads and executes the debugging program from the storage unit when starting up. The debugging program includes a download unit 401, an execution control unit 402, a debug information management unit 403, a variable value display control unit 404, a memory / register management unit 405, a variable value history management unit 406, and a compiler processing unit 408.

コンパイラ処理部408は、図2に示されるCソースファイル(Cソースプログラム)407に対して、プログラムとライン情報テーブルとを含む実行形式ファイル409を生成する。図13に示されるように、ライン情報テーブルには、実行形式ファイル409の名称を表すファイル名と、プログラムに用いられる関数の名称を表す関数名と、プログラムの行を表す行番号と、プログラムに用いられる変数が格納されている箇所(メモリ上のアドレス、又は、レジスタ)を表すアドレス範囲と、上記の変数の名称を表す変数名と、代入/参照を示す状態情報と、グローバル/ローカルを示すスコープ情報とが複数対応付けられて格納されている。ここで、“/”は“又は”を意味している。   The compiler processing unit 408 generates an executable file 409 including a program and a line information table for the C source file (C source program) 407 shown in FIG. As shown in FIG. 13, the line information table includes a file name representing the name of the executable file 409, a function name representing the name of the function used in the program, a line number representing the program line, and a program name. Indicates the address range indicating the location (address in memory or register) where the variable to be used is stored, the variable name indicating the name of the variable, the status information indicating substitution / reference, and the global / local A plurality of pieces of scope information are stored in association with each other. Here, “/” means “or”.

ダウンロード部401は、実行形式ファイル409中のプログラムを取得する。   The download unit 401 acquires the program in the executable file 409.

デバッグ情報管理部403は、実行形式ファイル409中のライン情報テーブルを取得して管理する。   The debug information management unit 403 acquires and manages the line information table in the execution format file 409.

メモリ/レジスタ管理部405は、複数の変数が格納されている箇所を表す情報と、複数の変数値とを格納している。   The memory / register management unit 405 stores information indicating a location where a plurality of variables are stored and a plurality of variable values.

実行制御部402は、ダウンロード部401によって取得されたプログラムを実行/停止する。実行制御部402は、プログラム停止時に、変数値表示制御部404を呼び出す。   The execution control unit 402 executes / stops the program acquired by the download unit 401. The execution control unit 402 calls the variable value display control unit 404 when the program is stopped.

変数値履歴管理部406は、関数履歴テーブルを備えている。変数値履歴管理部406は、実行制御部402が過去にプログラムを実行して停止したときの変数値と、その変数値に対する変数名、行番号、ファイル名とを履歴情報とし、そのときの関数コール・スタック情報と履歴情報とを対応付けて関数履歴テーブルに格納する。関数コール・スタック情報は、プログラムを実行するときに呼び出される関数の順番を示している。   The variable value history management unit 406 includes a function history table. The variable value history management unit 406 uses the variable value when the execution control unit 402 has stopped executing the program in the past and the variable name, line number, and file name for the variable value as history information, and the function at that time Call stack information and history information are associated with each other and stored in the function history table. The function call stack information indicates the order of functions that are called when the program is executed.

変数値表示制御部404は、プログラムが停止している時点での関数内で代入/参照されている変数の箇所を取得箇所としてデバッグ情報管理部403、即ち、ライン情報テーブルから取得する。変数値表示制御部404は、メモリ/レジスタ管理部405に格納された複数の変数値の中から、上記取得箇所に対応する変数値を取得変数値として取得する。また、変数値表示制御部404は、実行制御部402がプログラムを実行して停止したときの対象関数コール・スタック情報を取得し、関数履歴テーブルに格納された履歴情報の中から、対象関数コール・スタック情報に対応し、且つ、上記取得変数値に該当する履歴情報を該当履歴情報として取得する。変数値表示制御部404は、該当履歴情報に含まれる取得変数値、変数名、行番号と、上記の取得箇所に対する代入/参照を示す情報とを対応付けて表示装置に表示する。変数値表示制御部404は、該当履歴情報を上記の履歴情報として変数値履歴管理部406の関数履歴テーブルに格納することにより、関数履歴テーブルを更新する。   The variable value display control unit 404 acquires from the debug information management unit 403, that is, the line information table, using the location of the variable assigned / referenced in the function when the program is stopped as an acquisition location. The variable value display control unit 404 acquires a variable value corresponding to the acquisition location as an acquired variable value from among a plurality of variable values stored in the memory / register management unit 405. Further, the variable value display control unit 404 acquires the target function call / stack information when the execution control unit 402 executes and stops the program, and selects the target function call from the history information stored in the function history table. The history information corresponding to the stack information and corresponding to the acquired variable value is acquired as the corresponding history information. The variable value display control unit 404 displays the acquired variable value, variable name, and line number included in the corresponding history information in association with information indicating substitution / reference to the acquired location on the display device. The variable value display control unit 404 updates the function history table by storing the corresponding history information as the above history information in the function history table of the variable value history management unit 406.

[動作]
本発明の実施形態によるデバック装置の動作について説明する。
[Operation]
The operation of the debugging device according to the embodiment of the present invention will be described.

図5は、実行制御部402の動作として、デバック処理を示すフローチャートである。   FIG. 5 is a flowchart showing a debugging process as the operation of the execution control unit 402.

実行制御部402は、デバッグ対象となっている実行形式ファイル409中のプログラムをカレントPCの位置からCソース・レベルでステップ実行する(ステップS501)。Cソース・レベルでステップ実行とは、図2に示されるCソースファイル407のL7、L8といった各行を1行分実行することを意味する。   The execution control unit 402 executes the program in the execution format file 409 to be debugged from the position of the current PC at the C source level (step S501). Step execution at the C source level means that one line such as L7 and L8 of the C source file 407 shown in FIG. 2 is executed.

次に、実行制御部402は、変数値表示制御部404を呼び出す。変数値表示制御部404の処理が終了すると、次の処理を行う(ステップS502)。   Next, the execution control unit 402 calls the variable value display control unit 404. When the process of the variable value display control unit 404 is completed, the following process is performed (step S502).

実行制御部402は、次に実行するCソースファイル407の行にブレークが設定されているか否かを判定する(ステップS503)。ブレークとは、図2のCソースファイル407のL7、L8といった行に設定されるプログラム実行の停止を指示するイベントで、一般的なデバッグ装置が持つ機能の一つである。   The execution control unit 402 determines whether or not a break is set in the line of the C source file 407 to be executed next (step S503). A break is an event instructing stop of program execution set in the lines such as L7 and L8 of the C source file 407 in FIG. 2, and is one of the functions of a general debugging device.

設定されている場合(ステップS503−YES)、実行制御部402は、デバック処理を終了する。   If it is set (step S503—YES), the execution control unit 402 ends the debugging process.

一方、設定されていない場合(ステップS503−NO)、実行制御部402は、プログラムの実行停止要求が発生していないか否かを判定する(ステップS504)。プログラムの実行停止要求とは、任意の箇所でプログラムの実行を停止する指示で、一般的なデバッグ装置が持つ機能の一つである。   On the other hand, if it has not been set (step S503-NO), the execution control unit 402 determines whether or not a program execution stop request has occurred (step S504). A program execution stop request is an instruction to stop program execution at an arbitrary location, and is one of the functions of a general debugging device.

発生している場合(ステップS504−YES)、実行制御部402は、デバック処理を終了する。   If it has occurred (step S504—YES), the execution control unit 402 ends the debugging process.

一方、発生していない場合(ステップS504−NO)、実行制御部402は、ステップS501の処理を行う。   On the other hand, if it has not occurred (NO in step S504), the execution control unit 402 performs the process of step S501.

図6、図7は、変数値表示制御部404の動作として、変数値表示処理を示すフローチャートである。   6 and 7 are flowcharts showing variable value display processing as the operation of the variable value display control unit 404.

変数値表示制御部404は、実行制御部402がプログラムを実行して停止したときに、カレントPCの値、関数コール・スタック情報をそれぞれ対象カレントPC値、対象関数コール・スタック情報として実行制御部402から取得して表示装置に表示する(ステップS601)。図2に示されるCソースファイル407を基に、以下にいくつか例を示す。
[1] L7からプログラムを実行して、L10行目でプログラム停止している場合は、対象関数コール・スタック情報は、「main」となる。
[2] L7からプログラムを実行して、L10行目にてfuncAを呼び出し、L18行目で停止している場合は、対象関数コール・スタック情報は、「main→funcA」となる。
[3] L7からプログラムを実行して、L12行目にてfuncBを呼び出し、L26行目でfuncAを呼び出し、L18行目で停止している場合は、対象関数コール・スタック情報は、「main→funcA→funcB」となる。
When the execution control unit 402 executes the program and stops, the variable value display control unit 404 uses the current PC value and function call stack information as the target current PC value and target function call stack information, respectively. It is acquired from 402 and displayed on the display device (step S601). Some examples are shown below based on the C source file 407 shown in FIG.
[1] When a program is executed from L7 and the program is stopped at the L10th line, the target function call stack information is “main”.
[2] When a program is executed from L7 and funcA is called on the L10th line and is stopped on the L18th line, the target function call / stack information is “main → funcA”.
[3] When the program is executed from L7, funcB is called on the L12 line, funcA is called on the L26 line, and stopped on the L18 line, the target function call stack information is “main → funcA → funcB ”.

次に、変数値表示制御部404は、上記の対象関数コール・スタック情報に対応する履歴情報を該当履歴情報として変数値履歴管理部406から取得して表示装置に表示する。変数値の履歴がない場合は表示しない(ステップS602)。   Next, the variable value display control unit 404 acquires history information corresponding to the target function call / stack information from the variable value history management unit 406 as corresponding history information, and displays the history information on the display device. If there is no variable value history, it is not displayed (step S602).

次に、変数値表示制御部404は、上記の対象カレントPC値に対する行番号、変数名の一覧、代入/参照を示す情報の一覧をデバッグ情報管理部403(ライン情報テーブル)から取得する(ステップS603)。   Next, the variable value display control unit 404 acquires a line number, a list of variable names, and a list of information indicating substitution / reference from the target current PC value from the debug information management unit 403 (line information table) (step) S603).

ここで、変数名の一覧を取得できなかった場合(ステップS604−NO)、変数値表示制御部404は、後述のステップS605〜S609の処理を行わずに、後述のステップS701を行う。   Here, when the list of variable names cannot be acquired (NO in step S604), the variable value display control unit 404 performs step S701 described later without performing the processes of steps S605 to S609 described later.

一方、変数名の一覧を取得できた場合(ステップS604−YES)、変数値表示制御部404は、取得した変数の一覧を基に、変数の1つ1つに対して、以下の処理を行う(ステップS605)。   On the other hand, when a list of variable names has been acquired (step S604—YES), the variable value display control unit 404 performs the following process for each of the variables based on the acquired list of variables. (Step S605).

上述のように、ライン情報テーブルは、変数名と変数が格納されている箇所(アドレス範囲)とを対応付ける。そこで、変数値表示制御部404は、変数名に従って、プログラムが停止している関数内で代入/参照されている全ての変数が格納されている箇所を取得箇所としてデバッグ情報管理部403、即ち、ライン情報テーブルから割り出す(ステップS606)。   As described above, the line information table associates variable names with locations (address ranges) where variables are stored. Therefore, the variable value display control unit 404 uses the debug information management unit 403 as an acquisition location, where all variables assigned / referenced in the function in which the program is stopped according to the variable name, that is, It is determined from the line information table (step S606).

次に、変数値表示制御部404は、複数の変数値のうちの、取得箇所に対応する変数値を取得変数値としてメモリ/レジスタ管理部405から取得する(ステップS607)。   Next, the variable value display control unit 404 acquires, from the memory / register management unit 405, a variable value corresponding to the acquisition location among the plurality of variable values as an acquired variable value (step S607).

次に、変数値表示制御部404は、履歴情報のうちの、取得変数値に該当する履歴情報を該当履歴情報として変数値履歴管理部406(関数履歴テーブル)から取得し、該当履歴情報に含まれる取得変数値、変数名、行番号と、上記の取得箇所に対する代入/参照を示す情報とを対応付けて表示装置に表示する(ステップS608)。   Next, the variable value display control unit 404 acquires the history information corresponding to the acquired variable value from the history information as the corresponding history information from the variable value history management unit 406 (function history table) and includes it in the corresponding history information. The acquired variable value, variable name, and line number to be displayed are associated with the information indicating the substitution / reference to the acquisition location and displayed on the display device (step S608).

次に、変数値表示制御部404は、デバッグ情報管理部403から取得した変数名の一覧の全ての変数に対して処理を行っていない場合(ステップS609−NO)、ステップS606〜S608の処理を行う。   Next, when the variable value display control unit 404 has not performed processing on all the variables in the list of variable names acquired from the debug information management unit 403 (step S609-NO), the processing of steps S606 to S608 is performed. Do.

一方、変数値表示制御部404は、上記の全ての変数に対して処理した場合(ステップS609−YES)、後述のステップS701の処理を行う。   On the other hand, when the variable value display control unit 404 has processed all the above variables (step S609-YES), the variable value display control unit 404 performs the process of step S701 described later.

図14は、本発明を適用して、図2に示されるCソースファイル407のL7から実行を開始してL14で停止した場合に、変数値表示制御部404が表示装置に表示する表示結果の例である。ステップS609までの処理終了時点では、図14の符号1401、1402で囲まれた部分が表示される。   FIG. 14 shows the display result displayed on the display device by the variable value display control unit 404 when the present invention is applied and the execution starts from L7 of the C source file 407 shown in FIG. 2 and stops at L14. It is an example. At the end of the processing up to step S609, the portion surrounded by reference numerals 1401 and 1402 in FIG. 14 is displayed.

変数値表示制御部404は、関数コール・スタック情報と現在表示している変数値の履歴情とを対応付けて変数値履歴管理部406に登録する(ステップS701)。   The variable value display control unit 404 registers the function call / stack information and the history information of the currently displayed variable value in association with each other in the variable value history management unit 406 (step S701).

上述のように、ライン情報テーブルは、関数名と変数名とグローバル/ローカルを示すスコープ情報とを対応付ける。そこで、変数値表示制御部404は、関数名が対象カレントPC値によりカレント関数を示し、スコープ情報がローカルを示すときの変数名をローカル変数名とし、その一覧をデバッグ情報管理部403(ライン情報テーブル)から取得する(ステップS702)。   As described above, the line information table associates function names, variable names, and scope information indicating global / local. Therefore, the variable value display control unit 404 indicates the current function with the target current PC value as the function name, sets the variable name when the scope information indicates local as the local variable name, and lists the list as the debug information management unit 403 (line information). Table) (step S702).

上述のように、ライン情報テーブルは、関数名と変数名と代入/参照を示す状態情報とグローバル/ローカルを示すスコープ情報とを対応付ける。そこで、変数値表示制御部404は、関数名が対象カレントPC値によりカレント関数を示し、状態情報が代入/参照を示し、スコープ情報がグローバルを示しているときの変数名をグローバル変数名とし、その一覧をデバッグ情報管理部403(ライン情報テーブル)から取得する(ステップS703)。   As described above, the line information table associates function names, variable names, state information indicating substitution / reference, and scope information indicating global / local. Therefore, the variable value display control unit 404 uses the variable name when the function name indicates the current function based on the target current PC value, the state information indicates substitution / reference, and the scope information indicates global, as the global variable name, The list is acquired from the debug information management unit 403 (line information table) (step S703).

変数値表示制御部404は、グローバル/ローカル変数名の一覧を取得できなかった場合(ステップS704−NO)、ステップS705〜S709の処理を行わない。即ち、変数値表示処理を終了する。   If the list of global / local variable names cannot be acquired (step S704-NO), the variable value display control unit 404 does not perform the processing of steps S705 to S709. That is, the variable value display process is terminated.

一方、変数値表示制御部404は、グローバル/ローカル変数名のどちらか1つでも一覧を取得できた場合(ステップS704−YES)、取得したグローバルとローカル変数の一覧を基に、変数の1つ1つに対して、以下の処理を行う(ステップS705)。   On the other hand, if the variable value display control unit 404 can acquire the list with either one of the global / local variable names (step S704-YES), one of the variables is displayed based on the acquired list of global and local variables. The following processing is performed for one (step S705).

変数値表示制御部404は、グローバル/ローカル変数名に従って、変数が格納されている箇所(アドレス範囲)を取得箇所としてデバッグ情報管理部403(ライン情報テーブル)から割り出す(ステップS706)。   The variable value display control unit 404 determines the location (address range) where the variable is stored from the debug information management unit 403 (line information table) as an acquisition location according to the global / local variable name (step S706).

次に、変数値表示制御部404は、複数の変数値のうちの、取得箇所に対応する変数値を取得変数値としてメモリ/レジスタ管理部405から取得する(ステップS707)。   Next, the variable value display control unit 404 acquires, from the memory / register management unit 405, a variable value corresponding to the acquisition location among the plurality of variable values as an acquired variable value (step S707).

次に、変数値表示制御部404は、履歴情報のうちの、取得変数値に該当する履歴情報を該当履歴情報として変数値履歴管理部406(関数履歴テーブル)から取得し、該当履歴情報に含まれる取得変数値、変数名を表示装置に表示する(ステップS708)。   Next, the variable value display control unit 404 acquires the history information corresponding to the acquired variable value from the history information as the corresponding history information from the variable value history management unit 406 (function history table) and includes it in the corresponding history information. The obtained variable value and variable name are displayed on the display device (step S708).

次に、変数値表示制御部404は、デバッグ情報管理部403から取得した変数名の一覧の全ての変数に対して処理を行っていない場合(ステップS709−NO)、ステップS706〜S708の処理を行う。   Next, when the variable value display control unit 404 has not performed processing for all variables in the list of variable names acquired from the debug information management unit 403 (step S709—NO), the processing of steps S706 to S708 is performed. Do.

一方、変数値表示制御部404は、上記の全ての変数に対して処理した場合(ステップS709−YES)、変数値表示処理を終了する。全ての処理が終了すると、図14の符号1401、1402で囲まれた部分に加えて、符号1403で囲まれた部分が表示される。   On the other hand, the variable value display control part 404 complete | finishes a variable value display process, when it processes with respect to all said variables (step S709-YES). When all the processes are completed, in addition to the parts surrounded by reference numerals 1401 and 1402 in FIG. 14, the part surrounded by reference numeral 1403 is displayed.

図11、図12は、デバッグ情報管理部403の動作として、それぞれ、第1、2デバック情報管理処理を示すフローチャートである。   FIGS. 11 and 12 are flowcharts showing the first and second debug information management processes as the operation of the debug information management unit 403, respectively.

まず、第1デバック情報管理処理から説明する。第1デバック情報管理処理は、変数値表示制御部404から、対象カレントPC値を渡されて、行番号、変数名一覧、代入/参照を示す情報の一覧を、変数値表示制御部404に渡す際の動作フローである。   First, the first debug information management process will be described. In the first debug information management process, the target current PC value is passed from the variable value display control unit 404, and a line number, a variable name list, and a list of information indicating substitution / reference are passed to the variable value display control unit 404. This is an operation flow.

デバッグ情報管理部403は、対象カレントPC値を使用して、上述のライン情報テーブルのアドレス範囲を検索する(ステップS1101)。   The debug information management unit 403 searches the address range of the above-described line information table using the target current PC value (step S1101).

次に、デバッグ情報管理部403は、ライン情報テーブル中に、対象カレントPC値が該当するアドレス範囲が登録されているか否かを判定する(ステップS1102)。   Next, the debug information management unit 403 determines whether or not an address range corresponding to the target current PC value is registered in the line information table (step S1102).

登録されていない場合(ステップS1102−NO)、デバッグ情報管理部403は、第1デバック情報管理処理を終了する。第1デバック情報管理処理を終了した場合、行番号、変数名の一覧、代入/参照を示す情報の一覧を変数値表示制御部404に渡さない。   If not registered (NO in step S1102), the debug information management unit 403 ends the first debug information management process. When the first debug information management process is ended, the line number, the list of variable names, and the list of information indicating substitution / reference are not passed to the variable value display control unit 404.

一方、登録されている場合(ステップS1102−YES)、デバッグ情報管理部403は、該当するアドレス範囲に対応する行番号、変数名の一覧、代入/参照を示す情報の一覧を変数値表示制御部404に渡す(ステップS1103)。   On the other hand, if registered (step S1102-YES), the debug information management unit 403 displays a line number corresponding to the corresponding address range, a list of variable names, and a list of information indicating substitution / reference as a variable value display control unit. It passes to 404 (step S1103).

対象カレントPC値として、0x150が指定されている場合は、アドレス範囲の「0x150−0x180」が検索として該当する。この場合、行番号として「L11」、変数名の一覧として「a,b,c,d」、代入/参照を示す情報の一覧として「参照,参照,参照,代入」を変数値表示制御部404に渡す。   When 0x150 is specified as the target current PC value, “0x150-0x180” in the address range corresponds to the search. In this case, “L11” as the line number, “a, b, c, d” as the list of variable names, “reference, reference, reference, substitution” as the list of information indicating assignment / reference, and the variable value display control unit 404. To pass.

次に、第2デバック情報管理処理について説明する。第2デバック情報管理処理は、変数値表示制御部404から、対象カレントPC値を渡されて、カレント関数で代入/参照しているグローバル変数名の一覧を、変数値表示制御部404に渡す際の動作フローである。   Next, the second debug information management process will be described. In the second debug information management process, when the target current PC value is passed from the variable value display control unit 404, a list of global variable names assigned / referenced by the current function is passed to the variable value display control unit 404. This is an operation flow.

デバッグ情報管理部403は、対象カレントPC値を使用して、ライン情報テーブルのアドレス範囲を検索する(ステップS1201)。図13に示されるように、対象カレントPC値として、0x220が指定されている場合は、アドレス範囲の「0x200−0x230」が検索として該当することになる。   The debug information management unit 403 searches the address range of the line information table using the target current PC value (step S1201). As shown in FIG. 13, when 0x220 is specified as the target current PC value, “0x200-0x230” in the address range corresponds to the search.

次に、デバッグ情報管理部403は、ライン情報テーブル中に、対象カレントPC値が該当するアドレス範囲が登録されているか否かを判定する(ステップS1202)。   Next, the debug information management unit 403 determines whether or not an address range corresponding to the target current PC value is registered in the line information table (step S1202).

登録されていない場合(ステップS1202−NO)、デバッグ情報管理部403は、第2デバック情報管理処理を終了する。終了した場合、グローバル変数名の一覧を変数値表示制御部404に渡さない(ステップS1202)。   If not registered (step S1202-NO), the debug information management unit 403 ends the second debug information management process. If completed, the list of global variable names is not passed to the variable value display control unit 404 (step S1202).

一方、登録されている場合(ステップS1202−YES)、デバッグ情報管理部403は、該当するアドレス範囲に対応する関数名を取得する(ステップS1203)。   On the other hand, when registered (step S1202-YES), the debug information management unit 403 acquires a function name corresponding to the corresponding address range (step S1203).

対象カレントPC値として、0x220が指定されている場合は、アドレス範囲の「0x200−0x230」が検索として該当する。この場合、関数名として「main」を取得する。   When 0x220 is designated as the target current PC value, “0x200-0x230” in the address range corresponds to the search. In this case, “main” is acquired as the function name.

次に、デバッグ情報管理部403は、取得した関数名に対応する変数名の一覧を取得する(ステップS1204)。   Next, the debug information management unit 403 acquires a list of variable names corresponding to the acquired function names (step S1204).

関数名として「main」を取得している場合は、変数名の一覧として、「a,b,c,d」を取得する。同名が存在する場合は、1つにマージする。   When “main” is acquired as a function name, “a, b, c, d” is acquired as a list of variable names. If the same name exists, it is merged into one.

次に、デバッグ情報管理部403は、取得した変数名の一覧のうち、スコープ情報がグローバルとなっている変数名を一覧として、変数値表示制御部に渡す(ステップS1205)。   Next, the debug information management unit 403 passes, as a list, variable names whose scope information is global from the obtained list of variable names to the variable value display control unit (step S1205).

関数名として「main」、変数名の一覧として、「a,b,c,d」を取得している場合、変数名の一覧として、「a,b,c,d」を変数値表示制御部404に渡す。関数名として「funcB」、変数名の一覧として、「a,b,e」を取得している場合、変数名の一覧として、「b」を変数値表示制御部404に渡す。   When “main” is acquired as a function name and “a, b, c, d” is acquired as a list of variable names, “a, b, c, d” is displayed as a variable name list. Pass to 404. When “funcB” is acquired as a function name and “a, b, e” is acquired as a list of variable names, “b” is transferred to the variable value display control unit 404 as a list of variable names.

図8、図9は、変数値履歴管理部406の動作として、それぞれ、第1、2変数値履歴管理処理を示すフローチャートである。   FIGS. 8 and 9 are flowcharts showing the first and second variable value history management processes as the operation of the variable value history management unit 406, respectively.

まず、第1変数値履歴管理処理から説明する。第1変数値履歴管理処理は、変数値表示制御部404から対象関数コール・スタック情報を渡されて、履歴情報を該当履歴情報として変数値表示制御部404に渡す際の動作フローである。   First, the first variable value history management process will be described. The first variable value history management process is an operation flow when target function call / stack information is passed from the variable value display control unit 404 and the history information is passed to the variable value display control unit 404 as corresponding history information.

変数値履歴管理部406は、関数履歴テーブルの関数コール・スタック情報を検索する(ステップS801)。   The variable value history management unit 406 searches for function call stack information in the function history table (step S801).

図10は、本発明を適用して、図2に示されるCソースファイル407のL7から実行を開始してL14で停止した場合に、変数値履歴管理部406が生成する関数履歴テーブルの例である。図10に示されるように、関数コール・スタック情報として、「main」が指定されている場合は、複数の関数コール・スタック情報のうちの1番目の関数コール・スタック情報1001が該当することになる。関数コール・スタック情報として、「main→funcB」が指定されている場合は、複数の関数コール・スタック情報のうちの3番目の関数コール・スタック情報1002が該当することになる。   FIG. 10 is an example of a function history table generated by the variable value history management unit 406 when the present invention is applied and execution is started from L7 of the C source file 407 shown in FIG. 2 and stopped at L14. is there. As shown in FIG. 10, when “main” is designated as the function call stack information, the first function call stack information 1001 among the plurality of function call stack information is applicable. Become. When “main → funcB” is specified as the function call stack information, the third function call stack information 1002 among the plurality of function call stack information corresponds.

次に、変数値履歴管理部406は、関数履歴テーブル中に、変数値履歴管理部404から渡された関数コール・スタック情報が登録されているか否かを判定する(ステップS802)。   Next, the variable value history management unit 406 determines whether or not the function call / stack information passed from the variable value history management unit 404 is registered in the function history table (step S802).

登録されていない場合(ステップS802−NO)、変数値履歴管理部406は、第1変数値履歴管理処理を終了する。終了した場合、履歴情報を変数値表示制御部404に渡さない(ステップS802)。   If not registered (NO in step S802), the variable value history management unit 406 ends the first variable value history management process. When it is finished, the history information is not passed to the variable value display control unit 404 (step S802).

登録されている場合(ステップS802−YES)、変数値履歴管理部406は、対象関数コール・スタック情報に対する履歴情報を該当履歴情報として変数値表示制御部404に渡す(ステップS803)。   If registered (YES in step S802), the variable value history management unit 406 passes the history information for the target function call / stack information to the variable value display control unit 404 as corresponding history information (step S803).

対象関数コール・スタック情報1001として、「main」が指定されている場合は、該当履歴情報として、1番目から10番目までの履歴情報1003が該当することになる。対象関数コール・スタック情報として、「main→funcB」が指定されている場合は、該当履歴情報として、14番目から16番目までの履歴情報1004が該当することになる。   When “main” is designated as the target function call stack information 1001, the first to tenth history information 1003 corresponds to the corresponding history information. When “main → funcB” is specified as the target function call stack information, the 14th to 16th history information 1004 corresponds to the corresponding history information.

次に、第2変数値履歴管理処理について説明する。第2変数値履歴管理処理は、変数値表示制御部404から対象関数コール・スタック情報と該当履歴情報を渡されて、関数履歴テーブルを更新する際の動作フローである。   Next, the second variable value history management process will be described. The second variable value history management process is an operation flow when the target function call / stack information and the corresponding history information are passed from the variable value display control unit 404 and the function history table is updated.

変数値履歴管理部406は、関数履歴テーブル内の対象関数コール・スタック情報を検索する(ステップS901)。   The variable value history management unit 406 searches for the target function call stack information in the function history table (step S901).

次に、変数値履歴管理部406は、関数履歴テーブル中に、変数値履歴管理部404から渡された対象関数コール・スタック情報が登録されているか否かを判定する(ステップS902)。   Next, the variable value history management unit 406 determines whether or not the target function call / stack information passed from the variable value history management unit 404 is registered in the function history table (step S902).

登録されている場合(ステップS902−YES)、変数値履歴管理部406は、関数履歴テーブル内の対象関数コール・スタック情報に対する履歴情報を、変数値表示制御部404から渡された該当履歴情報に更新する(ステップS903)。変数値履歴管理部406は、対象関数コール・スタック情報として、「main」が指定されている場合は、該当履歴情報として1番目から10番目までの履歴情報1003が該当することになり、現在登録されている情報を削除して、変数値表示制御部404から渡された該当履歴情報に更新する。   If registered (YES in step S902), the variable value history management unit 406 adds the history information for the target function call / stack information in the function history table to the corresponding history information passed from the variable value display control unit 404. Update (step S903). When “main” is designated as the target function call / stack information, the variable value history management unit 406 corresponds to the first to tenth history information 1003 as the corresponding history information, and is currently registered. The stored information is deleted, and the corresponding history information passed from the variable value display control unit 404 is updated.

一方、登録されていない場合(ステップS902−NO)、変数値履歴管理部406は、新規に、変数値表示制御部404から渡された対象関数コール・スタック情報と該当履歴情報を関数履歴テーブルに登録する(ステップS904)。変数値履歴管理部406は、対象関数コール・スタック情報として「main→funcD」、該当履歴情報として「変数名:f,行番号:L30,ファイル名:sub.c,値:100」が指定されている場合は、関数履歴テーブル内の最後尾のデータとして登録する。   On the other hand, if not registered (NO in step S902), the variable value history management unit 406 newly stores the target function call / stack information and the corresponding history information passed from the variable value display control unit 404 in the function history table. Registration is performed (step S904). The variable value history management unit 406 is designated with “main → funcD” as target function call stack information and “variable name: f, line number: L30, file name: sub.c, value: 100” as corresponding history information. If registered, it is registered as the last data in the function history table.

変数値履歴テーブルは、ダウンロード部401が実行形式ファイル409をダウンロードするタイミングでクリアされる。   The variable value history table is cleared when the download unit 401 downloads the executable file 409.

[効果]
以上の説明により、本発明の実施形態によるデバック装置では、コンパイラ処理部408は、Cソースファイル407に対して、プログラムとライン情報テーブルとを含む実行形式ファイル409を生成する。ライン情報テーブルには、ファイル名、関数名、行番号、変数が格納されている箇所を表す情報、変数名、代入/参照を示す情報、グローバル/ローカルを示すスコープ情報を複数対応付けられている。メモリ/レジスタ管理部405は、複数の変数が格納されている箇所を表す情報と、複数の変数値とを格納している。変数値履歴管理部406は、実行制御部402が過去にプログラムを実行して停止したときの変数値と、その変数値に対する変数名、行番号、ファイル名とを履歴情報とし、そのときの関数コール・スタック情報と履歴情報とを対応付けて関数履歴テーブルに格納する。変数値表示制御部404は、プログラムが停止している時点での関数内で代入/参照されているグローバル変数、ローカル変数の箇所を取得箇所としてデバッグ情報管理部403(ライン情報テーブル)から取得する。変数値表示制御部404は、メモリ/レジスタ管理部405に格納された複数の変数値の中から、上記取得箇所に対応する変数値を取得変数値として取得する。また、変数値表示制御部404は、実行制御部402がプログラムを実行して停止したときの対象関数コール・スタック情報を取得し、関数履歴テーブルに格納された履歴情報の中から、対象関数コール・スタック情報に対応し、且つ、上記取得変数値に該当する履歴情報を該当履歴情報として取得する。変数値表示制御部404は、該当履歴情報に含まれる取得変数値、変数名、行番号と、上記の取得箇所に対する代入/参照を示す情報とを対応付けて表示装置に表示する。変数値表示制御部404は、該当履歴情報を上記の履歴情報として変数値履歴管理部406の関数履歴テーブルに格納することにより、関数履歴テーブルを更新する。
[effect]
As described above, in the debugging device according to the embodiment of the present invention, the compiler processing unit 408 generates the executable file 409 including the program and the line information table for the C source file 407. The line information table is associated with a plurality of file names, function names, line numbers, information indicating locations where variables are stored, variable names, information indicating substitution / reference, and scope information indicating global / local. . The memory / register management unit 405 stores information indicating a location where a plurality of variables are stored and a plurality of variable values. The variable value history management unit 406 uses the variable value when the execution control unit 402 has stopped executing the program in the past and the variable name, line number, and file name for the variable value as history information, and the function at that time Call stack information and history information are associated with each other and stored in the function history table. The variable value display control unit 404 acquires, from the debug information management unit 403 (line information table), the location of the global variable or local variable that is assigned / referenced in the function when the program is stopped as the acquisition location. . The variable value display control unit 404 acquires a variable value corresponding to the acquisition location as an acquired variable value from among a plurality of variable values stored in the memory / register management unit 405. Further, the variable value display control unit 404 acquires the target function call / stack information when the execution control unit 402 executes and stops the program, and selects the target function call from the history information stored in the function history table. The history information corresponding to the stack information and corresponding to the acquired variable value is acquired as the corresponding history information. The variable value display control unit 404 displays the acquired variable value, variable name, and line number included in the corresponding history information in association with information indicating substitution / reference to the acquired location on the display device. The variable value display control unit 404 updates the function history table by storing the corresponding history information as the above history information in the function history table of the variable value history management unit 406.

このように、従来では、第1の問題点として、変数の代入に関する履歴しか表示していなかったが、本発明では、変数値表示制御部404は、デバッグ情報管理部403から変数の代入/参照箇所に関する情報を取得して、代入箇所だけでなく、参照箇所での変数値も表示装置に表示するようにしている。これにより、変数の代入先を探す作業を省くことができ、デバッグ作業の効率が上がる。   As described above, conventionally, only the history related to variable substitution is displayed as a first problem. However, in the present invention, the variable value display control unit 404 receives a variable substitution / reference from the debug information management unit 403. Information on the location is acquired, and not only the substitution location but also the variable value at the reference location is displayed on the display device. As a result, the work of searching for a variable assignment destination can be omitted, and the efficiency of the debugging work can be improved.

また、従来では、第2の問題点として、プログラム停止時点での全ての変数の変更履歴を表示しているため、同名の変数が区別しにくいが、本発明では、上記の取得変数値(デバッグ対象となっている関数にて代入/参照している変数値)に該当する履歴情報を該当履歴情報として、即ち、変更履歴として表示装置に表示するようにしている。これにより、スコープの異なる同名の変数が表示されなくなり、デバッグ時に異なる変数を参照することによる作業ミスを回避できる。   Conventionally, as a second problem, since the change history of all variables at the time of stopping the program is displayed, it is difficult to distinguish the variables with the same name. However, in the present invention, the acquired variable values (debugging) The history information corresponding to the variable value assigned / referenced by the target function is displayed on the display device as the corresponding history information, that is, as the change history. As a result, variables with the same name in different scopes are not displayed, and work errors caused by referring to different variables during debugging can be avoided.

また、従来では、第3の問題点として、全ての履歴が表示されているが、本発明では、デバッグ対象となっている関数のデバッグに必要な変数の変更履歴のみを表示装置に表示するようにしている。これにより、デバッグ作業の効率が上がる。   Conventionally, all the history is displayed as a third problem. However, in the present invention, only the change history of the variable necessary for debugging the function being debugged is displayed on the display device. I have to. This increases the efficiency of debugging work.

更に、本発明では、変数名に、変数に対して代入/参照を行っている行番号を追加して表示装置に表示することで、該当行番号が実行された時点でのローカル変数の変数値を一瞬で判断できる。   Furthermore, in the present invention, the variable number of the local variable at the time when the corresponding line number is executed is displayed by adding the line number assigned / referenced to the variable to the variable name and displaying it on the display device. Can be determined in an instant.

101 実行形式ファイル、
102 プロセッサ制御部、
103 変数監視部、
104 レジスタ履歴メモリ、
105 ソース行履歴メモリ、
106 変数履歴メモリ、
107 レジスタ表示部、
108 プログラム表示部、
109 変数表示部、
401 ダウンロード部、
402 実行制御部、
403 デバッグ情報管理部、
404 変数値表示制御部、
405 メモリ/レジスタ管理部、
406 変数値履歴管理部、
407 Cソースファイル、
408 コンパイラ処理部、
409 実行形式ファイル、
1001 関数コール・スタック情報、
1002 関数コール・スタック情報、
1003 履歴情報、
1004 履歴情報、
1401 部分(表示結果)、
1402 部分(表示結果)、
1403 部分(表示結果)
101 executable file,
102 processor control unit,
103 variable monitoring unit,
104 register history memory,
105 source line history memory,
106 variable history memory,
107 register display,
108 program display section,
109 variable display section,
401 Download section,
402 execution control unit,
403 debug information manager,
404 variable value display control unit,
405 Memory / register management unit,
406 variable value history management unit,
407 C source file,
408 compiler processing unit,
409 executable file,
1001 Function call stack information,
1002 Function call stack information,
1003 History information,
1004 history information,
1401 part (display result),
1402 part (display result),
1403 part (display result)

Claims (13)

ソースファイルに対して、プログラムと、関数名と変数が格納されている箇所を表す情報と変数名と代入/参照を示す情報とが複数対応付けられたライン情報テーブルとを生成するコンパイラ処理部と、
複数の変数が格納されている箇所を表す情報と複数の変数値とが格納されたメモリ/レジスタ管理部と、
前記プログラムを実行/停止する実行制御部と、
関数履歴テーブルを備え、前記実行制御部が過去に前記プログラムを実行して停止したときの変数値と、その変数値に対する変数名とを履歴情報として、前記関数履歴テーブルに格納する変数値履歴管理部と、
前記プログラムが停止している時点での関数内で代入/参照されている変数の箇所を取得箇所として前記ライン情報テーブルから取得し、前記メモリ/レジスタ管理部に格納された前記複数の変数値の中から、前記取得箇所に対応する変数値を取得変数値として取得し、前記関数履歴テーブルに格納された前記履歴情報の中から、前記取得変数値に該当する履歴情報を該当履歴情報として取得し、前記該当履歴情報を前記表示装置に表示する変数値表示制御部と
を具備するデバック装置。
A compiler processing unit that generates, for a source file, a line information table in which a program, information indicating a function name and a location where a variable is stored, and a plurality of variable names and information indicating substitution / reference are associated with each other; ,
A memory / register management unit storing information representing a location where a plurality of variables are stored and a plurality of variable values;
An execution control unit for executing / stopping the program;
A variable value history management that includes a function history table and stores in the function history table, as history information, a variable value when the execution control unit has executed and stopped the program in the past and a variable name for the variable value And
The variable location assigned / referenced in the function at the time when the program is stopped is acquired from the line information table as an acquisition location, and the plurality of variable values stored in the memory / register management unit The variable value corresponding to the acquisition location is acquired as an acquisition variable value, and the history information corresponding to the acquisition variable value is acquired as the corresponding history information from the history information stored in the function history table. A debugging device comprising: a variable value display control unit that displays the corresponding history information on the display device.
前記変数値履歴管理部は、前記実行制御部が過去に前記プログラムを実行して停止したときの関数コール・スタック情報と前記履歴情報とを対応付けて前記関数履歴テーブルに格納し、
前記関数コール・スタック情報は、前記プログラムを実行するときに呼び出される関数の順番を示し、
前記変数値表示制御部は、前記実行制御部が前記プログラムを実行して停止したときの対象関数コール・スタック情報を取得し、前記履歴情報のうちの、前記対象関数コール・スタック情報に対応し、且つ、前記取得変数値に該当する履歴情報を前記該当履歴情報として前記関数履歴テーブルから取得する
請求項1に記載のデバック装置。
The variable value history management unit stores the function call stack information and the history information in association with each other when the execution control unit has executed and stopped the program in the past, and stores them in the function history table.
The function call stack information indicates the order of functions to be called when executing the program,
The variable value display control unit acquires target function call stack information when the execution control unit executes the program and stops, and corresponds to the target function call stack information in the history information. The debugging apparatus according to claim 1, wherein history information corresponding to the acquired variable value is acquired from the function history table as the corresponding history information.
前記変数値表示制御部は、前記該当履歴情報に含まれる前記取得変数値と、その変数名と、前記取得箇所に対する代入/参照を示す情報とを対応付けて前記表示装置に表示する
請求項1又は2に記載のデバック装置。
The variable value display control unit displays the acquired variable value included in the corresponding history information, its variable name, and information indicating substitution / reference to the acquired location in association with each other and displayed on the display device. Or the debugging apparatus of 2.
前記変数値表示制御部は、前記該当履歴情報を前記履歴情報として前記変数値履歴管理部の前記関数履歴テーブルに格納することにより、前記関数履歴テーブルを更新する
請求項1〜3のいずれかに記載のデバック装置。
The variable value display control unit updates the function history table by storing the corresponding history information as the history information in the function history table of the variable value history management unit. The debugging apparatus as described.
前記ライン情報テーブルは、更に、グローバル/ローカルを示すスコープ情報が複数対応付けられている
請求項1〜4のいずれかに記載のデバック装置。
The debugging apparatus according to claim 1, wherein the line information table is further associated with a plurality of scope information indicating global / local.
前記ライン情報テーブルは、行番号が更に複数対応付けられ、
前記関数履歴テーブルに格納された前記履歴情報は、更に、前記実行制御部が過去に前記プログラムを実行して停止したときの変数値に対する行番号を更に含む
請求項1〜5のいずれかに記載のデバック装置。
In the line information table, a plurality of line numbers are further associated,
6. The history information stored in the function history table further includes a line number for a variable value when the execution control unit has executed and stopped the program in the past. Debug device.
ソースファイルに対して、プログラムと、関数名と変数が格納されている箇所を表す情報と変数名と代入/参照を示す情報とが複数対応付けられたライン情報テーブルとを生成するステップと、
前記プログラムを実行/停止するステップと、
過去に前記プログラムを実行して停止したときの変数値と、その変数値に対する変数名とを履歴情報として、関数履歴テーブルに格納するステップと、
前記ライン情報テーブルを参照して、前記プログラムが停止している時点での関数内で代入/参照されている変数の箇所を取得箇所として取得するステップと、
複数の変数が格納されている箇所を表す情報と複数の変数値とが格納されたメモリ/レジスタ管理部を参照して、前記複数の変数値の中から、前記取得箇所に対応する変数値を取得変数値として取得するステップと、
前記関数履歴テーブルを参照して、前記履歴情報の中から、前記取得変数値に該当する履歴情報を該当履歴情報として取得するステップと、
前記該当履歴情報を前記表示装置に表示するステップと
を具備するデバック方法。
Generating, for a source file, a line information table in which a program, information indicating a function name and a location where a variable is stored, and a variable name and information indicating substitution / reference are associated with each other;
Executing / stopping the program; and
Storing the variable value when the program was executed and stopped in the past and the variable name for the variable value as history information in the function history table;
With reference to the line information table, obtaining a location of a variable that is assigned / referenced in a function at the time when the program is stopped as an acquisition location;
Referring to the memory / register management unit in which information representing a location where a plurality of variables are stored and a plurality of variable values are stored, a variable value corresponding to the acquisition location is selected from the plurality of variable values. A step of acquiring as an acquisition variable value;
Referring to the function history table, obtaining history information corresponding to the acquired variable value from the history information as corresponding history information;
A debugging method comprising: displaying the corresponding history information on the display device.
前記履歴情報を前記関数履歴テーブルに格納するステップは、
過去に前記プログラムを実行して停止したときの関数コール・スタック情報と前記履歴情報とを対応付けて前記関数履歴テーブルに格納するステップ
を含み、
前記関数コール・スタック情報は、前記プログラムを実行するときに呼び出される関数の順番を示し、
前記該当履歴情報を前記関数履歴テーブルから取得するステップは、
前記プログラムを実行して停止したときの対象関数コール・スタック情報を取得するステップと、
前記履歴情報のうちの、前記対象関数コール・スタック情報に対応し、且つ、前記取得変数値に該当する履歴情報を前記該当履歴情報として前記関数履歴テーブルから取得するステップと
を含む請求項7に記載のデバック方法。
The step of storing the history information in the function history table includes:
Storing the function call stack information and the history information in the function history table in association with the function call stack information when the program was stopped in the past,
The function call stack information indicates the order of functions to be called when executing the program,
The step of acquiring the relevant history information from the function history table includes:
Obtaining target function call stack information when the program is executed and stopped;
The step of acquiring history information corresponding to the target function call / stack information of the history information and corresponding to the acquired variable value from the function history table as the corresponding history information. The debugging method described.
前記該当履歴情報を前記表示装置に表示するステップは、
前記該当履歴情報に含まれる前記取得変数値、変数名、行番号と、前記取得箇所に対する代入/参照を示す情報とを対応付けて前記表示装置に表示するステップ
を含む請求項7又は8に記載のデバック方法。
The step of displaying the corresponding history information on the display device includes:
9. The method according to claim 7, further comprising: displaying the acquired variable value, variable name, and line number included in the corresponding history information in association with information indicating substitution / reference with respect to the acquired location on the display device. Debugging method.
前記該当履歴情報を前記履歴情報として前記変数値履歴管理部の前記関数履歴テーブルに格納することにより、前記関数履歴テーブルを更新するステップ
を更に具備する請求項7〜9のいずれかに記載のデバック方法。
The debug according to claim 7, further comprising a step of updating the function history table by storing the corresponding history information as the history information in the function history table of the variable value history management unit. Method.
前記ライン情報テーブルは、更に、グローバル/ローカルを示すスコープ情報が複数対応付けられている
請求項7〜10のいずれかに記載のデバック方法。
The debugging method according to claim 7, wherein the line information table is further associated with a plurality of scope information indicating global / local.
前記ライン情報テーブルは、行番号が更に複数対応付けられ、
前記関数履歴テーブルに格納された前記履歴情報は、更に、過去に前記プログラムを実行して停止したときの変数値に対する行番号を更に含む
請求項7〜11のいずれかに記載のデバック方法。
In the line information table, a plurality of line numbers are further associated,
The debugging method according to any one of claims 7 to 11, wherein the history information stored in the function history table further includes a line number corresponding to a variable value when the program is executed and stopped in the past.
請求項7〜12のいずれかに記載のデバック方法の各ステップをコンピュータに実行させるデバック用プログラム。   A debugging program for causing a computer to execute each step of the debugging method according to claim 7.
JP2009260931A 2009-11-16 2009-11-16 Debugging device Pending JP2011107883A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2009260931A JP2011107883A (en) 2009-11-16 2009-11-16 Debugging device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2009260931A JP2011107883A (en) 2009-11-16 2009-11-16 Debugging device

Publications (1)

Publication Number Publication Date
JP2011107883A true JP2011107883A (en) 2011-06-02

Family

ID=44231296

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2009260931A Pending JP2011107883A (en) 2009-11-16 2009-11-16 Debugging device

Country Status (1)

Country Link
JP (1) JP2011107883A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117573565A (en) * 2024-01-16 2024-02-20 麒麟软件有限公司 Debug history information reproduction method, device and storage medium
CN117573565B (en) * 2024-01-16 2024-06-07 麒麟软件有限公司 Debug history information reproduction method, device and storage medium

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS63317840A (en) * 1987-06-20 1988-12-26 Fujitsu Ltd Program debug system
JPH03246732A (en) * 1990-02-26 1991-11-05 Nec Corp Multitask program debugging system
JPH064344A (en) * 1992-06-17 1994-01-14 Hokkaido Nippon Denki Software Kk System for displaying type of variable referred to in program
JPH1165885A (en) * 1997-08-12 1999-03-09 Nec Corp Device and method for debugging software
JP2001236244A (en) * 2000-02-23 2001-08-31 Mitsubishi Electric Corp Debug system for robot program
JP2004054807A (en) * 2002-07-24 2004-02-19 Hitachi Ltd Method and device for information processing
JP2007034825A (en) * 2005-07-28 2007-02-08 Matsushita Electric Ind Co Ltd Debugging device
JP2008129714A (en) * 2006-11-17 2008-06-05 Univ Of Tsukuba Abnormality detection method, abnormality detection device, abnormality detection program, and learning model generation method

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS63317840A (en) * 1987-06-20 1988-12-26 Fujitsu Ltd Program debug system
JPH03246732A (en) * 1990-02-26 1991-11-05 Nec Corp Multitask program debugging system
JPH064344A (en) * 1992-06-17 1994-01-14 Hokkaido Nippon Denki Software Kk System for displaying type of variable referred to in program
JPH1165885A (en) * 1997-08-12 1999-03-09 Nec Corp Device and method for debugging software
JP2001236244A (en) * 2000-02-23 2001-08-31 Mitsubishi Electric Corp Debug system for robot program
JP2004054807A (en) * 2002-07-24 2004-02-19 Hitachi Ltd Method and device for information processing
JP2007034825A (en) * 2005-07-28 2007-02-08 Matsushita Electric Ind Co Ltd Debugging device
JP2008129714A (en) * 2006-11-17 2008-06-05 Univ Of Tsukuba Abnormality detection method, abnormality detection device, abnormality detection program, and learning model generation method

Non-Patent Citations (4)

* Cited by examiner, † Cited by third party
Title
CSNG200100894011; 小野 展弘: 'プログラムの静的解析と動的解析の相互補完によるプログラム理解・開発支援プロセス' 情報処理学会研究報告 第2000巻,第104号, 20001117, p.81-88, 社団法人情報処理学会 *
CSNG200500784007; 石黒 誉久: '変数更新の回数と分散に基づくプログラムのメンタルシミュレーションコスト評価' 電子情報通信学会技術研究報告 第104巻,第466号, 20041125, p.37-42, 社団法人電子情報通信学会 *
JPN6013047179; 小野 展弘: 'プログラムの静的解析と動的解析の相互補完によるプログラム理解・開発支援プロセス' 情報処理学会研究報告 第2000巻,第104号, 20001117, p.81-88, 社団法人情報処理学会 *
JPN6013047182; 石黒 誉久: '変数更新の回数と分散に基づくプログラムのメンタルシミュレーションコスト評価' 電子情報通信学会技術研究報告 第104巻,第466号, 20041125, p.37-42, 社団法人電子情報通信学会 *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117573565A (en) * 2024-01-16 2024-02-20 麒麟软件有限公司 Debug history information reproduction method, device and storage medium
CN117573565B (en) * 2024-01-16 2024-06-07 麒麟软件有限公司 Debug history information reproduction method, device and storage medium

Similar Documents

Publication Publication Date Title
US7620941B1 (en) Mechanism for lossless user-level tracing on an architecture supporting PC-relative addressing
US10229031B2 (en) Debugging inline functions in optimized code
JP2010250739A (en) Method and apparatus for support of software reuse
US20120110560A1 (en) Data type provider for a web semantic store
JP2003050715A (en) Compiler and debugging device
US8776010B2 (en) Data type provider for a data store
JP2008204405A (en) Software regression test system, regression test program and regression test method
JP2013008277A (en) Coverage measuring apparatus and method and program
JP2009104252A (en) Debugging support device and debugging support method
CN112685040A (en) Method, device, equipment and storage medium for generating interface file in android system
JP4328328B2 (en) Software development tool program
JP2011107883A (en) Debugging device
JP2014222384A (en) Function execution time measuring device, function execution time measuring method, and function execution time measuring program
JP4986598B2 (en) Application management system and control method thereof
CN116009852A (en) Code construction method, device, computer equipment and storage medium
JP2007004400A (en) Program debug method
JPH06175884A (en) Program error cause investigating device
EP1345129A2 (en) Information processing system and method
JP2009181528A (en) Operation cancellation system, method, and program
JP2016062311A (en) Update device and information processing method
JP4295912B2 (en) Debug system
JP2017138747A (en) Image forming apparatus
JP5789575B2 (en) Information processing apparatus and program
JPH0934754A (en) Instrument and method for measuring performance of program
JP4208591B2 (en) Breakpoint setting device, breakpoint setting method, and breakpoint setting program

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20120726

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20130918

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20130920

A02 Decision of refusal

Free format text: JAPANESE INTERMEDIATE CODE: A02

Effective date: 20140204