JPH07200352A - Data processor, program translation method and debug tool - Google Patents

Data processor, program translation method and debug tool

Info

Publication number
JPH07200352A
JPH07200352A JP5351795A JP35179593A JPH07200352A JP H07200352 A JPH07200352 A JP H07200352A JP 5351795 A JP5351795 A JP 5351795A JP 35179593 A JP35179593 A JP 35179593A JP H07200352 A JPH07200352 A JP H07200352A
Authority
JP
Japan
Prior art keywords
instruction
debug
debugging
data processor
program
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.)
Withdrawn
Application number
JP5351795A
Other languages
Japanese (ja)
Inventor
Shinya Kanda
真也 神田
Hiroyuki Sasaki
宏幸 佐々木
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.)
Hitachi Ltd
Original Assignee
Hitachi 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 Hitachi Ltd filed Critical Hitachi Ltd
Priority to JP5351795A priority Critical patent/JPH07200352A/en
Publication of JPH07200352A publication Critical patent/JPH07200352A/en
Withdrawn legal-status Critical Current

Links

Landscapes

  • Debugging And Monitoring (AREA)
  • Devices For Executing Special Programs (AREA)

Abstract

PURPOSE:To trace and acquire a parameter transfered for a subroutine call in a program described in a high class language with a real time trace function of an emulator. CONSTITUTION:A data processor 1 has an instruction set comprising a usual instruction and a debug instruction whose instruction code only differs from that of the usual instruction. For example, the debug instruction is used for a data transfer instruction to transfer a parameter to a subroutine. The data processor 1 uses a debug instruction analysis section 11 to analyze the debug instruction and makes the same operation as that of the corresponding usual instruction. The parameter or the like is traced and acquired by using the emulator recognizing the debug instruction and tracing the execution process.

Description

【発明の詳細な説明】Detailed Description of the Invention

【0001】[0001]

【産業上の利用分野】本発明は、高級言語で記述された
プログラムにおけるサブルーチンコールの際に引き渡さ
れるパラメータを検証可能にするための技術に係り、そ
れを実現するためのデータプロセッサ、コンパイラなど
によって実現されるプログラム翻訳方法、及びエミュレ
ータなどのデバッグツールに関するものである。本明細
書においてデータプロセッサは、CPU(セントラル・
プロセッシング・ユニット))、マイクロプロセッサ、
及び1チップマイクロコンピュータを包含する総称的な
概念として位置付けられるものである。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a technique for making it possible to verify a parameter passed at the time of a subroutine call in a program written in a high-level language. The present invention relates to a realized program translation method and a debugging tool such as an emulator. In this specification, a data processor is a CPU (central
Processing unit)), microprocessor,
It is positioned as a generic concept including a one-chip microcomputer.

【0002】[0002]

【従来の技術】大型計算機では、プリンタあるいはコン
ソール等の情報出力装置が既に周辺機器として用意され
ているため、プログラムデバッグの際に必要な情報をこ
れらの情報出力装置に出力することが行われている。例
えば、高級言語で書かれたプログラムデバッグの手法と
しては、サブルーチンコールの際にパラメータ(関数の
引数など)を情報出力装置に出力することが行なわれて
おり、ソースファイルをコンパイルする際に、パラメー
タを情報出力装置へ出力する文を挿入する手法等が提案
されている。
2. Description of the Related Art In a large-scale computer, an information output device such as a printer or a console is already prepared as a peripheral device, so that information necessary for program debugging is output to these information output devices. There is. For example, as a method for debugging a program written in a high-level language, parameters (function arguments, etc.) are output to an information output device at the time of a subroutine call, and parameters are compiled at the time of compiling the source file. There has been proposed a method of inserting a sentence for outputting the information to the information output device.

【0003】一方、産業用機器や家庭電気製品などのよ
うにデータプロセッサ若しくはマイクロコンピュータを
制御回路として組込んだ組込み機器におけるプログラム
デバッグでは、組み込み機器上にデバッガやデバッグ用
の入出力装置等のデバッグ用環境を整えることが難し
い。そのためエミュレータが使用されている。エミュレ
ータは、デバッグ対象とされる組込み機器に実装される
マイクロコンピュータと同一の制御機能を少なくとも備
えたエミュレーション用マイクロコンピュータを有し、
このエミュレーション用マイクロコンピュータでデバッ
グ対象プログラムを実行しながら組込み機器を実際に代
行制御する。この代行制御の過程においてエミュレーシ
ョン用マイクロコンピュータから入出力されるデータや
アドレスなどの各種情報がトレースメモリに貯えられ、
所要のブレークポイント毎に上記トレースメモリの内容
を解析可能に提供してプログラムデバッグやシステムデ
バッグを支援する。したがって、このエミュレータを使
用することにより、メモリアクセスの来歴等をそのトレ
ース機能を介して取得することができる。例えば、メモ
リアドレス及びデータなどがバスサイクル単位でトレー
スメモリに貯えられ、このように貯えられた情報をアド
レスをキーとしてそれに対応するデータを参照すること
でメモリアクセスの来歴を判断できる。
On the other hand, in program debugging in embedded equipment such as industrial equipment and household electric appliances in which a data processor or a microcomputer is incorporated as a control circuit, debugging of a debugger or an input / output device for debugging is performed on the embedded equipment. It is difficult to prepare a working environment. Therefore, the emulator is used. The emulator has an emulation microcomputer having at least the same control function as the microcomputer mounted on the embedded device to be debugged,
The emulation microcomputer actually executes the control of the embedded device while executing the debug target program. In the process of this proxy control, various information such as data and addresses input / output from the emulation microcomputer is stored in the trace memory,
The contents of the trace memory can be analyzed and provided for each required breakpoint to support program debugging and system debugging. Therefore, by using this emulator, the history of memory access and the like can be acquired through the trace function. For example, memory addresses and data are stored in the trace memory in bus cycle units, and the history of memory access can be determined by referring to the data corresponding to the thus stored information as an address.

【0004】このように、エミュレータにおいては組込
み機器を実際に動作させて得られるトレース情報を基に
デバッグを行う性質上、デバッグの動作には組込み機器
の動作に対してリアルタイム性が要求される。
As described above, in the emulator, due to the nature of debugging based on the trace information obtained by actually operating the embedded device, the debugging operation requires real-time operation with respect to the operation of the embedded device.

【0005】尚、エミュレータについて記載された文献
例としては、昭和60年12月25日に株式会社オーム
社発行の「マイクロコンピュータハンドブック」第58
0頁〜第584頁がある。
As an example of a document describing the emulator, "Microcomputer Handbook" No. 58, published by Ohm Co., Ltd. on December 25, 1985
There are pages 0 to 584.

【0006】[0006]

【発明が解決しようとする課題】近年、組み込み機器を
制御するハードウエアにマイクロコンピュータ、ソフト
ウエアにC言語などの高級言語を使用する例が増えてき
ており、そのような組込み機器に対するエミュレータの
トレース機能によるメモリアクセスの来歴取得は、予じ
めアドレスの判明している変数に対して可能であるが、
アドレスの変化する変数(サブルーチンコールの際のパ
ラメータおよびローカル変数等)に対しては不可能であ
る。何故ならば、C言語のような高級言語で書かれたプ
ログラム上でサブルーチンを呼びパラメータを渡す場
合、C言語ではスタック領域の変数を使用する。スタッ
クポインタの位置はサブルーチンの呼ばれ方で変化する
ため、あるサブルーチンに着目した場合、同一サブルー
チンの先頭でのスタックポインタの値(およびローカル
変数のアドレス)は常に一定であるとは限らないからで
ある。例えば、図9においてアドレス空間に割当てられ
たデータ領域において、グローバル変数領域は変数のア
ドレスが固定であるが、スタック及びローカル変数領域
は変数のアドレスがスタックポインタ相対で決定される
ため一定にはならない。図10の(A)、即ちプログラ
ムAがプログラムBを呼び、そのプログラムBの中で更
にプログラムCが呼ばれた場合と、同図の(B)、即ち
プログラムAが直接プログラムCを呼んでいる場合とを
比べると、夫々の場合のスタックポインタの値は図11
に示されるように相違される。
In recent years, there have been increasing examples of using a high-level language such as a C language for hardware and software for controlling embedded devices, and tracing of an emulator for such embedded devices. It is possible to obtain the history of memory access by a function for a variable with a known address.
It is not possible for variables whose addresses change (parameters and local variables at the time of subroutine call). Because, when calling a subroutine on a program written in a high-level language such as C language and passing parameters, the variables in the stack area are used in C language. Since the position of the stack pointer changes depending on how the subroutine is called, the value of the stack pointer (and the address of the local variable) at the beginning of the same subroutine is not always constant when focusing on a certain subroutine. is there. For example, in the data area assigned to the address space in FIG. 9, the global variable area has a fixed variable address, but the stack and local variable areas are not constant because the variable address is determined relative to the stack pointer. . 10A, that is, the program A calls the program B, and the program C is further called in the program B, and FIG. 10B, that is, the program A directly calls the program C. Comparing with the case, the value of the stack pointer in each case is shown in FIG.
Are different as shown in.

【0007】以上のように、C言語のような高級言語を
利用して生成されたプログラムを実行するデータプロセ
ッサを備えた組み込み機器に対するデバッグでは、高級
言語で書かれたプログラムでのサブルーチンコールの際
に引き渡されるパラメータを、エミュレータのリアルタ
イムトレース機能でトレース取得することは不可能であ
る。そうだからといって大型計算機システムでのデバッ
グの手法を組込み機器のデバッグに採用しようにもデバ
ッグ環境が整わず、組込み機器の動作に対してリアルタ
イム性が要求されるエミュレータ利用のデバッグではパ
ラメータを出力させる特別な文若しくは記述を挿入する
こともできない。
As described above, in debugging an embedded device equipped with a data processor for executing a program generated by using a high-level language such as C language, a subroutine call in a program written in a high-level language is required. It is impossible to trace the parameters passed to the emulator by the real-time trace function of the emulator. Even so, even if a debugging method in a large-scale computer system is adopted for debugging embedded devices, the debugging environment is not set up, and a special parameter is output for debugging using an emulator that requires real-time performance for embedded device operation. You cannot insert a sentence or description.

【0008】本発明の目的は、高級言語で記述されたプ
ログラムでのサブルーチンコールの際にひき渡されるパ
ラメータやローカル変数を、エミュレータなどのデバッ
グツールのリアルタイムなトレース機能で、トレース取
得可能にする技術を提供することにある。すなわち、そ
れを可能にするためのデータプロセッサ、コンパイラな
どによって実現されるプログラム翻訳方法、及びエミュ
レータなどのデバッグツールを提供するものである。
An object of the present invention is to enable a parameter or a local variable passed at the time of a subroutine call in a program written in a high-level language to be trace-acquired by a real-time trace function of a debugging tool such as an emulator. To provide. That is, the present invention provides a data processor, a program translation method realized by a compiler and the like, and a debugging tool such as an emulator for enabling the above.

【0009】本発明の前記並びにその他の目的と新規な
特徴は本明細書の記述及び添付図面から明らかになるで
あろう。
The above and other objects and novel features of the present invention will be apparent from the description of this specification and the accompanying drawings.

【0010】[0010]

【課題を解決するための手段】本願において開示される
発明のうち代表的なものの概要を簡単に説明すれば下記
の通りである。
The outline of the representative one of the inventions disclosed in the present application will be briefly described as follows.

【0011】〔1〕デバッグの動作には組込み機器の動
作に対してリアルタイム性が要求されるというリアルタ
イム性を損なわない様にするために、デバッグ用命令を
採用する。すなわち、データプロセッサの命令セットに
デバッグ用命令を追加する。追加された命令は以下の特
徴を持つ。 (a)デバッグ用命令にはデバッグ用命令と対になる通
常の命令が存在する。 (b)対となる通常の命令とデバッグ用命令との相違
は、命令コードのみであり、命令語長、オペランドのサ
イズと配置、動作、命令実行サイクル数等は、両者の間
での相違はない。
[1] Debugging instructions are adopted in order not to impair the real-time property that the operation of the embedded device requires real-time property for the operation of debugging. That is, the debug instruction is added to the instruction set of the data processor. The added instruction has the following features. (A) The debug instruction includes a normal instruction that is paired with the debug instruction. (B) The only difference between the normal instruction and the debug instruction, which are paired, is the instruction code, and the instruction word length, the size and arrangement of the operands, the operation, the number of instruction execution cycles, etc. are the same. Absent.

【0012】〔2〕上記デバッグ用命令を生成するため
の手段としての観点を持つ発明は、、コンパイラ(及び
デバッガ)のようなプログラム翻訳方法に着目するもの
であり、以下の何れかの機能を持つ。 (2−a) デバッグ用命令を自動生成する発明は、コ
ンパイルのようなプログラム翻訳時に、その後のデバッ
グ時にデバッグを容易にするために、ソースプログラム
の記述における特定の箇所を認識し、その必要部分に通
常の命令のコードではなく、デバッグ用の命令コードを
生成する。例えば、サブルーチンコールの部分およびパ
ラメータ引き渡しのためのデータ転送命令の箇所を認識
し、当該部分のジャンプサブルーチン命令およびムーブ
命令をデバッグジャンプサブルーチン命令およびデバッ
グムーブ命令に置き換えて、コードを生成する。 (2−b) 上記デバッグ用命令に代わるデバッグ情報
を生成して対処する発明は、上記2−aでのデバッグ用
の命令コードの生成に代えて、当該位置を示す情報をデ
バッグ情報として生成する。例えば、サブルーチンコー
ルの部分およびパラメータ引き渡しのためのデータ転送
命令の箇所を認識し、当該部分のジャンプサブルーチン
命令およびムーブ命令の位置を示す情報をデバッグ情報
として生成する。上記2−aでコンパイラが行ってい
た、デバッグ用の命令コードの生成は、デバッグ用のソ
フトウエア(例えばエミュレータのソフトウエア)がデ
バッグ情報を参照して、通常の命令コードからデバッグ
用の命令コードへの置き換えによって行う。
[2] The invention having a point of view as means for generating the above-mentioned debugging instruction focuses on a program translation method such as a compiler (and a debugger). To have. (2-a) The invention for automatically generating instructions for debugging recognizes a specific portion in the description of the source program and facilitates the debugging when the program is translated, such as compiling, to facilitate debugging. Generates an instruction code for debugging instead of a normal instruction code. For example, the portion of the subroutine call and the location of the data transfer instruction for passing the parameter are recognized, the jump subroutine instruction and the move instruction of the portion are replaced with the debug jump subroutine instruction and the debug move instruction, and the code is generated. (2-b) In the invention which deals with by generating debug information in place of the debug instruction, instead of generating the debug instruction code in 2-a, information indicating the position is generated as debug information. . For example, the portion of the subroutine call and the location of the data transfer instruction for passing the parameter are recognized, and the information indicating the positions of the jump subroutine instruction and the move instruction of the portion is generated as debug information. The generation of the instruction code for debugging, which was performed by the compiler in 2-a above, refers to the debug information by the software for debugging (for example, the software of the emulator), and the instruction code for debugging is changed from the normal instruction code. Replace with.

【0013】〔3〕上記デバッグ用命令を命令セットと
して持つデータプロセッサのためのエミュレータのよう
なデバッグツールに着目した発明は、デバッグツールに
以下の機能を持たせる。 (3−a) 上記2−aのプログラム翻訳方法が採用さ
れる場合、トレース回路に、上記デバッグ用命令を認識
する機能を持たせ、デバッグに必要な部分のみの命令実
行結果をトレース取得する機能を持たせる。例えば、デ
バッグジャンプサブルーチン命令およびデバッグムーブ
命令を認識する機能を持たせ、当該サブルーチンコール
時にデバッグジャンプサブルーチン命令、デバッグムー
ブ命令、および必要な周辺の命令実行結果をトレース取
得する機能を持たせる。また、デバッグツールにはそれ
らトレース結果を編集し、表示する機能を持たせる。 (3−b) 上記2−bのプログラム翻訳方法が採用さ
れる場合、上記3−aの機能に加えて以下の機能をデバ
ッグツールに持たせる。即ち、上記デバッグ情報に基づ
いて必要な部分の命令をデバッグ用命令で置き換える機
能をデバッグツールに持たせる。例えば、サブルーチン
コール時のジャンプサブルーチン命令およびムーブ命令
を、デバッグジャンプサブルーチン命令およびデバッグ
ムーブ命令に置き換える機能を持たせる。
[3] In the invention focused on a debug tool such as an emulator for a data processor having the above-mentioned debug instruction as an instruction set, the debug tool has the following functions. (3-a) When the program translation method of 2-a is adopted, the trace circuit has a function of recognizing the debug instruction, and a function of acquiring the instruction execution result of only a portion necessary for debugging by tracing. Have. For example, it has a function of recognizing a debug jump subroutine instruction and a debug move instruction, and a function of obtaining a trace of a debug jump subroutine instruction, a debug move instruction, and a necessary peripheral instruction execution result at the time of the subroutine call. In addition, the debug tool has a function to edit and display the trace results. (3-b) When the program translation method of 2-b is adopted, the debug tool has the following functions in addition to the functions of 3-a. That is, the debug tool has a function of replacing a necessary part of the instruction with the debug instruction based on the debug information. For example, it has a function of replacing a jump subroutine instruction and a move instruction during a subroutine call with a debug jump subroutine instruction and a debug move instruction.

【0014】[0014]

【作用】[Action]

〔1〕データプロセッサの命令セットに上記デバッグ用
命令を追加することは、そのようなデータプロセッサを
使用した組み込み機器において、通常の命令のみで構成
されたプログラムとそのプログラムの一部をデバッグ用
命令で置き換えたプログラムとの間で、プログラムのサ
イズ、構成および動作の上での相違点がないということ
を保証する。このことは、対象機器を代行制御しながら
デバッグを支援するデバッグツールに要求されるリアル
タイム性を損なわないように作用する。さらにそのこと
は、プログラム実行時に通常の命令とデバッグ用の命令
をエミュレータのようなデバッグツールが容易に区別で
きるように作用する。これにより、上記デバッグ用命令
を認識してその実行過程をトレースする機能を有するデ
バッグツールを利用することによって、高級言語で記述
されたプログラムでのサブルーチンコールの際にひき渡
されるパラメータやローカル変数を、エミュレータのリ
アルタイムなトレース機能でトレース取得できるように
なり、そのようなパラメータやローカル変数に着目した
デバッグを可能にする。
[1] Adding the above-mentioned debugging instruction to the instruction set of the data processor means that in an embedded device using such a data processor, a program composed of only ordinary instructions and a part of the program are instructions for debugging. It is guaranteed that there is no difference in the size, configuration and operation of the program with the program replaced by. This acts so as not to impair the real-time property required for a debug tool that assists in debugging while controlling the target device on behalf. Further, it works so that a debug tool such as an emulator can easily distinguish a normal instruction and a debug instruction during program execution. As a result, by using the debug tool that has the function of recognizing the above debug instruction and tracing the execution process, the parameters and local variables passed at the time of the subroutine call in the program written in the high-level language can be , The real-time trace function of the emulator can be used to acquire traces, enabling debugging focusing on such parameters and local variables.

【0015】〔2〕上記デバッグ用命令を自動生成する
プログラム翻訳方法は、命令セットに上記デバッグ用命
令を含むアーキテクチャーのデータプロセッサのための
機械語プログラムを簡単に生成する。上記デバッグ用命
令に代わるデバッグ情報を生成するプログラム翻訳方法
は、デバッグにのみ利用される情報によって機械語プロ
グラムのサイズが増大することを抑える。
[2] The program translation method for automatically generating the debug instruction simply generates a machine language program for a data processor having an architecture including the debug instruction in an instruction set. The program translation method for generating the debug information instead of the debug instruction suppresses an increase in the size of the machine language program due to the information used only for debugging.

【0016】〔3〕デバッグ用命令を認識する機能を持
ち、その命令の実行過程をトレースするデバッグツール
は、高級言語で記述されたプログラムでのサブルーチン
コールの際に引き渡されるパラメータやローカル変数を
そのトレース回路で取得して、そのようなパラメータや
ローカル変数に着目したデバッグを可能にする。デバッ
グ用命令を直接受けて動作されるデバッグツールは、コ
ンパイラなどが生成したデバッグ情報に基づいて必要な
部分の命令をデバッグ用命令で置き換える機能が付加さ
れたデバッグツールに比べ、その物理的な規模を小さく
する。後者のデバッグツールは、デバッグ用命令に割り
当てることができる未定義コードに余裕がない場合に
も、デバッグ用命令を利用して、パラメータやローカル
変数に着目したデバッグを可能にする。
[3] A debug tool that has a function of recognizing a debug instruction and traces the execution process of the instruction uses parameters and local variables passed at the time of a subroutine call in a program written in a high-level language. It is possible to debug by acquiring with a trace circuit and focusing on such parameters and local variables. Debug tools that operate by receiving debug instructions directly have a physical scale larger than that of a debug tool that has a function to replace necessary parts of instructions with debug instructions based on debug information generated by a compiler. To reduce. The latter debugging tool enables debugging focusing on parameters and local variables by using the debugging instruction even when there is not enough undefined code that can be assigned to the debugging instruction.

【0017】[0017]

【実施例】本発明の実施例を〔1〕データプロセッサ、
〔2〕コンパイラ、及び〔3〕エミュレータの項目に従
って順次説明する。 〔1〕 データプロセッサ 〔1−a〕 デバッグ用命令 本実施例のデータプロセッサはその命令セットにデバッ
グ用命令を有する。デバッグ用命令は(1),(2)の
特徴を有する。 (1)デバッグ用命令にはこれと対になる通常の命令が
存在する。 (2)対となる通常の命令とデバッグ用命令との相違は
命令コードのみであり、命令語長、オペランドのサイズ
と配置、動作、命令実行サイクル数等は、両者の間で相
違はない。
[Embodiment] An embodiment of the present invention [1] a data processor,
The items will be sequentially described in accordance with items of [2] compiler and [3] emulator. [1] Data Processor [1-a] Debug Instruction The data processor of this embodiment has a debug instruction in its instruction set. The debug instruction has the features (1) and (2). (1) The debug instruction has a normal instruction paired with it. (2) The difference between the normal paired instruction and the debugging instruction is only the instruction code, and the instruction word length, the size and arrangement of the operands, the operation, the number of instruction execution cycles, etc. are not different between the two.

【0018】デバッグ用命令として、デバッグデータ転
送命令(DBGMOV命令とも記す)及びデバッグジャ
ンプサブルーチン命令(DBGJSR命令とも記す)を
命令セットに追加する場合について説明する。
A description will be given of a case where a debug data transfer instruction (also referred to as a DBGMOV instruction) and a debug jump subroutine instruction (also referred to as a DBGJSR instruction) are added to the instruction set as debugging instructions.

【0019】データプロセッサがデータ転送命令MOV
とジャンプサブルーチン命令JSRを持つ場合、それに
対応されるデバッグ用命令として、DBGMOV命令及
びDBGJSR命令を追加する。
The data processor uses the data transfer instruction MOV.
And the jump subroutine instruction JSR, the DBGMOV instruction and the DBGJSR instruction are added as the corresponding debugging instructions.

【0020】DBGMOV命令は、データ転送命令MO
Vと同一の動作をする命令である。命令語長、オペラン
ドのサイズと配置は同一で、命令コード(およびそれに
対応する命令ニモニック)のみが異なることを特徴とす
る。両者は、データプロセッサの動作上は全く同一とな
る。MOV命令及びDBGMOV命令の命令ニモニック
と命令コード(機械語のコード)の一例は以下の通りで
ある。 (MOV命令) 命令ニモニック;MOV.W Rx,@(yy,
Rz) 命令コード ;1234xxxxxxxx (DBGMOV命令) 命令ニモニック;DBGMOV.W Rx,@(yy,
Rz) 命令コード ;1A34xxxxxxxx
The DBGMOV instruction is a data transfer instruction MO.
This instruction is the same as V. The instruction word length, the size and arrangement of the operands are the same, and only the instruction code (and the corresponding instruction mnemonic) is different. Both are exactly the same in terms of the operation of the data processor. An example of the instruction mnemonic and instruction code (machine language code) of the MOV instruction and the DBGMOV instruction is as follows. (MOV instruction) Instruction mnemonic; MOV. W Rx, @ (yy,
Rz) instruction code; 1234xxxxxxxxx (DBGMOV instruction) instruction mnemonic; DBGMOV. W Rx, @ (yy,
Rz) instruction code; 1A34xxxxxxxxxx

【0021】DBGJSR命令は、ジャンプサブルーチ
ン命令JSRと同一の動作をする命令である。命令語
長、オペランドのサイズと配置は同一で、命令コード
(およびそれに対応する命令ニモニック)のみが異な
る。両者は、データプロセッサの動作上は全く同一とな
る。以下にはJSR命令及びDBGJSR命令の命令ニ
モニックと命令コード(機械語のコード)の一例が示さ
れる。 (JSR命令) 命令ニモニック;JSR @xxxxxx 命令コード ;5678xxxxxxxx (DBGJSR命令) 命令ニモニック;DBGJSR @xxxxxx 命令コード ;5E78xxxxxxxx
The DBGJSR instruction is an instruction that operates in the same manner as the jump subroutine instruction JSR. The instruction word length, the operand size and arrangement are the same, and only the instruction code (and the corresponding instruction mnemonic) are different. Both are exactly the same in terms of the operation of the data processor. An example of instruction mnemonics and instruction codes (machine language code) of the JSR instruction and the DBGJSR instruction are shown below. (JSR instruction) Instruction mnemonic; JSR @xxxxxxxxx instruction code; 5678xxxxxxxxx (DBGJSR instruction) Instruction mnemonic; DBGJSR @xxxxxxxxx instruction code; 5E78xxxxxxxxxx

【0022】〔1−b〕 データプロセッサの構成 図1には上記デバッグ用命令が命令セットに追加された
データプロセッサ1の構成が命令解析部および命令実行
制御部に着目して示される。上記命令解析部10は、マ
イクロプログラムあるいはハードウエアで命令の解析を
行う回路部分であり、この部分にデバッグ用命令を解析
するためのプログラムあるいはハードウエアで構成され
たデバッグ用命令解析部11が追加されている。デバッ
グ用命令を実行する場合、命令実行制御部20はそのデ
バッグ用命令と対を成す通常の命令の実行と同じに動作
する。これに着目して同図の(A)に示されるデータプ
ロセッサ1はデバッグ用命令を実行可能であっても命令
実行制御部20には特別なハードウエアは追加されてい
ない。この命令実行制御部20は、算術論理演算器など
の演算回路や汎用レジスタ若しくは各種専用レジスタな
どを有する実行部、メモリ制御部、キャッシュメモリな
ど、命令解析部10,11で得られた制御信号に基づい
て命令を実行するための各種回路によって構成される。
本発明においてその様な一般的な回路の具体的構成は一
切制限されない。
[1-b] Configuration of Data Processor FIG. 1 shows the configuration of the data processor 1 in which the debug instruction is added to the instruction set, focusing on the instruction analysis unit and the instruction execution control unit. The instruction analysis unit 10 is a circuit portion that analyzes an instruction by a microprogram or hardware, and a debugging instruction analysis unit 11 configured by a program or hardware for analyzing a debugging instruction is added to this portion. Has been done. When executing the instruction for debugging, the instruction execution control unit 20 operates in the same manner as the execution of a normal instruction paired with the instruction for debugging. Paying attention to this, even if the data processor 1 shown in FIG. 9A can execute a debugging instruction, no special hardware is added to the instruction execution control unit 20. The instruction execution control unit 20 uses control signals obtained by the instruction analysis units 10 and 11 such as an execution unit having an arithmetic circuit such as an arithmetic and logic unit, a general-purpose register or various dedicated registers, a memory control unit, and a cache memory. It is composed of various circuits for executing instructions based on the above.
In the present invention, the specific configuration of such a general circuit is not limited at all.

【0023】また、詳細はエミュレータの項で述べる
が、エミュレータのハードウエア構成を簡便にするため
には、デバッグ用命令の実行と通常の命令の実行とを区
別するためのステータス信号などのステータス信号3の
出力機能をデータプロセッサ1に追加することが有効で
ある。これを考慮した図1の(B)に示されるデータプ
ロセッサ1は、命令実行制御部20のハードウエアに、
上記ステータス信号3の出力制御回路21が追加され
る。この出力制御回路21は、デバッグ用命令解析部1
1がデバッグ用命令のオペレーションコードを解析する
ことによって得られる信号に基づいて上記ステータス信
号3を第1の論理値として出力し、それ以外は第2の論
理値とする。
Although details will be described in the section of the emulator, in order to simplify the hardware configuration of the emulator, a status signal such as a status signal for distinguishing execution of a debugging instruction from execution of a normal instruction. It is effective to add the output function of 3 to the data processor 1. In consideration of this, the data processor 1 shown in FIG. 1B has the hardware of the instruction execution control unit 20 as follows.
An output control circuit 21 for the status signal 3 is added. The output control circuit 21 includes a debug instruction analysis unit 1
1 outputs the status signal 3 as a first logical value based on a signal obtained by analyzing the operation code of the debug instruction, and otherwise outputs a second logical value.

【0024】また、データプロセッサが命令コードをデ
コードしないビットの位置を規定した命令セットを作成
し、エミュレータがこのデコードしないビットによって
通常の命令とデバッグ用命令を区別する場合には、デー
タプロセッサの変更は不要である。
When the data processor creates an instruction set that defines the positions of the bits that do not decode the instruction code, and the emulator distinguishes the normal instruction from the debugging instruction by the bits that do not decode, the data processor is changed. Is unnecessary.

【0025】〔2〕 コンパイラ 上記データプロセッサ1に対応されるコンパイラについ
て説明する。 〔2−a〕 デバッグ用命令の生成 コンパイル時に、その後のデバッグ時にデバッグを容易
にするために、コンパイラが特定の箇所を認識し、その
必要部分に通常の命令のコードではなく、デバッグ用の
命令コードを生成する。例えば、コンパイル時にコンパ
イラがサブルーチンコールの部分およびパラメータ引き
渡しのためのデータ転送命令の箇所を認識し、当該部分
のJSR命令およびMOV命令をDBGJSR命令およ
びDBGMOV命令に置き換えて、コードを生成する。
例えば、C言語で記述されたプログラムの中に、 /* SUBROUTINE CALL*/ sbrtn(a); という記述が合った場合、上記デバッグ用命令を考慮し
ないコンパイラは通常 xx xx MOV.W Rx,@(yy,Rz) xx JSR _sbrtn xx xx というコードを生成する。これに対して上記デバッグ用
命令を考慮する本実施例におけるコンパイラは、サブル
ーチンコールを認識すると(C言語でのサブルーチンコ
ールは文字列とそれに続く()および;で示されるので
容易に認識できる)、当該部分に対し、 xx xx DBGMOV.W Rx,@(yy,Rz) xx DBGJSR _sbrtn xx xx というコードを生成する。上記説明では、便宜上、生成
されるコードの代わりにニモニックを使用したが、最終
的に生成されるコードは、機械語の数値コードであるこ
とは言うまでもない。また、コードの生成をコンパイラ
が行うと書いたが、クロスソフトウエアシステムの構成
によっては、アセンブラ、リンカ等と組み合わせてコー
ドを生成する場合があることも言うまでもない。尚、上
記xxは適宜のコードを意味するものと理解されたい。
コンパイラは、エンジニアリングワークステーションな
どのデータ処理システムに適用されて実現される。
[2] Compiler A compiler compatible with the data processor 1 will be described. [2-a] Generation of Instructions for Debugging To facilitate debugging at the time of subsequent debugging at the time of compilation, the compiler recognizes a specific portion, and the necessary portion is not a normal instruction code but an instruction for debugging. Generate code. For example, the compiler recognizes the portion of the subroutine call and the data transfer instruction for passing parameters when compiling, and replaces the JSR instruction and MOV instruction of the portion with the DBGJSR instruction and the DBGMOV instruction to generate the code.
For example, when the description of / * SUBROUTINE CALL * / sbrtn (a); is matched in the program written in C language, the compiler which does not consider the above-mentioned debugging instruction is usually xx xx MOV. Generate the code W Rx, @ (yy, Rz) xx JSR _sbrtn xx xx. On the other hand, when the compiler in this embodiment considering the above debug instruction recognizes the subroutine call (the subroutine call in the C language is easily recognized because it is indicated by the character string and the following () and;), For this part, xx xx DBGMOV. The code W Rx, @ (yy, Rz) xx DBGJSR_sbrtn xx xx is generated. In the above description, the mnemonic is used instead of the generated code for convenience, but it goes without saying that the finally generated code is a numerical code in machine language. Although it is written that the compiler generates the code, it goes without saying that the code may be generated in combination with an assembler, a linker, etc. depending on the configuration of the cross software system. It should be understood that xx above means an appropriate code.
The compiler is implemented by being applied to a data processing system such as an engineering workstation.

【0026】図2には本実施例のコンパイラによる処理
手順の一例が示される。コンパイラは、C言語のような
高級言語で記述されたソースファイルの記述に対して記
述行毎にどの命令に対応するかを順次判定していき、対
応する命令があった場合、その命令に対応する機械語の
コードを生成する。例えば、データプロセッサ1の命令
セットに含まれるxxの命令とyyの命令に対するコン
パイルに着目すると、図2に示されるように、ソースフ
ァイルの現在の処理対象記述行に対してxxの命令に対
応するソース記述か否かの判定ステップS1とyyの命
令に対応するソース記述か否かの判定ステップS3が存
在する。本実施例のコンパイラは上記デバッグ用命令を
コンパイルする機能が追加され、例えば上記DBGMO
V命令に対応するソース記述かを判定するステップS2
が追加されている。ソース記述に対応する命令が存在す
る場合には(上記ステップS1,S2,S3の何れかに
おいてYESと判定されたとき)その命令に対応する機
械語のコードが生成される(ステップS10,S20,
S30)。ソース記述に対応する命令が存在して機械語
コードに翻訳されると、次の命令の処理、即ちソースフ
ァイルの次の記述に対する処理に移行される。このよう
な処理がソースファイルの全ての記述行に対して行われ
る。図2においてデバッグ用命令に対応する処理はステ
ップS2とS20が代表的に示されているが、DBGJ
SR命令のようなその他のデバッグ用命令に対する処理
は、ステップS1の前に存在することになる同様の多数
の処理ステップ或はステップS3の後に存在することに
なる同様の多数の処理ステップに含まれるものと理解さ
れたい。
FIG. 2 shows an example of the processing procedure by the compiler of this embodiment. The compiler sequentially determines which instruction corresponds to each description line with respect to the description of the source file described in a high-level language such as C language, and when there is a corresponding instruction, the instruction is corresponded to. Generate the machine language code. For example, focusing on the compilation of the xx instruction and the yy instruction included in the instruction set of the data processor 1, as shown in FIG. 2, it corresponds to the xx instruction for the current processing target description line of the source file. There are a source description description determination step S1 and a source description correspondence determination step S3 corresponding to the yy instruction. The compiler of the present embodiment is added with a function of compiling the above-mentioned debug instruction.
Step S2 of determining whether the source description corresponds to the V instruction
Has been added. When an instruction corresponding to the source description exists (when YES is determined in any of steps S1, S2, and S3 above), a machine language code corresponding to the instruction is generated (steps S10, S20,
S30). When the instruction corresponding to the source description exists and is translated into the machine language code, the processing for the next instruction, that is, the processing for the next description of the source file is performed. Such processing is performed for all the description lines of the source file. In FIG. 2, steps S2 and S20 are representatively shown as the processing corresponding to the debug instruction.
Processing for other debugging instructions, such as SR instructions, is included in a number of similar processing steps that will be present before step S1 or in a number of similar processing steps that will be present after step S3. I want you to understand.

【0027】〔2−b〕 デバッグ用命令の生成に代わ
るデバッグ情報の生成 上述のコンパイラはデバッグ用命令を直接生成するもの
であるが、別の実施例に係るコンパイラは、コンパイラ
が特定の箇所を認識し、その必要部分の位置を示す情報
をデバッグ情報として生成する。デバッグ情報は、デバ
ッグ時にデバッグを容易にするための情報として利用さ
れ、特に制限されないが、データプロセッサが実行すべ
き機械語命令コードとは物理的に切り離された存在とさ
れる。例えば、コンパイル時にコンパイラがサブルーチ
ンコールの部分およびパラメータ引き渡しのためのデー
タ転送命令の箇所を認識し、当該部分のJSR命令およ
びMOV命令の位置を示す情報をデバッグ情報として生
成する。このようなデバッグ情報は、後述するエミュレ
ータの項でも説明するが、エミュレータのソフトウエア
に参照され、そのようなソフトウェアによって上記実施
例のコンパイラが行っていたDBGJSR命令及びDB
GMOV命令への置き換えが行われる。デバッグ情報フ
ァイルの内容としては、例えば、デバッグ用命令のアド
レスを順に記録したものがあれば、命令の置き換えは簡
単である。
[2-b] Generation of Debug Information Instead of Generation of Debug Instruction Although the above-mentioned compiler directly generates the debug instruction, the compiler according to another embodiment is such that the compiler selects a specific portion. It recognizes and generates information indicating the position of the necessary part as debug information. The debug information is used as information for facilitating debugging at the time of debugging, and is not particularly limited, but it is physically separated from the machine language instruction code to be executed by the data processor. For example, the compiler recognizes a portion of a subroutine call and a data transfer instruction for passing a parameter at the time of compilation, and generates information indicating the positions of the JSR instruction and the MOV instruction of the portion as debug information. Such debug information is referred to by the software of the emulator, which will be described later in the section of the emulator, and the DBGJSR instruction and the DB executed by the compiler of the above-described embodiment by such software are referred to.
Replacement with the GMOV instruction is performed. If the contents of the debug information file include, for example, the addresses of debugging instructions recorded in order, the replacement of instructions is easy.

【0028】〔3〕 エミュレータ 上記実施例のデータプロセッサ1を搭載した組込み機器
のシステムデバッグ若しくはプログラムデバッグに利用
されるデバッグツールとしてのエミュレータの実施例に
ついて説明する。
[3] Emulator An embodiment of an emulator as a debug tool used for system debugging or program debugging of an embedded device equipped with the data processor 1 of the above embodiment will be described.

【0029】図3にはデバッグツールの全体を示すブロ
ック図が示される。同図に示されるエミュレータ4は、
親計算機のようなホストシステム5と、デバッグ対象と
される組込み機器としてのマイクロコンピュータシステ
ム(ターゲットシステムとも記す)6との間に接続さ
れ、そのターゲットシステム6を本来制御すべきターゲ
ットマイクロコンピュータの機能を代行する一方でデバ
ッガとしての機能を持ち、詳細なシステム評価やプログ
ラムデバッグを支援する。ホストシステム5とエミュレ
ータ4とは例えばシリアル回線7よって結合される。タ
ーゲットシステム6とエミュレータ4はインタフェース
ケーブル8によって接続される。すなわち、インタフェ
ースケーブル8の先端が、ターゲットシステム6のター
ゲットマイクロコンピュータ用ソケット61に結合され
ることにより、エミュレータ4がターゲットシステム6
を代行制御する。上記エミュレータ4及びホストシステ
ム5がデバッグツールを構成する。
FIG. 3 is a block diagram showing the entire debug tool. The emulator 4 shown in FIG.
A function of a target microcomputer which is connected between a host system 5 such as a parent computer and a microcomputer system (also referred to as a target system) 6 as an embedded device to be debugged and which should originally control the target system 6. While acting as a substitute, it has a function as a debugger and supports detailed system evaluation and program debugging. The host system 5 and the emulator 4 are connected by a serial line 7, for example. The target system 6 and the emulator 4 are connected by an interface cable 8. That is, by connecting the tip of the interface cable 8 to the target microcomputer socket 61 of the target system 6, the emulator 4 is connected to the target system 6.
Control on behalf of. The emulator 4 and the host system 5 constitute a debug tool.

【0030】上記エミュレータ4は、特に制限されない
が、ターゲットシステム6を本来制御すべきターゲット
マイクロコンピュータの機能を代行するためのエミュレ
ーション用データプロセッサ40と、エミュレーション
のための条件設定などエミュレータ全体の制御を司るた
めのコントロール用データプロセッサ41を備える。エ
ミュレーション用データプロセッサ40は、エミュレー
ションバス42に結合され、コントロール用データプロ
セッサ41はコントロールバス43に結合され、双方の
バス42,43には、エミュレーション制御回路44、
ブレーク制御回路45、トレース回路46、代行メモリ
回路47が夫々接続される。エミュレーション用データ
プロセッサ40は、ターゲットシステム6のために開発
され若しくは開発途上のターゲットプログラムを実行し
てターゲットシステム6を代行制御する途上において、
ターゲットシステム6との間でやりとりされるアドレス
並びにデータなどの各種バス情報や制御信号などはエミ
ュレーションバス42にも与えられる。このようにして
与えられた情報は、例えばエミュレーション用データプ
ロセッサ40のバスサイクルに従ってトレース回路46
にトレースされる。また、エミュレーションバス42の
状態をブレーク制御回路45が監視して、予め設定され
ている状態に到達したときにエミュレーション動作を停
止させる。上記代行メモリ回路47は、ターゲットシス
テム6に未だ用意されていないメモリを補うための記憶
領域や、ターゲットプログラムの格納領域として利用さ
れる。ブレーク制御回路45に対するブレーク条件の設
定や、トレース回路46に対するトレース開始アドレス
の設定などの各種条件設定や初期設定はコントロールバ
ス43を介してコントロール用データプロセッサ41が
行う。上記ブレーク制御回路45によってエミュレーシ
ョン動作が停止されている状態において、トレース回路
46が保有するトレース情報は、コントロール用データ
プロセッサ41に読出されてホストインタフェース48
を通じホストシステム5に転送される。ホストシステム
5は転送されたトレース情報を表示したりその解析を行
ったりしてデバッグを支援する。
The emulator 4 is not particularly limited, but controls the entire emulator such as the emulation data processor 40 for substituting the function of the target microcomputer which should originally control the target system 6 and the condition setting for emulation. A control data processor 41 for controlling is provided. The emulation data processor 40 is coupled to an emulation bus 42, the control data processor 41 is coupled to a control bus 43, and both buses 42 and 43 have emulation control circuits 44,
The break control circuit 45, the trace circuit 46, and the proxy memory circuit 47 are connected to each other. The emulation data processor 40 executes a target program developed for the target system 6 or under development to control the target system 6 on behalf of the target system 6.
Various bus information such as addresses and data exchanged with the target system 6 and control signals are also given to the emulation bus 42. The information provided in this way is traced by the trace circuit 46 according to the bus cycle of the emulation data processor 40, for example.
Traced to. Further, the break control circuit 45 monitors the state of the emulation bus 42, and when the preset state is reached, the emulation operation is stopped. The proxy memory circuit 47 is used as a storage area for supplementing a memory not yet prepared in the target system 6 and a storage area for a target program. The control data processor 41 performs setting of various conditions such as setting of break conditions for the break control circuit 45, setting of a trace start address for the trace circuit 46, and initial setting via the control bus 43. In a state where the emulation operation is stopped by the break control circuit 45, the trace information held by the trace circuit 46 is read by the control data processor 41 and the host interface 48.
Through the host system 5. The host system 5 supports debugging by displaying the transferred trace information and analyzing it.

【0031】図4には上記トレース回路46の一例が示
される。同図に示されるトレース回路46は、アドレ
ス、データ、その他のデータプロセッサ情報(例えばス
テータス情報やアクセス制御信号)に基づいてトレース
メモリへの書き込みを制御するトレース条件判定回路4
60と、その制御に基づいて所要に情報を格納するトレ
ースメモリ461を備える。このトレース回路46はデ
ータプロセッサによる命令プリフェッチを考慮してデー
タプロセッサの動作を解析するため、PC追跡回路46
2及び命令解析回路463を備える。アドレス、デー
タ、その他のデータプロセッサ情報は、エミュレーショ
ン用バス42の情報であり、基本的にはインタフェース
ケーブル8を介してエミュレーション用データプロセッ
サ40とターゲットシステム6とがやり取りする情報と
等価な情報である。
FIG. 4 shows an example of the trace circuit 46. The trace circuit 46 shown in the figure is a trace condition determination circuit 4 that controls writing to the trace memory based on addresses, data, and other data processor information (for example, status information and access control signals).
60, and a trace memory 461 that stores information as required based on its control. The trace circuit 46 analyzes the operation of the data processor in consideration of the instruction prefetch by the data processor.
2 and an instruction analysis circuit 463. Address, data, and other data processor information are information of the emulation bus 42, and are basically equivalent to information exchanged between the emulation data processor 40 and the target system 6 via the interface cable 8. .

【0032】上記命令解析回路463はデータプロセッ
サ40がデバッグ用命令をフェッチしたか否かを解析す
る。上記命令解析回路463は命令フェッチを示すデー
タプロセッサ40のステータス情報及び命令コードから
デバッグ用命令を認識できる。図1の(B)で説明した
ようにデータプロセッサがデバッグ用命令と通常命令と
を識別可能にするステータス信号3を出力する場合には
そのステータス信号を以ってデバッグ用命令のフェッチ
を認識すればよい。デバッグ用命令を認識すると、命令
解析回路463はエミュレーションバス42上のデバッ
グ用命令をトレースメモリ461に書込み制御する。プ
リフェッチされた命令が実行されるか否かは、PC追跡
回路462が監視する。例えばその制御には、プリフェ
ッチした命令をデコード回路に供給したことを示すステ
ータス信号やプリフェッチした分岐先の命令を実行しな
いことを示すステータス信号をデータプロセッサ40か
ら受け取って判定する。例えば、PC追跡回路462
は、プリフェッチされたデバッグ用命令が実行されると
き、それによって起動されるバスサイクルなどで転送さ
れるパラメータなどをトレースメモリ461に記憶させ
るためにトレースメモリ461に対する書込み制御を行
う。このように、トレース回路46は、デバッグ用の命
令のフェッチサイクルそしてその実行サイクルをトレー
ス取得できる機能を有する。
The instruction analysis circuit 463 analyzes whether or not the data processor 40 has fetched a debug instruction. The instruction analysis circuit 463 can recognize the debug instruction from the status information of the data processor 40 indicating the instruction fetch and the instruction code. As described with reference to FIG. 1B, when the data processor outputs the status signal 3 for distinguishing the debugging instruction from the normal instruction, the status signal can be used to recognize the fetching of the debugging instruction. Good. Upon recognizing the debug instruction, the instruction analysis circuit 463 controls writing of the debug instruction on the emulation bus 42 to the trace memory 461. The PC tracking circuit 462 monitors whether or not the prefetched instruction is executed. For the control, for example, a status signal indicating that the prefetched instruction has been supplied to the decode circuit and a status signal indicating that the prefetched branch destination instruction is not executed are received from the data processor 40 for determination. For example, the PC tracking circuit 462
When the prefetched debug instruction is executed, the write control is performed on the trace memory 461 so as to store the parameter transferred in the bus cycle activated by the prefetched instruction in the trace memory 461. As described above, the trace circuit 46 has a function of acquiring traces of the instruction fetch cycle for debugging and its execution cycle.

【0033】コンパイラがデバッグ情報を生成する場合
において、エミュレータを含むデバッグツールは、コン
パイラが生成したデバッグ情報に基づいて必要な部分の
命令をデバッグ用命令で置き換える機能を必要とする。
この機能は、エミュレータで検証すべきプログラムをホ
ストシステム5がダウンロードするときに当該ホストシ
ステム5で実現できる。或は、エミュレータ4のコント
ロールプロセッサ41で行うようにしてもよい。
When the compiler generates the debug information, the debug tool including the emulator needs a function of replacing a necessary part of the instruction with the debug instruction based on the debug information generated by the compiler.
This function can be realized by the host system 5 when the host system 5 downloads the program to be verified by the emulator. Alternatively, the control processor 41 of the emulator 4 may be used.

【0034】図5には、データプロセッサが上記DBG
MOV命令を実行した際の、トレース取得の様子を示す
タイミングチャートの一例が示される。ここでは、DB
GMOV命令の実行により、cccc番地へのデータd
dddの書き込みが行われる場合を概略的に説明する。
まず、データプロセッサ1,40はaaaa番地から始
まるDBGMOV命令(命令コードの第1オペレーショ
ンコード=1a34、第2オペレーションコード=xx
xx)をフェッチする。エミュレータの命令解析回路4
63はDBGMOV命令のフェッチであることを認識
し、トレースメモリ461に対して、フェッチされるべ
き命令の書き込みを指示する。命令解析回路463はこ
れに入力されるデータバス上の情報が命令情報であるの
かそれ以外のデータ情報であるかの識別を、データプロ
セッサが出力するステータス信号の一種であるLIR信
号に基づいて判定する。LIR信号はそのローレベルに
よってデータプロセッサが命令の先頭をフェッチしてい
ることを示す信号である。次にPC追跡回路462が、
この命令の実行を確認すると、トレースメモリ461に
対して、データの転送サイクル(cccc番地へのデー
タddddの書込み)のデータ取得を指示する。命令プ
リフェッチを行うデータプロセッサの場合、プリフェッ
チされた命令は実行されないことがある。PC追跡回路
462は、プリフェッチされた命令が実際に実行された
か否かをLID信号によって識別する。LID信号は、
データプロセッサがプリフェッチした命令を命令デコー
ダへ転送したことを示す信号である。
In FIG. 5, the data processor is the DBG.
An example of a timing chart showing a state of trace acquisition when the MOV instruction is executed is shown. Here, DB
Execution of GMOV instruction causes data d to address cccc
A case where writing of ddd is performed will be schematically described.
First, the data processors 1 and 40 start the DBGMOV instruction starting from the address aaaa (first operation code of instruction code = 1a34, second operation code = xx).
xx) is fetched. Emulator instruction analysis circuit 4
63 recognizes that the DBGMOV instruction is fetched, and instructs the trace memory 461 to write the instruction to be fetched. The instruction analysis circuit 463 determines whether the information on the data bus input thereto is instruction information or other data information based on the LIR signal which is a kind of status signal output from the data processor. To do. The LIR signal is a signal indicating that the data processor is fetching the head of an instruction due to its low level. Then the PC tracking circuit 462
When the execution of this instruction is confirmed, the trace memory 461 is instructed to acquire the data of the data transfer cycle (writing of the data dddd to the cccc address). In the case of a data processor that performs instruction prefetch, the prefetched instruction may not be executed. The PC tracking circuit 462 identifies whether or not the prefetched instruction is actually executed by the LID signal. The LID signal is
This signal indicates that the data processor has transferred the prefetched instruction to the instruction decoder.

【0035】データプロセッサ40がデバッグ用の命令
を実行したことを示すステータス信号を出力し、或はデ
バッグ用命令をフェッチしたことを示すステータス信号
及びフェッチしたデバッグ用命令を実行したことを示す
ステータス信号を出力する場合には、エミュレータの命
令解析回路463およびPC追跡回路462は不要とな
り、ステータス信号の解析回路を代わりに置くこととな
る。この場合、データプロセッサの複雑な命令コードお
よび動作の解析が不要となるため、エミュレータの物理
的な回路規模を小さくできる。上記夫々のステータス信
号は図1で説明したステータス信号3の一例とされる。
The data processor 40 outputs a status signal indicating that the debugging instruction has been executed, or a status signal indicating that the debugging instruction has been fetched and a status signal indicating that the fetched debugging instruction has been executed. When outputting, the instruction analysis circuit 463 and the PC tracking circuit 462 of the emulator are unnecessary, and the status signal analysis circuit is placed instead. In this case, it is not necessary to analyze the complicated instruction code and operation of the data processor, so that the physical circuit scale of the emulator can be reduced. Each of the above status signals is an example of the status signal 3 described in FIG.

【0036】トレース取得終了後に、エミュレータ若し
くはホストシステムは、トレースメモリの内容を解析
し、表示する。図5のDBGMOV命令の実行結果を例
に取ると、トレースメモリの内容は図6の(A)に示さ
れる様になる。図6の(A)の内容を整理して表示する
と、図6の(B)に示される通りとされる。また、トレ
ース取得の例では説明しなかったが、これを更にDBG
JSR命令と組み合わせて表示すると、図6の(C)の
ようになる。これを高級言語記述での表示とすれば、図
6の(D)に示されるようになる。
After the trace acquisition is completed, the emulator or the host system analyzes and displays the contents of the trace memory. Taking the execution result of the DBGMOV instruction of FIG. 5 as an example, the contents of the trace memory are as shown in FIG. When the contents of (A) of FIG. 6 are organized and displayed, it is as shown in (B) of FIG. Also, although not explained in the example of trace acquisition, this is further described in DBG.
When displayed in combination with the JSR command, it becomes as shown in FIG. If this is displayed in a high-level language description, it will be as shown in FIG.

【0037】コンパイラが、デバッグ用命令ではなく、
デバッグ用命令の位置をデバッグ情報として生成した場
合のエミュレータの動作は、以下の通りとなる。まず、
プログラムおよびデバッグ情報をダウンロードする。次
に、デバッグ情報で指示されたアドレスの命令(必要が
あればユーザがエミュレータコマンドで指示したアドレ
ス情報を加味して)をデバッグ用命令のコードに置き換
える。次に、プログラムを実行し、トレースを取得し、
その後表示する。この部分の動作は、前に説明した通り
である。さらに必要があれば、ユーザが別なアドレス情
報をエミュレータコマンドで指示し、再度命令の置き換
え、プログラムの実行、トレースの取得を行うことにな
る。
The compiler is not a debug instruction,
The operation of the emulator when the position of the debug instruction is generated as the debug information is as follows. First,
Download program and debug information. Next, the instruction of the address designated by the debug information (adding address information designated by the user in the emulator command if necessary) is replaced with the code of the debug instruction. Then run the program, get the trace,
Then display. The operation of this part is as described above. If necessary, the user may instruct another address information with an emulator command, replace the instruction again, execute the program, and acquire the trace.

【0038】次に、データプロセッサ40がプリフェッ
チを行う場合のトレース取得のタイミングを図7及び図
8を参照しながら更に詳述する。ここでは、プリフェッ
チキューは1段とし、条件分岐命令に続く命令のプリフ
ェッチの際には、条件分岐命令の次のアドレスの命令及
び分岐先の命令の両者が、この順でプリフェッチされる
ものとする。尚、この例では、条件分岐命令(Bcc、
この例ではBEQ命令)の次にDBGMOV命令が続
き、これが実行される場合には、cccc番地へのデー
タddddの書き込み(例えばパラメータの転送)が行
われるものとする。すなわち、図7の(A)に示される
命令記述に着目する。このとき、データプロセッサ40
はステータス信号としてLIR信号、LID信号、及び
BCB信号を出力し、エミュレータ4は当該信号LI
R,LID,BCBを基に、プリフェッチされた命令の
実行を監視する。LIR信号は、データプロセッサ40
が命令の先頭をフェッチしていることを示す信号であ
る。データ転送サイクルでは出力されない。エミュレー
タは、これに入力されるデータバス上の情報が命令情報
であるのかそれ以外のデータ情報であるかの識別にLI
R信号を利用する。LID信号は、データプロセッサ4
0がプリフェッチした命令を命令デコーダ(図1の命令
解析部10及びデバッグ用命令解析部11に含まれる)
へ転送したことを示す信号である。命令プリフェッチを
行うデータプロセッサ40の場合、プリフェッチされた
命令が実行されないことがある。エミュレータ4は、プ
リフェッチされた命令が実際に実行されたか否かをLI
D信号及びBCB信号によって識別する。BCB信号
は、データプロセッサ40がプリフェッチした条件分岐
命令などの分岐先の命令を実行しないことを示す信号で
ある。
Next, the trace acquisition timing when the data processor 40 performs prefetch will be described in more detail with reference to FIGS. 7 and 8. Here, the prefetch queue is one stage, and when prefetching the instruction following the conditional branch instruction, both the instruction at the address next to the conditional branch instruction and the instruction at the branch destination are prefetched in this order. . In this example, the conditional branch instruction (Bcc,
In this example, a BEGM instruction) is followed by a DBGMOV instruction, and when this is executed, it is assumed that the data dddd is written to the cccc address (for example, parameter transfer). That is, attention is paid to the instruction description shown in FIG. At this time, the data processor 40
Outputs a LIR signal, a LID signal, and a BCB signal as a status signal, and the emulator 4 outputs the signal LI
The execution of the prefetched instruction is monitored based on R, LID, and BCB. The LIR signal is sent to the data processor 40.
Is a signal indicating that the beginning of the instruction is being fetched. It is not output in the data transfer cycle. The emulator uses the LI to identify whether the information on the data bus input to this is command information or other data information.
The R signal is used. The LID signal is sent to the data processor 4
An instruction decoder that prefetches 0 (included in the instruction analysis unit 10 and the debug instruction analysis unit 11 in FIG. 1)
Is a signal indicating that it has been transferred to. In the case of the data processor 40 that performs instruction prefetch, the prefetched instruction may not be executed. The emulator 4 determines whether the prefetched instruction is actually executed.
It is identified by the D signal and the BCB signal. The BCB signal is a signal indicating that the branch instruction such as the conditional branch instruction prefetched by the data processor 40 is not executed.

【0039】図7には上記条件の下でBEQ命令におけ
る分岐先命令(zzzz番地の命令)が実行されない場
合のタイミングチャートが示される。まず、データプロ
セッサはBEQ命令をプリフェッチした後、aaaa番
地から始まるDBGMOV命令をプリフェッチする。エ
ミュレータ4の命令解析回路463はDBGMOV命令
のプリフェッチであることをLIR信号を用いて認識す
る。この時、トレースメモリ461に対して、トレース
取得(データ及びアドレスなどの情報書き込み)を指示
する。次に、BEQ命令の飛び先であるzzzz番地の
プリフェッチを開始するが、この時BCB信号がローレ
ベルにされて分岐先の命令実行を無効とする場合、すな
わちBEQ命令における条件不成立によってブランチし
ない場合、DBGMOV命令が実行されることになり、
PC追跡回路462がBCB信号およびLID信号によ
りDBGMOV命令の実行を確認した上でトレースメモ
リ461に対して、データの転送サイクル(cccc番
地へのデータddddの書き込み)のトレース取得を指
示する。
FIG. 7 shows a timing chart when the branch destination instruction (the instruction at the address zzz) in the BEQ instruction is not executed under the above conditions. First, the data processor prefetches the BEQ instruction and then prefetches the DBGMOV instruction starting from the address aaa. The instruction analysis circuit 463 of the emulator 4 recognizes the prefetch of the DBGMOV instruction by using the LIR signal. At this time, the trace memory 461 is instructed to acquire the trace (write information such as data and address). Next, the prefetch of the address zzzzz, which is the jump destination of the BEQ instruction, is started. At this time, when the BCB signal is set to the low level to invalidate the execution of the instruction at the branch destination, that is, when the condition is not satisfied in the BEQ instruction, the branch does not occur. , The DBGMOV instruction will be executed,
The PC tracking circuit 462 confirms the execution of the DBGMOV instruction by the BCB signal and the LID signal, and then instructs the trace memory 461 to acquire the trace of the data transfer cycle (writing the data dddd to the address cccc).

【0040】図8には上記条件の下でBEQ命令におけ
る分岐先命令(zzzz番地の命令)が実行される場合
のタイミングチャートが示される。BCB信号が無効
(ブランチする、従ってDBGMOV命令は実行されな
い)の場合には、PC追跡回路462は、トレースメモ
リ461へのDBGMOV命令のプリフェッチのデータ
取得のキャンセルを指示する。これによって、トレース
メモリ461の次に書込み可能なカレントアドレスはD
BGMOV命令のプリフェッチのトレース取得前に戻さ
れ、次回の書き込み時にオーバーライトされることによ
り、今回の書き込みを無効とすることができる。
FIG. 8 shows a timing chart when the branch destination instruction (the instruction at the address zzz) in the BEQ instruction is executed under the above conditions. When the BCB signal is invalid (branching, and thus the DBGMOV instruction is not executed), the PC tracking circuit 462 instructs cancellation of the prefetch data acquisition of the DBGMOV instruction to the trace memory 461. As a result, the next writable current address of the trace memory 461 is D.
The current writing can be invalidated by being returned before the trace acquisition of the prefetch of the BGMOV instruction and being overwritten at the next writing.

【0041】上記実施例によれば以下の作用効果があ
る。 〔1〕データプロセッサ1,40の命令セットに上記デ
バッグ用命令を追加することは、そのようなデータプロ
セッサを使用した組み込み機器において、通常の命令の
みで構成されたプログラムとそのプログラムの一部をデ
バッグ用命令で置き換えたプログラムとの間で、プログ
ラムのサイズ、構成および動作の上での相違点がないと
いうことを保証できる。このことは、対象機器を代行制
御しながらデバッグを支援するエミュレータ4に要求さ
れるリアルタイム性を損なわないように作用する。さら
にそのことは、プログラム実行時に通常の命令とデバッ
グ用の命令をエミュレータ4が容易に区別できるように
作用する。これにより、上記デバッグ用命令を認識して
その実行過程をトレースする機能を有するエミュレータ
4を利用することによって、高級言語で記述されたプロ
グラムでのサブルーチンコールの際にひき渡されるパラ
メータやローカル変数を、エミュレータ4のリアルタイ
ムなトレース機能でトレース取得できるようになり、そ
のようなパラメータやローカル変数に着目したデバッグ
が可能になる。
According to the above embodiment, there are the following effects. [1] Adding the above-mentioned debugging instruction to the instruction set of the data processors 1 and 40 means that, in an embedded device using such a data processor, a program composed of only ordinary instructions and a part of the program are added. It can be guaranteed that there is no difference in the size, configuration, and operation of the program with the program replaced with the debug instruction. This acts so as not to impair the real-time property required of the emulator 4 that supports debugging while controlling the target device on behalf. Furthermore, this acts so that the emulator 4 can easily distinguish between a normal instruction and a debug instruction during program execution. As a result, by using the emulator 4 having the function of recognizing the debugging instruction and tracing the execution process thereof, the parameters and local variables passed at the time of the subroutine call in the program written in the high-level language can be set. The trace can be acquired by the real-time trace function of the emulator 4, and it becomes possible to debug focusing on such parameters and local variables.

【0042】〔2〕上記デバッグ用命令を自動生成する
コンパイラは、命令セットに上記デバッグ用命令を含む
アーキテクチャーのデータプロセッサのための機械語プ
ログラムを簡単に生成できる。上記デバッグ用命令に代
わるデバッグ情報を生成するコンパイラは、デバッグに
のみ利用される情報によって機械語プログラムのサイズ
が増大することを抑えることができる。
[2] The compiler that automatically generates the above-mentioned debugging instruction can easily generate a machine language program for the data processor of the architecture including the above-mentioned debugging instruction in the instruction set. The compiler that generates the debug information instead of the debug instruction can suppress an increase in the size of the machine language program due to the information used only for debugging.

【0043】〔3〕デバッグ用命令を認識する機能を持
ち、その命令の実行過程をトレースするエミュレータ4
は、高級言語で記述されたプログラムでのサブルーチン
コールの際に引き渡されるパラメータやローカル変数を
そのトレース回路で取得して、そのようなパラメータや
ローカル変数に着目したデバッグを可能にする。デバッ
グ用命令を直接受けて動作されるエミュレータは、コン
パイラなどが生成したデバッグ情報に基づいて必要な部
分の命令をデバッグ用命令で置き換える機能が付加され
たエミュレータに比べ、その物理的な規模を小さくでき
る。後者のデバッグツールは、デバッグ用命令に割り当
てることができる未定義コードに余裕がない場合にも、
デバッグ用命令を利用して、パラメータやローカル変数
に着目したデバッグが可能になる。
[3] Emulator 4 having a function of recognizing a debug instruction and tracing the execution process of the instruction
Enables the trace circuit to obtain parameters and local variables that are passed when a subroutine is called in a program written in a high-level language, and enables debugging focusing on such parameters and local variables. An emulator that operates by receiving debug instructions directly has a smaller physical scale than an emulator that has a function to replace necessary parts of instructions with debug instructions based on the debug information generated by a compiler. it can. The latter debugging tool can be used even when there is not enough undefined code that can be assigned to debugging instructions.
It becomes possible to debug by paying attention to parameters and local variables by using debug instructions.

【0044】〔4〕デバッグ用命令の実行と通常の命令
の実行とを区別するためのステータス信号、さらにはデ
ータプロセッサ40がデバッグ用の命令を実行したこと
を示すステータス信号、或はデバッグ用命令をフェッチ
したことを示すステータス信号及びフェッチしたデバッ
グ用命令を実行したことを示すステータス信号などのス
テータス信号3を出力する機能をデータプロセッサ1、
40が有することにより、エミュレータの物理的な回路
規模を小さくできる。
[4] A status signal for distinguishing between the execution of a debugging instruction and the execution of a normal instruction, and further, a status signal indicating that the data processor 40 has executed a debugging instruction, or a debugging instruction. Data processor 1, which outputs a status signal 3 indicating that the fetched debug instruction and a status signal indicating that the fetched debug instruction has been executed,
By having 40, the physical circuit scale of the emulator can be reduced.

【0045】以上本発明者によってなされた発明を実施
例に基づいて具体的に説明したが、本発明はそれに限定
されるものではなく、その要旨を逸脱しない範囲におい
て種々変更可能であることは言うまでもない。例えば、
エミュレータの全体的な構成は図3に限定されず、コン
トロールプロセッサを用いないものなど適宜変更可能で
ある。また、デバッグ用命令の種類も上記実施例に限定
されず、パラメータやローカル変数などに着目したデバ
ッグのために必要な命令に対応して設定することができ
る。また、データプロセッサが出力するステータス信号
LIR、LID、BCBの意義は、図7及び図8で説明
した内容とは逆であってもよい。すなわち、命令の先頭
をフェッチしていないことを示す第一の信号、プリフェ
ッチした命令を命令デコーダへ転送しないことを示す第
二の信号、プリフェッチした分岐先の命令を実行するこ
とを示す第三の信号として定義されてもよい。或いはそ
の他の定義を与えてもよい。
Although the invention made by the present inventor has been specifically described based on the embodiments, the present invention is not limited thereto, and needless to say, various modifications can be made without departing from the scope of the invention. Yes. For example,
The overall configuration of the emulator is not limited to that shown in FIG. 3, but may be changed as appropriate without using a control processor. Also, the type of debugging instruction is not limited to the above embodiment, and can be set in correspondence with the instruction necessary for debugging focusing on parameters and local variables. The meanings of the status signals LIR, LID, and BCB output by the data processor may be opposite to those described with reference to FIGS. 7 and 8. That is, the first signal indicating that the head of the instruction is not fetched, the second signal indicating that the prefetched instruction is not transferred to the instruction decoder, and the third signal indicating that the prefetched branch destination instruction is executed. It may be defined as a signal. Alternatively, other definitions may be given.

【0046】[0046]

【発明の効果】本願において開示される発明のうち代表
的なものによって得られる効果を簡単に説明すれば下記
の通りである。
The effects obtained by the typical ones of the inventions disclosed in the present application will be briefly described as follows.

【0047】〔1〕データプロセッサの命令セットに上
記デバッグ用命令を追加することにより、上記デバッグ
用命令を認識してその実行過程をトレースする機能を有
するデバッグツールを利用することによって、高級言語
で記述されたプログラムでのサブルーチンコールの際に
ひき渡されるパラメータやローカル変数を、エミュレー
タのようなデバッグツールのリアルタイムなトレース機
能でトレース取得できるようになり、そのようなパラメ
ータやローカル変数に着目したデバッグが可能になる。
[1] By adding the debug instruction to the instruction set of the data processor, a debug tool having a function of recognizing the debug instruction and tracing the execution process thereof can be used to generate a high-level language. The parameters and local variables passed when calling a subroutine in the described program can be trace-acquired by the real-time trace function of a debugging tool such as an emulator. Debugging focusing on such parameters and local variables Will be possible.

【0048】〔2〕上記デバッグ用命令を自動生成する
プログラム翻訳方法は、命令セットに上記デバッグ用命
令を含むアーキテクチャーのデータプロセッサのための
機械語プログラムを簡単に生成を実現する。上記デバッ
グ用命令に代わるデバッグ情報を生成するプログラム翻
訳方法は、デバッグにのみ利用される情報によって機械
語プログラムのサイズが増大することを抑える。
[2] The program translation method for automatically generating the debug instruction realizes easy generation of the machine language program for the data processor of the architecture including the debug instruction in the instruction set. The program translation method for generating the debug information instead of the debug instruction suppresses an increase in the size of the machine language program due to the information used only for debugging.

【0049】〔3〕デバッグ用命令を認識する機能を持
ち、その命令の実行過程をトレースするデバッグツール
は、高級言語で記述されたプログラムでのサブルーチン
コールの際に引き渡されるパラメータやローカル変数を
そのトレース回路で取得して、そのようなパラメータや
ローカル変数に着目したデバッグを可能にできる。デバ
ッグ用命令を直接受けて動作されるデバッグツールは、
コンパイラなどが生成したデバッグ情報に基づいて必要
な部分の命令をデバッグ用命令で置き換える機能が付加
されたデバッグツールに比べ、その物理的な規模を小さ
くできる。後者のデバッグツールは、デバッグ用命令に
割り当てることができる未定義コードに余裕がない場合
にも、デバッグ用命令を利用して、パラメータやローカ
ル変数に着目したデバッグを可能にする。
[3] A debugging tool that has a function of recognizing a debug instruction and traces the execution process of the instruction uses parameters and local variables that are passed when a subroutine is called in a program written in a high-level language. It is possible to obtain it with a trace circuit and enable debugging focusing on such parameters and local variables. A debug tool that operates by directly receiving debug instructions is
The physical scale of the debug tool can be reduced as compared with a debug tool having a function of replacing a necessary part of the instruction with a debug instruction based on debug information generated by a compiler or the like. The latter debugging tool enables debugging focusing on parameters and local variables by using the debugging instruction even when there is not enough undefined code that can be assigned to the debugging instruction.

【0050】〔4〕デバッグ用命令の実行と通常の命令
の実行とを区別するためのステータス信号、さらにはデ
ータプロセッサがデバッグ用の命令を実行したことを示
すステータス信号、或はデバッグ用命令をフェッチした
ことを示すステータス信号及びフェッチしたデバッグ用
命令を実行したことを示すステータス信号などのステー
タス信号を出力する機能をデータプロセッサが有するこ
とにより、エミュレータの物理的な回路規模を小さくで
きる。
[4] A status signal for distinguishing execution of a debug instruction from execution of a normal instruction, a status signal indicating that the data processor has executed a debug instruction, or a debug instruction. Since the data processor has a function of outputting a status signal such as a fetched status signal and a status signal indicating that the fetched debug instruction has been executed, the physical circuit scale of the emulator can be reduced.

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

【図1】本発明の一実施例に係るデータプロセッサのブ
ロック図である。
FIG. 1 is a block diagram of a data processor according to an embodiment of the present invention.

【図2】本実施例の一時司令に係るコンパイラによる処
理手順の一例フローチャートである。
FIG. 2 is an example flowchart of a processing procedure by a compiler according to the temporary command of the present embodiment.

【図3】本発明の一実施例に係るエミュレータの全体を
示すブロック図である。
FIG. 3 is a block diagram showing an entire emulator according to an exemplary embodiment of the present invention.

【図4】エミュレータに含まれるトレース回路の一例ブ
ロック図である。
FIG. 4 is a block diagram of an example of a trace circuit included in the emulator.

【図5】データプロセッサがDBGMOV命令を実行し
た際のトレース取得の様子を示す一例タイミングチャー
トである。
FIG. 5 is an example timing chart showing how traces are acquired when a data processor executes a DBGMOV instruction.

【図6】図5のDBGMOV命令の実行結果によってト
レースメモリに得られる内容並びにそれに基づく表示内
容の一例説明図である。
6 is an explanatory diagram showing an example of contents obtained in a trace memory according to the execution result of the DBGMOV instruction of FIG. 5 and display contents based on the contents.

【図7】BEQ命令における分岐先命令が実行されない
場合を例としてデータプロセッサがプリフェッチを行う
場合のトレース取得のタイミングを詳細に示すタイミン
グチャートである。
FIG. 7 is a timing chart showing in detail the trace acquisition timing when the data processor performs prefetch by taking as an example a case where a branch destination instruction in a BEQ instruction is not executed.

【図8】図7のBEQ命令における分岐先命令が実行さ
れる場合のタイミングチャートである。
8 is a timing chart when a branch destination instruction in the BEQ instruction of FIG. 7 is executed.

【図9】C言語のような高級言語で書かれたプログラム
に基づいて割当てられるアドレスマップの一例説明図で
ある。
FIG. 9 is an explanatory diagram of an example of an address map assigned based on a program written in a high-level language such as C language.

【図10】サブルーチンのような同一プログラムであっ
てもその呼ばれ方が相違されることを示す説明図であ
る。
FIG. 10 is an explanatory diagram showing that the same program, such as a subroutine, is called differently.

【図11】同一プログラムであってもその呼ばれ方が異
なると変数のアドレスが一定にならないことを示す説明
図である。
FIG. 11 is an explanatory diagram showing that even if the same program is called differently, the addresses of variables are not constant.

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

1 データプロセッサ 10 命令解析部 11 デバッグ用命令解析部 20 命令実行制御部 21 出力制御回路 3 ステータス信号 4 エミュレータ 40 エミュレーション用データプロセッサ 46 トレース回路 460 トレース条件判定回路 461 トレースメモリ 462 PC追跡回路 463 命令解析回路 5 ホストシステム 6 ターゲットシステム 1 Data Processor 10 Instruction Analysis Unit 11 Debug Instruction Analysis Unit 20 Instruction Execution Control Unit 21 Output Control Circuit 3 Status Signal 4 Emulator 40 Emulation Data Processor 46 Trace Circuit 460 Trace Condition Judgment Circuit 461 Trace Memory 462 PC Tracking Circuit 463 Instruction Analysis Circuit 5 Host system 6 Target system

Claims (9)

【特許請求の範囲】[Claims] 【請求項1】 フェッチした命令を解析する命令解析部
と、命令の解析結果に従って命令を実行するための命令
実行制御部とを備えたデータプロセッサにおいて、 上記命令解析部で解析対象とされる命令セットに含まれ
る所定の命令に対して命令コードが相違されたデバッグ
用命令を解析するためのデバッグ用命令解析部を設け、 上記デバッグ用命令解析部は、デバッグ用命令と対を成
す上記所定の命令に対する命令解析部での解析結果と同
一の解析結果を少なくとも得るものであることを特徴と
するデータプロセッサ。
1. A data processor comprising an instruction analysis unit for analyzing a fetched instruction and an instruction execution control unit for executing an instruction according to an instruction analysis result, and an instruction to be analyzed by the instruction analysis unit. A debug instruction analysis unit for analyzing a debug instruction having an instruction code different from that of a predetermined instruction included in the set is provided, and the debug instruction analysis unit forms a pair with the debug instruction. A data processor which obtains at least the same analysis result as an analysis result of an instruction analysis unit for an instruction.
【請求項2】 上記デバッグ用命令は、それと対を成す
上記所定の命令に対し、命令語長、オペランドのサイズ
と配置、命令実行サイクル数が等しくされるものである
ことを特徴とする請求項1記載のデータプロセッサ。
2. The debugging instruction is such that the instruction word length, the size and arrangement of operands, and the number of instruction execution cycles are made equal to the predetermined instruction forming a pair with the debugging instruction. 1. The data processor according to 1.
【請求項3】 上記デバッグ用命令解析部の解析結果を
受けて、データプロセッサがデバッグ用の命令を実行し
たことを示すステータス信号、又はデバッグ用命令をフ
ェッチしたことを示すステータス信号及びフェッチした
デバッグ用命令を実行したことを示すステータス信号を
出力する出力制御回路を備えて成るものであることを特
徴とする請求項1又は2記載のデータプロセッサ。
3. A status signal indicating that the data processor has executed a debug instruction, or a status signal indicating that the debug instruction has been fetched and the fetched debug in response to the analysis result of the debug instruction analysis unit. 3. The data processor according to claim 1, further comprising an output control circuit which outputs a status signal indicating that the instruction for execution has been executed.
【請求項4】 高級言語で記述されたソースプログラム
から請求項1乃至3の何れか1項記載のデータプロセッ
サのための機械語のプログラムを生成するプログラム翻
訳方法であって、 ソースプログラムの記述におけるサブルーチンコール及
びそれに伴うパラメータ引渡の箇所に対し、上記デバッ
グ用命令の命令コードを生成するステップを含むことを
特徴とするプログラム翻訳方法。
4. A program translation method for generating a machine language program for a data processor according to any one of claims 1 to 3 from a source program written in a high-level language, the method comprising: A program translation method comprising a step of generating an instruction code of the above-mentioned debugging instruction with respect to a location of a subroutine call and parameter passing accompanying it.
【請求項5】 上記デバッグ用命令は、当該部分のジャ
ンプサブルーチン命令に対して命令コードのみ相違され
るデバッグジャンプサブルーチン命令と、当該部分のム
ーブ命令に対して命令コードのみ相違されるデバッグム
ーブ命令を含むものであることを特徴とする請求項4記
載のプログラム翻訳方法。
5. The debug instruction includes a debug jump subroutine instruction in which only an instruction code is different from a jump subroutine instruction in the relevant portion, and a debug move instruction in which only an instruction code is different from a move instruction in the relevant portion. The program translation method according to claim 4, wherein the program translation method includes:
【請求項6】 高級言語で記述されたソースプログラム
から請求項1乃至3の何れか1項記載のデータプロセッ
サのための機械語のプログラムを生成するプログラム翻
訳方法であって、 ソースプログラムの記述におけるサブルーチンコール及
びそれに伴うパラメータ引渡の箇所に対し、その位置を
示すためのデバッグ情報を生成するステップを含むこと
を特徴とするプログラム翻訳方法。
6. A program translation method for generating a machine language program for a data processor according to any one of claims 1 to 3 from a source program written in a high-level language, the method comprising: A program translation method including a step of generating debug information for indicating a position of a subroutine call and a parameter passing position accompanying the subroutine call.
【請求項7】 請求項4記載のプログラム翻訳方法で生
成された機械語プログラムのデバッグを行うためのデバ
ッグツールであって、 デバッグツールによる対象機器に対する制御情報をトレ
ースメモリに貯えるトレース回路に、上記デバッグ用命
令を認識してその実行過程をトレースメモリに格納させ
るデバッグ用命令制御回路を設けて成るものであること
を特徴とするデバッグツール。
7. A debug tool for debugging a machine language program generated by the program translation method according to claim 4, wherein the trace circuit stores control information for a target device by the debug tool in a trace memory. A debug tool characterized by comprising a debug instruction control circuit for recognizing a debug instruction and storing the execution process in a trace memory.
【請求項8】 請求項6記載のプログラム翻訳方法で生
成された機械語プログラムのデバッグを行うためのデバ
ッグツールであって、 上記プログラム翻訳方法で生成されたデバッグ情報に基
づいて必要な部分の命令をデバッグ用命令で置き換える
回路を備え、 デバッグツールによる対象機器に対する制御情報をトレ
ースメモリに貯えるトレース回路に、上記デバッグ用命
令を認識してその実行過程をトレースメモリに格納させ
るデバッグ用命令制御回路を設けて成るものであること
を特徴とするデバッグツール。
8. A debug tool for debugging a machine language program generated by the program translation method according to claim 6, wherein a necessary part of the instruction is based on the debug information generated by the program translation method. Is equipped with a circuit that replaces the debug instruction with a debug instruction, and a debug instruction control circuit that recognizes the debug instruction and stores the execution process in the trace memory A debugging tool characterized by being provided.
【請求項9】 上記デバッグ用命令制御回路は、命令の
先頭をフェッチしているか否かを示す第1の信号と、プ
リフェッチした命令を命令デコーダへ転送したか否かを
示す第2の信号と、プリフェッチした分岐先の命令を実
行するか否かを示す第3の信号とをデータプロセッサの
ステータス信号として受け、これに入力されるデータバ
ス上の情報が命令情報であるか否かの識別を上記第1の
信号によって行い、プリフェッチされた命令が実行され
たか否かを上記第2の信号によって識別し、プリフェッ
チした分岐先の命令が実行されたか否かを第3の信号で
判定して、プリフェッチされたデバッグ用命令の実行過
程をトレースメモリに格納させるものであることを特徴
とする請求項7又は8記載のデバッグツール。
9. The debug instruction control circuit includes a first signal indicating whether the beginning of an instruction is fetched and a second signal indicating whether a prefetched instruction is transferred to an instruction decoder. , A third signal indicating whether or not to execute the prefetched branch destination instruction is received as a status signal of the data processor, and it is discriminated whether or not the information on the data bus inputted thereto is instruction information. The first signal is used to identify whether or not the prefetched instruction has been executed by the second signal, and it is determined whether or not the prefetched branch destination instruction has been executed by the third signal. 9. The debugging tool according to claim 7, wherein the execution process of the prefetched debugging instruction is stored in a trace memory.
JP5351795A 1993-12-28 1993-12-28 Data processor, program translation method and debug tool Withdrawn JPH07200352A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP5351795A JPH07200352A (en) 1993-12-28 1993-12-28 Data processor, program translation method and debug tool

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP5351795A JPH07200352A (en) 1993-12-28 1993-12-28 Data processor, program translation method and debug tool

Publications (1)

Publication Number Publication Date
JPH07200352A true JPH07200352A (en) 1995-08-04

Family

ID=18419662

Family Applications (1)

Application Number Title Priority Date Filing Date
JP5351795A Withdrawn JPH07200352A (en) 1993-12-28 1993-12-28 Data processor, program translation method and debug tool

Country Status (1)

Country Link
JP (1) JPH07200352A (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2006331201A (en) * 2005-05-27 2006-12-07 Matsushita Electric Ind Co Ltd Instruction execution device, debugging method, debugging device and debugging program
JP2009157874A (en) * 2007-12-28 2009-07-16 Nec Electronics Corp Information processor, and debugging method of software
JP2021108129A (en) * 2017-03-29 2021-07-29 グーグル エルエルシーGoogle LLC Distributed hardware tracing
US11921611B2 (en) 2017-03-29 2024-03-05 Google Llc Synchronous hardware event collection

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2006331201A (en) * 2005-05-27 2006-12-07 Matsushita Electric Ind Co Ltd Instruction execution device, debugging method, debugging device and debugging program
JP4718901B2 (en) * 2005-05-27 2011-07-06 パナソニック株式会社 Instruction execution device, debugging method, debugging device, and debugging program
JP2009157874A (en) * 2007-12-28 2009-07-16 Nec Electronics Corp Information processor, and debugging method of software
JP2021108129A (en) * 2017-03-29 2021-07-29 グーグル エルエルシーGoogle LLC Distributed hardware tracing
US11650895B2 (en) 2017-03-29 2023-05-16 Google Llc Distributed hardware tracing
US11921611B2 (en) 2017-03-29 2024-03-05 Google Llc Synchronous hardware event collection

Similar Documents

Publication Publication Date Title
US6286132B1 (en) Debugging support apparatus, a parallel execution information generation device, a computer-readable recording medium storing a debugging support program, and a computer-readable recording medium storing a parallel execution information generation program
EP1130518B1 (en) Software analysis system having an apparatus for selectively collecting analysis data from a target system executing software instrumented with tag statements and method for use thereof
US8266608B2 (en) Post-compile instrumentation of object code for generating execution trace data
US9152531B2 (en) Post-compile instrumentation of object code for generating execution trace data
US5909577A (en) Determining dynamic properties of programs
US20030033592A1 (en) Software debugger and software development support system
US6141791A (en) Debug aid device, program compiler device, storage medium storing computer-readable debugger program, and storage medium storing program compiler program
JP4718901B2 (en) Instruction execution device, debugging method, debugging device, and debugging program
JP2004062858A (en) Compilation of application code in data processor
WO2004003730A1 (en) Automatic configuration of a microprocessor
JP2003131902A (en) Software debugger, system-level debugger, debug method and debug program
Lueck et al. PinADX: an interface for customizable debugging with dynamic instrumentation
CA2194020C (en) Minimizing debug information for global types in compiled languages
CA2194021A1 (en) Binary class library with debugging support
Koju et al. An efficient and generic reversible debugger using the virtual machine based approach
JPH07200352A (en) Data processor, program translation method and debug tool
US20030070117A1 (en) Simulation apparatus and simulation method
JP3379675B2 (en) Reverse execution debugging system
KR0177742B1 (en) Micro controller development system
JP2563708B2 (en) Microprocessor device and emulator device using the same
JP3716635B2 (en) Information processing apparatus and interrupt control method thereof
JP2915944B2 (en) Coverage measurement method and microcomputer
Vranken Debug facilities in the TriMedia CPU64 architecture
JPH07281924A (en) Trace device and emulator using the trace device
CN116775454A (en) Method for testing a computer program

Legal Events

Date Code Title Description
A300 Withdrawal of application because of no request for examination

Free format text: JAPANESE INTERMEDIATE CODE: A300

Effective date: 20010306