[go: up one dir, main page]

JPH03223938A - Return address monitoring circuit for debugging device - Google Patents

Return address monitoring circuit for debugging device

Info

Publication number
JPH03223938A
JPH03223938A JP28361489A JP28361489A JPH03223938A JP H03223938 A JPH03223938 A JP H03223938A JP 28361489 A JP28361489 A JP 28361489A JP 28361489 A JP28361489 A JP 28361489A JP H03223938 A JPH03223938 A JP H03223938A
Authority
JP
Japan
Prior art keywords
return
return address
time
microcomputer
address
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
JP28361489A
Other languages
Japanese (ja)
Other versions
JP2754899B2 (en
Inventor
Akihiro Kamigaki
上垣 秋広
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.)
Mitsubishi Electric Corp
Original Assignee
Mitsubishi Electric 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 Mitsubishi Electric Corp filed Critical Mitsubishi Electric Corp
Priority to JP28361489A priority Critical patent/JP2754899B2/en
Publication of JPH03223938A publication Critical patent/JPH03223938A/en
Application granted granted Critical
Publication of JP2754899B2 publication Critical patent/JP2754899B2/en
Anticipated expiration legal-status Critical
Expired - Lifetime legal-status Critical Current

Links

Landscapes

  • Manufacturing Optical Record Carriers (AREA)

Abstract

PURPOSE:To shorten the debugging time by providing a comparator to compare the return address saved in a stack area with the return address written into a storage circuit at call of a subroutine in a return state. CONSTITUTION:A comparator 4 compares in real time and in a return state the return address saved into a stack area at call of the subroutine of a microcomputer 1 to be debugged with the return address written into a storage circuit 9 at call of the subroutine. Thus both return addresses can be compared in real time with each other. As a result, an abnormal operation of the computer 1 is detected during a real time operation and then a program mistake is detected. In such a constitution, the debugging time is shortened.

Description

【発明の詳細な説明】 〔産業上の利用分野〕 本発明は、プログラムを実行してプログラムの誤りを訂
正するデバッグ装置のプログラムミス検出手段に関する
ものである。
DETAILED DESCRIPTION OF THE INVENTION [Field of Industrial Application] The present invention relates to a program error detection means for a debugging device that executes a program and corrects errors in the program.

〔従来の技術〕[Conventional technology]

第2図は従来のデバッグ装置を示す構成図であり、アド
レスバス、データバスの値をリアルタイムに検出する部
分の構成例を示す。
FIG. 2 is a configuration diagram showing a conventional debugging device, and shows an example of the configuration of a portion that detects values of an address bus and a data bus in real time.

第2図において、■はデバッグの対象となるマイクロコ
ンピュータ、2はマイクロコンピュータのリード・ライ
トサイクルに応答するデバイス(ROM、RAM、周辺
IC等)、3はデバッグ装置を操作するユーザが指定す
る検出したいアドレスバス5、データバス6の値をラッ
チする比較データラッチ、4は比較データラッチ3の値
とマイクロコンピュータ1出力のアドレスバス5.デー
タバス6の値との一致を検出する比較器、7ば制御バス
である。
In Figure 2, ■ is a microcomputer to be debugged, 2 is a device that responds to read/write cycles of the microcomputer (ROM, RAM, peripheral IC, etc.), and 3 is a detection specified by the user operating the debugging device. Comparison data latch 4 latches the desired address bus 5 and data bus 6 values, and address bus 5.4 latches the value of comparison data latch 3 and the microcomputer 1 output. A comparator 7 detects a match with the value on the data bus 6, and 7 is a control bus.

次に動作について説明する。Next, the operation will be explained.

■マイクロコンピュータIがデバイス2をアクセスする
ために出力したアドレスバス5の値と比較データラッチ
3に設定した値とを比較器4で比較する。比較する際、
マイクロコンピュータ1から出力される制御バス7の信
号も併せて比較すれば、マイクロコンピュータ1の特定
アドレスへの特定アクセスの検出が可能となる。次いで
、一致検出信号を使用してプログラム実行の中止、リア
ルタイムトレースの開始等の動作を行なう。
(2) The comparator 4 compares the value of the address bus 5 output by the microcomputer I to access the device 2 with the value set in the comparison data latch 3. When comparing,
If the signals on the control bus 7 output from the microcomputer 1 are also compared, it becomes possible to detect a specific access to a specific address of the microcomputer 1. Next, the coincidence detection signal is used to perform operations such as stopping program execution and starting real-time tracing.

■マイクロコンピュータ1がデバイス2に対してリード
・ライトする時のデータバス6の値と比較データラッチ
3に設定した値とを比較器4で比較する。比較する際、
マイクロコンピュータ1から出力される制御バス7の信
号も併せて比較すれば、マイクロコンピュータ1の特定
データへの特定アクセスの検出が可能となる。次いで、
一致検出信号を使用してプログラム実行の中止、リアル
タイムトレースの開始等の動作を行なう。
(2) The comparator 4 compares the value of the data bus 6 when the microcomputer 1 reads/writes the device 2 with the value set in the comparison data latch 3. When comparing,
If the signals of the control bus 7 outputted from the microcomputer 1 are also compared, it becomes possible to detect specific access to specific data of the microcomputer 1. Then,
The coincidence detection signal is used to perform operations such as stopping program execution and starting real-time tracing.

■上記■と■を組み合わせることにより、特定アドレス
への特定データのリード・ライト等の動作を検出するこ
とが可能となる。
(2) By combining (2) and (2) above, it becomes possible to detect operations such as reading and writing specific data to a specific address.

〔発明が解決しようとする課題〕[Problem to be solved by the invention]

従来のデバッグ装置では、特定アドレスへの特定データ
の書込みの検出1.特定アドレスへの特定アクセスの検
出は可能であったが、サブルーチンコール時に退避され
るリターンアドレスとリターン時に取り出されるリター
ンアドレスの一致を検出することは不可能であった。
In conventional debugging devices, detection of writing of specific data to a specific address 1. Although it was possible to detect a specific access to a specific address, it was impossible to detect a match between the return address saved at the time of a subroutine call and the return address retrieved at the time of return.

本発明はこのような点に鑑みてなされたものであり、そ
の目的とするところは、サブル−チンコール時にマイク
ロコンピュータによって退避したリターンアドレスとリ
ターン時にマイクロコンピュータが取り出すリターンア
ドレスの一致をリアルタイムに監視できるデバッグ装置
を実現することにある。
The present invention has been made in view of these points, and its purpose is to monitor in real time whether the return address saved by the microcomputer at the time of subroutine call matches the return address retrieved by the microcomputer at the time of return. The purpose is to realize a debugging device.

〔課題を解決するための手段〕[Means to solve the problem]

このような目的を達成するために本発明は、デバッグ対
象となるマイクロコンピュータのサブルーチンコール時
にスタック領域に退避したリターンアドレスとサブルー
チンコール時に記憶回路に書き込まれたリターンアドレ
スとをリターン時にリアルタイムに比較する比較回路を
設けるようにしたものである。
In order to achieve such an object, the present invention compares in real time at the time of return, the return address saved in the stack area at the time of a subroutine call of the microcomputer to be debugged and the return address written to the storage circuit at the time of the subroutine call. A comparison circuit is provided.

〔作用〕[Effect]

本発明によるデバッグ装置のリターンアドレス監視回路
においては、サブルーチンコール時にマイクロコンピュ
ータによって退避したリターンアドレスとリターン時に
マイクロコンピュータが取り出すリターンアドレスの比
較は、サブルーチンコール命令によりスタック領域に退
避されるデータの値とその値がライトされるアドレスの
値とを順次記憶し、リターン命令により取り出されるデ
ータの値およびその値がリードされるアドレスの値と上
記記憶した値とを比較することにより行なわれる。
In the return address monitoring circuit of the debugging device according to the present invention, the return address saved by the microcomputer at the time of a subroutine call and the return address taken out by the microcomputer at the time of return are compared with the value of data saved to the stack area by the subroutine call instruction. This is done by sequentially storing the value of the address to which the value is written, and comparing the value of the data retrieved by the return command and the value of the address from which the value is read with the stored value.

〔実施例〕〔Example〕

第1図は、本発明によるリターンアドレス監視回路の一
実施例が適用されるデバッグ装置を示す構成図である。
FIG. 1 is a block diagram showing a debugging device to which an embodiment of the return address monitoring circuit according to the present invention is applied.

第1図においては、リターンアドレスの一致検出に直接
関係した部分だけを図示した。
In FIG. 1, only the parts directly related to the detection of matching of return addresses are shown.

第1図において、1はデバッグの対象となるマイクロコ
ンピュータ、2はスタック領域となるメモリ、4は比較
回路、5はアドレスバス、6はデータバス、7は制御バ
ス、8はデータバス6、制御バス7を監視し、サブルー
チンコール命令、リターン命令を検出する命令デコーダ
、9はサブルーチンコール命令により退避されるデータ
とアドレスの値を記憶する記憶回路、10はデバッグ装
置全体を制御するデバッグ装置制御部である。比較回路
4は、リターン命令によりメモリ2より取り出したデー
タおよびそのアドレスの値と記憶回路9中の対応する値
とを比較する。
In FIG. 1, 1 is a microcomputer to be debugged, 2 is a memory serving as a stack area, 4 is a comparison circuit, 5 is an address bus, 6 is a data bus, 7 is a control bus, 8 is a data bus 6, a control bus An instruction decoder monitors the bus 7 and detects subroutine call instructions and return instructions; 9 a storage circuit that stores data and address values saved by subroutine call instructions; 10 a debug device control unit that controls the entire debug device; It is. The comparison circuit 4 compares the data retrieved from the memory 2 by the return command and the value of its address with the corresponding value in the storage circuit 9.

次に、本実施例の動作を第1図を参照しながら説明する
。マイクロコンピュータ1は、サブルーチンコール命令
を実行すると、リターンアドレスをメモリ2に退避する
。同時に命令デコーダ8はサブルーチンコール命令の実
行を検出し、マイクロコンピュータ1が退避したリター
ンアドレス値および退避に使用したメモリのアドレスを
記憶回路9に書き込む。記憶回路9は、先に書き込んだ
値が後に読み出されるFILO(ファーストインラスト
アウト)の回路構成とする。記憶回路9からの読出しは
リターン命令の実行により行なう。
Next, the operation of this embodiment will be explained with reference to FIG. When the microcomputer 1 executes the subroutine call instruction, the microcomputer 1 saves the return address in the memory 2. At the same time, the instruction decoder 8 detects the execution of the subroutine call instruction, and writes the return address value saved by the microcomputer 1 and the address of the memory used for saving into the storage circuit 9. The memory circuit 9 has a FILO (first in last out) circuit configuration in which the value written first is read out later. Reading from the storage circuit 9 is performed by executing a return command.

次に、マイクロコンピュータ1は、リターン命令を実行
すると、リターンアドレスをメモリ2から取り出す。同
時に命令デコーダ8はリターン命令の実行を検出し、マ
イクロコンピュータ1がすターンアドレスを取り出すた
めに出力したアドレスの値およびメモリ2が出力したデ
ータと記憶回路9の対応する値とを比較回路4により比
較する。
Next, when the microcomputer 1 executes the return instruction, it retrieves the return address from the memory 2. At the same time, the instruction decoder 8 detects the execution of the return instruction, and the comparator circuit 4 compares the address value outputted by the microcomputer 1 to retrieve the turn address, the data outputted by the memory 2, and the corresponding value of the storage circuit 9. compare.

比較回路4は、値が不一致であった場合、デバッグ装置
制御部10に不一致検出信号aを送る。デバッグ装置制
御部10ばマイクロコンピュータ1の実行を停止させる
などの動作を行ない、デバッグ装置はプログラマにリタ
ーンアドレスの不一致を通知する。
If the values do not match, the comparison circuit 4 sends a mismatch detection signal a to the debugging device control section 10. The debugging device control unit 10 performs operations such as stopping the execution of the microcomputer 1, and the debugging device notifies the programmer of the mismatch of return addresses.

なお、上記実施例では、ザブルーチンコール命令とリタ
ーン命令の組合せだけを示したが、これ以外に、ソフト
ウェア割込み命令と割込みからのリターン命令の組合せ
、および内部・外部の要因によるハードウェア割込みと
割込みからのリターン命令の組合せを使用してもよい。
In addition, in the above embodiment, only the combination of the routine call instruction and the return instruction is shown, but in addition to this, the combination of the software interrupt instruction and the return instruction from the interrupt, and the hardware interrupt and interrupt caused by internal/external factors. A combination of return instructions from may also be used.

さらに、上記3つの組合せは単独で使用しても、複数同
時に使用してもよいことはいうまでもない。
Furthermore, it goes without saying that the above three combinations may be used alone or in combination.

〔発明の効果〕〔Effect of the invention〕

以上説明したように本発明は、ザブルーチンコール時に
スタック領域に退避したリターンアドレスとザブルーチ
ンコール時に記憶回路に書き込まれたリターンアドレス
とをリターン時にリアルタイムに比較することにより、
プI」グラムミスによってスタックポインタが変化して
リターン命令の実行後にマイクロコンビプ、−夕が異常
動作することをリアルタイム動作中に検出することがで
き、プログラムミスを発見することによってデバッグ時
間を短縮できる効果がある。
As explained above, the present invention compares the return address saved in the stack area at the time of the subroutine call and the return address written to the storage circuit at the time of the subroutine call in real time at the time of return.
It is possible to detect during real-time operation that the stack pointer changes due to a programming error and the microcomputer operates abnormally after executing a return instruction, and debugging time can be shortened by discovering programming errors. effective.

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

第1図は本発明によるリターンアドレス監視回路の一実
施例が適用されるデバッグ装置を示す構成図、第2図は
従来のデバッグ装置を示す構成図である。 ■・・・マイクロコンピュータ、2・・・メモリ、4・
・・比較回路、5・・・アドレスバス、6・・・データ
バス、7・・・制御バス、8・・・命令デコーダ、9・
・・記憶回路、10・・・デバッグ装置制御部。
FIG. 1 is a block diagram showing a debug device to which an embodiment of the return address monitoring circuit according to the present invention is applied, and FIG. 2 is a block diagram showing a conventional debug device. ■...Microcomputer, 2...Memory, 4.
...Comparison circuit, 5...Address bus, 6...Data bus, 7...Control bus, 8...Instruction decoder, 9.
...Storage circuit, 10...Debug device control unit.

Claims (1)

【特許請求の範囲】[Claims] プログラムを実行してプログラムの誤りを訂正するデバ
ッグ装置において、デバッグ対象となるマイクロコンピ
ュータのサブルーチンコール時にスタック領域に退避し
たリターンアドレスと前記サブルーチンコール時に記憶
回路に書き込まれたリターンアドレスとをリターン時に
リアルタイムに比較する比較回路を備えたことを特徴と
するデバッグ装置のリターンアドレス監視回路。
In a debugging device that executes a program and corrects program errors, the return address saved in the stack area at the time of a subroutine call of the microcomputer to be debugged and the return address written to the storage circuit at the time of the subroutine call are checked in real time at the time of return. A return address monitoring circuit for a debugging device, characterized by comprising a comparison circuit for comparing.
JP28361489A 1989-04-24 1989-04-24 Return address monitoring circuit of debug device Expired - Lifetime JP2754899B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP28361489A JP2754899B2 (en) 1989-04-24 1989-04-24 Return address monitoring circuit of debug device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP28361489A JP2754899B2 (en) 1989-04-24 1989-04-24 Return address monitoring circuit of debug device

Publications (2)

Publication Number Publication Date
JPH03223938A true JPH03223938A (en) 1991-10-02
JP2754899B2 JP2754899B2 (en) 1998-05-20

Family

ID=17667787

Family Applications (1)

Application Number Title Priority Date Filing Date
JP28361489A Expired - Lifetime JP2754899B2 (en) 1989-04-24 1989-04-24 Return address monitoring circuit of debug device

Country Status (1)

Country Link
JP (1) JP2754899B2 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH09179753A (en) * 1995-12-26 1997-07-11 Nec Software Ltd Stack information collecting system using timing of return processing

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH09179753A (en) * 1995-12-26 1997-07-11 Nec Software Ltd Stack information collecting system using timing of return processing

Also Published As

Publication number Publication date
JP2754899B2 (en) 1998-05-20

Similar Documents

Publication Publication Date Title
JP2526688B2 (en) Programmable controller and partial execution method of sequence program
EP0638864B1 (en) Development support system for microcomputer with internal cache
US5257269A (en) Error controller for use in debugging microprocessor
JPH03223938A (en) Return address monitoring circuit for debugging device
JPH0581087A (en) Processor monitoring system
JP2000353109A (en) Emulator and emulation system
KR20000045665A (en) Interrupt generation circuit
JPS59183443A (en) Debug device
JPS6270947A (en) Control system for debug interruption
JPS6282437A (en) Control system for interruption of debug in information processor
JPH05224985A (en) Microprogram controller
JPH04215106A (en) Programmable controller
JPS6282438A (en) Control system for interruption of debug in information processor
JPH02242439A (en) Program load control system
JPS5916057A (en) Microcomputer
JPH04367902A (en) Programmable controller
JPH03211619A (en) Data processor
JPH02297225A (en) Microprocessor
JPS6091458A (en) Program debug device of microprocessor
JPS61169943A (en) Stack tracer circuit
JPH04337847A (en) Program check method
JPS61233841A (en) Personal computer with self-diagnostic function
JPH01181133A (en) Break point setting device
JPS6227421B2 (en)
JPH02148340A (en) System for controlling writing in control storage