JP2715988B2 - Program simulator device and program debugging method - Google Patents

Program simulator device and program debugging method

Info

Publication number
JP2715988B2
JP2715988B2 JP7127811A JP12781195A JP2715988B2 JP 2715988 B2 JP2715988 B2 JP 2715988B2 JP 7127811 A JP7127811 A JP 7127811A JP 12781195 A JP12781195 A JP 12781195A JP 2715988 B2 JP2715988 B2 JP 2715988B2
Authority
JP
Japan
Prior art keywords
instruction
program
function
unit
stack
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.)
Expired - Lifetime
Application number
JP7127811A
Other languages
Japanese (ja)
Other versions
JPH08320813A (en
Inventor
義一 河内
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.)
NEC Corp
Original Assignee
NEC 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 NEC Corp filed Critical NEC Corp
Priority to JP7127811A priority Critical patent/JP2715988B2/en
Publication of JPH08320813A publication Critical patent/JPH08320813A/en
Application granted granted Critical
Publication of JP2715988B2 publication Critical patent/JP2715988B2/en
Anticipated expiration legal-status Critical
Expired - Lifetime legal-status Critical Current

Links

Description

【発明の詳細な説明】DETAILED DESCRIPTION OF THE INVENTION

【0001】[0001]

【産業上の利用分野】本発明は、実行済みのプログラム
を後戻りすることで再実行可能なプログラムシミュレー
タ装置及びこのプログラムシミュレータ装置を利用して
プログラムをデバッグするプログラムデバッグ方法に関
する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a program simulator that can be re-executed by rerunning an already executed program, and a program debugging method for debugging a program using the program simulator.

【0002】[0002]

【従来の技術】一般に、従来のプログラムシミュレータ
装置では、プログラムのデバッグを行う場合のプログラ
ムの実行方式として、実行されたプログラムをブレーク
ポイントの設定や外部端末からの割り込み等によって停
止するような、ノーマル実行方式が知られている。ま
た、プログラムが機械語の場合は1命令づつ実行すると
共に、高級言語の場合は1行毎の命令を実行するような
ステップ実行方式も知られている。このような各方式で
は、プログラムのデバッグを行う場合にプログラムを正
方向に実行してゆくものである。
2. Description of the Related Art In general, in a conventional program simulator apparatus, as a program execution method for debugging a program, a normal program in which an executed program is stopped by setting a break point, interrupting from an external terminal, or the like. Execution methods are known. Also, a step execution method is known in which when a program is a machine language, instructions are executed one by one, and when a program is a high-level language, instructions for each line are executed. In each of these methods, when debugging a program, the program is executed in the forward direction.

【0003】一方、近年は、プログラムのデバッグを行
う場合、プログラムを逆方向に実行するようなものも提
案されている。このようなプログラムデバッグ方式は、
プログラムを1ステップづつ後戻りさせるステップ実行
型の後戻り方式である。
On the other hand, in recent years, when debugging a program, a program which executes the program in the reverse direction has been proposed. Such a program debugging method,
This is a step execution type return method in which the program is returned one step at a time.

【0004】[0004]

【発明が解決しようとする課題】プログラムシミュレー
タ装置によりプログラムのデバッグを行う場合、プログ
ラムの一部を各資源(即ち、プログラム及びメモリの各
アドレス,プログラムを実行するCPUのレジスタ内容
等)の値を変更して再実行させたい場合がある。このよ
うな場合、従来のシミュレータ装置では、上述したよう
な、プログラムを先頭番地から正方向に再実行させる方
式、及び1命令づつ逆方向にステップ実行する方式の2
通りがある。
When a program is debugged by a program simulator device, a part of the program is obtained by changing the values of resources (that is, addresses of the program and memory, register contents of a CPU executing the program, and the like). You may want to change and re-execute. In such a case, in the conventional simulator apparatus, as described above, a method of re-executing a program in the forward direction from the start address and a method of step-executing in the reverse direction one instruction at a time.
There is a street.

【0005】ところが、前者の場合は、再実行させたい
プログラムの箇所がプログラムの終わりの部分に存在す
るときには、再実行させるのに膨大な時間がかかるとい
う欠点がある。また、後者の場合は、後戻りさせるステ
ップの数が数ステップであれば特に問題を生じないが、
数百ステップにも及ぶようなサブルーチンコール等の場
合は、1命令づつ後戻りさせているとそのサブルーチン
コールの先頭番地まで戻すには、同様にかなりの時間が
かかるという問題がある。従って、本発明はプログラム
のデバッグ時にこのプログラムの一部を再実行させて再
デバッグを行う場合、デバッグ作業時間を短縮すること
を目的とする。
However, in the former case, there is a disadvantage that when a program to be re-executed is located at the end of the program, it takes an enormous amount of time to re-execute the program. In the latter case, no particular problem occurs if the number of steps to be reversed is a few.
In the case of a subroutine call that involves several hundred steps, there is a problem that it takes a considerable amount of time to return to the head address of the subroutine call if the instruction is moved backward by one instruction. Therefore, an object of the present invention is to reduce the debugging work time when re-debugging a part of the program when the program is debugged.

【0006】[0006]

【課題を解決するための手段】このような課題を解決す
るために本発明は、正方向に実行されるプログラムの1
命令から逆命令を作成する逆命令作成部と、実行された
1命令のアドレス及び対応の逆命令を保持する第1のス
タック部と、複数の命令からなる関数の先頭番地でこの
関数のアドレス,その時のメモリアドレス及びレジスタ
の内容等を示す資源の値が書き込まれる第2のスタック
部と、第2のスタック部の資源の値を復元する復元部
と、第2のスタック部に資源値が書き込まれている場合
第2のスタック部から取り出した関数の資源の値に基
づきこの関数の各命令を正方向に実行し、第1のスタッ
ク部に逆命令が俣持されている場合は第1のスタック部
から取り出した逆命令を実行して命令の後戻りを行う
令実行部とを設けたものである。また、プログラムのデ
バッグを行う場合は、正方向に実行されるプログラムの
1命令から逆命令を作成して保持し、かつ複数の命令か
らなる関数の先頭番地でこの関数のアドレス,その時の
メモリアドレス及びレジスタの内容等を示す資源の値を
保持する一方、プログラムの再デバッグを行う場合は
数の先頭番地からこの関数の各命令を順次正方向に
し、かつ保持された逆命令を1命令づつ実行してプロ
グラムの各命令を後戻り方向に実行するようにした方法
である。
SUMMARY OF THE INVENTION In order to solve such a problem, the present invention provides a program executed in a forward direction.
A reverse instruction generating unit for generating a reverse instruction from an instruction, a first stack unit for storing an address of one executed instruction and a corresponding reverse instruction, and an address of this function at a starting address of a function including a plurality of instructions; A second stack unit in which the resource value indicating the memory address and the contents of the register at that time is written, a restoration unit for restoring the resource value of the second stack unit, and a resource value written in the second stack unit If
Executes each instruction in the function based on the value of the resources of the function taken from the second stack portion in the positive direction, the first stack
The first stack part when the reverse instruction is held in the master part
And an instruction execution unit for executing the reverse instruction taken out of the instruction and returning the instruction . When debugging a program, a reverse instruction is created and retained from one instruction of the program executed in the forward direction, and the address of this function and the memory address at that time are stored at the start address of a function composed of a plurality of instructions. If you want to re-debug the program while retaining the values of resources indicating the contents of registers and the like ,
Each instruction of the function from the start address of the function number and the actual <br/> line sequentially in the forward direction, and it retained the inverse instruction executes one instruction at a time Pro
This is a method in which each instruction of the gram is executed in the backward direction .

【0007】[0007]

【作用】プログラムのデバッグを行う場合は、正方向に
実行されるプログラムの1命令から逆命令を作成して保
持し、かつ複数の命令からなる関数の先頭番地でこの関
数のアドレス,その時のメモリアドレス及びレジスタの
内容等を示す資源の値を保持する一方、プログラムの再
デバッグを行う場合は、保持した逆命令を1命令づつ実
行して命令の後戻りを行い、かつ関数の先頭番地から順
次正方向に実行する。
When debugging a program, a reverse instruction is created and retained from one instruction of the program executed in the forward direction, and the address of this function is stored at the head address of the function consisting of a plurality of instructions, and the memory at that time. While re-debugging a program while retaining the values of resources indicating the contents of addresses and registers, etc., when re-debugging the program, the retained inverse instructions are executed one instruction at a time to return to the next instruction, and the correct address is sequentially read from the start address of the function Run in the direction.

【0008】[0008]

【実施例】以下、本発明について図面を参照して説明す
る。図3は、本発明の一実施例を示すブロック図であ
る。同図において、1は被デバッグプログラム(以下、
プログラム)が格納される記憶部、2は記憶部1内のプ
ログラムのデバッグを行うプログラムシミュレータ装置
である。
DESCRIPTION OF THE PREFERRED EMBODIMENTS The present invention will be described below with reference to the drawings. FIG. 3 is a block diagram showing one embodiment of the present invention. In the figure, 1 is a program to be debugged (hereinafter, referred to as a program to be debugged).
The storage unit 2 for storing the program) is a program simulator device for debugging the program in the storage unit 1.

【0009】また、プログラムシミュレータ装置2は、
次のように構成されている。即ち、21は記憶部1から
取り出されたプログラムの各命令のアドレス及びその逆
命令が1命令毎にデータとして記憶されかつデータの先
入れ後出しが行われるスタック部、22は上記プログラ
ムが取り出され実行中にこのプログラムの中の複数の命
令からなるサブルーチンや割り込み処理ルーチン等の関
数の先頭アドレス情報,及びその時にCPU等からなる
後述の命令実行部26によりアクセスされる図示しない
メモリのアドレス,その内容及び命令実行部26のレジ
スタ値等の各情報が資源値データとして各関数毎に記憶
されると共に、データの先入れ後出しが行われるスタッ
ク部、23は記憶部1から取り出されたプログラムの各
命令の逆命令を生成しスタック部21へ格納する逆命令
作成部である。
Further, the program simulator device 2 comprises:
It is configured as follows. That is, reference numeral 21 denotes a stack unit in which the address of each instruction of the program fetched from the storage unit 1 and its reverse instruction are stored as data for each instruction and data is first-in, first-out. During execution, the start address information of a function such as a subroutine consisting of a plurality of instructions in this program or an interrupt processing routine, and the address of a memory (not shown) accessed by an instruction execution unit 26 comprising a CPU or the like at that time. The stack unit 23 stores the information such as the contents and the register value of the instruction execution unit 26 as resource value data for each function, and performs a first-in first-out operation of data. This is an inverse instruction creation unit that generates an inverse instruction of each instruction and stores it in the stack unit 21.

【0010】また、24はプログラム中の関数の上記資
源値をスタック部22に格納する書込部、25はスタッ
ク部22の資源値を読み出して復元する復元部、26は
プログラムの再デバッグ時にスタック部21の逆命令を
1ステップづつ実行してプログラムを逆方向に実行する
と共に復元部25により復元された関数の資源値に基づ
きこの関数の各命令を順次正方向(通常方向)に実行す
る命令実行部である。なお、上述の逆命令作成部23で
は、例えば、記憶部1から取り出した命令がインクリメ
ント(値を1つ増加させる命令)であれば、これをデク
リメント(値を1つ減少させる命令)とするような、逆
命令が生成される。
Reference numeral 24 denotes a writing unit for storing the resource values of the functions in the program in the stack unit 22; 25, a restoring unit for reading and restoring the resource values of the stack unit 22; An instruction that executes the reverse instruction of the unit 21 step by step and executes the program in the reverse direction, and sequentially executes each instruction of this function in the forward direction (normal direction) based on the resource value of the function restored by the restoration unit 25 The execution unit. In the above-described reverse instruction creating unit 23, for example, if the instruction fetched from the storage unit 1 is an increment (an instruction to increase the value by one), this is decremented (an instruction to decrease the value by one). A reverse instruction is generated.

【0011】次に以上のように構成されたプログラムシ
ミュレータ装置2の動作の概要について説明する。記憶
部1内のプログラムをデバッグする場合、プログラムシ
ミュレータ装置2は、このプログラムを記憶部1から1
命令づつ取り出し命令実行部26によりこのプログラム
の各命令を順次正方向に実行させる。そしてこの際に
は、逆命令作成部23は、記憶部1から取り出された命
令の逆命令を生成して順次スタック部21に格納する。
また、取り出された命令がサブルーチン等の関数であれ
ば、書込部24はこの関数に関する上述した各資源値を
スタック部22に格納する。
Next, an outline of the operation of the program simulator device 2 configured as described above will be described. When debugging a program in the storage unit 1, the program simulator device 2 stores the program in the storage unit 1.
Each instruction of this program is sequentially executed in the forward direction by the fetch instruction execution unit 26 for each instruction. In this case, the reverse instruction creating unit 23 generates an inverse instruction of the instruction fetched from the storage unit 1 and sequentially stores it in the stack unit 21.
If the fetched instruction is a function such as a subroutine, the writing unit 24 stores the above-described resource values related to this function in the stack unit 22.

【0012】ここで、プログラムの再デバッグを行う必
要が生じてデバッグ作業者が図示しない第1のキーを操
作すると、命令実行部26は、スタック部21内に格納
されている各逆命令のうち、最も格納の新しい最新の逆
命令を取り出して実行する。続いて再度第1のキー操作
が行われると、命令実行部26は、スタック部21内の
次に格納の新しい逆命令を取り出して実行する。このよ
うにして、順次1ステップづつ命令が後戻り方向に実行
される。
Here, when it becomes necessary to re-debug the program and the debug operator operates a first key (not shown), the instruction execution unit 26 causes the instruction execution unit 26 to execute Fetch and execute the most recently stored reverse instruction. Subsequently, when the first key operation is performed again, the instruction execution unit 26 fetches the next reverse instruction stored in the stack unit 21 and executes it. In this way, the instructions are sequentially executed one step at a time in the backward direction.

【0013】また、プログラムの再デバッグを行う場合
に、デバッグ作業者が図示しない第2のキーを操作する
と、復元部25は、スタック部22に格納されている各
関数の各資源値のうち最も格納の新しい資源値を読み出
し命令実行部26に与える。命令実行部26はこの資源
値に基づいてこの資源値に該当する関数のプログラムを
その先頭番地から順次正方向に実行する。このように、
プログラムのデバッグ中にデバッグしたプログラムを再
びデバッグするようなデバッグのやり直しを行う場合、
命令を1命令づつ逆戻り実行させることができるだけで
はなく、関数単位での再デバッグも容易、かつ短時間に
行うことができる。従って、特に数百ステップにも及ぶ
ような関数(サブルーチン等)のデバッグをやり直す場
合、そのデバッグ作業に要する時間を大幅に短縮するこ
とができる。
When a debug operator operates a second key (not shown) when re-debugging a program, the restoring unit 25 causes the restoring unit 25 to store the most resource value of each function stored in the stack unit 22. The stored new resource value is given to the read command execution unit 26. The instruction execution unit 26 sequentially executes the program of the function corresponding to the resource value in the forward direction from the start address based on the resource value. in this way,
If you want to redo debugging while debugging a program, such as re-debugging the debugged program,
Not only can instructions be executed backwards one instruction at a time, but re-debugging in function units can be performed easily and in a short time. Therefore, when re-debugging a function (subroutine or the like) particularly involving several hundred steps, the time required for the debugging work can be greatly reduced.

【0014】次に、プログラムシミュレータ装置2の詳
細な要部動作を図1及び図2の各フローチャートに基づ
いて具体的に説明する。まず図2に示すプログラムデバ
ッグ時にプログラムを正方向に実行する場合の動作から
説明する。上記したように記憶部1内のプログラムをデ
バッグする場合、プログラムシミュレータ装置2は、こ
のプログラムを記憶部1から1命令づつ取り出し命令実
行部26に与えて実行させるが、この場合、シミュレー
タ装置2は、記憶部1から取り出した命令が上述の関数
の先頭番地の命令に該当するか否かをステップS1で判
断する。
Next, the operation of the main part of the program simulator apparatus 2 will be described in detail with reference to the flowcharts of FIGS. First, the operation when the program is executed in the forward direction at the time of program debugging shown in FIG. 2 will be described. When debugging a program in the storage unit 1 as described above, the program simulator device 2 fetches the program one instruction at a time from the storage unit 1 and gives the program to the instruction execution unit 26 for execution. In this case, the simulator device 2 In step S1, it is determined whether the instruction fetched from the storage unit 1 corresponds to the instruction at the start address of the function.

【0015】そして取り出した命令が関数の先頭番地の
命令ではない場合は、ステップS2で逆命令作成部23
にこの命令を読み込ませてステップS3でこの実行され
た命令の逆命令を生成させる。その後、この命令のアド
レス及び生成された逆命令がステップS4で逆命令作成
部23によりスタック部21へプッシュされ格納され
る。また、取り出した命令が関数の先頭番地の命令に該
当する場合は、書込部24は、この関数の各資源の値を
ステップS5でスタック部22にプッシュして格納す
る。その後、ステップS2〜S4では、逆命令生成部2
3により上述したと同様に逆命令の作成及び格納が行わ
れる。
If the fetched instruction is not the instruction at the start address of the function, the reverse instruction creator 23 proceeds to step S2.
This instruction is read in step S3 to generate an instruction reverse to the executed instruction in step S3. Thereafter, the address of the instruction and the generated reverse instruction are pushed and stored in the stack unit 21 by the reverse instruction creating unit 23 in step S4. If the extracted instruction corresponds to the instruction at the start address of the function, the writing unit 24 pushes the value of each resource of this function to the stack unit 22 in step S5 and stores it. Thereafter, in steps S2 to S4, the reverse instruction generation unit 2
3 creates and stores the reverse instruction in the same manner as described above.

【0016】こうして逆命令がスタック部21に、また
関数の各資源値がスタック部22に格納された後、ステ
ップS6でシミュレータ装置2はスタック部21または
スタック部22の容量に空きがあるか否かを判断し、空
きがある場合は取り出した上記命令をステップS7で命
令実行部26により実行させる。また、スタック容量に
空きが無い場合はステップS8で該当スタック部内の古
いデータ(古い命令)を削除した後、ステップS7で命
令実行部26に命令の実行を行わせる。
After the inverse instruction is stored in the stack unit 21 and each resource value of the function is stored in the stack unit 22, the simulator apparatus 2 determines in step S6 whether there is free space in the stack unit 21 or the stack unit 22. Then, if there is a free space, the extracted instruction is executed by the instruction execution unit 26 in step S7. If there is no free space in the stack capacity, the old data (old command) in the corresponding stack section is deleted in step S8, and the command execution unit 26 is caused to execute the command in step S7.

【0017】次にステップS9でシミュレータ装置2
は、命令の逆戻り実行の有無を判断する。そして、これ
が「NO」となる場合はステップS10のシミュレーシ
ョン(即ち、デバッグ)の終了が「YES」となるま
で、記憶部1のプログラムの各命令が順次取り出され、
その逆命令の生成・格納や関数の資源値の格納がなさ
れ、かつ取り出された命令が順次実行される。
Next, at step S9, the simulator device 2
Determines whether the instruction has been executed backward. If this is "NO", each instruction of the program in the storage unit 1 is sequentially fetched until the end of the simulation (that is, debugging) in step S10 becomes "YES".
The reverse instruction is generated and stored, the resource value of the function is stored, and the extracted instructions are sequentially executed.

【0018】こうしてプログラムのデバッグが行われ
る。ここで、こうしたプログラムの実行によるプログラ
ムデバッグ中に実行されたプログラムの再デバッグを行
う必要が生じ、デバッグ作業者により図示しない第1の
キーまたは第2のキーの何れかが操作されると、シミュ
レータ装置2ではステップS9の「命令の後戻りを行
う」判断を「YES」と判定し、この場合は、後述の図
1のフローチャートに示す命令の後戻り処理をステップ
S11で開始する。
Thus, the program is debugged. Here, it is necessary to re-debug the program executed during program debugging by executing such a program, and when any of a first key or a second key (not shown) is operated by a debug operator, the simulator is activated. The apparatus 2 determines “YES” in the determination of “return the instruction” in step S9. In this case, the instruction return processing shown in the flowchart of FIG. 1 described later is started in step S11.

【0019】即ち、図1のステップS21では第2のキ
ー操作による「関数の先頭に戻るか」を判断し、これが
「YES」となる場合は、ステップS22でスタック部
22内の空きの有無を判断する。そしてスタック部22
に空きが無ければ、復元部25に対し、ステップS23
でスタック部22に格納されている各関数の各資源値の
うち最も格納の新しい資源値をポップ(取りだし)させ
命令実行部26に供給させる。命令実行部26はこの資
源値に基づいてこの資源値に該当する関数のプログラム
をその先頭番地から順次正方向に実行する。
That is, in step S21 of FIG. 1, it is determined whether or not to return to the beginning of the function by the second key operation, and if this is "YES", it is determined in step S22 whether there is an empty space in the stack unit 22. to decide. And the stack part 22
If there is no free space in step S23,
Then, among the resource values of the functions stored in the stack unit 22, the most recently stored resource value is popped (fetched) and supplied to the instruction execution unit 26. The instruction execution unit 26 sequentially executes the program of the function corresponding to the resource value in the forward direction from the start address based on the resource value.

【0020】そしてこの関数のプログラムの実行が終了
すると、シミュレータ装置2はステップS24の「命令
の後戻りを終了するか?」の「NO」を経てステップS
21に戻る。ここで再度、第2のキー操作が行われる
と、ステップS22の「スタック22が空きか?」の
「NO」を経てステップS23で、次に格納の新しい資
源値がスタック部22からポップされ命令実行部26に
与えられて、同様に該当関数のプログラムが実行され
る。こうして、順次スタック部22の各資源値が取り出
され、各資源値に基づいた各関数のプログラムが実行さ
れることにより、スタック部22内が全くの空き状態と
なり、ステップS22の判定が「YES」となると、シ
ミュレータ装置2は再デバッグ時のプログラム実行を終
了する。また、こうした再デバッグ時に命令の後戻りを
終了させるための図示しない終了キーが操作されステッ
プS24の判定が「YES」となる場合も、シミュレー
タ装置2は、再デバッグ時のプログラム実行を終了す
る。
When the execution of the program of the function is completed, the simulator apparatus 2 proceeds to step S24 through "NO" of "Do you want to end instruction return?"
Return to 21. Here, when the second key operation is performed again, after "NO" of "Is the stack 22 empty?" In step S22, in step S23, a new resource value to be stored is popped from the stack unit 22 and an instruction is issued. The program is given to the execution unit 26 and the program of the function is similarly executed. Thus, the resource values of the stack unit 22 are sequentially taken out, and the programs of the functions based on the resource values are executed, so that the stack unit 22 is completely empty, and the determination in step S22 is “YES”. Then, the simulator device 2 ends the program execution at the time of re-debugging. Also, when the end key (not shown) for terminating the return of the instruction at the time of such re-debugging is operated and the determination in step S24 becomes "YES", the simulator device 2 ends the program execution at the time of re-debugging.

【0021】次に、命令の後戻りを行うためにデバッグ
作業者によって第1のキー操作が行われた場合はステッ
プS21の「関数の先頭に戻るか?」の判定が「NO」
となる。この場合シミュレータ装置2は、ステップS2
5でスタック部21の空きの有無を判断する。そしてス
タック部21に空きが無ければ、シミュレータ装置2内
の命令実行部26は、ステップS26でスタック部21
に格納されている各命令のアドレス及びその逆命令のう
ち最も格納の新しいアドレス及び逆命令をポップして読
み込み、ステップS27でこの逆命令を実行する。
Next, when the first key operation is performed by the debug operator to return the instruction, the determination of "return to the beginning of the function?" In step S21 is "NO".
Becomes In this case, the simulator device 2 performs step S2
At 5, it is determined whether or not the stack unit 21 is empty. If there is no free space in the stack unit 21, the instruction execution unit 26 in the simulator device 2
Is popped and read out of the address of each instruction stored in and the inverse instruction stored therein, and the inverse instruction is executed in step S27.

【0022】そしてこの逆命令の実行が終了すると、ス
テップS24の「命令の後戻りを終了するか?」の「N
O」を経てステップS21に戻る。ここで再度、第1の
キー操作が行われると、シミュレータ装置2は、ステッ
プS21の「関数の先頭に戻るか?」の「NO」を経て
ステップS25へ移行し、ステップS25で同様にスタ
ック部21が空き状態か否かを判断する。この場合、ス
タック部21が空き状態でなければ、ステップS26
で、命令実行部26に対し、次に格納の新しい逆命令を
スタック部21からポップさせステップS27で実行さ
せる。
When the execution of the reverse instruction is completed, "N" of "Do you want to end instruction return?"
After "O", the process returns to step S21. Here, when the first key operation is performed again, the simulator device 2 proceeds to step S25 via “NO” of “Return to beginning of function?” In step S21, and similarly in step S25, the stack unit It is determined whether or not 21 is empty. In this case, if the stack unit 21 is not empty, step S26
Then, the instruction execution unit 26 is caused to pop the next stored reverse instruction from the stack unit 21 and execute it in step S27.

【0023】こうして、順次スタック部21の各逆命令
が取り出されて実行されることにより、スタック21部
内が全くの空き状態となり、ステップS25の判定が
「YES」となると、シミュレータ装置2は再デバッグ
時のプログラムの実行を終了する。また、このような再
デバッグ中に命令の後戻りを終了させるための終了キー
が操作されステップS24の判定が「YES」となる場
合も、シミュレータ装置2は再デバッグ時のプログラム
実行を終了する。
In this way, the inverse instructions of the stack unit 21 are sequentially fetched and executed, so that the stack 21 is completely empty. If the determination in step S25 becomes "YES", the simulator apparatus 2 re-debugs. The execution of the current program ends. Also, when the end key for terminating the retrace of the instruction is operated during such re-debugging and the determination in step S24 becomes "YES", the simulator device 2 ends the program execution at the time of re-debugging.

【0024】[0024]

【発明の効果】以上説明したように本発明によれば、プ
ログラムのデバッグ時には正方向に実行されるプログラ
ムの1命令から逆命令を作成して保持し、かつ複数の命
令からなる関数の先頭番地でこの関数のアドレス,その
時のメモリアドレス及びレジスタの内容等を示す資源の
値を保持する一方、プログラムの再デバッグ時には、保
持した逆命令を1命令づつ実行して命令の後戻りを行
い、かつ関数の先頭番地から順次正方向に実行するよう
にしたので、特に数百ステップにも及ぶような関数のプ
ログラムを再デバッグする場合のデバッグ作業に要する
時間を大幅に短縮することができる。
As described above, according to the present invention, when debugging a program, a reverse instruction is created and retained from one instruction of a program executed in the forward direction, and the start address of a function consisting of a plurality of instructions is stored. Holds the address of this function, the memory address at that time, the value of resources indicating the contents of the register, etc., while re-debugging the program, executes the held reverse instruction one instruction at a time to return the instruction, and Are sequentially executed in the forward direction from the start address of the function, so that the time required for the debugging work when re-debugging a program of a function having several hundred steps can be greatly reduced.

【図面の簡単な説明】[Brief description of the drawings]

【図1】 本発明に係るプログラムシミュレータ装置の
要部動作を示すフローチャートである。
FIG. 1 is a flowchart showing an operation of a main part of a program simulator device according to the present invention.

【図2】 上記実施例装置のプログラムデバッグ時の動
作を示すフローチャートである。
FIG. 2 is a flowchart showing an operation of the apparatus of the embodiment when debugging a program.

【図3】 上記実施例装置の要部構成を示すブロック図
である。
FIG. 3 is a block diagram illustrating a main configuration of the apparatus according to the embodiment.

【符号の説明】[Explanation of symbols]

1…記憶部、2…プログラムシミュレータ装置、21,
22…スタック部、23…逆命令作成部、24…書込
部、25…復元部、26…命令実行部。
DESCRIPTION OF SYMBOLS 1 ... Storage part, 2 ... Program simulator apparatus, 21
22: stack unit, 23: reverse instruction creation unit, 24: writing unit, 25: restoration unit, 26: instruction execution unit.

フロントページの続き (56)参考文献 特開 昭62−85347(JP,A) 特開 平2−50228(JP,A) 特開 平3−158937(JP,A) 特開 平4−342038(JP,A) 特開 平4−352245(JP,A) 特開 平4−153741(JP,A) 特開 平4−328644(JP,A) 特開 平5−61717(JP,A) 特開 平5−81075(JP,A) 特開 平5−108404(JP,A) 特開 平6−222952(JP,A) 特開 平7−84832(JP,A) 特開 昭59−165106(JP,A) 特開 昭63−24424(JP,A)Continuation of the front page (56) References JP-A-62-85347 (JP, A) JP-A-2-50228 (JP, A) JP-A-3-158937 (JP, A) JP-A-4-342038 (JP) JP-A-4-352245 (JP, A) JP-A-4-1533741 (JP, A) JP-A-4-328644 (JP, A) JP-A-5-61717 (JP, A) JP-A-5-81075 (JP, A) JP-A-5-108404 (JP, A) JP-A-6-222952 (JP, A) JP-A-7-84832 (JP, A) JP-A-59-165106 (JP, A) A) JP-A-63-24424 (JP, A)

Claims (2)

(57)【特許請求の範囲】(57) [Claims] 【請求項1】 正方向に実行されるプログラムの1命令
から逆命令を作成する逆命令作成部と、実行される1命
令のアドレス及び対応の逆命令を保持する第1のスタッ
ク部と、前記プログラム中の複数の命令からなる関数の
先頭アドレス情報,この先頭アドレス情報に対応するメ
モリのアドレス及びレジスタの内容等が前記関数の資源
値として書き込まれる第2のスタック部と、第2のスタ
ック部の資源値を復元する復元部と、第2のスタック部
に前記資源値が書き込まれている場合は第2のスタック
部から取り出され復元された関数の資源値に基づきこの
関数の各命令を正方向に実行し、第1のスタック部に逆
命令が保持されている場合は第1のスタック部から取り
出した逆命令を実行して命令の後戻りを行う命令実行部
とを備え、1命令毎に逆命令を実行する機能及び1関数
毎の後戻り実行機能を有することを特徴とするプログラ
ムシミュレータ装置。
An inverse instruction creating unit that creates an inverse instruction from one instruction of a program executed in a forward direction; a first stack unit that holds an address of one instruction to be executed and a corresponding inverse instruction; A second stack section in which start address information of a function including a plurality of instructions in the program, a memory address and register contents corresponding to the start address information are written as resource values of the function, and a second stack section. And a second stack unit for restoring the resource value of
When said resource value is written to execute each instruction of the function on the basis of the resource value of the function restored is Eject from the second stack portion in the positive direction, opposite to the first stack portion
If the instruction is held, it is taken from the first stack.
A program simulator apparatus comprising: an instruction execution unit that executes an issued reverse instruction to return the instruction; and has a function of executing the reverse instruction for each instruction and a return execution function for each function.
【請求項2】 プログラムのデバッグを行う場合は、正
方向に実行されるプログラムの1命令から逆命令を作成
して保持し、かつ前記プログラムの中の複数の命令から
なる関数の先頭番地でこの関数のアドレス,その時にア
クセスされるメモリのアドレス及びレジスタの内容等を
示す資源の値を保持する一方、プログラムの再デバッグ
を行う場合は、前記関数の先頭番地からこの関数の各命
令を順次正方向に実行し、かつ保持された逆命令を1命
令づつ実行してプログラムの各命令を後戻り方向に実行
することを特徴とするプログラムデバッグ方法。
2. When debugging a program, a reverse instruction is created and retained from one instruction of a program to be executed in the forward direction, and the reverse instruction is created at the start address of a function consisting of a plurality of instructions in the program. address of a function, while retaining the value of resources that indicates the contents of the address of the memory and registers, etc., when performing re-program debugging, each instruction of the function from the starting address of the previous SL functions sequentially accessed at that time Executes in the forward direction and executes the retained reverse instruction for one instruction.
Execute each instruction of the program in the backward direction
Program debugging method characterized by.
JP7127811A 1995-05-26 1995-05-26 Program simulator device and program debugging method Expired - Lifetime JP2715988B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP7127811A JP2715988B2 (en) 1995-05-26 1995-05-26 Program simulator device and program debugging method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP7127811A JP2715988B2 (en) 1995-05-26 1995-05-26 Program simulator device and program debugging method

Publications (2)

Publication Number Publication Date
JPH08320813A JPH08320813A (en) 1996-12-03
JP2715988B2 true JP2715988B2 (en) 1998-02-18

Family

ID=14969261

Family Applications (1)

Application Number Title Priority Date Filing Date
JP7127811A Expired - Lifetime JP2715988B2 (en) 1995-05-26 1995-05-26 Program simulator device and program debugging method

Country Status (1)

Country Link
JP (1) JP2715988B2 (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP4107470B2 (en) * 2001-10-11 2008-06-25 三菱電機株式会社 Software failure analysis method and apparatus
JP4366652B2 (en) * 2004-04-23 2009-11-18 横河電機株式会社 Transmitter and duplexing method thereof
JP4997997B2 (en) * 2007-02-05 2012-08-15 横河電機株式会社 Anomaly judgment repair measuring equipment

Family Cites Families (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS59165106A (en) * 1983-03-11 1984-09-18 Hitachi Ltd On-line debugging device
JPS6285347A (en) * 1985-10-09 1987-04-18 Nec Eng Ltd Information processor
JPS6324424A (en) * 1986-07-17 1988-02-01 Mitsubishi Electric Corp Program debug system
JPH0250228A (en) * 1988-08-11 1990-02-20 Fujitsu Ltd Debug processor
JPH03158937A (en) * 1989-11-17 1991-07-08 Hitachi Ltd Program execution control system
JPH04153741A (en) * 1990-10-18 1992-05-27 Nec Corp Adverse debugging execution system for debugged program
JPH04328644A (en) * 1991-04-30 1992-11-17 Nec Corp Debug back-up device
JPH04342038A (en) * 1991-05-20 1992-11-27 Nec Corp Analyzing method for program abnormality
JPH04352245A (en) * 1991-05-30 1992-12-07 Fujitsu Ltd Simulation system
JPH0561717A (en) * 1991-09-03 1993-03-12 Nec Corp Program debugging device
JPH0581075A (en) * 1991-09-19 1993-04-02 Mitsubishi Electric Corp Software development device
JPH05108404A (en) * 1991-10-16 1993-04-30 Nec Corp Debugger system
JPH06222952A (en) * 1993-01-27 1994-08-12 Toshiba Corp Debug supporting device
JPH0784832A (en) * 1993-09-09 1995-03-31 Hitachi Ltd Real-time system simulation device

Also Published As

Publication number Publication date
JPH08320813A (en) 1996-12-03

Similar Documents

Publication Publication Date Title
US7545381B2 (en) Interruptible GPU and method for context saving and restoring
JP2560988B2 (en) Information processing apparatus and processing method
JPH09330236A (en) Microprocessor and peripheral device for the same
GB2281986A (en) Logging program counter on reset.
JP2715988B2 (en) Program simulator device and program debugging method
JP4180115B2 (en) Processing system, program creation method, and processing unit
JPH09128267A (en) Data processor and data processing method
JPH0683615A (en) Computer for executing instruction set emulation
JP2001306334A (en) Emulation device
JP2663895B2 (en) CPU simulator
JPH096647A (en) Reverse execution debugging system
JP2671160B2 (en) Exception handling method
JP2743860B2 (en) User program debug processing system
JP2000029690A (en) Method and device for data processing
JPH0675957A (en) Restoration mechanism of fault during editing
JPH04328644A (en) Debug back-up device
KR100280404B1 (en) How to Support Multiple Interrupt Service Routines in DSP
JPS61117635A (en) Virtual storage control system
JPH01118930A (en) Computer system
JP2907436B2 (en) Pattern information processing apparatus and method
JPS62237533A (en) Data processor
JP2002196938A (en) Device for exception handling flow and its handling execution method
JPH06295252A (en) Computer
JPH0764820A (en) Debugging processor
JPH01258154A (en) Control system for micro instruction execution