JP3110391B2 - Program re-execution method - Google Patents

Program re-execution method

Info

Publication number
JP3110391B2
JP3110391B2 JP10253050A JP25305098A JP3110391B2 JP 3110391 B2 JP3110391 B2 JP 3110391B2 JP 10253050 A JP10253050 A JP 10253050A JP 25305098 A JP25305098 A JP 25305098A JP 3110391 B2 JP3110391 B2 JP 3110391B2
Authority
JP
Japan
Prior art keywords
program
execution
instruction
value
program counter
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 - Fee Related
Application number
JP10253050A
Other languages
Japanese (ja)
Other versions
JP2000081995A (en
Inventor
秀彦 高木
Original Assignee
日本電気アイシーマイコンシステム株式会社
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 日本電気アイシーマイコンシステム株式会社 filed Critical 日本電気アイシーマイコンシステム株式会社
Priority to JP10253050A priority Critical patent/JP3110391B2/en
Publication of JP2000081995A publication Critical patent/JP2000081995A/en
Application granted granted Critical
Publication of JP3110391B2 publication Critical patent/JP3110391B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Description

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

【0001】[0001]

【発明の属する技術分野】本発明は、プログラムをデバ
ッグを終了した命令まで再実行するプログラム再実行方
法に関する。
The present invention relates to a program re-execution method for re-executing a program up to an instruction for which debugging has been completed.

【0002】[0002]

【従来の技術】プログラムのデバッグ中に、ある処理ま
できてソフトウェアの不具合が発覚し、ある変数の初期
値変更後、再度デバッグを最初からスタートして該当処
理で結果を確認しようとする場面において、その再現処
理を自動で行うことができるデバッガは、従来存在しな
い。従って、従来のデバッガを使って、ある処理まで移
動させるためには、使用者が考えながら該当箇所まで処
理を進めなければならなかった。
2. Description of the Related Art During debugging of a program, in a situation where a software defect is found due to a certain process, and after an initial value of a certain variable is changed, debugging is restarted from the beginning and the result is to be confirmed in the corresponding process. Conventionally, there is no debugger capable of automatically performing the reproduction process. Therefore, in order to move to a certain process by using the conventional debugger, the process has to be advanced to a corresponding portion while considering the user.

【0003】[0003]

【発明が解決しようとする課題】従来例で本願発明に一
番近いデバッガ「プログラム再実行処理方式」(特開平
5−250208号公報)では、プログラムを最初から
起動させることなく、ある時点の状態を高速に再現する
ことを可能にしている。しかし、この従来技術では、前
回と全く同じ状態に復元させることはできても、上記問
題のように、ある命令の変更後の実行状態を作ることは
できない。再実行して処理を該当命令で止めるために
は、その命令を何回実行したときに止めるかを知る必要
がある。この回数を得る手段として、最初の実行中に全
ての命令の実行回数を覚えておき、その情報から該当命
令の実行回数を取得するという方法が容易に推測でき
る。図6のフローチャートは、その1例である。
In the prior art debugger "program re-execution processing method" (Japanese Patent Laid-Open No. 5-250208) which is the closest to the present invention, the state at a certain point in time without starting the program from the beginning. Can be reproduced at high speed. However, according to this conventional technique, it is possible to restore the state exactly the same as the previous state, but it is not possible to create an execution state after a certain instruction is changed, as described above. In order to re-execute and stop the processing at the corresponding instruction, it is necessary to know how many times the instruction is to be executed before stopping. As a means for obtaining the number of times, a method of remembering the number of times of execution of all instructions during the first execution and acquiring the number of times of execution of the corresponding instruction from the information can be easily estimated. The flowchart of FIG. 6 is one example.

【0004】しかしこの方法では、デバッガが使用する
データメモリが膨大になるという問題点があった。その
理由は、デバッグするプログラムの命令数分のアクセス
回数を保持するテーブルが必要になるためである。
However, this method has a problem that the data memory used by the debugger becomes enormous. The reason is that a table for holding the number of accesses corresponding to the number of instructions of the program to be debugged is required.

【0005】図3のプログラムを、上述した発明の実施
例と同じ条件で実行したとき、図7に示すように、30
命令分のテーブルが必要となる。近年、プログラムのサ
イズは膨大化しており、100000命令を超えるプロ
グラムも存在する。そのとき、100000命令分のテ
ーブルが必要となり、決して実用的とは言えない。
When the program shown in FIG. 3 is executed under the same conditions as those of the embodiment of the present invention, as shown in FIG.
A table for instructions is required. In recent years, the size of programs has become enormous, and some programs have more than 100,000 instructions. At that time, a table for 100,000 instructions is required, which is not practical.

【0006】本発明は、プログラムをデバッグを終了し
た命令まで再実行することを少ないメモリ消費量で可能
とするプログラム再実行方法を提供することを目的とす
る。
SUMMARY OF THE INVENTION It is an object of the present invention to provide a program re-execution method which makes it possible to re-execute a program up to an instruction for which debugging has been completed with a small memory consumption.

【0007】[0007]

【課題を解決するための手段】本発明によるプログラム
再実行方法は、プログラムをデバッグが終了した命令ま
で再実行するプログラム再実行方法において、デバッグ
が開始してから終了するまでの間に、前記プログラム中
の特定の命令を実行したときのプログラムカウンタの値
とその命令の実行回数とその命令の最終実行情報を1レ
コードとするテーブルを記憶手段に作成するステップ
と、デバッグ終了時に、前記テーブルを参照して、最後
の命令を実行した時のプログラムカウンタの値である最
終目的プログラムカウンタの値と、前記テーブル中のプ
ログラムカウンタの値に対応する命令のうちで最も遅く
実行された命令のプログラムカウンタの値である目的プ
ログラムカウンタの値と、該目的プログラムカウンタに
対応する実行回数である目的回数を記憶手段に記憶する
ステップと、再実行時に、現在のプログラムカウンタの
値が前記目的回数だけ前記目的プログラムカウンタの値
になるまで前記プログラムを実行した後に、前記現在の
プログラムカウンタの値が前記最終目的プログラムの値
になるまで前記プログラムを実行するステップと、を有
することを特徴とする。
A program re-execution method according to the present invention is a program re-execution method for re-executing a program up to an instruction for which debugging has been completed. Creating a table in the storage means in which the value of the program counter, the number of times of execution of the instruction, and the last execution information of the instruction when executing a specific instruction among the instructions are stored in the storage means; Then, the value of the final target program counter, which is the value of the program counter when the last instruction was executed, and the program counter of the latest executed instruction among the instructions corresponding to the value of the program counter in the table. The value of the target program counter, which is the value, and the number of executions corresponding to the target program counter Storing the target number of times in the storage means, and, during re-execution, after executing the program until the current value of the program counter reaches the value of the target program counter by the number of times of the target, the value of the current program counter Executing the program until the value reaches the value of the final target program.

【0008】また、本発明によるプログラム再実行方法
は、上記のプログラム再実行方法において、前記再実行
時の前記プログラムの実行は、ステップ実行であること
を特徴とする。
In the program re-execution method according to the present invention, in the above-described program re-execution method, the execution of the program at the time of the re-execution is step execution.

【0009】更に、本発明によるプログラム再実行方法
は、上記のプログラム再実行方法において、前記特定の
命令はラベルの付いている命令であることを特徴とす
る。
Further, a program re-execution method according to the present invention is characterized in that in the above-described program re-execution method, the specific instruction is an instruction with a label.

【0010】更に、本発明によるプログラム再実行方法
は、上記のプログラム再実行方法において、前記特定の
命令は所定数毎の命令であることを特徴とする。
Further, a program re-execution method according to the present invention is characterized in that, in the above-described program re-execution method, the specific instruction is an instruction for every predetermined number.

【0011】[0011]

【発明の実施の形態】本発明は、プログラムのデバッグ
中に、ある処理まできてプログラムの不具合が発覚し、
プログラム修正後、再度デバッグを最初からスタートし
て該当処理で結果を確認しようとする場面において、そ
の該当処理までの処理を自動実行することを、デバッガ
の使用データメモリを最小限に押さえて実現する手段を
提供するものである。
DESCRIPTION OF THE PREFERRED EMBODIMENTS According to the present invention, during debugging of a program, a certain process is performed and a defect of the program is detected.
When the debugger is restarted from the beginning after the program is corrected and the result is to be checked in the relevant process, the process up to the relevant process is automatically executed by minimizing the data memory used by the debugger. It provides a means.

【0012】図1において、実行回数記憶手段32は、
プログラム実行中に各命令ごとの実行回数を記憶する。
コマンド入力手段22によって、実行状態の再現が要求
されると、実行状態再現手段42は、実行回数記憶手段
32で記憶された内容から再現位置の命令とその実行回
数を求め、プログラムを再実行することで実行状態を再
現する。このとき、実行回数記憶手段32で実行回数を
記憶する対象命令をラベルの付いた命令のみとし、実行
状態再現手段42では、再現位置に過去に実行した命令
のうちで一番近いラベルの付いた命令であるラベルの付
いた命令のうちで最終実行情報がONである命令まで処
理を移したあと再現位置まで処理を移すことで、実行回
数記憶手段32で作成するテーブルを小さくする。この
ように記憶する対象命令をラベルに限定しているため、
デバッガの使用データメモリを最小限に押さえて、再実
行処理を可能にする。
In FIG. 1, the execution number storage means 32 includes:
During execution of the program, the number of executions for each instruction is stored.
When execution of the execution state is requested by the command input unit 22, the execution state reproduction unit 42 obtains the instruction of the reproduction position and the number of executions from the contents stored in the execution number storage unit 32, and re-executes the program. To reproduce the execution state. At this time, the number of executions stored in the number-of-executions storage means 32 is limited to only the labeled instruction, and the execution state reproduction means 42 executes the reproduction at the reproduction position with the label closest to the previously executed instructions. The table created by the execution count storage unit 32 is reduced by moving the process to the reproduction position after moving the process up to the instruction whose final execution information is ON among the instructions with the label which is the instruction. Since the target instructions to be stored are limited to labels,
The re-execution process can be performed while keeping the data memory used by the debugger to a minimum.

【0013】[実施形態1]図1を参照すると、本発明
の再実行処理方式の実施形態1は、全体の処理の制御を
行う処理制御手段1と、入力手段2と、記憶手段3と、
実行手段4と、出力手段5とから構成されている。
[Embodiment 1] Referring to FIG. 1, a first embodiment of a re-execution processing method according to the present invention is a processing control means 1 for controlling the entire processing, an input means 2, a storage means 3,
It comprises an execution unit 4 and an output unit 5.

【0014】入力手段2は、デバッグするための目的プ
ログラムを入力するプログラム入力手段21と、ステッ
プ実行等の指示を受け付けるコマンド入力手段22とを
備えている。
The input means 2 includes a program input means 21 for inputting a target program for debugging, and a command input means 22 for receiving instructions such as step execution.

【0015】記憶手段3は、実行する目的プログラムを
格納するプログラム記憶手段31と、命令ごとの実行回
数を記憶し格納する実行回数記憶手段32とを備えてい
る。
The storage means 3 comprises a program storage means 31 for storing a target program to be executed, and an execution number storage means 32 for storing and storing the number of executions for each instruction.

【0016】実行手段4は、目的プログラムを実行する
プログラム実行手段41と、任意の実行位置までを一気
に実行する実行状態再現手段42とを備えている。
The execution means 4 includes a program execution means 41 for executing a target program, and an execution state reproduction means 42 for executing an arbitrary execution position at a time.

【0017】出力手段5は、デバッグした結果をファイ
ルに出力する結果ファイル出力手段と、結果を画面に表
示する結果表示手段とを備えている。
The output means 5 includes a result file output means for outputting a result of debugging to a file, and a result display means for displaying the result on a screen.

【0018】目的プログラムがプログラム入力手段21
によって読み込まれ、プログラム記憶手段31によって
格納され、コマンド入力手段32によって受け取ったコ
マンドに従い、プログラム実行手段41によって目的プ
ログラムは実行される。その際、実行回数記憶手段32
によって命令ごとの実行回数が格納され、その格納され
た情報をもとに実行状態再現手段42によって、任意の
実行状態を再現する。
The target program is a program input means 21
The target program is executed by the program execution unit 41 in accordance with the command read by the command storage unit 31 and received by the command input unit 32. At this time, the execution number storage means 32
The number of executions for each instruction is stored, and an arbitrary execution state is reproduced by the execution state reproduction means 42 based on the stored information.

【0019】次に図1及び図2のフローチャートを参照
して本実施形態の全体の動作について詳細に説明する。
Next, the overall operation of the present embodiment will be described in detail with reference to the flowcharts of FIGS.

【0020】図2において、はじめにステップS1は、
再現指定がなされたかどうかをチェックする。再現指定
がされているときには、ステップS9に移り、再現処理
を行う。再現指定がされていないときには、ステップS
2により、これから実行する命令がラベル付きの命令が
どうかチェックする。ラベル付きの命令以外のときに
は、ステップS4により1ステップ実行を行い、再びス
テップS2に戻り、次の命令のチェックを行う。ステッ
プS2でラベル付き命令と判断したときには、実行回数
登録テーブルT1に、その命令のプログラムカウンタ
(図2では「PC」と記載)と、その回数情報を記録す
る。記録するプログラムカウンタが実行回数登録テーブ
ルT1にまだ登録されていないときには、回数情報を1
として新たに登録し、その度に最終実行情報をONにす
る。その際に、それ以外の最終実行情報はOFFにす
る。既に登録されているときには、その回数情報を1増
加し、その都度に最終実行情報をONにする。その際
に、それ以外の最終実行情報はOFFにする。このステ
ップS2からステップS6までの処理を、ステップS7
でデバッグの終了を判断するまで繰り返す。ステップS
7でデバッグ終了を判断すると、ステップS8では、実
行回数登録テーブルT1から、現在のプログラムカウン
タ(最終目的プログラムカウンタ)と、そのプログラム
カウンタから過去に実行された命令のうちで一番近い命
令のプログラムカウンタ、すなわち、対応する最終実行
情報がONになっているプログラムカウンタ(目的プロ
グラムカウンタ)と、目的プログラムカウンタに対応し
た回数情報(目的回数)をログファイルT2に出力す
る。
In FIG. 2, first, step S1 is as follows.
Check whether the reproduction specification has been made. If the reproduction has been designated, the process proceeds to step S9, where a reproduction process is performed. If no reproduction is designated, step S
Step 2 checks whether the instruction to be executed is a labeled instruction. If the instruction is not a labeled instruction, one step is executed in step S4, and the process returns to step S2 to check the next instruction. When it is determined in step S2 that the instruction is a labeled instruction, the program counter (in FIG. 2, described as "PC") of the instruction and the information on the number of times are recorded in the execution count registration table T1. If the program counter to be recorded is not yet registered in the execution count registration table T1, the count information is set to 1
And the final execution information is turned ON each time. At this time, the other final execution information is turned off. If it has already been registered, the count information is incremented by one, and the final execution information is turned ON each time. At this time, the other final execution information is turned off. The processing from step S2 to step S6 is performed in step S7.
Repeat until the end of debugging is determined. Step S
When the debug end is determined in step S7, in step S8, the current program counter (final target program counter) and the program of the closest instruction among instructions executed in the past from the program counter are read from the execution count registration table T1. A counter, that is, a program counter (target program counter) for which the corresponding final execution information is ON, and count information (target count) corresponding to the target program counter are output to the log file T2.

【0021】次に再現指定ありの場合について説明す
る。ステップS1で再現指定が有りと判断すると、ステ
ップS9で、ログファイルT2から、「最終目的プログ
ラムカウンタ」と、「目的プログラムカウンタ」と、そ
の「目的回数」とを読み込む。
Next, a case where reproduction is specified will be described. If it is determined in step S1 that reproduction is designated, in step S9, the "final target program counter", the "target program counter", and the "target number of times" are read from the log file T2.

【0022】ステップS10では、変数Counter
を”1”で初期化する。つづいて、ステップS11で1
ステップ実行後、ステップS12で現在のプログラムカ
ウンタと目的プログラムカウンタとを比較し、一致して
いなければ、ステップS11に戻り、再び1ステップ実
行を行う。一致しているときには、さらに変数Coun
terと目的回数とを比較し、一致していなければ変数
Counterを1増加して、ステップS11に戻り、
再び1ステップ実行を行う。一致しているときには、現
在のプログラムカウンタから、最終目的プログラムカウ
ンタまでに処理を移すために、1ステップ実行を繰り返
す。具体的には、ステップS15で現在のプログラムカ
ウンタと最終目的プログラムカウンタとを比較し、一致
していなければ、ステップS16により1ステップ実行
を行ったあと、再びステップS15に戻る。ステップS
15で一致したとき、目的の最終プログラムカウンタま
での処理の再現が終了する。
In step S10, the variable Counter
Is initialized to “1”. Then, at step S11, 1
After executing the step, the current program counter and the target program counter are compared in step S12, and if they do not match, the process returns to step S11 and executes one step again. If they match, the variable Count
ter and the target number of times, and if they do not match, the variable Counter is incremented by 1, and the process returns to step S11.
One-step execution is performed again. If they match, one-step execution is repeated to shift the process from the current program counter to the final target program counter. Specifically, in step S15, the current program counter is compared with the final target program counter. If they do not match, one step is executed in step S16, and the process returns to step S15. Step S
When they match, the reproduction of the process up to the target final program counter ends.

【0023】次に、具体例を用いて本実施形態の動作を
説明する。
Next, the operation of this embodiment will be described using a specific example.

【0024】例えば、図3のプログラムをデバッグ中
に、命令311を3回実行した時点で不具合に気づき、
命令301を変更後、同じ位置まで再実行する場合につ
いて説明する。
For example, while debugging the program of FIG. 3, when the instruction 311 is executed three times,
A case where the instruction 301 is changed and then re-executed to the same position will be described.

【0025】図1の入力プログラム入力手段21により
図3のプログラムを読み込み、プログラム記憶手段31
により格納する。このプログラムを、プログラム実行手
段41により、実行しながらデバッグする。図2のステ
ップS1は、図1のコマンド入力手段22により、再現
が指示されたかどうかをチェックする。指示はされてい
ないので、ステップS2以降の処理に移り、デバッグが
スタートする。ステップS2では、これから実行する命
令がラベル付きの命令かどうかをチェックする。
The program shown in FIG. 3 is read by the input program input means 21 shown in FIG.
Stored by This program is debugged while being executed by the program execution means 41. Step S1 in FIG. 2 checks whether or not reproduction is instructed by the command input unit 22 in FIG. Since no instruction has been given, the process moves to the processing after step S2, and debugging starts. In step S2, it is checked whether the instruction to be executed is a labeled instruction.

【0026】最初の命令は図3のラベル付き命令301
であるため、結果は真となり、ステップS3に移る。ス
テップS3では、現在のプログラムカウンタと、現プロ
グラムカウンタの実行回数を、実行回数登録テーブルT
1に格納する。この場合は、図4の実行回数登録テーブ
ル401のように、プログラムカウンタ”0000”
と、実行回数”1”と最終実行情報”ON”格納され
る。このステップS2からステップS6までの処理を、
上記で説明したように、命令311を3回実行した時点
まで繰り返し行う。ステップS7でデバッグの終了、す
なわち、命令311を3回実行した時点での実行回数登
録テーブルT1の内容は、図4の実行回数登録テーブル
402に示すように、プログラムカウンタ”0000”
に対する実行回数”1”及び最終実行情報”OFF”
と、プログラムカウンタ”0012”に対する実行回
数”3”及び最終実行情報”ON”となっている。つづ
いてステップS8により、実行回数登録テーブルT1か
ら、現在のプログラムカウンタ”0017”と、そのプ
ログラムカウンタから過去に実行された命令のうちで一
番近い命令のプログラムカウンタ、すなわち、最終実行
情報が”ON”となっているプログラムカウンタ、この
場合”0012”と、その回数情報”3”とをログファ
イルT2に出力する。再びデバッガがスタートすると、
今度はステップS1の判断で、再現処理を行うステップ
S7に移る。最初にステップS9で、ログファイルT2
から、最終目的プログラムカウンタ”0017”と、目
的プログラムカウンタ”0012”と、その目的回数”
3”とを読み込む。ステップS10では、変数Coun
terを”1”で初期化する。つづいてステップS11
で、1ステップ実行後、ステップS12で現在のプログ
ラムカウンタ、この場合”0003”と、目的プログラ
ムカウンタ”0012”とを比較する。一致していない
ので、ステップS11に戻り、再び1ステップ実行を行
う。このステップS11とステップS12の処理を、プ
ログラムカウンタが”0012”となるまで繰り返す。
最初にプログラムカウンタが”0012”となった時点
で、処理はステップS13に移り、変数Counter
と目的回数とを比較する。変数Counterは1で、
目的回数は”3”であるため一致せず、ステップS14
により、変数Counterを”1”増加して”2”に
したあと、再びステップS11に戻り、1ステップ実行
を行う。このステップS11からステップS14までの
処理を、ステップS13の条件が満たされるまで繰り返
す。変数Counterが”3”となり、ステップS1
3の条件式が満たされると、ステップS15に移り、現
在のプログラムカウンタから、最終目的プログラムカウ
ンタまで処理を移すために、1ステップ実行を繰り返
す。こうしてステップS15での条件式が満たされたと
き、プログラムカウンタは”0017”となり、目的の
最終プログラムカウンタまでの処理の再現が終了する。
The first instruction is labeled instruction 301 in FIG.
Therefore, the result is true, and the process proceeds to step S3. In step S3, the current program counter and the number of executions of the current program counter are stored in the execution number registration table T.
1 is stored. In this case, as shown in the execution count registration table 401 in FIG.
, The number of executions “1” and the final execution information “ON” are stored. The processing from step S2 to step S6 is
As described above, the instruction 311 is repeatedly executed until the instruction 311 is executed three times. At the end of debugging in step S7, that is, the content of the execution count registration table T1 at the time when the instruction 311 is executed three times, as shown in the execution count registration table 402 of FIG.
Execution count “1” and final execution information “OFF”
"3" and the final execution information "ON" for the program counter "0012". Then, in step S8, the current program counter “0017” and the program counter of the closest instruction among the instructions executed in the past from the program counter, that is, the final execution information are “from the execution count registration table T1”. The program counter which is "ON", in this case "0012", and its count information "3" are output to the log file T2. When the debugger starts again,
This time, according to the determination in step S1, the process proceeds to step S7 for performing the reproduction process. First, in step S9, the log file T2
From the final target program counter "0017", the target program counter "0012", and the target count "
3 ". In step S10, the variable Count
ter is initialized to “1”. Next, step S11
After executing one step, in step S12, the current program counter, in this case "0003", is compared with the target program counter "0012". Since they do not match, the process returns to step S11 to execute one step again. Steps S11 and S12 are repeated until the program counter becomes "0012".
When the program counter becomes "0012" for the first time, the process proceeds to step S13, where the variable Counter is used.
And the target number of times. The variable Counter is 1,
Since the target number of times is "3", they do not match, and step S14
As a result, the variable Counter is increased by “1” to “2”, and then returns to step S11 to execute one step. The processing from step S11 to step S14 is repeated until the condition of step S13 is satisfied. The variable Counter becomes “3”, and step S1
When the conditional expression (3) is satisfied, the process moves to step S15, and one-step execution is repeated to move the process from the current program counter to the final target program counter. When the conditional expression in step S15 is satisfied in this way, the program counter becomes "0017", and the reproduction of the process up to the target final program counter ends.

【0027】[実施形態2]次に、本発明の他の実施形
態について図面を参照して詳細に説明する。
[Second Embodiment] Next, another embodiment of the present invention will be described in detail with reference to the drawings.

【0028】図5を参照すると、本実施形態は、変数C
ounterを”1”で初期化する図2のステップS1
0が、目的回数を変数Counterに代入するステッ
プS21に置き換わる点と、変数Counterと目的
回数を比較する図2のステップ13が、変数Count
erと”1”とを比較するステップ22に置き換わる点
と、変数Counterを1増加する図2のステップ1
6が、変数Counterを1減少させるステップ23
に置き換わる点との3点で図2に示す実施形態1と異な
る。
Referring to FIG. 5, the present embodiment uses a variable C
Step S1 in FIG. 2 for initializing the counter with "1"
0 is substituted in step S21 for substituting the target count into the variable Counter, and step 13 in FIG. 2 for comparing the variable Counter with the target count is a variable Count
er and “1” are replaced by step 22, and step 1 in FIG.
6 reduces the variable Counter by 1 step 23
3 is different from the first embodiment shown in FIG.

【0029】次に、具体例について説明する。図1の入
力プログラム入力手段21により図3のプログラムを読
み込み、プログラム記憶手段31により格納する。この
プログラムを、プログラム実行手段41により、実行し
ながらデバッグする。図2のステップS1は、図1のコ
マンド入力手段22により、再現が指示されたかどうか
をチェックする。指示はされていないので、ステップS
2以降の処理に移り、デバッグがスタートする。ステッ
プS2では、これから実行する命令がラベル付きの命令
かどうかをチェックする。最初の命令は図3のラベル付
き命令301であるため、結果は真となり、ステップS
3に移る。ステップS3では、現在のプログラムカウン
タと、現プログラムカウンタの実行回数と最終実行情報
を、実行回数登録テーブルT1に格納する。この場合
は、図4の実行回数登録テーブル401のように、プロ
グラムカウンタ”0000”と、実行回数”1”と最終
実行情報”ON”が格納される。このステップS2から
ステップS6までの処理を、上記で説明したように、命
令311を3回実行した時点まで繰り返し行う。ステッ
プS7でデバッグの終了、すなわち、命令311を3回
実行した時点での実行回数登録テーブルT1の内容は、
図4の実行回数登録テーブル402にように、プログラ
ムカウンタ”0000”に対する実行回数”1”及び最
終実行情報”OFF”と、プログラムカウンタ”001
2”に対する実行回数”3”及び最終実行情報”ON”
となっている。つづいてステップS8により、実行回数
登録テーブルT1から、現在のプログラムカウンタ”0
017”と、そのプログラムカウンタから過去に実行さ
れた命令のうちで一番近い命令のプログラムカウンタ、
すなわち最終実行情報が”ON”である箇所のプログラ
ムカウンタ、この場合”0012”と、その回数情報”
3”とをログファイルT2に出力する。
Next, a specific example will be described. The program of FIG. 3 is read by the input program input means 21 of FIG. 1 and stored by the program storage means 31. This program is debugged while being executed by the program execution means 41. Step S1 in FIG. 2 checks whether or not reproduction is instructed by the command input unit 22 in FIG. Since no instruction has been given, step S
The process moves to the second and subsequent processes, and debugging starts. In step S2, it is checked whether the instruction to be executed is a labeled instruction. Since the first instruction is the labeled instruction 301 of FIG. 3, the result is true and the step S
Move to 3. In step S3, the current program counter, the execution count of the current program counter, and the final execution information are stored in the execution count registration table T1. In this case, a program counter “0000”, an execution count “1”, and final execution information “ON” are stored as in the execution count registration table 401 in FIG. The processing from step S2 to step S6 is repeated until the instruction 311 is executed three times as described above. At the end of debugging in step S7, that is, the content of the execution count registration table T1 at the time when the instruction 311 is executed three times is as follows.
As shown in the execution count registration table 402 of FIG. 4, the execution count “1” and the final execution information “OFF” for the program counter “0000”, and the program counter “001”
"3" and final execution information "ON" for "2"
It has become. Subsequently, in step S8, the current program counter “0” is read from the execution count registration table T1.
017 ”, the program counter of the closest instruction among instructions executed in the past from the program counter,
That is, the program counter at the location where the final execution information is “ON”, in this case “0012”, and the number-of-times information “
3 "is output to the log file T2.

【0030】再びデバッガがスタートすると、今度はス
テップS1の判断で、再現処理を行うステップS9に移
る。最初にステップS9は、ログファイルT2から、最
終目的プログラムカウンタ”0017”と、目的プログ
ラムカウンタ”0012”と、その目的回数”3”とを
読み込む。次にステップS21で、変数Counter
に、目的回数”3”を代入する。ステップS11で1ス
テップ実行後、ステップS12で現在のプログラムカウ
ンタ、この場合”0003”と、目的プログラムカウン
タ”0012”とを比較する。一致していないので、ス
テップS11に戻り、再び1ステップ実行を行う。この
ステップS11とステップS12の処理を、プログラム
カウンタが”0012”となるまで繰り返す。最初にプ
ログラムカウンタが”0012”となった時点で、処理
はステップS22に移り、変数Counterと”1”
とを比較する。変数Counterは”3”であるため
一致せず、ステップS23により、変数Counter
を”1”減少して”2”にしたあと、再びステップS1
1に戻り、1ステップ実行を行う。このステップS11
からステップS23までの処理を、ステップS22の条
件が満たされるまで繰り返す。変数Counterが”
1”となり、ステップS22の条件式が満たされると、
ステップS15に移り、現在のプログラムカウンタか
ら、最終目的プログラムカウンタまで処理を移すため
に、1ステップ実行を繰り返す。
When the debugger is started again, the process proceeds to step S9 for performing a reproduction process according to the determination in step S1. First, step S9 reads the final target program counter “0017”, the target program counter “0012”, and the target count “3” from the log file T2. Next, in step S21, the variable Counter
Is substituted for the target number of times “3”. After executing one step in step S11, in step S12, the current program counter, in this case "0003", is compared with the target program counter "0012". Since they do not match, the process returns to step S11 to execute one step again. Steps S11 and S12 are repeated until the program counter becomes "0012". When the program counter first becomes "0012", the process proceeds to step S22, where the variable Counter and "1" are set.
Compare with Since the value of the variable Counter is “3”, they do not match.
Is decreased by “1” to “2”, and then the step S1 is performed again.
Return to step 1 and execute one step. This step S11
Are repeated until the condition of step S22 is satisfied. The variable Counter is "
1 ", and when the conditional expression in step S22 is satisfied,
Moving to step S15, one-step execution is repeated in order to shift processing from the current program counter to the final target program counter.

【0031】こうしてステップS15での条件式が満た
されたとき、プログラムカウンタは”0017”とな
り、目的の最終プログラムカウンタまでの処理の再現が
終了する。
When the conditional expression in step S15 is satisfied, the program counter becomes "0017", and the reproduction of the processing up to the target final program counter ends.

【0032】なお、図2及び図5に示した方法は、CD
−ROMなどのコンピュータ読み取り可能な記録媒体に
記録されたコンピュータにこれらの方法に含まれる手順
を実行させるためのプログラムを、コンピュータが読み
取り実行することにより実現することもできる。
The method shown in FIG. 2 and FIG.
-A program for causing a computer to execute the procedures included in these methods, which is recorded on a computer-readable recording medium such as a ROM, may be implemented by reading and executing the program.

【0033】また、上記の実施形態ではラベルの付いた
命令に対応するプログラムカウンタから目的プログラム
カウンタを求めたが、本発明はこれに限定されるもので
はなく、ラベルの付いた命令の代わりに例えば、所定数
毎の命令を使用することもできる。
In the above embodiment, the target program counter is obtained from the program counter corresponding to the labeled instruction. However, the present invention is not limited to this. For example, instead of the labeled instruction, , A predetermined number of instructions can be used.

【0034】[0034]

【発明の効果】以上説明したように、本発明によれば以
下の効果が奏される。
As described above, according to the present invention, the following effects can be obtained.

【0035】第1の効果は、プログラムのデバッグ中
に、ある処理まできてプログラムの不具合が発覚し、プ
ログラム修正後、再度デバッグを最初からスタートして
該当処理で結果を確認しようとする場面において、その
該当処理までの移動を、デバッガが自動で再現できるこ
とにある。
The first effect is that when a program is debugged and a program is found to be defective due to a certain process, and after the program is corrected, debugging is started again from the beginning and the result is to be checked in the process. That is, the debugger can automatically reproduce the movement up to the corresponding processing.

【0036】何故ならば、プログラム実行中に各命令ご
との実行回数を記憶する実行回数記憶手段と、実行状態
の再現が要求されたときに、前記記憶された内容から再
現位置の命令とその実行回数を求め、プログラムを再実
行することで実行状態を再現する実行状態再現手段とを
有するからである。
This is because, during execution of a program, execution number storage means for storing the number of executions for each instruction, and when reproduction of an execution state is requested, an instruction at a reproduction position and its execution are stored based on the stored contents. This is because there is an execution state reproducing means for reproducing the execution state by obtaining the number of times and re-executing the program.

【0037】第2の効果は、上記該当処理までの移動
を、デバッガの使用データメモリを最小限に押さえて実
現できることにある。
The second effect is that the movement up to the above-mentioned processing can be realized while minimizing the data memory used by the debugger.

【0038】何故ならば、前記実行回数記憶手段で実行
回数を記憶する対象命令をラベルの付いた命令のみと
し、実行状態再現手段では、再現位置に過去に実行され
た命令のうちで一番近いラベルの付いた命令まで処理を
移したあと再現位置まで処理を移すことで、実行回数記
憶手段で作成するテーブルを最小限に押さえるからであ
る。
The reason is that only the labeled instruction is used as the target instruction for storing the number of executions in the execution number storage means, and the execution state reproducing means is the closest to the reproduction position among the previously executed instructions. This is because the table created by the execution count storage unit is minimized by shifting the processing to the reproduction position after shifting the processing to the labeled instruction.

【0039】一般に、ラベルの付いた命令は、プログラ
ム全体の約1割程度存在する。従ってテーブルのサイ
ズ、すなわちデバッガが使用するデータメモリの大きさ
を従来の約10分の1にすることができる。
Generally, about 10% of instructions with a label are present in the entire program. Therefore, the size of the table, that is, the size of the data memory used by the debugger can be reduced to about one tenth of the conventional size.

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

【図1】本発明の実施形態によるプログラム再実行方法
を実行するための装置の構成を示す図である。
FIG. 1 is a diagram showing a configuration of an apparatus for executing a program re-execution method according to an embodiment of the present invention.

【図2】本発明の実施形態1によるプログラム再実行方
法を説明するためのフロー図である。
FIG. 2 is a flowchart for explaining a program re-execution method according to the first embodiment of the present invention.

【図3】本発明の実施形態及び従来例によるプログラム
再実行方法を適用するプログラム例である。
FIG. 3 is an example of a program to which a program re-execution method according to an embodiment of the present invention and a conventional example is applied.

【図4】本発明の実施形態1の方法により更新される実
行回数登録テーブルの状態を示す図である。
FIG. 4 is a diagram illustrating a state of an execution count registration table updated by the method according to the first embodiment of the present invention.

【図5】本発明の実施形態2によるプログラム再実行方
法を説明するためのフロー図である。
FIG. 5 is a flowchart for explaining a program re-execution method according to a second embodiment of the present invention.

【図6】プログラム再実行方法を説明するためのフロー
図である。
FIG. 6 is a flowchart for explaining a program re-execution method.

【図7】図6に示す方法で用いる実行回数登録テーブル
の図である。
FIG. 7 is a diagram of an execution count registration table used in the method shown in FIG. 6;

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

1 処理制御手段 2 入力手段 3 記憶手段 4 実行手段 5 出力手段 DESCRIPTION OF SYMBOLS 1 Processing control means 2 Input means 3 Storage means 4 Execution means 5 Output means

───────────────────────────────────────────────────── フロントページの続き (56)参考文献 特開 昭56−58199(JP,A) 特開 平7−191883(JP,A) 特開 昭62−196238(JP,A) 特開 昭60−27037(JP,A) 特開 平6−139107(JP,A) (58)調査した分野(Int.Cl.7,DB名) G06F 11/28 G06F 11/34 ──────────────────────────────────────────────────続 き Continuation of front page (56) References JP-A-56-58199 (JP, A) JP-A-7-191883 (JP, A) JP-A-62-196238 (JP, A) JP-A-60-1985 27037 (JP, A) JP-A-6-139107 (JP, A) (58) Fields investigated (Int. Cl. 7 , DB name) G06F 11/28 G06F 11/34

Claims (8)

(57)【特許請求の範囲】(57) [Claims] 【請求項1】 プログラムをデバッグが終了した命令ま
で再実行するプログラム再実行方法において、デバッグが開始してから終了するまでの間に、前記プロ
グラム中の全ての命令のうちの一部をなす複数の特定の
命令の各々を実行したときのプログラムカウンタの値、
該各々の命令の実行回数、及び該各々の命令が前記複数
の特定の命令のうちでデバッグ終了前の最後に実行され
たものであるか否かを示す最終実行情報を1レコードと
して有し、前記複数の特定の命令に対応して複数のこの
ようなレコードより成るテーブルを記憶手段に作成する
ステップと、 デバッグ終了時に、前記テーブル中の複数のレコードの
うちの1のレコードであって、そのレコードに記憶され
ている前記最終実行情報がそのレコードに記憶されてい
る命令が前記複数の特定の命令のうちでデバッグ終了前
の最後に実行されたものであることを示しているレコー
ドに記憶されている実行回数である目的回数及びそのよ
うなレコードに記憶されているプログラムカウンタの値
である目的プログラムカウンタの値を記憶手段に記憶す
るステップと、 前記デバッグ終了時に、前記プログラム中の全ての命令
のうちで最後の命令を実行した時のプログラムカウンタ
の値である最終目的プログラムカウンタの値を記憶手段
に記憶するステップと、 再実行時に、現在のプログラムカウンタの値が前記目的
回数だけ前記目的プログラムカウンタの値になるまで前
記プログラムを実行した後に、前記現在のプログラムカ
ウンタの値が前記最終目的プログラムの値になるまで前
記プログラムを実行するステップと、 を有することを特徴とするプログラム再実行方法。
1. A program Program rerun process to be re-executed until the instruction debugging is complete and during from the start to the end of debugging, the pro
Multiple specific instructions that are part of all instructions in the
The value of the program counter when executing each of the instructions,
The number of executions of each of the instructions, and
Is executed last before the end of debugging
The final execution information indicating whether or not the
And corresponding to the plurality of specific instructions.
A table consisting of such records in the storage means
Step and, at the end of debugging, the plurality of records in the table.
One of the records, which is stored in that record
Is not stored in the record.
Before the end of debugging among the plurality of specific instructions
Record showing that it was the last run of
Number of executions, which is the number of executions stored in the
Of the program counter stored in such records
Is stored in the storage means.
And all instructions in the program at the end of the debugging
Program counter when the last instruction was executed
Means for storing the value of the final purpose program counter which is the value of
And after executing the program until the current value of the program counter reaches the value of the target program counter by the target number of times at the time of re-execution, the value of the current program counter is changed to the value of the final target program. Executing the program until the value becomes a value.
【請求項2】 請求項1に記載のプログラム再実行方法
において、前記再実行時の前記プログラムの実行は、ス
テップ実行であることを特徴とするプログラム再実行方
法。
2. The program re-execution method according to claim 1, wherein the execution of the program at the time of the re-execution is a step execution.
【請求項3】 請求項1又は2に記載のプログラム再実
行方法において、前記特定の命令はラベルの付いている
命令であることを特徴とするプログラム再実行方法。
3. The program re-execution method according to claim 1, wherein the specific instruction is a labeled instruction.
【請求項4】 請求項1又は2に記載のプログラム再実
行方法において、前記特定の命令は所定数毎の命令であ
ることを特徴とするプログラム再実行方法。
4. The program re-execution method according to claim 1, wherein the specific instruction is an instruction for every predetermined number.
【請求項5】 コンピュータに、デバッグが開始してから終了するまでの間に、前記プロ
グラム中の全ての命令のうちの一部をなす複数の特定の
命令の各々を実行したときのプログラムカウンタの値、
該各々の命令の実行回数、及び該各々の命令が前記複数
の特定の命令のうちでデバッグ終了前の最後に実行され
たものであるか否かを示す最終実行情報を1レコードと
して有し、前記複数の特定の命令に対応して複数のこの
ようなレコードより成るテーブルを記憶手段に作成する
ステップと、 デバッグ終了時に、前記テーブル中の複数のレコードの
うちの1のレコードであって、そのレコードに記憶され
ている前記最終実行情報がそのレコードに記憶されてい
る命令が前記複数の特定の命令のうちでデバッグ終了前
の最後に実行されたものであることを示しているレコー
ドに記憶されている実行回数である目的回数及びそのよ
うなレコードに記憶されているプログラムカウンタの値
である目的プログラムカウンタの値を記憶手段に記憶す
るステップと、 前記デバッグ終了時に、前記プログラム中の全ての命令
のうちで最後の命令を実行した時のプログラムカウンタ
の値である最終目的プログラムカウンタの値を記憶手段
に記憶するステップと、 再実行時に、現在のプログラムカウンタの値が前記目的
回数だけ前記目的プログラムカウンタの値になるまで前
記プログラムを実行した後に、前記現在のプログラムカ
ウンタの値が前記最終目的プログラムの値になるまで前
記プログラムを実行するステップと、 を実行させるためのプログラムを記録したことを特徴と
するコンピュータ読み取り可能な記録媒体。
5. The computer according to claim 1 , further comprising:
Multiple specific instructions that are part of all instructions in the
The value of the program counter when executing each of the instructions,
The number of executions of each of the instructions, and
Is executed last before the end of debugging
The final execution information indicating whether or not the
And corresponding to the plurality of specific instructions.
A table consisting of such records in the storage means
Step and, at the end of debugging, the plurality of records in the table.
One of the records, which is stored in that record
Is not stored in the record.
Before the end of debugging among the plurality of specific instructions
Record showing that it was the last run of
Number of executions, which is the number of executions stored in the
Of the program counter stored in such records
Is stored in the storage means.
And all instructions in the program at the end of the debugging
Program counter when the last instruction was executed
Means for storing the value of the final purpose program counter which is the value of
And after executing the program until the current value of the program counter reaches the value of the target program counter by the target number of times at the time of re-execution, the value of the current program counter is changed to the value of the final target program. A computer-readable recording medium on which is recorded a program for executing the program until a value is reached.
【請求項6】 請求項5に記載のコンピュータ読み取り
可能な記録媒体において、前記再実行時の前記プログラ
ムの実行は、ステップ実行であることを特徴とするコン
ピュータ読み取り可能な記録媒体。
6. The computer-readable recording medium according to claim 5, wherein the execution of the program at the time of the re-execution is a step execution.
【請求項7】 請求項5又は6に記載のコンピュータ読
み取り可能な記録媒体において、前記特定の命令はラベ
ルの付いている命令であることを特徴とするコンピュー
タ読み取り可能な記録媒体。
7. The computer-readable recording medium according to claim 5, wherein the specific instruction is a labeled instruction.
【請求項8】 請求項5又は6に記載のコンピュータ読
み取り可能な記録媒体において、前記特定の命令は所定
数毎の命令であることを特徴とするコンピュータ読み取
り可能な記録媒体。
8. The computer-readable recording medium according to claim 5, wherein the specific instruction is an instruction for every predetermined number.
JP10253050A 1998-09-07 1998-09-07 Program re-execution method Expired - Fee Related JP3110391B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP10253050A JP3110391B2 (en) 1998-09-07 1998-09-07 Program re-execution method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP10253050A JP3110391B2 (en) 1998-09-07 1998-09-07 Program re-execution method

Publications (2)

Publication Number Publication Date
JP2000081995A JP2000081995A (en) 2000-03-21
JP3110391B2 true JP3110391B2 (en) 2000-11-20

Family

ID=17245795

Family Applications (1)

Application Number Title Priority Date Filing Date
JP10253050A Expired - Fee Related JP3110391B2 (en) 1998-09-07 1998-09-07 Program re-execution method

Country Status (1)

Country Link
JP (1) JP3110391B2 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP7240470B1 (en) 2021-10-18 2023-03-15 レノボ・シンガポール・プライベート・リミテッド Electronics and cooling modules

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP7240470B1 (en) 2021-10-18 2023-03-15 レノボ・シンガポール・プライベート・リミテッド Electronics and cooling modules

Also Published As

Publication number Publication date
JP2000081995A (en) 2000-03-21

Similar Documents

Publication Publication Date Title
JPH06222952A (en) Debug supporting device
US8468501B2 (en) Partial recording of a computer program execution for replay
EP3577564B1 (en) Efficient retrieval of memory values during trace replay
JP3206641B2 (en) Microcomputer system debugging method, debugging device, and recording medium recording debug program
JP3110391B2 (en) Program re-execution method
JP2922723B2 (en) Information processing device
JP2001306334A (en) Emulation device
JPH08137717A (en) Debugging method and device therefor
JP2908446B1 (en) Computer simulator and simulation method
JP2000076095A (en) Device and method for tracing program and storage medium storing program therefor
JP2002024055A (en) Computer system and operation reproducing method of application program
JP3130798B2 (en) Bus transfer device
JPH05165680A (en) Memory operation tracing device
JP2006031248A (en) Software evaluation system for generating log by hooking function call
JP2910548B2 (en) Data check device
JPH04328644A (en) Debug back-up device
JP2000353359A (en) Storage device initializing method
JP2001202272A (en) Debugging method, debugging device using this method and recording medium with debugging method recorded thereon
JP3151811B2 (en) Failure processing verification method and method for information processing device
JPH01123337A (en) Interactive program debugging system
JP3099810B2 (en) Logic simulation apparatus, logic verification speedup method used therefor, and recording medium storing control program for the method
JPH0764820A (en) Debugging processor
JP2000267931A (en) Software execution system
JPS6270947A (en) Control system for debug interruption
JPH07191875A (en) Debugger

Legal Events

Date Code Title Description
LAPS Cancellation because of no payment of annual fees