JP2591432B2 - Trace device - Google Patents

Trace device

Info

Publication number
JP2591432B2
JP2591432B2 JP5218174A JP21817493A JP2591432B2 JP 2591432 B2 JP2591432 B2 JP 2591432B2 JP 5218174 A JP5218174 A JP 5218174A JP 21817493 A JP21817493 A JP 21817493A JP 2591432 B2 JP2591432 B2 JP 2591432B2
Authority
JP
Japan
Prior art keywords
address
program
memory
base pointer
value
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
JP5218174A
Other languages
Japanese (ja)
Other versions
JPH0756766A (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
Nippon Electric Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Nippon Electric Co Ltd filed Critical Nippon Electric Co Ltd
Priority to JP5218174A priority Critical patent/JP2591432B2/en
Publication of JPH0756766A publication Critical patent/JPH0756766A/en
Application granted granted Critical
Publication of JP2591432B2 publication Critical patent/JP2591432B2/en
Anticipated expiration legal-status Critical
Expired - Lifetime legal-status Critical Current

Links

Landscapes

  • Debugging And Monitoring (AREA)

Description

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

【0001】[0001]

【産業上の利用分野】本発明はプログラムをデバッグす
るためのトレース装置に関し、特に、局所変数をトレー
スするトレース装置に関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a tracing device for debugging a program, and more particularly to a tracing device for tracing local variables.

【0002】[0002]

【従来の技術】通常、C言語の様な高級言語ではプログ
ラムの特定部分たとえばサブルーチン、あるいは割り込
みルーチンの処理だけに関与する局所変数はスタック上
に割りつけられ、局所変数へのアクセスは特定のレジス
タに対するレジスタ相対アクセス命令により行われる。
このレジスタをベースポインタと呼ぶ。
2. Description of the Related Art Normally, in a high-level language such as the C language, local variables involved only in processing a specific part of a program, for example, a subroutine or an interrupt routine, are allocated on a stack, and access to the local variables is performed by a specific register. This is performed by a register relative access instruction for.
This register is called a base pointer.

【0003】ベースポインタとして特定のレジスタをべ
ースポインタ専用として確保する場合がある。これを図
11、図12、図13を参照して説明する。図11の
(A)、(B)はC言語のソースプログラムであり、図
12の(A)、(B)はhlレジスタをベースポインタ
に割付けるようにした場合の図11の(A)、(B)の
ソースプログラムのコンパイル後のオブジェクトのアセ
ンブルリストであり、図13の(A)はhlレジスタを
ベースポインタに割り付けた場合に関数y()が関数x
()から呼び出された時のスタックの内容を示す。すな
わち、図12の(A)、(B)では各関数の局所変数の
ベースのアドレスはベースポインタとなるhlレジスタ
に格納され、局所変数へのアクセスはhlレジスタによ
るレジスタ相対アドレッシングで行われる。
In some cases, a specific register is reserved as a base pointer exclusively for the base pointer. This will be described with reference to FIGS. 11, 12, and 13. FIG. FIGS. 11A and 11B are C language source programs, and FIGS. 12A and 12B are diagrams in which the hl register is assigned to the base pointer, and FIGS. FIG. 13B is an assemble list of an object after compiling the source program. FIG. 13A shows a case where a function y () is a function x when an hl register is assigned to a base pointer.
Shows the contents of the stack when called from (). That is, in FIGS. 12A and 12B, the base address of the local variable of each function is stored in the hl register serving as a base pointer, and access to the local variable is performed by register relative addressing using the hl register.

【0004】図13の(A)に示す局所変数のアドレス
は一意に確定したものではなく、関数が呼び出された時
のスタックトップのアドレスによって変化する。たとえ
ば、同じy()という関数であっても、それが呼び出さ
れた時のスタックトップアドレスが図13の(B)に示
す0FE08hの場合と図13の(C)に示す0FE1
0hの場合とでは、局所変数c,d,e,f,のアドレ
スも8バイト異なる。このように局所変数のアドレスが
一意に決まったものではなく変化するものであるという
ことは、逆にアドレスが同じであっても、そのアドレス
に割り付けられる局所変数は変化するということでもあ
る。たとえば、スタックトップが図13の(D)に示す
0FE04hの時に呼び出された関数x()の局所変数
aとスタックトップが図13の(E)に示す0FE08
hの時に呼び出された関数y()の局所変数eとは、ど
ちらも0FE02hというアドレスになる。
The address of a local variable shown in FIG. 13A is not uniquely determined, but changes according to the address of the top of the stack when the function is called. For example, even if the function y () is the same, the stack top address when it is called is 0FE08h shown in FIG. 13B and 0FE1h shown in FIG.
In the case of 0h, the addresses of the local variables c, d, e, f also differ by 8 bytes. The fact that the address of a local variable is not uniquely determined but changes is that, even if the address is the same, the local variable assigned to the address changes. For example, the local variable a of the function x () called when the stack top is 0FE04h shown in FIG. 13D and the stack top are 0FE08 shown in FIG.
The local variable e of the function y () called at the time of h is an address of 0FE02h.

【0005】 上述の性質をもった局所変数を識別する
ためには、データアクセス時のアドレスと、その時の局
所変数のベースアドレスと、その時のプログラム実行ア
ドレスの3つのトレースが必要になる。たとえば、デー
タアクセス時のアドレスとは、図12の(A)の〔hl
+3〕、〔hl+2〕、〔hl+1〕、〔hl〕、図1
2の(B)の〔hl+7〕、〔hl+6〕…〔hl〕で
あり、局所変数のベースアドレスとは図12の(A)の
hl、図12の(B)のhlである。この場合、両者の
間では、共通する値があるので、図12の(A)のプロ
グラムか図12の(B)のプログラムかの識別をプログ
ラム実行アドレスいわゆるプログラムカウンタ(PC)
値で識別するのである。なお、上述の3つのアドレスが
トレースされていない場合には、局所変数へのアクセス
では、どの局所変数にアクセスしたかを識別しようとす
ると、トレースデータに対して手間のかかるデータ処理
をしなければならない。すなわち、その時のプログラム
実行アドレスを得るためには、トレースデータを遡って
データアクセス直前のフェッチアドレスを調べなければ
ならず、また、その時の局所変数のベースアドレスを得
るためには、やはりトレースデータを遡って最後にベー
スポインタであるhlレジスタに代入された値を調べな
ければならない。さらに、トレースメモリの容量は小さ
いためにトレースメモリが一杯になった場合には、最古
のトレースデータが最新のトレースデータで上書きされ
ているので、トレースデータが消されてしまい、局所変
数の識別が全く不可能になってしまう場合もある。ま
た、クオリファイトレースやセクショントレースを行っ
た場合には、これらのデータがトレース対象外になって
しまい、トレースメモリに記録されていない場合もあ
り、このような場合にも、局所変数の識別が全く不可能
になってしまう。
In order to identify a local variable having the above-described properties, three traces of an address at the time of data access, a base address of the local variable at that time, and a program execution address at that time are required. For example, the address at the time of data access is [hl] in FIG.
+3], [hl + 2], [hl + 1], [hl], FIG.
[Hl + 7], [hl + 6]... [Hl] in FIG. 2B, and the base addresses of the local variables are hl in FIG. 12A and hl in FIG. In this case, since there is a common value between the two, the discrimination between the program of FIG. 12A and the program of FIG.
They are identified by value. In the case where the above three addresses are not traced, in accessing the local variables, if an attempt is made to identify which local variable has been accessed, it is necessary to perform time-consuming data processing on the trace data. No. That is, in order to obtain the program execution address at that time, the trace data must be traced back to check the fetch address immediately before the data access, and to obtain the base address of the local variable at that time, the trace data must also be obtained. It is necessary to check the value assigned to the h1 register, which is the base pointer, retroactively. Furthermore, when the trace memory is full due to the small capacity of the trace memory, the oldest trace data is overwritten with the latest trace data, so the trace data is erased and the identification of local variables Sometimes it becomes impossible at all. In addition, when qualifying trace or section trace is performed, these data may be excluded from the trace target and may not be recorded in the trace memory. It will be impossible.

【0006】このため、本願出願人は、ベースポインタ
がhlレジスタに割り付けられている場合にデータアク
セス時のアドレスと、その時の局所変数のベースのアド
レスと、その時のプログラム実行アドレスの3つをトレ
ースする図14のトレーサ装置を提案している。図14
においては、マイクロプロセッサのエバチップ(Eva
luation chip)1をトレースメモリ2にト
レースする。図14では、hlレジスタ値をトレースす
るために、内部レジスタを識別するデコーダ3、ナンド
回路4、ベースポインタラッチ回路5等を設けてある。
すなわち、エバチップ1において内部レジスタへライト
した時に、どの内部レジスタへ書き込んだかを識別する
レジスタアドレスRA、書き込んだレジスタデータR
D、内部レジスタへ書き込んだことを通知するレジスタ
ライト信号RWがエバチップ1から送出される。これを
受けてデコーダ3がレジスタアドレスRAが局所変数の
ベースアドレスを保持するレジスタ(ここではhlレジ
スタ)と一致した時に一致信号をナンド回路4に送出す
る。ナンド回路4はエバチップ1から*レジスタライト
信号RWも受ける。この結果、デコーダ3からの一致信
号と*レジスタライト信号RWから作成したストローブ
信号STR1でレジスタデータRDはベースポインタラ
ッチ5にラッチされる。また、図14では、プログラム
実行アドレスをトレースするために、プログラム実行ア
ドレスラッチ回路6を設けてある。すなわち、エバチッ
プ1から出力されたアドレスバスABの内容は*リード
信号S1 及び命令フェッチ/*データアクセスステータ
ス信号S2 から生成したフェッチストローブ信号STR
2でプログラム実行アドレスラッチ6にラッチされる。
ベースポインタラッチ回路5の出力及びプログラム実行
アドレスラッチ回路6の出力はトレースメモリ2に入力
され、アドレスバスAB、データバスDB、*ライト信
号S3 等の値と共にトレースメモリ2に*リード信号S
1 及び*ライト信号S3 から生成された*トレーサライ
ト信号TWによって書き込まれる。
For this reason, the applicant of the present application traces three addresses: the address at the time of data access, the base address of the local variable at that time, and the program execution address at that time when the base pointer is allocated to the hl register. 14 is proposed. FIG.
In the Eva chip of the microprocessor (Eva
trace chip) is traced to the trace memory 2. In FIG. 14, in order to trace the value of the hl register, a decoder 3, a NAND circuit 4, a base pointer latch circuit 5, and the like for identifying an internal register are provided.
That is, when writing to the internal register in the evaluation chip 1, the register address RA for identifying which internal register has been written and the written register data R
D, a register write signal RW for notifying that data has been written to the internal register is sent from the evaluation chip 1. In response, the decoder 3 sends a match signal to the NAND circuit 4 when the register address RA matches a register (here, the hl register) holding the base address of the local variable. The NAND circuit 4 also receives the * register write signal RW from the evaluation chip 1. As a result, the register data RD is latched by the base pointer latch 5 with the strobe signal STR1 created from the coincidence signal from the decoder 3 and the * register write signal RW. In FIG. 14, a program execution address latch circuit 6 is provided to trace the program execution address. That is, the contents of the address bus AB output from the evaluation chip 1 * read signal S 1 and the instruction fetch / * data access status signal fetch strobe generated from S 2 signal STR
In step 2, the program execution address latch 6 latches the program execution address.
The output of the base pointer latch circuit 5 and the output of the program execution address latch circuit 6 are input to the trace memory 2 and are supplied to the trace memory 2 together with the values of the address bus AB, the data bus DB, the * write signal S 3, etc.
It is written by 1 and * write signal generated from S 3 * tracer write signal TW.

【0007】図15は図14のトレースメモリ2の内容
を示したものであり、本図では説明を簡単にするために
データアクセス時の情報のみ示してある。トレースメモ
リ2にはアドレス、データ、ステータス、ベースポイン
タ値、プログラム実行アドレスが記録されている。ま
た、図16はCコンパイラによって生成されたデバッグ
情報のテーブルを示したものであり、予め、図示しない
メモリに書き込まれている。テーブルには関数名、関数
開始アドレス、関数終了アドレスがあり、各関数ごとに
関数に含まれる変数名、変数オフセット、変数サイズの
テーブルを有している。図17は、図15に示すトレー
スメモリ2の内容及び図16に示すデバッグ情報を用い
て局所変数の識別を行うフローチャートであって、図1
4において図示しないマイクロプロセッサによって実行
される。まず、ステップ1701において、トレースメ
モリ2中のプログラム実行アドレスが関数の開始アドレ
スと終了アドレスとの間にあるかどうかを判別し、デー
タアクセスを行った関数を特定する。次に、ステップ1
702において、アドレスの値からベースポインタの値
を引いて変数オフセットを計算する。さらに、ステップ
1703において、上述の特定した関数の局所変数の中
から、計算した変数オフセットの値が、テーブル上の変
数オフセットと変数オフセットに変数サイズを加えた範
囲内に含まれるものを探し、局所変数を判別する。そし
て、図17のルーチンはステップ1704にて終了す
る。
FIG. 15 shows the contents of the trace memory 2 shown in FIG. 14. Only the information at the time of data access is shown in FIG. The address, data, status, base pointer value, and program execution address are recorded in the trace memory 2. FIG. 16 shows a table of debug information generated by the C compiler, which is written in advance in a memory (not shown). The table includes a function name, a function start address, and a function end address. Each function has a table of variable names, variable offsets, and variable sizes included in the function. FIG. 17 is a flowchart for identifying a local variable using the contents of the trace memory 2 shown in FIG. 15 and the debug information shown in FIG.
4 is executed by a microprocessor (not shown). First, in step 1701, it is determined whether or not the program execution address in the trace memory 2 is between the start address and the end address of the function, and the function that has performed data access is specified. Next, step 1
At 702, a variable offset is calculated by subtracting the value of the base pointer from the value of the address. Further, in step 1703, the local variable of the specified function is searched for a variable in which the calculated value of the variable offset falls within the range obtained by adding the variable size to the variable offset and the variable offset on the table. Determine the variables. Then, the routine in FIG. 17 ends in step 1704.

【0008】[0008]

【発明が解決しようとする課題】しかしながら、上述の
先に提案したトレース装置においては、コンパイラが
定のレジスタたとえばhlレジスタをベースポインタ専
用として確保するようなオブジェクトを生成することを
前提としているので、このようなコンパイラでは数少な
い内部レジスタが実質的に減少するという課題がある。
However, in the above-described tracing device, the compiler generates an object that reserves a specific register, for example, the hl register exclusively for the base pointer.
Because of this assumption, such a compiler has a problem that a few internal registers are substantially reduced .

【0009】 コンパイラによっては、ベースポインタ
としてスタックポインタを使用させるオブジェクトがあ
る。スタックポインタをベースポインタとして兼用させ
ると、次のような問題がある。つまり、特定のレジスタ
をベースポインタ専用として確保する場合には、サブル
ーチンの入ロでベースポインタの退避と設定を行ってい
る部分(プロローグ部分という)及びサブルーチンの出
口でベースポインタの復帰を行っている部分(エピロー
グ部分という)を除いて、ベースポインタの値はサブル
ーチンの中では一定になっている。これに対して、スタ
ックポインタをベースポインタとして兼用すると、サブ
ルーチン呼び出し時に引数をスタックにプッシュするた
め、この部分で、局所変数のベースのアドレスを保持し
ているべきスタックポインタの値が変化してしまう。こ
れをより詳細に説明すると、図18の(A)、(B)、
(C)は、特定のレジスタ(hl)をベースポインタ専
用として確保する場合と、スタックポインタ(sp)を
ベースポインタとして兼用する場合との相違を説明する
ためのソースログラム、図19、図20(図18の
(A)に対応)、図21(図18の(B)に対応)、図
22(図18の(C)に対応)はhlレジスタをベース
ポインタ専用として確保した場合のコンパイル後のオブ
ジェクトのアセンブルリストにspとhlの値の変化を
併記したものである。ここで、図21、図22のspと
hlの値は、図20で*を付けた所でのサブルーチン呼
び出し時の値である。これらから明らかな様に、ベース
ポインタであるhlはサブルーチンの入口と出口で変化
しているのみであり、サブルーチン内で実際に局所変数
にアクセスしている部分では一定になっている。このた
め、サブルーチン内では同一の局所変数にアクセスする
のに、常に同じ相対オフセットを使ってアクセスしてい
る。これに対し、図23、図24(図18の(A)に対
応)、図25(図18の(B)に対応)、図26(図1
8の(C)に対応)はスタックポインタspをベースポ
インタとして兼用させた場合のコンパイル後のオブジェ
クトアセンブルリストにsp値の変化を併記したもの
である。ここで、図25、図26のスタックポインタs
pの値は、図24で*を付けた所でのサブルーチン呼び
出し時の値である。これから明らかな様に、ベースポイ
ンタであるspの値は、サブルーチンに渡す引数をスタ
ックにプッシュ(push)したり、サブルーチンから
復帰する時に引数領域を開放するためにスタックをポッ
プ(pop)したりするごとに変化していく。この結
果、サブルーチン内で同一の局所変数にアクセスするの
に、複の異なったオフセットを使ってアクセスしてい
る。たとえば、図23ではaという局所変数にアクセス
するのに、+3、+5、+7の3つのオフセットを使っ
ている。このように、スタックポインタをベースポイン
タとして兼用する場合は、スタックポインタの値が細か
く変化するため、ベースポインタの値を単純にトレース
していたのでは、トレース結果を解析するのに、スタッ
クポインタが変化する場所ごとに局所変数のオフセット
の情報が必要になり、デバッグ情報の量が多くなり、解
析に時間がかかることになる。
Some compilers use a base pointer
Object that uses the stack pointer as
You. When the stack pointer is also used as the base pointer , the following problem occurs. In other words, when a specific register is reserved exclusively for the base pointer, the part where the base pointer is saved and set at the entry of the subroutine (referred to as the prologue part) and the base pointer is restored at the exit of the subroutine. Except for the part (referred to as epilogue part), the value of the base pointer is constant in the subroutine. On the other hand, if the stack pointer is also used as the base pointer, the argument is pushed onto the stack when calling a subroutine, and the value of the stack pointer that should hold the base address of the local variable changes in this part. . This will be described in more detail with reference to FIGS.
(C) a particular register (hl) in the case of securing the base pointer only the source program to explain the difference between the case of shared stack pointer (sp) as a base pointer, 19, 20 (Corresponding to (A) in FIG. 18), FIG. 21 (corresponding to (B) in FIG. 18), and FIG. 22 (corresponding to (C) in FIG. 18) after compiling when the hl register is reserved exclusively for the base pointer. And the change of the values of sp and hl are written together in the assemble list of the object. Here, the values of sp and hl in FIGS. 21 and 22 are the values at the time of calling the subroutine at the place marked with * in FIG. As is apparent from these, the hl which is the base pointer only changes at the entry and exit of the subroutine, and is constant in the part where the local variable is actually accessed in the subroutine. Therefore, the same local variable is always accessed using the same relative offset in the subroutine. On the other hand, FIG. 23, FIG. 24 (corresponding to FIG. 18A), FIG. 25 (corresponding to FIG. 18B), and FIG.
Corresponding to 8 (C)) is obtained by also shown a change in sp value assembly list of objects of the compiled when was also used the stack pointer sp as a base pointer. Here, the stack pointer s shown in FIGS.
The value of p is the value at the time of calling the subroutine at the place marked * in FIG. As is apparent from the above description, the value of sp, which is the base pointer, pushes an argument to be passed to the subroutine onto the stack, and pops the stack to release an argument area when returning from the subroutine. It changes every time. As a result, to access the same local variable in a subroutine, it is accessed using different offsets of several. For example, in FIG. 23, three offsets of +3, +5, and +7 are used to access the local variable a. As described above, when the stack pointer is also used as the base pointer, the value of the stack pointer changes finely. Therefore, if the trace of the base pointer is simply traced, the stack pointer is required to analyze the trace result. The information of the offset of the local variable is required for each changing place, the amount of debug information increases, and the analysis takes time.

【0010】[0010]

【課題を解決するための手段】 上述の課題を解決する
ために本発明は、ソースプログラムをコンパイルして得
られたオブジェクトプログラムの実行をトレースするト
レース装置において、オブジェクトプログラムのサブル
ーチンもしくは割り込みルーチンの呼出し時に発生する
信号によりインクレメントもしくはデクレメントされ、
オブジェクトプログラムのサブルーチンもしくは割り込
みルーチンの復帰時に発生する信号によりデクレメント
もしくはインクレメントされるアップダウンカウンタ
と、オブジェクトプログラムのサブルーチンもしくは割
り込みルーチンの呼出し時に発生する信号をストローブ
信号として受信し、アドレスバスからのスタックポイン
タ値をソースプログラムの局所変数のベースポインタ値
としてアップダウンカウンタの値をアドレスとする記憶
場所に退避するベースポインタライト用メモリと、アッ
プダウンカウンタの値をアドレスとするベースポインタ
ライト用メモリの出力をベースポインタ値としてオブジ
ェクトプログラムがデータアクセスを行ったときに、少
なくとも、ベースポインタ値、プログラム実行アドレス
及びアクセスしたアドレスをトレースするトレースメモ
リとを備えている。また、本発明は、オブジェクトプロ
グラムのアドレスをメモリアドレスとして入力し、スタ
ックポインタ値がベースポインタ値として確定したアド
レスまでオブジェクトプログラムの実行が至ったことを
示す信号を出力するベースポインタ確定値検出用メモリ
と、スタックポインタ値が更新される毎に該スタックポ
インタ値をラッチするスタックポインタラッチ回路とを
備えている。この場合、ベースポインタライト用メモリ
は、ベースポインタ確定値検出用メモリからの信号をス
トローブ信号として受信し、スタックポインタラッチ回
路からのスタックポインタ値をソースプログラムの局所
変数のベースポインタ値としてアップダウンカウンタの
値をアドレスとする記憶場所に退避する。
According to the present invention, there is provided a trace apparatus for tracing the execution of an object program obtained by compiling a source program. It is incremented or decremented by the signal generated at the time,
An up / down counter that is decremented or incremented by a signal generated when the subroutine or interrupt routine of the object program returns, and a signal generated when the subroutine or interrupt routine of the object program is called are received as strobe signals and received from the address bus. A base pointer write memory that saves a stack pointer value as a base pointer value of a local variable of a source program to a storage location whose address is an up / down counter value, and a base pointer write memory that uses an up / down counter value as an address Object output as base pointer value
When the project program accesses data,
At least, base pointer value, program execution address
And a trace memory for tracing the accessed address . Further, the present invention inputs the address of the object program as the memory address, a base pointer determined value detection execution of the object program stack pointer value to the address that was established as a base pointer value to output a signal indicating that the Tsu optimum The memory includes a memory and a stack pointer latch circuit that latches the stack pointer value each time the stack pointer value is updated. In this case, the base pointer write memory receives the signal from the base pointer determined value detection memory as a strobe signal, and uses the stack pointer value from the stack pointer latch circuit as the base pointer value of the local variable of the source program, and Is saved to a storage location whose address is the value of.

【0011】[0011]

【作用】上述の手段によれば、デバッグ情報を増やすこ
となく、スタックポインタソースプログラムの局所変
数のベースポインタとして兼用しているオブジェクトの
場合でも効率よく局所変数は識別される。
According to the above-mentioned means, without increasing debug information, the stack pointer of the object which also serves as the base pointer of the local variable of the source program can be used.
Even in such a case, local variables are efficiently identified .

【0012】[0012]

【実施例】図1は本発明に係るトレース装置の第1の実
施例を示すブロック回路図である。図1においては、図
14のデコーダ3、ナンド回路、ベースポインタラッ
チ回路等の代わりに、スタックポインタspをアドレ
スバスABから読み取るために、アップダウンカウンタ
7、オア回路8、ベースポインタライト用メモリ9等を
設けてある。ベースポインタのトレース以外は図14
場合と同一である。アップダウンカウンタ7は、サブル
ーチンの呼び出し時あるいは割込みルーチンの呼出し時
に信号*CALL/*INT信号によって+1カウント
アップされ、サブルーチンの復帰時あるいは割込みルー
チンの復帰時に信号*RET/*IRET信号によって
1カウントダウンされる。アップダウンカウンタ7の出
力値はベースポインタライト用メモリ9のアドレスとな
る。また、ベースポインタライト用メモリ9にはオア回
路8によってサブルーチンもしくは割込みルーチンの呼
出し時かつ書込み時にアドレスバスAB上のスタックポ
インタsp値が書き込まれる。
FIG. 1 is a block circuit diagram showing a first embodiment of a trace device according to the present invention. In FIG.
Instead of the fourteen decoders 3, the NAND circuit 4 , the base pointer latch circuit 5, etc., an up / down counter 7, an OR circuit 8, a base pointer write memory 9, etc. are provided to read the stack pointer sp from the address bus AB. is there. Except traces of the base pointer is the same as in FIG. 14. The up / down counter 7 is incremented by +1 by a signal * CALL / * INT when calling a subroutine or an interrupt routine, and decremented by 1 by a signal * RET / * IRET when returning from a subroutine or interrupt routine. You. The output value of the up / down counter 7 becomes an address of the base pointer write memory 9. The value of the stack pointer sp on the address bus AB is written into the base pointer write memory 9 by the OR circuit 8 when a subroutine or an interrupt routine is called and written.

【0013】図2のタイミング図を参照して図1の回路
動作を説明する。図2の(A)はサブルーチンの呼び出
し時及び復帰時のタイミング図である。ずなわち、*C
ALL/*INTステータス信号は、サブルーチンの呼
び出し動作の開始からリターンアドレスをスタックにプ
ッシュし終わるまでの時間t1〜t3 、0レベルであ
る。この結果、時刻t1 にて、アップダウンカウンタ7
は、この*CALL/*INTステータス信号のダウン
エッジでアップカウントアップされ、ベースポインタラ
イト用メモリ9のアドレスを1番地先に進める。サブル
ーチン呼出し時の時間t2 〜t3 には、リターンアドレ
スをスタックにプッシュするためのメモリへの書込み動
作が行われるが、この時の*ライト信号をオア回路8に
よって取り出しベースポインタライト用メモリ9のR/
*W端子に供給する。この結果、アドレスバスABに出
力されるスタックアドレスspをベースポインタライト
用メモリ9に書き込む。トレースメモリ2には、このベ
ースポインタライト用メモリ9の出力をベースポインタ
値として書き込む。なお、図示しないが、サブルーチン
の中で更にサブルーチン呼び出しが行われた場合は、ベ
ースポインタライト用メモリ9のアドレスが更に1番地
先に進み、そこにベースポインタ値が書き込まれる。サ
ブルーチンから復帰する場合は、*RET/*IRET
ステータス信号が、サブルーチン復帰動作の開始からリ
ターンアドレスをスタックからポップし終わるまでの時
間t4 〜t5 、0レベルである。この結果、時刻t5
てアップダウンカウンタ7は、*RET/*IRETス
テータス信号のアップエッジでカウントダウンされベー
スポインタライト用メモリ9のアドレスを一番地後に戻
す。これにより、ベースポインタライト用メモリ9の出
力DOUT から、サブルーチン呼び出しが行われる以前の
ベースポインタ値が出力されるようになる。
The operation of the circuit of FIG. 1 will be described with reference to the timing chart of FIG. FIG. 2A is a timing chart when a subroutine is called and when it returns. That is, * C
The ALL / * INT status signal is at the 0 level from time t 1 to t 3 from the start of the subroutine calling operation to the end of pushing the return address onto the stack. As a result, at time t 1 , the up-down counter 7
Is incremented at the falling edge of the * CALL / * INT status signal, and the address of the base pointer write memory 9 is advanced to the first address. The subroutine call at time t 2 ~t 3, although the write operation of the return address to memory for pushing the stack is performed, the base pointer write memory 9 removed * write signal when the by OR circuit 8 R /
* Supply to W terminal. As a result, the stack address sp output to the address bus AB is written to the base pointer write memory 9. The output of the base pointer write memory 9 is written to the trace memory 2 as a base pointer value. Although not shown, when a subroutine is further called in the subroutine, the address of the base pointer writing memory 9 further advances to the first address, and the base pointer value is written there. * RET / * IRET when returning from the subroutine
Status signal is, time t 4 ~t 5 from the start of the subroutine return operation until you pop the return address from the stack, is zero level. As a result, the up-down counter 7 at time t 5 is, * RET / * IRET is counted down by the up-edge of the status signal returns the address of the base pointer write memory 9 after one address. Thus, the base pointer value before the subroutine is called is output from the output D OUT of the base pointer write memory 9.

【0014】図2の(B)は割込みルーチンの呼出し時
および割込みルーチンからの復帰時のタイミングチャー
トである。図2の(A)のサブルーチンの場合と動作が
異なるは、割込みルーチンの場合には、スタックにはリ
ターンアドレスだけではなくフラグレジスタもプッシュ
されるために*CALL/*INTステータス信号が0
レベルの間にメモリへの書込み動作が矢印X1、X2に
示すごとく2回行われる点である。ベースポインタ値と
して必要なのは、2回目の書込み動作が行われた時のア
ドレスであり、1回目の書込み動作が行われたときのア
ドレスは不要なので、ベースポインタライト用メモリ9
のアドレスを変更させずに、同一アドレスにオーバライ
トするようにしている。この場合、トレースメモリ2に
1回目の書込み動作が行われた時のスタックアドレスが
書き込まれてしまうが、この値は局所変数の識別に使用
されることはないので問題はない。
FIG. 2B is a timing chart at the time of calling the interrupt routine and at the time of returning from the interrupt routine. The operation is different from that of the subroutine of FIG. 2A. In the case of the interrupt routine, not only the return address but also the flag register is pushed on the stack, so that the * CALL / * INT status signal becomes 0.
The point is that the write operation to the memory is performed twice as shown by arrows X1 and X2 during the level. What is needed as the base pointer value is the address when the second write operation is performed, and the address when the first write operation is performed is unnecessary.
Are not changed, and the same address is overwritten. In this case, the stack address at the time of performing the first write operation is written in the trace memory 2, but this value is not used for identifying local variables, so there is no problem.

【0015】図3は本発明に係るトレース装置の第2の
実施例を示すブロック回路図である。図1の第1の実施
例においては、*CALLステータス信号あるいは*I
NTステータス信号がリターンアドレスをプッシュする
まで0レベルを維持している場合であるが、図3の第2
の実施例においては、*CALL信号あるいは*INT
ステータス信号が短時間しか0レベルを維持していない
場合であり、この場合にも、第1の実施例と同等の動作
を行えるようにしたものである。このため、図3におい
ては、図1の構成要素に、カウンタ10及びカウンタ1
1を付加してある。ここで、カウンタ10は、トリガ端
子Trgに*CALL信号の0レベルを受けた後にクロ
ック端子CKに0レベルのパルスを1個計数して出力端
子Qに1レベルのパルスを出力するものである。また、
カウンタ11は、トリガ端子Trgに*INT信号の0
レベルを受けた後にクロック端子CKに0レベルのパル
スを2個計数して出力端子Qに1レベルのパルスを出力
するものである。
FIG. 3 is a block circuit diagram showing a second embodiment of the trace device according to the present invention. In the first embodiment of FIG. 1, the * CALL status signal or * I
This is the case where the NT status signal maintains the 0 level until the return address is pushed.
In the embodiment of *, * CALL signal or * INT
This is the case where the status signal maintains the 0 level only for a short time, and in this case, the same operation as in the first embodiment can be performed. Therefore, in FIG. 3, the components of FIG.
1 is added. Here, the counter 10 counts one zero-level pulse at the clock terminal CK after receiving the zero level of the * CALL signal at the trigger terminal Trg, and outputs a one-level pulse to the output terminal Q. Also,
The counter 11 outputs * INT signal 0 to the trigger terminal Trg.
After receiving the level, two 0-level pulses are counted to the clock terminal CK and a 1-level pulse is output to the output terminal Q.

【0016】 図2の(A)、(B)に対応する図4の
(A)、(B)のタイミング図を参照すると、サブルー
チンまたは割り込みルーチンの呼び出し動作が行われて
いることを示す*CALLステータス信号および*IN
Tステータス信号が、動作の開始時点のみ0レベルを出
力し、スタックへリターンアドレスやフラグレジスタを
プッシュしている時点では1レベルに戻っている。この
ため、図4の(A)では、カウンタ10は、*CALL
ステータス信号が0レベルになった後で、1回目の*ラ
イト信号が0レベルの期間のみ0レベルを出力する。ま
た、図4の(B)では、カウンタ11は、*INTステ
ータス信号が0レベルになった後で、2回目の*ライト
信号が0レベル期間のみ0レベルを出力する。なお、オ
ア回路8は、カウンタ10、11の出力が遅延する場合
でも、ベースポインタライト用メモリ9への書込み動作
を遅延なく終わらせる作用をする。また、図1の第1の
実施例と同様に、アップダウンカウンタ7は*CALL
ステータス信号または*INTステータス信号のダウン
エッジでアップカウントを行い、サブルーチンからの復
帰を示す*RETステータス信号または割り込みルーチ
ンからの復帰を示す*IRETステータス信号のダウン
エッジでダウンカウントを行う。ベースポインタライト
用メモリ9の動作も第1の実施例と同じである。
Referring to the timing charts of FIGS. 4A and 4B corresponding to FIGS. 2A and 2B, * CALL indicates that a subroutine or an interrupt routine is being called. Status signal and * IN
The T status signal outputs the 0 level only at the start of the operation, and returns to the 1 level when the return address or the flag register is pushed onto the stack. For this reason, in FIG. 4A, the counter 10 indicates * CALL
After the status signal goes to the 0 level, the 0 level is output only while the first * write signal is at the 0 level. In FIG. 4B, after the * INT status signal goes to the 0 level, the counter 11 outputs the 0 level only during the period in which the second * write signal is at the 0 level. The OR circuit 8 functions to end the write operation to the base pointer write memory 9 without delay even when the outputs of the counters 10 and 11 are delayed. Also , as in the first embodiment of FIG. 1, the up / down counter 7 is set to * CALL.
The up-counting is performed at the down edge of the status signal or the * INT status signal, and the down-counting is performed at the down edge of the * RET status signal indicating the return from the subroutine or the * IRET status signal indicating the return from the interrupt routine. The operation of the base pointer write memory 9 is the same as in the first embodiment.

【0017】 上述の第1、第2の実施例において得ら
れたトレースメモリ2の内容は、トレースされたベース
ポインタ値が正しいベースポインタ値ではなく、コンパ
イラが出力したデバッグ情報により補正しなければなら
ない値であるという点を除いて、図15の内容と同じで
ある。以下、この補正方法について、Cコンパイラを例
にして、説明する。コンパイラが出力したオブジェクト
は、プロローグ部分において、局所変数の領域を確保す
るためにスタックポインタを確保するサイズ分だけ減じ
ている。たとえば、関数の場合、図23に示すごと
く、プロローグ部分でスタックポインタspを4(
イト分)減じており、また、関数pの場合、図25に示
すごとく、プロローグ部分でスタックポインタspを2
回(バイト分)減じている。従って、ベースポインタ
値を補正するためには、プロローグ部分で確保している
スタックサイズの情報が必要であり、図5に示すごと
く、コンパイラが、このスタックサイズの情報をデバッ
グ情報として出力している。つまり、図5においては、
各関数ごとに、プロローグ部分で確保するスタックサイ
ズを出力している点が図16と異なる。
The contents of the trace memory 2 obtained in the above-described first and second embodiments have to be corrected by the debug information output by the compiler because the traced base pointer value is not a correct base pointer value. It is the same as the contents of FIG. 15 except that it is a value. Hereinafter, this correction method will be described using a C compiler as an example. The object output by the compiler is reduced in the prologue portion by the size for securing the stack pointer in order to secure an area for local variables. For example, in the case of the function r , as shown in FIG. 23, the stack pointer sp is reduced by 4 ( 4 bytes) in the prologue part, and in the case of the function p, as shown in FIG. 2
Times ( 2 bytes). Therefore, in order to correct the base pointer value, information on the stack size secured in the prologue part is necessary, and as shown in FIG. 5, the compiler outputs this information on the stack size as debug information. . That is, in FIG.
The difference from FIG. 16 is that the stack size secured in the prologue portion is output for each function.

【0018】 図6は図1もしくは図3に示すトレース
メモリ2の内容及び図5に示すデバッグ情報を用いて局
所変数の識別を行うフローチャートであって、図1、図
において図示しないマイクロプロセッサによって実行
される。図6においては、図17のフローチャートに対
してステップ601を付加してある。すなわち、ステッ
プ1702にて変数オフセットを計算する前に、ステッ
プ601において、トレースされているプログラム実行
アドレスから関数を検索し、トレースされているベース
ポインタ値から該当関数の確保スタックサイズを減じ
て、正しいベースポインタ値を計算する。その後、ステ
ップ1702、1703にて図17と同様にベースポイ
ンタ値から局所変数を識別することになる。
FIG. 6 is a flowchart for identifying a local variable using the contents of the trace memory 2 shown in FIG. 1 or FIG. 3 and the debug information shown in FIG.
3 is executed by a microprocessor (not shown). In FIG. 6, step 601 is added to the flowchart of FIG. That is, before calculating the variable offset in step 1702, in step 601, a function is searched from the traced program execution address, and the secured stack size of the function is subtracted from the traced base pointer value to correct the function. Calculate the base pointer value. Thereafter, in steps 1702 and 1703, a local variable is identified from the base pointer value as in FIG.

【0019】 図7は本発明に係るトレース装置の第3
の実施例を示すブロック回路図である。図7において
は、図1の構成要素に対して、スタックポインタ値がベ
ースポインタ値として確定したことを出力するためのベ
ースポインタ確保値検出用メモリ12及びスタックポイ
ンタラッチ回路13を付加した。エバチップ1におい
て、スタックポインタspへの書込み動作が行われる
と、スタックポインタspへの書込みデータがスタック
ポインタデータとして出力される。同時に、スタックポ
インタへ書込みしたことを示すスタックポインタライト
信号が出力される。この結果、スタックポインタデータ
がスタックポインタラッチ回路13にラッチされること
になる。他方、ベースポインタ確定値検出用メモリ12
は、プログラムメモリと同一のアドレス空間を有し、か
つプログラムメモリと同じアドレスバスに接続される1
ビット幅のメモリである。プログラムメモリにデバッグ
対象プログラムをロードする時には、ベースポインタ確
保値検出用メモリ12に対して、デバッグ対象プログラ
ムの各サブルーチンのプロローグを抜けた所(図23、
図25、図26で◎を付けた所)のアドレスに1を書き
込み、それ以外の部分には全て0を書き込んでおく。ベ
ースポインタ確定値検出用メモリ12は、プログラムメ
モリと同じアドレスに接続されているので、デバッグ対
象プログラムの実行がプロローグを抜けた所で、それま
で0であった出力が1に変化する。この出力を、ナンド
回路8’で波形の鈍りを取り除いた後、ベースポインタ
ライト用メモリ9のR*W端子に入力し、スタックポ
インタラッチ回路13の出力をベースポインタライト用
メモリ9に書き込む。
FIG. 7 shows a third example of the tracing device according to the present invention.
FIG. 2 is a block circuit diagram showing an embodiment of the present invention. In FIG. 7, a base pointer reserved value detection memory 12 and a stack pointer latch circuit 13 for outputting that the stack pointer value is determined as the base pointer value are added to the components of FIG. In the evaluation chip 1, when a write operation to the stack pointer sp is performed, write data to the stack pointer sp is output as stack pointer data. At the same time, a stack pointer write signal indicating that writing has been performed on the stack pointer is output. As a result, the stack pointer data is latched by the stack pointer latch circuit 13. On the other hand, the base pointer fixed value detection memory 12
Have the same address space as the program memory and are connected to the same address bus as the program memory.
It is a bit-width memory. When the debug target program is loaded into the program memory, the base pointer reserved value detection memory 12 is passed through the prologue of each subroutine of the debug target program (FIG. 23,
1 is written in the address (indicated by ◎ in FIGS. 25 and 26), and 0 is written in all other portions. Since the base pointer fixed value detection memory 12 is connected to the same address as the program memory, the output which has been 0 changes to 1 when the execution of the debug target program exits the prologue. This output is input to the R / * W terminal of the base pointer write memory 9 after removing the dullness of the waveform by the NAND circuit 8 ', and the output of the stack pointer latch circuit 13 is written to the base pointer write memory 9.

【0020】サブルーチンの呼び出し時及び復帰時の場
合の図7の回路動作は図8に示される。図8において
は、 時刻t1 :CALL 命令フェッチ t2 :リターンアドレスのプッシュ t3 :プロローグ部分の命令フェッチ t4 :プロローグ部分の命令フェッチ t5 :プロローグ部分の命令フェッチ(スタックポイン
タへのライト動作あり) t6 :プロローグ部分を抜けた後の最初の命令フェッチ t7 :RET命令フェッチ t8 :リターンアドレスのポップ また、割り込みルーチンの呼び出し時及び復帰時の場合
の図7の回路動作は図9に示される。図9においては、 時刻t1 :フラグレジスタのプッシュ t2 :リターンアドレスのプッシュ t3 :プロローグ部分の命令フェッチ t4 :プロローグ部分の命令フェッチ t5 :プロローグ部分の命令フェッチ(スタックポイン
タへのライト動作あり) t6 :プロローグ部分を抜けた後の最初の命令フェッチ t7 :RET命令フェッチ t8 :リターンアドレスのポップ t9 :フラグレジスタのポップ である。
FIG. 8 shows the circuit operation of FIG. 7 when the subroutine is called and when it returns. In FIG. 8, time t 1 : CALL instruction fetch t 2 : push of return address t 3 : instruction fetch of prologue part t 4 : instruction fetch of prologue part t 5 : instruction fetch of prologue part (write operation to stack pointer) There) t 6: prolog first instruction fetch after exiting the t 7: RET instruction fetch t 8: return address popped Further, the circuit operation of FIG. 7 in the case when the calling time and the return of the interrupt routine 9 Is shown in In FIG. 9, time t 1 : push of flag register t 2 : push of return address t 3 : instruction fetch of prologue part t 4 : instruction fetch of prologue part t 5 : instruction fetch of prologue part (write to stack pointer) operation There) t 6: the first instruction after exiting the prolog fetch t 7: RET instruction fetch t 8: return address popped t 9: a pop flag register.

【0021】図7に示す第3の実施例においては、プロ
ローグの終わりのアドレスが必要である。このプロロー
グの終わりのアドレスは、図10のように、コンパイラ
がデバッグ情報としてサブルーチン(C言語では関数)
ごとに出力する。このプロローグ終了アドレスがベース
ポインタ確定値検出用メモリ12に設定される。また、
アップダウンカウンタ7の動作と、ベースポインタライ
ト用メモリ9がベースポインタ値を退避/復帰する動作
は、第1、第2の実施例と同一である。また、トレース
データから局所変数を識別する方法は、トレースされて
いるベースポインタ値を補正する必要がないので、従来
と同様に、図17のフローチャートによって行われる。
なお、第1、第2の実施例と異なり、コンパイラはプロ
ローグで確保するスタックサイズをデバッグ情報として
出力する必要がない。
In the third embodiment shown in FIG. 7, the address at the end of the prolog is required. As shown in FIG. 10, the end address of the prolog is a subroutine (a function in the C language) used by the compiler as debug information.
Output every time. This prologue end address is set in the base pointer fixed value detection memory 12. Also,
The operation of the up / down counter 7 and the operation of the base pointer write memory 9 saving / restoring the base pointer value are the same as those in the first and second embodiments. Also, the method of identifying a local variable from the trace data does not require correction of the traced base pointer value, and thus is performed according to the flowchart of FIG.
Unlike the first and second embodiments, the compiler does not need to output the stack size secured in the prologue as debug information.

【0022】なお、上述の実施例において、アップ/ダ
ウンカウンタ7は、*CALL/*INT信号によりカ
ウントアップされ、*RET/*IRET信号によりカ
ウントダウンされているが、*CALL/*INT信号
によりカウントダウンし、*RET/*IRET信号に
よりカウントアップしてもよい。
In the above embodiment, the up / down counter 7 counts up by the * CALL / * INT signal and counts down by the * RET / * INT signal, but counts down by the * CALL / * INT signal. Alternatively, the count may be increased by the * RET / * IRET signal.

【0023】[0023]

【発明の効果】以上説明したように本発明によれば、ソ
ースプログラムをコンパイルして得られたオブジェクト
プログラムが、ソースプログラムの局所変数のベースポ
インタとしてスタックポインタを使用するオブジェクト
プログラムであるプログラムの実行をトレースした場
合、少ないデバッグ情報で効率よく局所変数を識別する
ことができる。
As described above, according to the present invention, an object program obtained by compiling a source program is an object program using a stack pointer as a base pointer of a local variable of the source program. , Local variables can be efficiently identified with less debug information.

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

【図1】本発明に係るトレース装置の第1の実施例を示
すブロック回路図である。
FIG. 1 is a block circuit diagram showing a first embodiment of a trace device according to the present invention.

【図2】図1の回路動作を説明するタイミング図であ
る。
FIG. 2 is a timing chart for explaining the operation of the circuit in FIG. 1;

【図3】本発明に係るトレース装置の第2の実施例を示
すブロック回路図である。
FIG. 3 is a block circuit diagram showing a second embodiment of the trace device according to the present invention.

【図4】図3の回路動作を説明するタイミング図であ
る。
FIG. 4 is a timing chart illustrating the operation of the circuit in FIG. 3;

【図5】図1、図3におけるデバッグ情報を示すテーブ
ル図である。
FIG. 5 is a table diagram showing debug information in FIGS. 1 and 3;

【図6】図1、図3における局所変数の識別を行うフロ
ーチャートである。
FIG. 6 is a flowchart for identifying local variables in FIGS. 1 and 3;

【図7】本発明に係るトレース装置の第3の実施例を示
すブロック回路図である。
FIG. 7 is a block circuit diagram showing a third embodiment of the trace device according to the present invention.

【図8】図7の回路動作を説明するタイミング図であ
る。
FIG. 8 is a timing chart for explaining the operation of the circuit in FIG. 7;

【図9】図7の回路動作を説明するタイミング図であ
る。
FIG. 9 is a timing chart for explaining the operation of the circuit in FIG. 7;

【図10】図7におけるデバッグ情報を示すテーブル図
である。
FIG. 10 is a table showing debug information in FIG. 7;

【図11】C言語のソースプログラムの例を示すプログ
ラムリストである。
FIG. 11 is a program list showing an example of a C language source program.

【図12】図11のソースプログラムをコンパイルした
後のアセンブルリストである。
FIG. 12 is an assemble list after compiling the source program of FIG. 11 ;

【図13】局所変数のスタック上の割付け例を示す図で
ある。
FIG. 13 is a diagram illustrating an example of allocation of local variables on a stack.

【図14】先に提案したトレース装置を示すブロック回
路図である。
FIG. 14 is a block circuit diagram showing the previously proposed trace device.

【図15】図14のトレースメモリの内容を示すテーブ
ル図である。
FIG. 15 is a table showing the contents of a trace memory shown in FIG. 14;

【図16】図14におけるデバッグ情報を示すテーブル
図である。
FIG. 16 is a table showing debug information in FIG. 14;

【図17】図14における局所変数の識別を行うフロー
チャートである。
FIG. 17 is a flowchart for identifying a local variable in FIG. 14;

【図18】課題を説明するためのソースプログラムの例
を示すプログラムリストである。
FIG. 18 is a program list showing an example of a source program for explaining a problem.

【図19】hlレジスタをベースポインタとして図18
の(A)のソースプログラムをコンパイルした後のアセ
ンブルリストである。
FIG. 19 shows an hl register as a base pointer,
7A is an assemble list after compiling the source program of FIG.

【図20】hlレジスタをベースポインタとして図18
の(A)のソースプログラムをコンパイルした後のアセ
ンブルリストである。
FIG. 20 shows a state where the hl register is used as a base pointer.
7A is an assemble list after compiling the source program of FIG.

【図21】hlレジスタをベースポインタとして図18
の(B)のソースプログラムをコンパイルした後のアセ
ンブルリストである。
FIG. 21 shows a case where the hl register is used as a base pointer and FIG.
7B is an assemble list after compiling the source program of FIG.

【図22】hlレジスタをベースポインタとして図18
の(C)のソースプログラムをコンパイルした後のアセ
ンブルリストである。
FIG. 22 shows a state where the hl register is used as a base pointer.
7C is an assemble list after compiling the source program of FIG.

【図23】スタックポインタをベースポインタとして図
18の(A)のソースプログラムをコンパイルした後の
アセンブルリストである。
FIG. 23 is an assemble list after compiling the source program of FIG. 18A using the stack pointer as a base pointer.

【図24】スタックポインタをベースポインタとして図
18の(A)のソースプログラムをコンパイルした後の
アセンブルリストである。
FIG. 24 is an assemble list obtained by compiling the source program of FIG. 18A using a stack pointer as a base pointer.

【図25】スタックポインタをベースポインタとして図
18の(B)のソースプログラムをコンパイルした後の
アセンブルリストである。
FIG. 25 is an assemble list after compiling the source program of FIG. 18B using the stack pointer as a base pointer.

【図26】スタックポインタをベースポインタとして図
18の(C)のソースプログラムをコンパイルした後の
アセンブルリストである。
FIG. 26 is an assemble list after compiling the source program of FIG. 18C using the stack pointer as a base pointer.

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

1…エバチップ 2…トレースメモリ 3…デコーダ 5…ベースポインタラッチ回路 6…プログラム実行アドレスラッチ回路 7…アップダウンカウンタ 9…ベースポインタライト用メモリ 10、11…カウンタ 12…ベースポインタ確定値検出用メモリ 13…スタックポインタラッチ回路 AB…アドレスバス DB…データバス STR1、STR2…ストローブ信号 DESCRIPTION OF SYMBOLS 1 ... Evaluation chip 2 ... Trace memory 3 ... Decoder 5 ... Base pointer latch circuit 6 ... Program execution address latch circuit 7 ... Up / down counter 9 ... Base pointer write memory 10, 11 ... Counter 12 ... Base pointer fixed value detection memory 13 ... Stack pointer latch circuit AB ... Address bus DB ... Data bus STR1, STR2 ... Strobe signal

Claims (4)

(57)【特許請求の範囲】(57) [Claims] 【請求項1】 ソースプログラムをコンパイルして得ら
れたオブジェクトプログラムの実行をトレースするトレ
ース装置において、 前記オブジェクトプログラムのサブルーチンもしくは割
り込みルーチンの呼出し時に発生する信号(*CALL
/*INT信号)によりインクレメントもしくはデクレ
メントされ、前記オブジェクトプログラムのサブルーチ
ンもしくは割り込みルーチンの復帰時に発生する信号
(*RET/*IRET信号)によりデクレメントもし
くはインクレメントされるアップダウンカウンタ(7)
と、 前記オブジェクトプログラムのサブルーチンもしくは割
り込みルーチンの呼出し時に発生する前記信号をストロ
ーブ信号(STR1)として受信し、アドレスバス(A
B)からのスタックポインタ(sp)値を前記ソースプ
ログラムの局所変数のベースポインタ値として前記アッ
プダウンカウンタの値をアドレスとする記憶場所に退避
するベースポインタライト用メモリ(9)と、 前記アップダウンカウンタの値をアドレスとするベース
ポインタライト用メモリ(9)の出力をベースポインタ
値として、前記オブジェクトプログラムがデータアクセ
スを行ったときに、少なくとも、前記ベースポインタ
値、プログラム実行アドレス及びアクセスしたアドレス
をトレースするトレースメモリ(2)とを具備すること
を特徴とするトレース装置。
1. A tracing device for tracing the execution of an object program obtained by compiling a source program, wherein a signal (* CALL) generated when a subroutine or an interrupt routine of the object program is called.
/ * INT signal), an up / down counter (7) which is incremented or decremented by a signal (* RET / * IRET signal) generated when returning from the subroutine or interrupt routine of the object program.
Receiving the signal generated at the time of calling the subroutine or interrupt routine of the object program as a strobe signal (STR1), and
A base pointer write memory (9) for saving the stack pointer (sp) value from B) as a base pointer value of a local variable of the source program to a storage location having the address of the up / down counter as an address; The object program uses the output of the base pointer write memory (9) having the address of the counter as an address as a base pointer value to execute data access.
At least the base pointer
Value, program execution address and accessed address
Traces apparatus characterized by comprising a trace memory (2) to trace.
【請求項2】 さらに、 前記オブジェクトプログラムの実行のプログラム実行ア
ドレスを前記トレースメモリに入力する手段(6)と、 該トレースメモリにおけるプログラム実行アドレスを用
いて予めコンパイラがデバッグ情報として出力したデバ
ッグ情報テーブルによりサブルーチンもしくは割り込み
ルーチンを判別する手段と、 前記トレースメモリに入力されたベースポインタ値を、
予めコンパイラがデバッグ情報として出力した各サブル
ーチンあるいは割り込みルーチンの確保スタックサイズ
を用いて補正する手段と、 該補正されたベースポインタ値と前記トレースメモリに
記録されたアドレスとから、前記ソースプログラムの局
所変数の変数オフセットを計算する手段と、 該変数オフセットを用いて前記判別されたサブルーチン
もしくは割り込みルーチンにおける局所変数を判別する
手段とを具備する請求項に記載のトレース装置。
2. A means for inputting a program execution address of the execution of the object program into the trace memory, and a debug information table previously output as debug information by a compiler using the program execution address in the trace memory. Means for determining a subroutine or an interrupt routine, and a base pointer value input to the trace memory,
Means for correcting using the reserved stack size of each subroutine or interrupt routine previously output as debug information by the compiler, and local variables of the source program from the corrected base pointer value and the address recorded in the trace memory. 2. The tracing apparatus according to claim 1 , further comprising: means for calculating a variable offset of: and means for determining a local variable in the determined subroutine or interrupt routine using the variable offset.
【請求項3】 ソースプログラムをコンパイルして得ら
れたオブジェクトプログラムの実行をトレースするトレ
ース装置において、 前記オブジェクトプログラムのサブルーチンもしくは割
り込みルーチンの呼出し時に発生する信号(*CALL
/*INT信号)によりインクレメントもしくはデクレ
メントされ、前記オブジェクトプログラムのサブルーチ
ンもしくは割り込みルーチンの復帰時に発生する信号
(*RET/*IRET信号)によりデクレメントもし
くはインクレメントされるアップダウンカウンタ(7)
と、前記オブジェクトプログラムのプログラム実行アドレス
をメモリアドレスとして入力し、スタックポインタ 値が
ベースポインタ値として確定したアドレスまで前記オブ
ジェクトプログラムの実行が至ったことを示す信号を出
力するベースポインタ確定値検出用メモリ(12)と、 スタックポインタ値が更新される毎に該スタックポイン
タ値をラッチするスタックポインタラッチ回路(13)
と、 前記ベースポインタ確定値検出用メモリからの信号をス
トローブ信号(STR1)として受信し、前記スタック
ポインタラッチ回路(13)からのスタックポインタ値
を前記ソースプログラムの局所変数のベースポインタ値
として前記アップダウンカウンタの値をアドレスとする
記憶場所に退避するベースポインタライト用メモリ
(9)と、 前記アップダウンカウンタの値をアドレスとするベース
ポインタライト用メモリ(9)の出力をベースポインタ
値として、前記オブジェクトプログラムがデータアクセ
スを行ったときに、少なくとも、前記ベースポインタ
値、プログラム実行アドレス及びアクセスしたアドレス
をトレースするトレースメモリ(2)とを具備すること
を特徴とするトレース装置。
3. A tracing device for tracing execution of an object program obtained by compiling a source program, wherein a signal (* CALL) generated when a subroutine or an interrupt routine of the object program is called.
/ * INT signal), an up / down counter (7) which is incremented or decremented by a signal (* RET / * IRET signal) generated when returning from the subroutine or interrupt routine of the object program.
And a program execution address of the object program
Is input as a memory address, and the object pointer is reached until the address at which the stack pointer
A base pointer definite value detection memory for executing the object program to output a signal indicating that the Tsu Itaru (12), the stack pointer latch circuit for latching the stack pointer value each time the stack pointer value is updated (13)
Receiving a signal from the base pointer fixed value detection memory as a strobe signal (STR1), and updating the stack pointer value from the stack pointer latch circuit (13) as a base pointer value of a local variable of the source program. a memory for the base pointer write to save the value of the down counter in a memory location whose address (9), as the base pointer value output of the up-down counter memory for the base pointer write to the value as the address (9), wherein If the object program
At least the base pointer
Value, program execution address and accessed address
Traces apparatus characterized by comprising a trace memory (2) to trace.
【請求項4】 さらに、 前記オブジェクトプログラムの実行のプログラム実行ア
ドレスを前記トレースメモリに入力する手段(6)と、 該トレースメモリにおけるプログラム実行アドレスを用
いて予めコンパイラがデバッグ情報として出力したデバ
ッグ情報テーブルによりサブルーチンもしくは割り込み
ルーチンを判別する手段と、 該ベースポインタ値と前記トレースメモリに記録された
アドレスとから、前記ソースプログラムの局所変数の変
数オフセットを計算する手段と、 該変数オフセットを用いて前記判別されたサブルーチン
もしくは割り込みルーチンにおける局所変数を判別する
手段とを具備する請求項に記載のトレース装置。
4. A means for inputting a program execution address of the execution of the object program into the trace memory, a debug information table previously output as debug information by a compiler using the program execution address in the trace memory. Means for judging a subroutine or an interrupt routine, means for calculating a variable offset of a local variable of the source program from the base pointer value and an address recorded in the trace memory, and the judgment using the variable offset. 4. A tracing device according to claim 3 , further comprising: means for determining a local variable in the executed subroutine or interrupt routine.
JP5218174A 1993-08-10 1993-08-10 Trace device Expired - Lifetime JP2591432B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP5218174A JP2591432B2 (en) 1993-08-10 1993-08-10 Trace device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP5218174A JP2591432B2 (en) 1993-08-10 1993-08-10 Trace device

Publications (2)

Publication Number Publication Date
JPH0756766A JPH0756766A (en) 1995-03-03
JP2591432B2 true JP2591432B2 (en) 1997-03-19

Family

ID=16715782

Family Applications (1)

Application Number Title Priority Date Filing Date
JP5218174A Expired - Lifetime JP2591432B2 (en) 1993-08-10 1993-08-10 Trace device

Country Status (1)

Country Link
JP (1) JP2591432B2 (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP4846493B2 (en) * 2006-09-05 2011-12-28 富士通セミコンダクター株式会社 Debug system and debug circuit
JP5814856B2 (en) * 2012-05-09 2015-11-17 株式会社ソフイア Game machine
JP5990670B2 (en) * 2013-02-22 2016-09-14 株式会社ソフイア Game machine

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS61180344A (en) * 1985-02-06 1986-08-13 Omron Tateisi Electronics Co Step execution system for high level language
JPH05181712A (en) * 1991-12-27 1993-07-23 Hokuriku Nippon Denki Software Kk Stack history forming system

Also Published As

Publication number Publication date
JPH0756766A (en) 1995-03-03

Similar Documents

Publication Publication Date Title
US7000225B2 (en) Method for inserting global breakpoints
US7237149B2 (en) Method and apparatus for qualifying debug operation using source information
US6959365B2 (en) Microcomputer including a flash memory and a flash memory rewrite program stored therein
US20070006172A1 (en) Method and system of identifying overlays used by a program
KR930016880A (en) Electronic device and its fixing information
US20050273666A1 (en) Information processing apparatus and test method for programs
US5592674A (en) Automatic verification of external interrupts
US6473841B1 (en) Signal processing apparatus with memory access history storage
JP2591432B2 (en) Trace device
US8291417B2 (en) Trace buffer with a processor
JPH0447340B2 (en)
JP3067408B2 (en) Diagnosis method of memory access control device
EP0436211A2 (en) Method and apparatus for observing internal memory-mapped registers
JP3206559B2 (en) Software evaluation system
JP2669300B2 (en) Program trace circuit and program trace method
JP3101458B2 (en) Program error detection device
JPH0581087A (en) Processor monitoring system
JP2000010816A (en) Tracing device for debugging
JPH0644098A (en) Memory access bus comparator
JPH0426736B2 (en)
KR100195221B1 (en) Instruction execution number measure device in program execution
JPH11149489A (en) Simulation system
JPH04256039A (en) Information processor capable of counting instruction
US20060130018A1 (en) Method and apparatus for implementing a codeless intrinsic framework for embedded system processors
JPH02272647A (en) System for measuring execution time of program