JP2005115619A - Program debugger - Google Patents

Program debugger Download PDF

Info

Publication number
JP2005115619A
JP2005115619A JP2003348401A JP2003348401A JP2005115619A JP 2005115619 A JP2005115619 A JP 2005115619A JP 2003348401 A JP2003348401 A JP 2003348401A JP 2003348401 A JP2003348401 A JP 2003348401A JP 2005115619 A JP2005115619 A JP 2005115619A
Authority
JP
Japan
Prior art keywords
routine
inspection
target memory
instruction code
inspection routine
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
JP2003348401A
Other languages
Japanese (ja)
Inventor
Harue Tsuchida
晴江 土田
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.)
Toshiba Corp
Kioxia Systems Co Ltd
Original Assignee
Toshiba Corp
Toshiba Memory Systems Co Ltd
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 Toshiba Corp, Toshiba Memory Systems Co Ltd filed Critical Toshiba Corp
Priority to JP2003348401A priority Critical patent/JP2005115619A/en
Publication of JP2005115619A publication Critical patent/JP2005115619A/en
Pending legal-status Critical Current

Links

Images

Abstract

<P>PROBLEM TO BE SOLVED: To provide a program debugger which allows check routines to be added, modified, or deleted without recompiling a source program. <P>SOLUTION: In response to an assembly command code read out from a storage device 2, a test routine embedding-in part 14 embeds a check routine generated by a check routine generation part 12, in an free space of a target memory 3 on the basis of memory management table information owened by a target memory management part 13. A program code selection part 15 selects one of an assembly command code generated by the check routine embedding part 14 and the assembly command code stored in the storage device 2. <P>COPYRIGHT: (C)2005,JPO&NCIPI

Description

本発明は、プログラムの動作検証に使用するデバッガに関する。   The present invention relates to a debugger used for program operation verification.

コンピュータ用プログラムの作成にあたっては、そのプログラムが正常に動作するかどうかを検証するためのデバッグ作業が必要である。そのため、検査対象の記述部分に検査ルーチンを組み込んだデバッグ用プログラムを作成し、このプログラムをデバッガで実行することが行われる。   When creating a computer program, a debugging operation is required to verify whether the program operates normally. Therefore, a debugging program in which an inspection routine is incorporated in the description portion to be inspected is created and this program is executed by the debugger.

デバッガは、ユーザからのデバッグ実行指示に従い、上記のデバッグ用プログラムに組み込まれた検査ルーチンに基づいてデバッグを実行し、デバッグ結果をユーザに返す。   In accordance with a debug execution instruction from the user, the debugger executes debugging based on the inspection routine incorporated in the debugging program and returns the debug result to the user.

通常、上述のデバッグ用プログラムとしては、ソースプログラムに検査ルーチンを組み込んだデバッグ用ソースプログラムが用いられることが多い。   Usually, as the above-described debugging program, a debugging source program in which an inspection routine is incorporated in the source program is often used.

ただし、このようなソースプログラムへの検査ルーチンの組み込み作業を人手で行おうとすると、検査対象箇所をプログラム上で検索する必要があるなど、作業者の負担が重くなる。   However, if it is attempted to manually incorporate the inspection routine into the source program, it is necessary to search the inspection target portion on the program, which increases the burden on the operator.

そこで、従来、検査ルーチンの組み込みに対して、種々の自動化の提案が行われている(例えば、特許文献1参照。)。   In view of this, various automation proposals have conventionally been made for incorporating inspection routines (see, for example, Patent Document 1).

この特許文献1においては、コンパイラに検査ルーチンを組み込む手段を設け、ソースプログラムのコンパイルの実行により、検査ルーチンの組み込まれたオブジェクトモジュールを自動的に得ることが提案されている。
特開平5−224908号公報 (第3ページ、図1)
In this patent document 1, it is proposed that a means for incorporating a check routine is provided in a compiler, and an object module incorporating the check routine is automatically obtained by executing compilation of the source program.
JP-A-5-224908 (3rd page, FIG. 1)

しかしながら、上述のようなデバッグ用ソースプログラムを用いるデバッグ、あるいはコンパイラにより検査ルーチンを組み込んだオブジェクトモジュールを用いるデバッグでは、検査ルーチンの追加、変更のたびにソースプログラムの再コンパイルを行わなければならないという問題があった。   However, in debugging using a debugging source program as described above, or debugging using an object module in which an inspection routine is incorporated by a compiler, the source program must be recompiled every time an inspection routine is added or changed. was there.

また、デバッグ完了後は、総ての検査ルーチンを削除した完成版ソースプログラムを作成し、この完成版ソースプログラムに対して、改めてコンパイルを行わなければならないという問題があった。   Further, after the debugging is completed, there is a problem that a completed version source program in which all the inspection routines are deleted must be created, and the completed version source program must be compiled again.

そこで、本発明の目的は、検査ルーチンの生成および組み込みが自動的にでき、且つ検査ルーチンの追加、変更あるいは削除に際してソースプログラムの再コンパイルの必要のないデバッガを提供することにある。   SUMMARY OF THE INVENTION An object of the present invention is to provide a debugger that can automatically generate and incorporate a check routine and does not require recompilation of a source program when adding, changing, or deleting a check routine.

本発明の一態様によれば、ソースプログラムをコンパイルして得られたアセンブリ命令コード列が書き込まれるターゲットメモリの使用領域を管理するターゲットメモリ管理部と、前記ソースプログラムの任意のプログラム記述行に対する検査ルーチン挿入指示に従ってアセンブリ命令コード列からなる検査ルーチンを生成する検査ルーチン生成部と、前記検査ルーチンを前記アセンブリ命令コード列に組み込む検査ルーチン組み込み部と、を具備し、前記検査ルーチン組み込み部が、前記ターゲットメモリ管理部から出力される前記ターゲットメモリの使用領域に関する情報に基づいて、前記検査ルーチンが前記ターゲットメモリの空き領域に書き込まれるように、前記検査ルーチンを前記アセンブリ命令コード列に組み込むことを特徴とするプログラムのデバッガが提供される。   According to one aspect of the present invention, a target memory management unit that manages a use area of a target memory in which an assembly instruction code sequence obtained by compiling a source program is written, and an inspection for an arbitrary program description line of the source program A test routine generation unit that generates a test routine including an assembly instruction code sequence in accordance with a routine insertion instruction; and a test routine installation unit that incorporates the test routine into the assembly command code sequence. The inspection routine is incorporated into the assembly instruction code string so that the inspection routine is written into an empty area of the target memory based on information on the target memory use area output from the target memory management unit. When That program debugger is provided.

また、本発明の別の一態様によれば、ソースプログラムをコンパイルして得られたアセンブリ命令コード列が書き込まれるターゲットメモリの使用領域を管理するターゲットメモリ管理部と、前記ソースプログラムの任意のプログラム記述行に対する検査ルーチン挿入指示に従ってアセンブリ命令コード列からなる検査ルーチンを生成する検査ルーチン生成部と、前記検査ルーチン生成部が複数の検査ルーチン挿入指示に従って生成した複数の前記検査ルーチンを保管する検査ルーチン保管部と、前記複数の検査ルーチンから選択された検査ルーチンを前記アセンブリ命令コード列に組み込む検査ルーチン組み込み部と、を具備し、前記検査ルーチン組み込み部が、前記ターゲットメモリ管理部から出力される前記ターゲットメモリの使用領域に関する情報に基づいて、前記検査ルーチンが前記ターゲットメモリの空き領域に書き込まれるように、前記検査ルーチンを前記アセンブリ命令コード列に組み込むことを特徴とするプログラムのデバッガが提供される。   According to another aspect of the present invention, a target memory management unit that manages a use area of a target memory in which an assembly instruction code sequence obtained by compiling a source program is written, and an arbitrary program of the source program A test routine generation unit that generates a test routine including an assembly instruction code sequence according to a test routine insertion instruction for a description line, and a test routine that stores a plurality of the test routines generated by the test routine generation unit according to a plurality of test routine insertion instructions A storage unit; and a test routine built-in unit that incorporates a test routine selected from the plurality of test routines into the assembly instruction code string, and the test routine built-in unit is output from the target memory management unit. Target memory usage Based on the information about the test routine to be written in the empty area of the target memory, the debugger program characterized by incorporating the test routine to the assembly instruction code sequence is provided.

本発明によれば、ソースプログラムをコンパイルして得られたアセンブリ命令コード列に対して、デバッガ内でアセンブリ命令で記述された検査ルーチンを自動的に生成して指定の検査対象箇所に挿入するため、ソースプログラムを再コンパイルすることなく、検査ルーチンの組み込まれたアセンブリ命令コード列を得ることができる。   According to the present invention, for an assembly instruction code string obtained by compiling a source program, an inspection routine described by an assembly instruction is automatically generated in a debugger and inserted into a specified inspection target location. Thus, an assembly instruction code sequence in which an inspection routine is incorporated can be obtained without recompiling the source program.

また、再コンパイルすることなく、検査ルーチンを変更あるいは不使用としたアセンブリ命令コード列を生成することもできる。   Further, an assembly instruction code sequence in which the inspection routine is changed or not used can be generated without recompiling.

さらに、検査ルーチンの組み込まれていないアセンブリ命令コード列の選択も可能なため、再コンパイルすることなく、検査ルーチンの削除されたアセンブリ命令コード列を得ることができる。   Furthermore, since it is possible to select an assembly instruction code sequence in which no inspection routine is incorporated, an assembly instruction code sequence from which the inspection routine has been deleted can be obtained without recompilation.

以下、本発明の実施例を図面を参照して説明する。   Embodiments of the present invention will be described below with reference to the drawings.

図1は、本発明の実施例1に係るデバッガの構成を示すブロック図である。   FIG. 1 is a block diagram showing a configuration of a debugger according to Embodiment 1 of the present invention.

デバッガ1は、ソースプログラムのデバッグのため、ソースコードをコンパイルして生成されたアセンブリ命令コードを記憶装置2から読み出し、ターゲットメモリ3に書き込む。さらに、デバッガ1には、デバッグ状況などを表示するための表示装置4と、デバッグの実行に関するコマンドなどを入力するための入力装置5が接続されている。なお、記憶装置2には、ソースコードおよび標準関数などのライブラリも格納されており、これらは必要に応じてデバッガ1に読み込まれる。   The debugger 1 reads the assembly instruction code generated by compiling the source code from the storage device 2 and writes it in the target memory 3 for debugging the source program. Further, the debugger 1 is connected with a display device 4 for displaying a debugging status and the like, and an input device 5 for inputting a command relating to execution of debugging. The storage device 2 also stores libraries such as source codes and standard functions, which are read into the debugger 1 as necessary.

また、このデバッガ1は、デバッグ用の検査ルーチンを生成して記憶装置2から読み出したアセンブリ命令コード列に組み込み、ターゲットメモリ3への書き込みを行う。そのために、デバッガ1は、コマンド解析部11、検査ルーチン生成部12、ターゲットメモリ管理部13、検査ルーチン組み込み部14、プログラムコード選択部15およびターゲットメモリ制御部16を有している。   The debugger 1 generates a test routine for debugging, incorporates it into the assembly instruction code sequence read from the storage device 2, and writes it into the target memory 3. For this purpose, the debugger 1 includes a command analysis unit 11, an inspection routine generation unit 12, a target memory management unit 13, an inspection routine incorporation unit 14, a program code selection unit 15, and a target memory control unit 16.

コマンド解析部11は、入力装置から入力されたコマンドの内容を解析し、検査ルーチン生成部12、検査ルーチン組み込み部14およびプログラムコード選択部15に、それぞれの動作の実行を指示する。また、コマンド解析部11は、検査箇所のアドレス、変数の型、変数のアドレスなどの情報を検査ルーチン生成部12および検査ルーチン組み込み部14に出力する。   The command analysis unit 11 analyzes the contents of the command input from the input device, and instructs the inspection routine generation unit 12, the inspection routine incorporation unit 14, and the program code selection unit 15 to execute each operation. In addition, the command analysis unit 11 outputs information such as the inspection location address, the variable type, and the variable address to the inspection routine generation unit 12 and the inspection routine incorporation unit 14.

検査ルーチン生成部12は、コマンド解析部11からの指示および情報を受けて、デバッグに必要な検査ルーチンを生成する。   The inspection routine generation unit 12 receives an instruction and information from the command analysis unit 11 and generates an inspection routine necessary for debugging.

ターゲットメモリ管理部13は、メモリ管理テーブルを作成して、ターゲットメモリ3の使用状況を管理する。また、このメモリ管理テーブルに基づいて、ターゲットメモリ3の使用状況に関する情報を出力する。   The target memory management unit 13 creates a memory management table and manages the usage status of the target memory 3. Further, based on this memory management table, information on the usage status of the target memory 3 is output.

検査ルーチン組み込み部14は、コマンド解析部11からの指示および情報を受けて、検査ルーチン生成部12が生成した検査ルーチンをアセンブリ命令コード列に組み込む。このとき、検査ルーチン組み込み部14は、ターゲットメモリ管理部13から得られるターゲットメモリ3の使用状況に関する情報に基づいて、検査ルーチンがターゲットメモリ3の空き領域に書き込まれるように組み込む。   The inspection routine incorporation unit 14 receives the instruction and information from the command analysis unit 11 and incorporates the inspection routine generated by the inspection routine generation unit 12 into the assembly instruction code string. At this time, the inspection routine incorporation unit 14 incorporates the inspection routine so that the inspection routine is written in an empty area of the target memory 3 based on the information on the usage state of the target memory 3 obtained from the target memory management unit 13.

このとき、検査ルーチン組み込み部14は、1つの検査ルーチンを複数の空き領域に分散して書き込むように組み込むこともできる。   At this time, the inspection routine incorporation unit 14 can also incorporate one inspection routine so as to be distributed and written in a plurality of empty areas.

また、検査ルーチン組み込み部14は、検査ルーチンが組み込まれたアセンブリ命令コード列に対して検査ルーチンの使用をOFFするコマンドが入力されると、検査ルーチンの実行を無効とするアセンブリ命令コード列を新たに生成する。   In addition, when a command to turn off the use of the inspection routine is input to the assembly instruction code sequence in which the inspection routine is incorporated, the inspection routine incorporation unit 14 newly creates an assembly instruction code sequence that invalidates the execution of the inspection routine. To generate.

プログラムコード選択部15は、コマンド解析部11からの指示を受けて、ターゲットメモリ3に書き込むアセンブリ命令コード列を、検査ルーチンを組み込んだアセンブリ命令コード列にするか、検査ルーチンを組み込んでいない(すなわち、元の)アセンブリ命令コード列にするかの選択を行う。これにより、検査ルーチンを組み込んだ後でも、直ちに元のプログラムを実行することができる。   In response to an instruction from the command analysis unit 11, the program code selection unit 15 changes an assembly instruction code sequence to be written to the target memory 3 to an assembly instruction code sequence incorporating a test routine, or does not incorporate a test routine (that is, The original instruction code sequence is selected. As a result, the original program can be executed immediately even after the inspection routine is incorporated.

ターゲットメモリ制御部16は、ターゲットメモリ3の書き込みおよび読み出しを制御している。   The target memory control unit 16 controls writing and reading of the target memory 3.

次に、このデバッガ1におけるデバッグ用の検査ルーチンの生成およびアセンブリ命令コード列への検査ルーチンの組み込み動作について、図2〜図4を用いて説明する。   Next, the generation of a debugging inspection routine and the operation of incorporating the inspection routine into the assembly instruction code string in the debugger 1 will be described with reference to FIGS.

図2は、デバッグの対象とするC言語で書かれたソースプログラムの例と、これをコンパイルして得られたアセンブリ命令コード列の対応を示す図である。   FIG. 2 is a diagram showing a correspondence between an example of a source program written in C language to be debugged and an assembly instruction code string obtained by compiling the source program.

図2(a)は、ソースプログラムの中から、変数a、b、cを用いる関数func1の使用を記述した部分を抜き出したものである。   FIG. 2A shows an extracted part of the source program describing the use of the function func1 using the variables a, b and c.

図2(b)は、上記のソースプログラムをコンパイルして得られたアセンブリ命令コード列の例を示す図である。   FIG. 2B is a diagram illustrating an example of an assembly instruction code string obtained by compiling the above source program.

ここで、図2(a)に示したソースプログラムは、変数a、b、cをそれぞれスタックに格納するpush命令と、関数func1を呼び出すcall命令に変換されている。そして、これらの命令を書き込むメモリのアドレスが指定されている。ここでは、上記の命令を、それぞれ100番地、102番地、104番地、106番地に書き込むことが指定されている。   Here, the source program shown in FIG. 2A is converted into a push instruction for storing the variables a, b, and c in the stack and a call instruction for calling the function func1, respectively. And the address of the memory in which these instructions are written is designated. Here, it is specified that the above instructions are written to addresses 100, 102, 104, and 106, respectively.

また、図2(b)の例では、メモリの109番地から299番地は、他の命令が使用する領域とし、300番地以降は、メモリの空き領域とする。   In the example of FIG. 2B, the addresses 109 to 299 of the memory are areas used by other instructions, and the addresses after the address 300 are free areas of the memory.

図3は、本実施例における検査ルーチンの生成例を示す図である。ここでは、図2(a)に示すソースプログラム行に検査ルーチンを設定する場合を例にとって説明する。   FIG. 3 is a diagram illustrating a generation example of the inspection routine in the present embodiment. Here, a case where an inspection routine is set in the source program line shown in FIG.

検査ルーチンを設定するには、先ず、図3(a)に示すように、表示装置4に検査箇所のソースプログラム行を表示する。   To set the inspection routine, first, as shown in FIG. 3A, the source program line of the inspection portion is displayed on the display device 4.

次に、図3(b)に示すように、入力装置5から、設定したい検査ルーチンを入力する。ここで、図3(b)に示す検査ルーチンは、関数func1の引数aとbが等しいときに、デバッグ用の関数dbgfuncを実行するというものである。   Next, as shown in FIG. 3B, an inspection routine to be set is input from the input device 5. Here, the checking routine shown in FIG. 3B is to execute the debugging function dbgfunc when the arguments a and b of the function func1 are equal.

この入力を受けて、コマンド解析部11は、検査ルーチン生成部12に検査ルーチンの生成を指示し、変数a、bの型に関する情報を出力する。   In response to this input, the command analysis unit 11 instructs the inspection routine generation unit 12 to generate an inspection routine, and outputs information regarding the types of the variables a and b.

図3(c)は、検査ルーチン生成部12にて生成された検査ルーチンの例を示す図である。   FIG. 3C is a diagram illustrating an example of an inspection routine generated by the inspection routine generation unit 12.

図3(c)では、図3(b)で設定された検査ルーチンに対応して、変数a、bをレジスタにロードするld命令、変数a、bを比較するcmp命令、変数a、bが等しくない場合にジャンプするjr命令および関数dbgfuncを呼び出すcall命令からなる検査ルーチンが生成されている。   In FIG. 3C, corresponding to the inspection routine set in FIG. 3B, an ld instruction for loading variables a and b into a register, a cmp instruction for comparing variables a and b, and variables a and b A test routine has been generated consisting of a jr instruction that jumps if they are not equal and a call instruction that calls the function dbgfunc.

変数a、bのld命令に記されているnnnおよびmmmは、それぞれの変数の格納先アドレスを示し、call命令に記されているxxxは、関数dbgfuncが書き込まれるアドレスを示す。   Nnn and mmm written in the ld instruction of the variables a and b indicate storage destination addresses of the respective variables, and xxx written in the call instruction indicates an address where the function dbgfunc is written.

なお、関数dbgfuncがプログラム内で既に使われているときは、プログラム内にリンクされているdbgfuncが使用できるが、まだプログラム内で使用されていないときは、記憶装置2に格納されているライブラリからdbgfuncのコードを取得する必要がある。   When the function dbgfunc is already used in the program, the dbgfunc linked in the program can be used. However, when the function dbgfunc is not yet used in the program, the function dbgfunc can be used from the library stored in the storage device 2. It is necessary to obtain the dbgfunc code.

図4は、本実施例における検査ルーチンの組み込まれたアセンブリ命令コード列の生成の例を示す。   FIG. 4 shows an example of generation of an assembly instruction code string in which a test routine is incorporated in this embodiment.

ここでは、図3(c)に示した検査ルーチンを図2(b)に示したメモリ空き領域に組み込む例を示している。   Here, an example is shown in which the inspection routine shown in FIG. 3C is incorporated into the free memory area shown in FIG.

検査ルーチン組み込み部14は、コマンド解析部11からの指示および検査箇所アドレスの情報を受けて、検査箇所アドレスの100番地の内容を検査ルーチンへジャンプするjp命令に書き換えるとともに、図3(c)に示した検査ルーチンをターゲットメモリ3の300番地以降の空き領域に組み込む。   The inspection routine incorporation unit 14 receives the instruction from the command analysis unit 11 and information on the inspection location address, rewrites the content of the address 100 of the inspection location address into a jp instruction that jumps to the inspection routine, and also in FIG. The indicated inspection routine is incorporated into an empty area after address 300 in the target memory 3.

ただし、検査ルーチンを組み込むにあたっては、本来のプログラム動作に影響を与えないための処理が必要である。そのため、図4の例では、前処理としてレジスタの退避命令を追加し、後処理としてレジスタの復帰命令を追加している。   However, in order to incorporate the inspection routine, it is necessary to perform processing so as not to affect the original program operation. For this reason, in the example of FIG. 4, a register save instruction is added as preprocessing, and a register return instruction is added as postprocessing.

また、検査ルーチンの追加により破壊される命令に対しては、これを補完する命令を追加する必要がある。図4の例では、100番地へのjp命令で破壊された100番地と102番地の命令を318番地と320番地で補完している。   Moreover, it is necessary to add an instruction that complements an instruction that is destroyed by the addition of the inspection routine. In the example of FIG. 4, the instructions at addresses 100 and 102 destroyed by the jp instruction to address 100 are complemented at addresses 318 and 320.

なお、ここでは、変数a、bが、それぞれ200番地、202番地に格納されているものとする。この変数アドレス情報がコマンド解析部11から出力され、この情報に基づいて、図3(c)でnnn、mmmと表わされていたアドレス値が、それぞれ、200、202となる。   Here, it is assumed that variables a and b are stored at addresses 200 and 202, respectively. The variable address information is output from the command analysis unit 11, and based on this information, the address values represented as nnn and mmm in FIG. 3C are 200 and 202, respectively.

これにより、図4に示すように、検査ルーチンおよびその組み込みに関連する一連の命令が、ターゲットメモリ3の空き領域に書き込まれるアセンブリ命令コード列が生成される。   As a result, as shown in FIG. 4, an assembly instruction code string is generated in which a series of instructions related to the inspection routine and its incorporation are written in an empty area of the target memory 3.

次に、検査ルーチン組み込み部14が、1つの検査ルーチンを複数の空き領域に分散して組み込む例を説明する。   Next, an example will be described in which the inspection routine incorporation unit 14 incorporates one inspection routine in a distributed manner in a plurality of empty areas.

図5(a)に示すように、ターゲットメモリ3の空き領域が、複数の領域に分散して存在する場合がある。しかも、図5(a)の例の300〜308番地の空き領域のように、1つの空き領域に検査ルーチンの総てを組み込めないほど、1つの空き領域のサイズが小さいことがある。   As shown in FIG. 5A, the free area of the target memory 3 may exist in a plurality of areas. Moreover, the size of one free area may be so small that all of the inspection routines cannot be incorporated into one free area, such as the free areas at addresses 300 to 308 in the example of FIG.

このような場合、検査ルーチン組み込み部14は、空き領域の大きさに合わせて検査ルーチンを分割し、複数の空き領域に分散させて検査ルーチンをアセンブリ命令コード列に組み込む。   In such a case, the inspection routine incorporation unit 14 divides the inspection routine according to the size of the free area and distributes the inspection routine into a plurality of free areas to incorporate the inspection routine into the assembly instruction code string.

図5(b)に、複数の空き領域に検査ルーチンを分散させてアセンブリ命令コード列に組み込んだ例を示す。この例は、図5(a)に示す2つの空き領域に図3(c)の検査ルーチンを組み込んだときの例である。   FIG. 5B shows an example in which inspection routines are distributed in a plurality of empty areas and incorporated in an assembly instruction code string. This example is an example when the inspection routine of FIG. 3C is incorporated into two free areas shown in FIG.

この例に示すように、複数の空き領域を使用する場合、先に使用する空き領域の最後のアドレスに、次に使用する空き領域の先頭アドレスへのジャンプ(jp)命令を挿入する。このようにして、1つの検査ルーチンを複数の空き領域に分散させて配置することができる。   As shown in this example, when using a plurality of free areas, a jump (jp) instruction to the start address of the free area to be used next is inserted at the last address of the free area to be used first. In this way, one inspection routine can be distributed and arranged in a plurality of empty areas.

次に、図6を用いて、検査ルーチンの使用をOFFするコマンドが入力されたときの動作について説明する。このコマンドは、プログラムの処理速度の測定などのために、検査ルーチンの実行を無効にしたいときに入力されるものである。   Next, the operation when a command for turning off the use of the inspection routine is input will be described with reference to FIG. This command is input when it is desired to invalidate the execution of the inspection routine in order to measure the processing speed of the program.

検査ルーチンの使用をOFFするコマンドが入力されると、コマンド解析部11は、検査ルーチン組み込み部に対して、検査箇所アドレスの命令の書き戻しを指示する。これを受けて、検査ルーチン組み込み部14は、検査ルーチンが組み込まれたアセンブリ命令コード列のうち、検査箇所アドレス部分のみ命令内容を元に戻す。これにより、アセンブリ命令コード列に検査ルーチンが組み込まれていても、検査ルーチンへのジャンプ命令がなくなるため、検査ルーチンは実行されなくなる。   When a command for turning off the use of the inspection routine is input, the command analysis unit 11 instructs the inspection routine incorporation unit to write back the instruction at the inspection location address. In response to this, the inspection routine incorporation unit 14 restores the instruction content only to the inspection portion address portion of the assembly instruction code string in which the inspection routine is incorporated. As a result, even if the inspection routine is incorporated in the assembly instruction code string, since there is no jump instruction to the inspection routine, the inspection routine is not executed.

図6に、この検査ルーチン使用OFFコマンド入力時に生成されるアセンブリ命令コード列の例を示す。ここでは、図4に示したアセンブリ命令コード列に対して、検査ルーチン使用OFFのコマンドが入力されたときの例を示す。   FIG. 6 shows an example of an assembly instruction code string generated when the inspection routine use OFF command is input. Here, an example is shown in which an inspection routine use OFF command is input to the assembly instruction code string shown in FIG.

図6(a)に示すように、入力装置5から検査ルーチンの使用をOFFするコマンドが入力される。すると、コマンド解析部11の指示を受けて、検査ルーチン組み込み部14が、検査箇所アドレス部分の命令内容を元に戻す。   As shown in FIG. 6A, a command for turning off the use of the inspection routine is input from the input device 5. Then, in response to an instruction from the command analysis unit 11, the inspection routine incorporation unit 14 restores the instruction content of the inspection location address part.

その結果、図6(b)に示すように、検査ルーチンは組み込まれているが、検査箇所アドレス部分の命令内容が元に戻されたアセンブリ命令コード列が生成される。   As a result, as shown in FIG. 6B, an assembly instruction code string is generated in which the inspection routine is incorporated, but the instruction content at the inspection location address part is restored.

すなわち、検査ルーチンの設定によって書き換わった100番地と102番地の命令の内容が、図2(b)に示した元のアセンブリ命令コード列に書き換えられている。   That is, the contents of the instructions at addresses 100 and 102 rewritten according to the setting of the inspection routine are rewritten to the original assembly instruction code string shown in FIG.

これにより、図4では100番地に書かれていた300番地へジャンプするjp命令がなくなる。そのため、300番地以降に書かれている検査ルーチンへのジャンプが行われなくなり、検査ルーチンは実行されなくなる。   As a result, there is no jp instruction for jumping to address 300, which was written at address 100 in FIG. Therefore, the jump to the inspection routine written after address 300 is not performed, and the inspection routine is not executed.

次に、図7を用いて、プログラム選択部15の動作について説明する。ここで、検査ルーチンを組み込む前のアセンブリ命令コード列がname0という名前で保存されており、検査ルーチンを組み込んだ後のアセンブリ命令コード列がname1という名前で保存されているものとする。   Next, the operation of the program selection unit 15 will be described with reference to FIG. Here, it is assumed that the assembly instruction code string before incorporating the inspection routine is stored under the name name0, and the assembly instruction code string after incorporating the inspection routine is stored under the name name1.

図7(a)に示すように、プログラム選択コマンドで、アセンブリ命令コード列名name1が、入力装置5から入力されると、コマンド解析部11は、プログラムコード選択部15へ、名前name1のアセンブリ命令コード列の選択を指示する。   As shown in FIG. 7A, when an assembly instruction code string name name1 is input from the input device 5 by a program selection command, the command analysis unit 11 sends an assembly instruction with the name name1 to the program code selection unit 15. Indicates selection of code string.

これを受けて、プログラムコード選択部15は、図7(b)に示すように、検査ルーチンが組み込まれたアセンブリ命令コード列を出力する。   In response to this, the program code selection unit 15 outputs an assembly instruction code string in which the inspection routine is incorporated, as shown in FIG.

一方、図7(c)に示すように、アセンブリ命令コード列名name0が、入力装置5から入力されると、プログラムコード選択部15は、図7(d)に示すように、検査ルーチンを組み込む前、すなわち元のアセンブリ命令コード列を出力する。   On the other hand, when the assembly instruction code string name name0 is input from the input device 5 as shown in FIG. 7C, the program code selection unit 15 incorporates an inspection routine as shown in FIG. 7D. The previous, that is, the original assembly instruction code string is output.

このような本実施例によれば、ソースプログラムの再コンパイルをすることなく、ターゲットメモリ3の空き領域に検査ルーチンを組み込むアセンブリ命令コード列を生成することができる。また、1つの検査ルーチンを、ターゲットメモリ3の複数の空き領域に分散させて組み込むアセンブリ命令コード列を生成することができる。さらに、検査ルーチンが組み込まれていても、その使用を無効にできるアセンブリ命令コード列を生成することができる。   According to the present embodiment, an assembly instruction code string that incorporates a test routine in an empty area of the target memory 3 can be generated without recompiling the source program. Further, it is possible to generate an assembly instruction code string in which one inspection routine is incorporated in a plurality of empty areas of the target memory 3. Furthermore, even if a test routine is incorporated, an assembly instruction code string that can be invalidated can be generated.

また、本実施例によれば、検査ルーチンを組み込んだアセンブリ命令コード列と、検査ルーチンを組み込んでいないアセンブリ命令コード列とを、簡単に切り替えて出力することができる。   Further, according to the present embodiment, an assembly instruction code sequence incorporating a test routine and an assembly instruction code sequence not incorporating a test routine can be easily switched and output.

図8は、本発明の実施例2に係るデバッガの構成を示すブロック図である。   FIG. 8 is a block diagram illustrating a configuration of a debugger according to the second embodiment of the present invention.

本実施例のデバッガ100は、実施例1のデバッガ1に、さらに検査ルーチン保管部117を追加したものである。また、この検査ルーチン保管部117に対するコマンド入力の追加に応じて、コマンド解析部をコマンド解析部111に変更している。   The debugger 100 of the present embodiment is obtained by adding an inspection routine storage unit 117 to the debugger 1 of the first embodiment. Further, the command analysis unit is changed to the command analysis unit 111 in accordance with the addition of the command input to the inspection routine storage unit 117.

その他は、実施例1と同一の機能を有するブロックであり、これらのブロックには、図1と同一の符号を付し、ここでは、その詳細な説明を省略する。   Others are blocks having the same functions as those in the first embodiment, and these blocks are denoted by the same reference numerals as those in FIG. 1, and detailed description thereof is omitted here.

本実施例で追加された検査ルーチン保管部117は、検査ルーチン生成部12で生成された検査ルーチンの保管を行う。すなわち、N箇所の検査箇所に対して、検査ルーチン生成部12がN個の検査ルーチンを生成したとき、検査ルーチン保管部117は、それぞれの検査ルーチンに名前(例えば、検査ルーチン1〜検査ルーチンN)をつけて保管する。   The inspection routine storage unit 117 added in the present embodiment stores the inspection routine generated by the inspection routine generation unit 12. That is, when the inspection routine generation unit 12 generates N inspection routines for N inspection locations, the inspection routine storage unit 117 assigns names to the inspection routines (for example, inspection routine 1 to inspection routine N). ) And store.

また、コマンド解析部111は、検査ルーチン選択コマンドが入力されると、指定された検査ルーチンの出力を検査ルーチン保管部117へ指示する。これを受けて、検査ルーチン保管部117は、指定された検査ルーチンを検査ルーチン組み込み部14へ出力する。   Further, when an inspection routine selection command is input, the command analysis unit 111 instructs the inspection routine storage unit 117 to output the specified inspection routine. In response to this, the inspection routine storage unit 117 outputs the specified inspection routine to the inspection routine incorporation unit 14.

検査ルーチン組み込み部14は、入力された指定の検査ルーチンをターゲットメモリ3の空き領域に組み込む。   The inspection routine incorporation unit 14 incorporates the input designated inspection routine into the free area of the target memory 3.

その後、検査ルーチン選択コマンドで、別の検査ルーチンが選択されると、検査ルーチン保管部117は、新たに指定された検査ルーチンを検査ルーチン組み込み部14へ出力する。   Thereafter, when another inspection routine is selected by the inspection routine selection command, the inspection routine storage unit 117 outputs the newly specified inspection routine to the inspection routine incorporation unit 14.

いま、この新たに選択された検査ルーチンが前に選択された検査ルーチンと同時に使用する必要のない検査ルーチンであるとする。   Now, assume that this newly selected inspection routine is an inspection routine that does not need to be used simultaneously with the previously selected inspection routine.

このとき、検査ルーチン保管部117が、記憶装置2から元のアセンブリ命令コード列を新たに読み出して使用すれば、検査ルーチン保管部117は、新たに指定された検査ルーチンをターゲットメモリ3の前と同じ空き領域に組み込むことができる。   At this time, if the inspection routine storage unit 117 newly reads and uses the original assembly instruction code string from the storage device 2, the inspection routine storage unit 117 sets the newly specified inspection routine as the front of the target memory 3. Can be incorporated into the same free space.

図9は、このような検査ルーチン選択の動作で生成されるアセンブリ命令コード列の例である。なお、ここでは、ターゲットメモリ3の300番地以降に空き領域があるものとする。   FIG. 9 is an example of an assembly instruction code string generated by such an operation of selecting the inspection routine. Here, it is assumed that there is an empty area after address 300 of the target memory 3.

図9(a)に示すように、検査ルーチン選択コマンドで、検査ルーチン1が選択されると、検査ルーチン保管部117は、検査ルーチン1を検査ルーチン組み込み部14へ出力する。   As shown in FIG. 9A, when the inspection routine 1 is selected by the inspection routine selection command, the inspection routine storage unit 117 outputs the inspection routine 1 to the inspection routine incorporation unit 14.

これを受けて、検査ルーチン組み込み部14は、図9(b)に示すように、ターゲットメモリ3の300番地以降に検査ルーチン1を組み込んだアセンブリ命令コード列を生成する。   In response to this, the inspection routine incorporation unit 14 generates an assembly instruction code string in which the inspection routine 1 is incorporated at address 300 and subsequent addresses of the target memory 3 as shown in FIG. 9B.

次いで、図9(c)に示すように、検査ルーチン選択コマンドで、検査ルーチン2が選択されると、検査ルーチン保管部117は、検査ルーチン2を検査ルーチン組み込み部14へ出力する。ただし、この検査ルーチン2は、検査ルーチン1と同時に使用する必要のない検査ルーチンとする。   Next, as shown in FIG. 9C, when the inspection routine 2 is selected by the inspection routine selection command, the inspection routine storage unit 117 outputs the inspection routine 2 to the inspection routine incorporation unit 14. However, the inspection routine 2 is an inspection routine that does not need to be used simultaneously with the inspection routine 1.

このとき、検査ルーチン組み込み部14は、記憶装置2から元のアセンブリ命令コード列を改めて読み出す。そして、図9(d)に示すように、ターゲットメモリ3の300番地以降に検査ルーチン2を組み込んだ別のアセンブリ命令コード列を生成する。   At this time, the inspection routine incorporation unit 14 reads the original assembly instruction code sequence from the storage device 2 again. Then, as shown in FIG. 9D, another assembly instruction code string in which the inspection routine 2 is incorporated at the address 300 and subsequent addresses of the target memory 3 is generated.

このように、検査ルーチン組み込み部14は、同一の空き領域に別の検査ルーチンを組み込んだ異なるアセンブリ命令コード列を生成することができる。   As described above, the inspection routine incorporation unit 14 can generate different assembly instruction code sequences in which different inspection routines are incorporated in the same empty area.

このような本実施例によれば、同時に実行される必要のない検査ルーチンは、ターゲットメモリ3の同一の空き領域に入れ替わりで組み込まれる。すなわち、ターゲットメモリ3に総ての検査ルーチンを組み込む空き領域を必要としない。そのため、ターゲットメモリ3を効率よく使用できる。   According to the present embodiment, inspection routines that do not need to be executed at the same time are incorporated in the same empty area of the target memory 3 by being replaced. That is, there is no need for a free area in which all inspection routines are incorporated in the target memory 3. Therefore, the target memory 3 can be used efficiently.

本発明の実施例1に係るデバッガの構成を示すブロック図。1 is a block diagram showing a configuration of a debugger according to Embodiment 1 of the present invention. ソースプログラムとアセンブリ命令コード列の対応関係を説明するための図。The figure for demonstrating the correspondence of a source program and an assembly instruction code sequence. 本発明の実施例における検査ルーチン生成の例を示す図。The figure which shows the example of the test | inspection routine production | generation in the Example of this invention. 本発明の実施例における検査ルーチンの組み込まれたアセンブリ命令コード列生成の例を示す図。The figure which shows the example of the assembly instruction code sequence generation in which the test | inspection routine was integrated in the Example of this invention. 本発明の実施例における検査ルーチンの組み込まれたアセンブリ命令コード列生成の別の例を示す図。The figure which shows another example of the assembly instruction code sequence generation in which the test | inspection routine was integrated in the Example of this invention. 本発明の実施例における検査ルーチン使用OFFコマンド入力時のアセンブリ命令コード列の生成例を示す図。The figure which shows the example of a production | generation of the assembly instruction code sequence at the time of test routine use OFF command input in the Example of this invention. 本発明の実施例におけるプログラム選択の例を説明するための図。The figure for demonstrating the example of the program selection in the Example of this invention. 本発明の実施例2に係るデバッガの構成を示すブロック図。FIG. 6 is a block diagram showing a configuration of a debugger according to Embodiment 2 of the present invention. 本発明の実施例2における検査ルーチン選択動作を説明するための図。The figure for demonstrating the test | inspection routine selection operation | movement in Example 2 of this invention.

符号の説明Explanation of symbols

1、100 デバッガ
2 記憶装置
3 ターゲットメモリ
4 表示装置
5 入力装置
11、111 コマンド解析部
12 検査ルーチン生成部
13 ターゲットメモリ管理部
14 検査ルーチン組み込み部
15 プログラムコード選択部
16 ターゲットメモリ制御部
117 検査ルーチン保管部
DESCRIPTION OF SYMBOLS 1,100 Debugger 2 Memory | storage device 3 Target memory 4 Display apparatus 5 Input device 11, 111 Command analysis part 12 Inspection routine production | generation part 13 Target memory management part 14 Inspection routine incorporation part 15 Program code selection part 16 Target memory control part 117 Inspection routine Storage department

Claims (5)

ソースプログラムをコンパイルして得られたアセンブリ命令コード列が書き込まれるターゲットメモリの使用領域を管理するターゲットメモリ管理部と、
前記ソースプログラムの任意のプログラム記述行に対する検査ルーチン挿入指示に従ってアセンブリ命令コード列からなる検査ルーチンを生成する検査ルーチン生成部と、
前記検査ルーチンを前記アセンブリ命令コード列に組み込む検査ルーチン組み込み部と、
を具備し、
前記検査ルーチン組み込み部が、前記ターゲットメモリ管理部から出力される前記ターゲットメモリの使用領域に関する情報に基づいて、前記検査ルーチンが前記ターゲットメモリの空き領域に書き込まれるように、前記検査ルーチンを前記アセンブリ命令コード列に組み込むことを特徴とするプログラムのデバッガ。
A target memory management unit for managing a target memory use area in which an assembly instruction code sequence obtained by compiling a source program is written;
A test routine generator for generating a test routine consisting of assembly instruction code strings in accordance with a test routine insertion instruction for an arbitrary program description line of the source program;
An inspection routine incorporation section for incorporating the inspection routine into the assembly instruction code sequence;
Comprising
The inspection routine is incorporated into the assembly so that the inspection routine is written into a free area of the target memory based on information on the target memory use area output from the target memory management section. A program debugger characterized by being incorporated into an instruction code string.
ソースプログラムをコンパイルして得られたアセンブリ命令コード列が書き込まれるターゲットメモリの使用領域を管理するターゲットメモリ管理部と、
前記ソースプログラムの任意のプログラム記述行に対する検査ルーチン挿入指示に従ってアセンブリ命令コード列からなる検査ルーチンを生成する検査ルーチン生成部と、
前記検査ルーチン生成部が複数の検査ルーチン挿入指示に従って生成した複数の前記検査ルーチンを保管する検査ルーチン保管部と、
前記複数の検査ルーチンから選択された検査ルーチンを前記アセンブリ命令コード列に組み込む検査ルーチン組み込み部と、
を具備し、
前記検査ルーチン組み込み部が、前記ターゲットメモリ管理部から出力される前記ターゲットメモリの使用領域に関する情報に基づいて、前記検査ルーチンが前記ターゲットメモリの空き領域に書き込まれるように、前記検査ルーチンを前記アセンブリ命令コード列に組み込むことを特徴とするプログラムのデバッガ。
A target memory management unit for managing a target memory use area in which an assembly instruction code sequence obtained by compiling a source program is written;
A test routine generator for generating a test routine consisting of assembly instruction code strings in accordance with a test routine insertion instruction for an arbitrary program description line of the source program;
A test routine storage unit that stores the plurality of test routines generated by the test routine generation unit according to a plurality of test routine insertion instructions;
A test routine built-in unit that incorporates a test routine selected from the plurality of test routines into the assembly instruction code string;
Comprising
The inspection routine is incorporated into the assembly so that the inspection routine is written into a free area of the target memory based on information on the target memory use area output from the target memory management section. A program debugger characterized by being incorporated into an instruction code string.
前記検査ルーチン保管部に保管された前記複数の検査ルーチンのうち、同時に実行する必要のない検査ルーチンは順次選択されて、前記ターゲットメモリの同一の空き領域を順次書き換えて使用することを特徴とする請求項2に記載のプログラムのデバッガ。   Of the plurality of inspection routines stored in the inspection routine storage unit, inspection routines that do not need to be executed simultaneously are sequentially selected, and the same empty area of the target memory is sequentially rewritten and used. A debugger for the program according to claim 2. 前記アセンブリ命令コード列に組み込まれた前記検査ルーチンの使用のON/OFFを制御することができることを特徴とする請求項1乃至3のいずれか1項に記載のプログラムのデバッガ。   4. The program debugger according to claim 1, wherein ON / OFF of use of the inspection routine incorporated in the assembly instruction code string can be controlled. 5. 前記検査ルーチンの組み込まれたアセンブリ命令コード列と、前記検査ルーチンを組み込む前のアセンブリ命令コード列とのいずれかを選択して出力することができることを特徴とする請求項1乃至4のいずれか1項に記載のプログラムのデバッガ。   5. An assembly instruction code string in which the inspection routine is incorporated and an assembly instruction code string before the inspection routine is incorporated can be selected and output. The debugger of the program described in the section.
JP2003348401A 2003-10-07 2003-10-07 Program debugger Pending JP2005115619A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2003348401A JP2005115619A (en) 2003-10-07 2003-10-07 Program debugger

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2003348401A JP2005115619A (en) 2003-10-07 2003-10-07 Program debugger

Publications (1)

Publication Number Publication Date
JP2005115619A true JP2005115619A (en) 2005-04-28

Family

ID=34540606

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2003348401A Pending JP2005115619A (en) 2003-10-07 2003-10-07 Program debugger

Country Status (1)

Country Link
JP (1) JP2005115619A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8745597B2 (en) 2009-11-25 2014-06-03 International Business Machines Corporation Providing programming support to debuggers
JP2020108553A (en) * 2019-01-04 2020-07-16 株式会社ユニバーサルエンターテインメント Game machine

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8745597B2 (en) 2009-11-25 2014-06-03 International Business Machines Corporation Providing programming support to debuggers
US8826244B2 (en) 2009-11-25 2014-09-02 International Business Machines Corporation Providing programming support to debuggers
JP2020108553A (en) * 2019-01-04 2020-07-16 株式会社ユニバーサルエンターテインメント Game machine

Similar Documents

Publication Publication Date Title
US5956479A (en) Demand based generation of symbolic information
US5170465A (en) Incremental-scanning compiler for source-code development system
US7266809B2 (en) Software debugger and software development support system for microcomputer operable to execute conditional execution instruction
JPH0254337A (en) Data processing system for facilitating generation of executable image
Niephaus et al. Example-based live programming for everyone: building language-agnostic tools for live programming with LSP and GraalVM
US8473903B2 (en) Code edit apparatus and recording medium
US20110029953A1 (en) System and Method for Scalable Handling of Debug Information
US5812828A (en) Function simulation
US5946493A (en) Method and system in a data processing system for association of source code instructions with an optimized listing of object code instructions
JP2001236244A (en) Debug system for robot program
US20020129336A1 (en) Automatic symbol table selection in a multi-cell environment
US6438725B2 (en) Apparatus and method for fast code coverage analysis
JP2009104252A (en) Debugging support device and debugging support method
JP2008052688A (en) Patch data generation device for program
JP2005115619A (en) Program debugger
KR100417655B1 (en) Regulating information generator and program development system composed of regulator
JP6717140B2 (en) Analysis program, analysis method, and analysis device
JP2013242604A (en) Execution module optimization device, execution module optimization method and program
CN114356783A (en) Method and device for automatically generating unit test code, storage medium and equipment
JP5813600B2 (en) Application development device and application development tool
JP3461185B2 (en) Method and apparatus for registering source code line number to load module
JP5067705B2 (en) Abnormal test support device, abnormal test support method, and program
US7076780B2 (en) Application program interface for a computer program
KR101548960B1 (en) Method for making and debuging program using virtual platform and appparatus therof
JP2009064125A (en) Server device and program thereof

Legal Events

Date Code Title Description
RD02 Notification of acceptance of power of attorney

Free format text: JAPANESE INTERMEDIATE CODE: A7422

Effective date: 20050428

RD04 Notification of resignation of power of attorney

Free format text: JAPANESE INTERMEDIATE CODE: A7424

Effective date: 20050606