JPH01177644A - Debugging device - Google Patents

Debugging device

Info

Publication number
JPH01177644A
JPH01177644A JP63001905A JP190588A JPH01177644A JP H01177644 A JPH01177644 A JP H01177644A JP 63001905 A JP63001905 A JP 63001905A JP 190588 A JP190588 A JP 190588A JP H01177644 A JPH01177644 A JP H01177644A
Authority
JP
Japan
Prior art keywords
subroutine
register
address
program
actual
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.)
Granted
Application number
JP63001905A
Other languages
Japanese (ja)
Other versions
JPH0724030B2 (en
Inventor
Koichi Nakamoto
幸一 中本
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 JP63001905A priority Critical patent/JPH0724030B2/en
Publication of JPH01177644A publication Critical patent/JPH01177644A/en
Publication of JPH0724030B2 publication Critical patent/JPH0724030B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Landscapes

  • Debugging And Monitoring (AREA)

Abstract

PURPOSE:To make high-speed access by providing a means to trace an executive stack in a real device in a debugging device. CONSTITUTION:The return address of a subroutine stored in a point where an offset value is separated from a variable A to exist in a memory 14, and it is set to a variable B to exist in the memory 14. Next, the contents of the variable B, namely, the return address is contained in a register 17. Whether the address exists between the starting address of the designated subroutine and the completing address of the subroutine contained in a register 18 or not is decided. Namely, when it exists between them, the subroutine to call the subroutine, to which an attention is paid, is the designated subroutine, and when it does not exist between them, the frame pointer of the subroutine to call the subroutine stored into a point where the offset value is separated from the frame pointer is obtained, and it is set to the variable A. Thus, the access to the real argument of the subroutine of a program or a local variable can be made high-speed, and the efficiency of a debugging work can be improved.

Description

【発明の詳細な説明】 本発明はデバッグ装置に関し、特にプログラムのサブル
ーチンの実引数、又は局所変数へのアクセスを高速に行
うことを特徴とするデバッグ装置である。
DETAILED DESCRIPTION OF THE INVENTION The present invention relates to a debugging device, and more particularly, to a debugging device characterized by high-speed access to actual arguments or local variables of a subroutine of a program.

(従来の技術) 従来、実機に接続してデバッグを行うためのデバッグ装
置では、アクセスしようとする実機中のプログラムメモ
リのアドレスを指定して、該アドレスへのデータの書込
み、又は該アドレスからのデータの読出しを行っていた
(Prior Art) Conventionally, in a debugging device connected to an actual device for debugging, a program memory address in the actual device to be accessed is specified, and data is written to or read from the address. Data was being read.

(発明が解決しようとする問題点) 上述した従来の方式、たとえば高級言語で書がれなプロ
グラムでは、プログラム実行時に、サブルーチンが呼ば
れた時に、実行時スタックに実引数、局所変数、呼び側
のサブルーチンのフレームを指すフレームポインタの値
、及び戻り番地からなるスタックフレームを形成される
。このとき、指定されたサブルーチンの実引数、局所変
数に対応するメモリアドレスにアクセスする時、以下の
ような問題が発生する。
(Problem to be Solved by the Invention) In the conventional method described above, for example, in a program written in a high-level language, when a subroutine is called during program execution, actual arguments, local variables, and the caller are stored on the runtime stack. A stack frame is formed consisting of the frame pointer value pointing to the frame of the subroutine and the return address. At this time, the following problem occurs when accessing the memory address corresponding to the actual argument or local variable of the specified subroutine.

まず、実行時スタック中の最近呼ばれたサブルーチンの
スタックフレームから呼び側のサブルーチンのスタック
フレームへ、スタックフレーム中のフレームポインタを
たどりなから、スタックフレームの内容を調べる。
First, the contents of the stack frame are examined by following the frame pointer in the stack frame from the stack frame of the most recently called subroutine in the runtime stack to the stack frame of the calling subroutine.

もし、スタックフレーム中の戻り番地が指定されたサブ
ルーチンの命令領域に含まれるならば、該スタックフレ
ームに対応するサブルーチンを呼んだサブルーチンが、
指定されたサブルーチンであることがわかる。したがっ
て、該サブルーチンのスタックフレーム中に保持されて
いる実引数、局所変数にアクセスすることになる。
If the return address in the stack frame is included in the instruction area of the specified subroutine, the subroutine that called the subroutine corresponding to the stack frame
You can see that it is the specified subroutine. Therefore, the actual arguments and local variables held in the stack frame of the subroutine are accessed.

この時、プログラムのソースファイル、シンボルテーブ
ルを保持するホストマシンとデバッグ装置とを回線によ
り結合して、ホストマシンから、指定された関数の実引
数、局所変数にアクセスしようとすると、該関数の命令
領域、アクセスしようとする実引数、局所変数のフレー
ム内の相対位置に関する情報が、ホストマシンのみにし
かないため、上述のように、実行スタックを辿っていく
場合に、ホストマシンとデバッグ装置間の通信回数が増
加し、サブルーチンの実引数、又は局所変数へのアクセ
スが高速には行われなくなり、デバッグ作業の能率低下
をまねいていた。
At this time, when the host machine that holds the program source files and symbol table is connected to the debugging device via a line, and the host machine attempts to access the actual arguments and local variables of the specified function, the command of the function Because only the host machine has information about the area, the actual argument to be accessed, and the relative position within the frame of local variables, communication between the host machine and the debugging device is difficult when traversing the execution stack, as described above. The number of times this happens increases, and the actual arguments of the subroutine or local variables cannot be accessed quickly, leading to a decrease in the efficiency of debugging work.

本発明は、このような従来の欠点を解決したもので、そ
の目的は、プログラムのサブル−チンの実引数、又は局
所変数へのアクセスを高速にしてデバッグ作業の能率を
高めることになる。
The present invention solves these conventional drawbacks, and its purpose is to increase the efficiency of debugging work by speeding up access to actual arguments or local variables of program subroutines.

(問題を解決するための手段) 本発明は、デバッグ装置において、該実機で実行中のプ
ログラムのサブルーチン開始アドレスを保持する第1の
レジスタと該サブルーチン終了アドレスを保持する第2
のレジスタと実機中で実行されるサブルーチンの引数、
もしくは局所変数の格納される領域の、フレームポイン
タからのオフセットを保持する第3のレジスタと該領域
から読み出したデータ、もしくは該領域へ書込むデータ
を保持する第4のレジスタと実機中のプログラムメモリ
にあるサブルーチンの実行スタックより、第1のレジス
タ及び第2のレジスタに対応するサブルーチンのフレー
ムを見出し、該フレームより、第3のレジスタに格納さ
れたオフセット値で指定されるサブルーチンの実引数、
もしくは局所変数のアドレスの内容を読出し、第4のレ
ジスタに設定する手段、及び、該アドレスに第4のレジ
スタの内容を書込む手段を有する。
(Means for Solving the Problem) The present invention provides a debugging device that includes a first register that holds a subroutine start address of a program being executed on the actual machine, and a second register that holds the subroutine end address of the program that is being executed on the actual machine.
registers and arguments of subroutines executed in the actual machine,
Or a third register that holds the offset from the frame pointer of the area where local variables are stored, a fourth register that holds the data read from the area, or data written to the area, and the program memory in the actual machine. Find the frame of the subroutine corresponding to the first register and the second register from the execution stack of the subroutine in the subroutine, and from the frame, the actual argument of the subroutine specified by the offset value stored in the third register,
Alternatively, it has means for reading the contents of the address of the local variable and setting it in the fourth register, and means for writing the contents of the fourth register at the address.

(実−施例) 次に本発明の実施例について図面を参照して説明する。(Example) Next, embodiments of the present invention will be described with reference to the drawings.

第1図は本発明のデバッグ装置の一実施例のブロック図
であり、デバッグ装置1と実機2とで構成されている。
FIG. 1 is a block diagram of an embodiment of the debugging device of the present invention, which is composed of a debugging device 1 and an actual device 2. As shown in FIG.

デバッグ装置1は、プロセッサ10、メモリ14、デイ
スプレィ15、キーボード16実機のプロセッサ20を
制御する制御回路103、指定されたサブルーチンの開
始アドレスを格納するレジスタ17、指定されたサブル
ーチンの終了アドレスを格納するレジスタ18、指定さ
れたサブルーチンにおいてアクセスする局所変数、又は
実引数へのフレームポインタからのオフセット値を格納
するレジスタ19、アクセスされた局所変数、又は実引
数へ設定するデータ、又は該局所変数又は実引数から読
み出されたデータを格納するデータレジスタ101、読
み又は書きのアクセス方法を保持するアクセスレジスタ
102を具備する。
The debug device 1 includes a processor 10, a memory 14, a display 15, a keyboard 16, a control circuit 103 that controls the processor 20 of the actual machine, a register 17 that stores the start address of a specified subroutine, and an end address of the specified subroutine. Register 18, a register 19 that stores the offset value from the frame pointer to a local variable accessed in a specified subroutine or an actual argument; It includes a data register 101 that stores data read from an argument, and an access register 102 that holds a read or write access method.

プロセッサ10、メモリ14、デイプレイ15、キーボ
ード16、レジスタ17、レジスタ18、レジスタ19
、データレジスタ101はデータバス11、アドレスバ
ス12、コントロールバス13によって接続されている
。実機2はプロセー6 = ッサ20、メモリ24を具備する。−アドレスバス22
、プロセッサ20とメモリ24はデータバス21、コン
トロールハス23によって接続されている。デバッグ装
置1のメモリ14には、デイスプレィ15とキーボード
16を制御して、指定されたサブルーチンの命令開始ア
ドレスをレジスタ17に設定し該サブルーチンの命令終
了アドレスをレジスタ18に設定し該サブルーチンのア
クセスする局所変数、又は実引数のフレームポインタか
らのオフセット値をレジスタ19に設定し、該局所変数
又は実引数への読み又は書きのアクセス方法を命令レジ
スタ102に設定し該局所変数、又は実引数に設定する
データをデータレジスタ101に設定し又は、該局所変
数、又は実引数から読出されたデータを保持するデータ
レジスタ101からデータを読出すプログラムが含まれ
る。
Processor 10, memory 14, dayplay 15, keyboard 16, register 17, register 18, register 19
, data register 101 are connected by a data bus 11, an address bus 12, and a control bus 13. The actual machine 2 includes a processor 6 = processor 20 and a memory 24. -address bus 22
, the processor 20 and the memory 24 are connected by a data bus 21 and a control bus 23. In the memory 14 of the debugging device 1, a display 15 and a keyboard 16 are controlled to set the instruction start address of a specified subroutine in a register 17, set the instruction end address of the subroutine in a register 18, and access the subroutine. Set the offset value from the frame pointer of the local variable or actual argument in the register 19, set the read or write access method to the local variable or actual argument in the instruction register 102, and set it in the local variable or actual argument. The program includes a program that sets data to the data register 101 or reads data from the data register 101 holding data read from the local variable or actual argument.

次に第1図のデバッグ装置の動作を、第2図及び第3図
を用いて説明する。
Next, the operation of the debugging device shown in FIG. 1 will be explained using FIGS. 2 and 3.

まず、デバッグ装置1において、メモリ14に含まれる
前記プログラムを起動させる。該プログラムはキーボー
ド16よりアクセスするサブルーチンの命令開始アドレ
ス、命令終了アドレス、アクセスする局所変数又は実引
数のフレームポインタからのオフセラ1〜値を入力され
、それぞれレジスタ17、レジスタ18、レジスタ19
に設定し、更に、アクセス方法を命令レジスタ102に
設定し、命令レジスタ102の内容が書き込み命令の場
合は、データレジスタ101に書込みデータを設定する
First, in the debugging device 1, the program included in the memory 14 is activated. The program receives input from the keyboard 16 of the instruction start address of the subroutine to be accessed, the instruction end address, the local variable to be accessed, or the offset value from the frame pointer of the actual argument, and registers 17, 18, and 19, respectively.
Furthermore, the access method is set in the command register 102, and if the contents of the command register 102 are a write command, write data is set in the data register 101.

次に、実機2の実行中断状態において、第2図に示す処
理をメモリ14に含まれる制御プログラムは行う。即ち
、該制御プログラムは、プロセッサ20のフレームポイ
ンタレジスタの内容(第3図)をメモリ14にある変数
Aに設定する(第2図201)。
Next, while the execution of the actual device 2 is suspended, the control program included in the memory 14 performs the processing shown in FIG. That is, the control program sets the contents of the frame pointer register of the processor 20 (FIG. 3) to the variable A in the memory 14 (FIG. 2 201).

次に、サブルーチンのスタックフレームにおいて、変数
Aからオフセット値の離れたところに格納されているサ
ブルーチンの戻り番地を求め、メモリ14にある変数B
に設定する(第2図202)。
Next, in the stack frame of the subroutine, find the return address of the subroutine that is stored at an offset value away from variable A, and
(202 in FIG. 2).

次に、変数Bの内容、即ち戻り番地が、レジスタ17に
含まれる。指定されたサブルーチンの開始アドレスとレ
ジスタ18に含まれるサブルーチンの終了アドレスの間
にあるか否が判定される(第2図203〉。もし間にあ
えば、着目しているサブルーチンを呼んだサブルーチン
が、指定されたサブルーチンである。
Next, the contents of variable B, ie, the return address, are included in register 17. It is determined whether the start address of the specified subroutine is between the end address of the subroutine contained in register 18 (Fig. 2, 203). If there is time, the subroutine that called the subroutine of interest is , is the specified subroutine.

もし、サブルーチンの戻り番地がレジスタ17とレジス
タ18の間になければ、着目しているサブルーチンを呼
んだサブルーチンは指定されたサブルーチンではない。
If the return address of the subroutine is not between registers 17 and 18, the subroutine that called the subroutine of interest is not the specified subroutine.

ゆえに、フレームポインタからオフセット値の離れた箇
所に格納されている該サブルーチンを呼んだサブルーチ
ンのフレームポインタを求め、変数Aに設定する(第2
図205)。
Therefore, find the frame pointer of the subroutine that called the subroutine, which is stored at a location that is an offset value away from the frame pointer, and set it in variable A (second
Figure 205).

前記のサブルーチンの戻り番地の判定を行う。The return address of the subroutine described above is determined.

前記のサブルーチンの戻り番地の判定203において、
指定されたサブルーチンが見出された時、変数Aに゛指
定されたサブルーチンのスタックフレームのポインタ値
を設定する(第2図204)。
In determining the return address of the subroutine 203,
When the specified subroutine is found, the pointer value of the stack frame of the specified subroutine is set in variable A (FIG. 2, 204).

次に、第2図206において命令レジスタ102の内容
を調べ、書込み指示の場合は、変動Aの内容からレジス
タ19に含まれるオフセット値離れたメモリアドレスに
、データレジスタ101の内容を書き込む(第2図20
7〉。
Next, in 206 of FIG. 2, the contents of the instruction register 102 are checked, and in the case of a write instruction, the contents of the data register 101 are written to a memory address separated by an offset value included in the register 19 from the contents of fluctuation A (second Figure 20
7〉.

又、読出し指示の場合は、当該アドレスの内容をデータ
レジスタ101に設定する。以上でメモリ14に含まれ
る制御プログラムの動作は終了する(第2図208)。
Further, in the case of a read instruction, the contents of the address are set in the data register 101. With this, the operation of the control program included in the memory 14 ends (208 in FIG. 2).

・ (発明の効果) 以上説明したように本発明は、実機において高級言語な
どで書かれたプログラムが実行された時形成される実行
時スタックになるサブルーチンの局所変数又は実引数に
アクセスする場合に、デバッグ装置内に実機内の実行的
スタックを辿る手段を具備することにより、アドレスの
みによるメモリアクセスしか許さないデバッグ装置に比
べて、高速にアクセスすることが可能となる。更に、デ
バッグ装置とホストマシンとを回線で接続してデー1〇
− バックする場合に、ホストマシンとデバッグ装置間の通
信量を減少させることができ、従来のデバッグ装置に比
べてデバッグ効果を向上させるという効果がある。
- (Effects of the Invention) As explained above, the present invention provides a method for accessing local variables or actual arguments of subroutines that become the runtime stack that is formed when a program written in a high-level language or the like is executed on an actual machine. By providing the debug device with means for tracing the executable stack in the actual machine, it becomes possible to access the memory at a higher speed than in a debug device that only allows memory access using addresses. Furthermore, when backing up data by connecting a debug device and a host machine via a line, it is possible to reduce the amount of communication between the host machine and the debug device, improving debugging effectiveness compared to conventional debug devices. It has the effect of causing

図面の簡単な説明 第1図は本発明の実施例を示すブロック図、第2図は実
機において実行スタックにあるサブルーチンの局所変数
又は実引数にアクセスする処理の一例を示す流れ図、第
3図は第2図の説明のための実機における実行スタック
の一例を示す図である。
BRIEF DESCRIPTION OF THE DRAWINGS FIG. 1 is a block diagram showing an embodiment of the present invention, FIG. 2 is a flowchart showing an example of the process of accessing local variables or actual arguments of a subroutine in the execution stack on an actual machine, and FIG. FIG. 3 is a diagram showing an example of an execution stack in an actual machine for explaining FIG. 2;

1・・・デバッグ装置 10・・・データバス11・・
・アドレスバス 12・・・コントロールバス14・・
・メモリ    15・・・デイスプレィ16・・・キ
ーボ”−ド  17・・・レジスタ18・・・レジスタ
   19・・・レジスタ101・・・データレジスタ 102・・・アクセスレジスタ
1...Debug device 10...Data bus 11...
・Address bus 12...Control bus 14...
・Memory 15... Display 16... Keyboard 17... Register 18... Register 19... Register 101... Data register 102... Access register

Claims (1)

【特許請求の範囲】[Claims] プロセッサと該プロセッサの制御プログラムを記録した
プログラムメモリとを具備する実機の、システムバスも
しくは該プロセッサの端子からアドレス信号、データ信
号およびコントロール信号を取出してプログラムデバッ
グを行うデバッグ装置であって、該実機で実行中のプロ
グラムのサブルーチン開始アドレスを保有する第1のレ
ジスタと該サブルーチンの終了アドレスを保持する第2
のレジスタと実機中で実行されるサブルーチンの引数も
しくは局所変数の格納される領域のフレームポインタか
らのオフセットを保持する第3のレジスタと該領域から
読み出したデータ、もしくは該領域へ書込むデータを保
持する第4のレジスタと実機中のプログラムメモリにあ
るサブルーチンの実行スタックより、第1のレジスタ及
び第2のレジスタに対応するサブルーチンのフレームを
見出し、該フレームより第3のレジスタに格納されたオ
フセット値で指定されるサブルーチンの実引数もしくは
局所変数のアドレスの内容を読出し第4のレジスタに設
定する手段、及び該アドレスに第4のレジスタの内容を
書込む手段を有し、プログラムのサブルーチンの実引数
、又は局所変数へのアクセスを高速に行うことを特徴と
するデバッグ装置。
A debugging device that performs program debugging by extracting address signals, data signals, and control signals from a system bus or a terminal of the processor of an actual machine that is equipped with a processor and a program memory in which a control program for the processor is recorded. A first register holds the subroutine start address of the program being executed in , and a second register holds the end address of the subroutine.
and a third register that holds the offset from the frame pointer of the area where the arguments or local variables of the subroutine executed in the actual machine are stored, and the data read from or written to the area. Find the frame of the subroutine corresponding to the first register and the second register from the execution stack of the subroutine in the fourth register and the program memory of the actual machine, and calculate the offset value stored in the third register from the frame. means for reading out the contents of an actual argument of a subroutine or the address of a local variable specified by and setting it in a fourth register, and means for writing the contents of the fourth register to the address, and the actual argument of the subroutine of the program , or a debugging device characterized by high-speed access to local variables.
JP63001905A 1988-01-08 1988-01-08 Debug device Expired - Fee Related JPH0724030B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP63001905A JPH0724030B2 (en) 1988-01-08 1988-01-08 Debug device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP63001905A JPH0724030B2 (en) 1988-01-08 1988-01-08 Debug device

Publications (2)

Publication Number Publication Date
JPH01177644A true JPH01177644A (en) 1989-07-13
JPH0724030B2 JPH0724030B2 (en) 1995-03-15

Family

ID=11514593

Family Applications (1)

Application Number Title Priority Date Filing Date
JP63001905A Expired - Fee Related JPH0724030B2 (en) 1988-01-08 1988-01-08 Debug device

Country Status (1)

Country Link
JP (1) JPH0724030B2 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH07168743A (en) * 1993-12-16 1995-07-04 Nec Corp Information display system in abnormal completion of user program
JP2008305337A (en) * 2007-06-11 2008-12-18 Panasonic Corp Program converter, program conversion method, program, storage medium, debugging device, debugging method and program development system

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS59221753A (en) * 1983-06-01 1984-12-13 Hitachi Ltd Subroutine tracer
JPS61128743U (en) * 1985-01-25 1986-08-12

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS59221753A (en) * 1983-06-01 1984-12-13 Hitachi Ltd Subroutine tracer
JPS61128743U (en) * 1985-01-25 1986-08-12

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH07168743A (en) * 1993-12-16 1995-07-04 Nec Corp Information display system in abnormal completion of user program
JP2008305337A (en) * 2007-06-11 2008-12-18 Panasonic Corp Program converter, program conversion method, program, storage medium, debugging device, debugging method and program development system

Also Published As

Publication number Publication date
JPH0724030B2 (en) 1995-03-15

Similar Documents

Publication Publication Date Title
JPH01177644A (en) Debugging device
JPS6367695B2 (en)
JPH05108404A (en) Debugger system
JPH0581087A (en) Processor monitoring system
JP2795676B2 (en) Program trace device
JPH0447350A (en) Main storage read/response control
JP2815638B2 (en) Debug device
JP2788353B2 (en) Task trace method
JP3140028B2 (en) Subroutine argument passing method
JP2669300B2 (en) Program trace circuit and program trace method
JPH05197596A (en) Tracer
JP2507791B2 (en) Data processing device
JPH0793184A (en) Debugging device
JPH04167146A (en) Address tracing system for information processor
JPH0795288B2 (en) Microcomputer
JP2601541B2 (en) FORTRAN input / output list processing method
JPH1165875A (en) In-circuit emulator
JPH04242455A (en) Inter-processor communication trace circuit
KR890016477A (en) Operation program and data loading method of electronic exchange
JPH04260139A (en) File access rpocessor
JPH05181702A (en) Soft debugger
JP2000010820A (en) Method and device for testing one process of multiprocess system
JPH04328644A (en) Debug back-up device
JPS6136253B2 (en)
JPH0293947A (en) Electronic computer

Legal Events

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