JP2013137707A - Processor and debug device using the same - Google Patents
Processor and debug device using the same Download PDFInfo
- Publication number
- JP2013137707A JP2013137707A JP2011289065A JP2011289065A JP2013137707A JP 2013137707 A JP2013137707 A JP 2013137707A JP 2011289065 A JP2011289065 A JP 2011289065A JP 2011289065 A JP2011289065 A JP 2011289065A JP 2013137707 A JP2013137707 A JP 2013137707A
- Authority
- JP
- Japan
- Prior art keywords
- instruction
- stack
- processor
- original
- 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.)
- Pending
Links
Images
Landscapes
- Debugging And Monitoring (AREA)
Abstract
Description
本発明は、プロセッサが実行するプログラムなどをデバッグするための技術に関し、特に、ソフトウェアブレーク(以下、S/Wブレークと略す。)を実現するための機能を備えたプロセッサおよびそれを用いたデバッグ装置に関する。 The present invention relates to a technique for debugging a program or the like executed by a processor, and in particular, a processor having a function for realizing a software break (hereinafter abbreviated as an S / W break) and a debugging apparatus using the processor. About.
近年、CPU(Central Processing Unit)の高機能化、多機能化が進み、それをデバッグするための様々なデバッグ機能が開発されている。そのデバッグ機能の1つとして、S/Wブレーク機能を挙げることができる。 In recent years, CPUs (Central Processing Units) have become more sophisticated and multifunctional, and various debugging functions have been developed to debug them. One of the debugging functions is an S / W break function.
S/Wブレーク機能は、ブレークポイントである指定アドレスの本来命令をブレーク用命令に書き換えることによって実現される。デバッグ対象のCPUがプログラムを実行しているときに、指定アドレスのブレーク命令を実行すると割り込みが発生し、CPUがブレーク状態に遷移する。なお、ここで本来命令とは、プログラムの元の命令を指すものとする。 The S / W break function is realized by rewriting an original instruction at a specified address as a breakpoint to a break instruction. When the CPU to be debugged is executing a program, if a break instruction at a specified address is executed, an interrupt is generated and the CPU transits to a break state. Here, the original instruction refers to the original instruction of the program.
S/Wブレークポイントを解除せずにCPUがプログラムの実行を再開する場合、まず指定アドレスのブレーク命令を本来命令に書き戻す。そして、CPUが本来命令をステップ実行した後、指定アドレスの本来命令を再度ブレーク命令に書き換え、CPUが次命令以降の命令実行を再開する。これに関連する技術として、下記の特許文献1および特許文献2に開示された発明がある。
When the CPU resumes program execution without releasing the S / W breakpoint, the break instruction at the designated address is first written back to the original instruction. Then, after the CPU executes step execution of the original instruction, the original instruction at the designated address is rewritten to a break instruction again, and the CPU resumes execution of instructions following the next instruction. As techniques related to this, there are inventions disclosed in
特許文献1は、モニタープログラムを簡単化することができるインサーキットエミュレータ装置およびインサーキットエミュレーション方法を提供することを目的とする。モニタープログラムを格納するエミュレーションメモリと、ブレークが発生したエミュレーションメモリのアドレスに元々格納されていたユーザープログラムの本来の命令を格納するためのレジスタと、切替信号に応じて、エミュレーションメモリの出力およびレジスタの出力のいずれか一方を選択出力するマルチプレクサと、モニタープログラムからユーザープログラムに復帰した後の最初の命令として、ブレークが発生したアドレスに置換されているブレークを発生する命令の代わりに、ユーザープログラムの本来の命令を出力するように制御する切替信号を生成するコントロール回路とを有する。
特許文献2は、オフライン状態で動作するプログラムのデバッグを行う場合に、ハードウェアを操作することなく、会話形式でデバッグを行い、デバッグ作業を簡易化することを目的とする。デバッグプログラムと被デバッグプログラムをリンクし、被デバッグプログラム内の任意のブレイクポイントからブレイク手段へジャンプすることで被デバッグプログラムからデバッグプログラムへ制御を移し、コマンド入力解析手段において入力待ちすることでブレイクポイントホルトを実現する。
S/Wブレークポイントがフラッシュメモリに設定されている場合、ブレーク命令から本来命令への書き戻しのためのブロック単位での消去/書き換え、および本来命令からブレーク命令への書き換えのためのブロック単位での消去/書き換えが必要となり、操作上の反応が遅くなるといった問題点があった。 When S / W breakpoints are set in the flash memory, erase / rewrite in block units for writing back from the break instruction to the original instruction, and in block units for rewriting from the original instruction to the break instruction There is a problem in that it is necessary to erase / rewrite, and the response of operation becomes slow.
また、フラッシュメモリは消去/書き込み回数に制限がある。そのため、上述のように消去/書き換えが頻繁に行なわれると、フラッシュメモリの寿命が短くなるといった問題点もあった。 In addition, the flash memory has a limit on the number of erase / write operations. For this reason, there has been a problem that if the erasing / rewriting is frequently performed as described above, the lifetime of the flash memory is shortened.
本発明は、上記問題点を解決するためになされたものであり、その目的は、ブレーク状態から復帰するときにフラッシュメモリに対する消去/書き込み回数を削減することが可能なプロセッサおよびそれを用いたデバッグ装置を提供することである。 The present invention has been made to solve the above problems, and an object of the present invention is to provide a processor capable of reducing the number of times of erasing / writing to the flash memory when returning from a break state, and debugging using the processor. Is to provide a device.
本発明の一実施例によれば、ブレーク命令を実行したときに割り込みが発生してブレーク状態に遷移するプロセッサが提供される。命令デコーダは、フェッチした命令をデコードする。制御部は、命令デコーダによるデコード結果に応じてプロセッサの制御を行なう。プロセッサがブレーク状態のときに、命令デコーダによって割り込み復帰命令がデコードされると、命令置換部は、制御部による制御に応じて、フェッチされた復帰先命令をスタックに退避される本来命令に置換して命令デコーダにデコードさせる。 According to an embodiment of the present invention, there is provided a processor that generates an interrupt and transitions to a break state when a break instruction is executed. The instruction decoder decodes the fetched instruction. The control unit controls the processor according to the decoding result by the instruction decoder. When an interrupt return instruction is decoded by the instruction decoder while the processor is in a break state, the instruction replacement unit replaces the fetched return destination instruction with the original instruction saved in the stack under the control of the control unit. To be decoded by the instruction decoder.
本発明の一実施例によれば、命令置換部が、制御部による制御に応じて、フェッチされた復帰先命令をスタックに退避される本来命令に置換して命令デコーダにデコードさせるので、フラッシュメモリに対する消去/書き込み回数を削減することが可能となる。 According to one embodiment of the present invention, the instruction replacement unit replaces the fetched return destination instruction with the original instruction saved in the stack and causes the instruction decoder to decode in accordance with control by the control unit. It is possible to reduce the number of times of erasing / writing with respect to.
図1は、本発明の実施の形態におけるプロセッサを含んだユーザシステムをデバッグするためのデバッグ装置の構成例を示す図である。このシステムは、ホストマシン1と、エミュレータ2と、ユーザシステム3とを含む。また、ユーザシステム3は、コンピュータシステムの1つであって、デバッグ対象のCPU11と、デバッグ制御回路12と、RAM13と、フラッシュメモリ(以下、単にROMと呼ぶ。)14とを含み、バス15を介してこれらが接続されている。
FIG. 1 is a diagram illustrating a configuration example of a debugging device for debugging a user system including a processor according to an embodiment of the present invention. This system includes a
ホストマシン1は、PC(Personal Computer)などのコンピュータ装置であり、ユーザシステム3のデバッグを支援するためのプログラム(デバッガ)を実行する。このデバッガは、操作者が対話的にユーザシステム3内のプログラムの実行を制御したり、CPU11内のレジスタ値や、RAM13、ROM14などのメモリ内容を変更したりする機能を提供する。
また、デバッガは、ホストマシン1内のUSB(Universal Serial Bus)などの通信I/F(Interface)を介してエミュレータ2と通信を行ない、エミュレータ2と連携して動作する。
The
The debugger communicates with the
エミュレータ2は、コンピュータシステムであるユーザシステム3内のCPU11で実行されるプログラムのデバッグ作業に用いられる装置である。エミュレータ2は、JTAG(Joint Test Action Group)などの通信I/Fを介してデバッグ制御回路12と通信を行ない、ユーザシステム3内のCPU11の実行制御、CPU11内部のレジスタ値の取得や変更、RAM13、ROM14などのメモリ内容の取得や変更などのデバッグ機能を制御する。
The
デバッグ制御回路12は、エミュレータ2からの制御によって動作し、CPU11の実行制御、CPU11内部のレジスタ値の取得や変更、RAM13、ROM14などのメモリ内容の取得や変更、指定されたアドレスでプログラムの実行を停止させるブレークポイントなどのデバッグ機能を実現する。
The
ブレークポイントとして、指定アドレスの本来命令をブレーク用命令に置き換えることによってブレークを実現するS/Wブレーク機能や、アドレスなどの条件を設定する専用レジスタを備えることで実現するH/Wブレーク機能などがある。 As a breakpoint, there are an S / W break function that realizes a break by replacing an original instruction at a specified address with an instruction for a break, and an H / W break function that is realized by providing a dedicated register for setting conditions such as an address is there.
S/Wブレーク機能は、上述のようにブレークポイントのアドレスにある本来命令をブレーク用命令に置き換えることによって実現するものであり、ユーザシステム3内のCPU11がプログラムを実行中に、ブレークポイントで置き換えられたブレーク用命令を実行すると割り込みが発生してブレーク状態に遷移する。
The S / W break function is realized by replacing the original instruction at the breakpoint address with a break instruction as described above. The
なお、本実施の形態においては、エミュレータ2とデバッグ制御回路12とが存在する場合について説明するが、ROM14の一部にCPU11の情報を収集するためのモニタプログラムを予め書き込んでおき、UART(Universal Asynchronous Receiver Transmitter)、USBなどの通信I/Fを介してモニタプログラムとホストマシン1とが直接通信を行なう方式であってもよい。
In this embodiment, the case where the
図2は、本発明の実施の形態におけるCPU11の内部構成を説明するためのブロック図である。このCPU11は、アドレスレジスタ21と、プログラムカウンタ22と、命令レジスタ23と、命令デコーダ24と、制御部25と、命令置換部26と、データレジスタ27と、ALU(Arithmetic Logical Unit)28と、アキュムレータ29とを含み、クロックパルスに同期して動作を行なう。また、命令置換部26は、本来命令一時保存レジスタ30を含む。
FIG. 2 is a block diagram for explaining the internal configuration of the
アドレスレジスタ21は、CPU11がメモリやI/O(Input/Output)に対して命令やデータをアクセスする際に用いられるアドレスを保持するレジスタであり、たとえば、命令をフェッチする場合にはプログラムカウンタ22に格納される値を保持する。
The
プログラムカウンタ22は、次に実行する命令のメモリ上のアドレスを格納するものであり、制御部24によって制御される。
The
命令レジスタ23は、図示しない命令フェッチ部によってフェッチされた命令を、制御部25による制御によって保持するレジスタであり、保持した命令を命令デコーダ24に転送する。
The
命令デコーダ24は、命令レジスタ23から転送された命令をデコードし、デコード結果を制御部25に転送する。制御部25は、命令デコーダ24によるデコード結果に応じて、CPU11内のALU28、アキュムレータ29などの各ブロックを制御する。
The
命令置換部26は、命令デコーダ24が後述の「指定命令付き割り込み復帰命令」をデコードしたときに制御部25から制御信号を受け、スタックから取得した本来命令を本来命令一時保存レジスタに保存する。そして、制御部25が「指定命令付き割り込み復帰命令」を実行して割り込みから復帰したときに、本来であれば復帰先PC(プログラムカウンタ)からフェッチされた命令が命令レジスタ23に記憶されることになるが、命令置換部26は、命令デコーダ24によって復帰先命令がデコードされる前に、命令レジスタ23に記憶される復帰先命令の一部または全部を、本来命令一時保存部30に記憶した本来命令に置換して命令レジスタ23に格納する。その結果、CPU11は、「指定命令付き割り込み復帰命令」を実行後に、本来命令を実行することになる。
The
命令置換部26は、それ以外の命令置換が不要な場合には、データレジスタ27に記憶される命令をそのまま命令レジスタ23に格納する。命令レジスタ23は、制御部25から制御信号を受け、データレジスタ27に記憶される命令または置換部26によって置換された命令を保持し、命令デコーダ24にその命令を与えてデコードさせる。
The
データレジスタ27は、CPU11がメモリやI/Oから読み出した命令やデータ、メモリやI/Oに書き込むデータを一時的に保持するレジスタであり、たとえば命令フェッチの場合にはフェッチされた命令が格納される。
The data register 27 is a register that temporarily holds instructions and data read from the memory and I / O by the
図3は、本発明の実施の形態におけるCPU11が指定命令付き割り込み復帰命令を実行したときの動作を説明するための図である。例1は、割り込みから復帰する際に、スタックに退避されている本来命令を指定命令として取得して本来命令一時保存レジスタ30に格納し、SP(スタックポインタ)の値を4だけ加算した後にスタックに退避されているPSW(Program Status Word)を復帰させる。そして、SPの値を4だけ加算した後にスタックに退避されているPCを復帰させ、さらにSPの値を4だけ加算する。
FIG. 3 is a diagram for explaining an operation when the
例2は、割り込みから復帰する際に、スタックに退避されている本来命令を指定命令として取得して本来命令一時保存レジスタ30に格納し、SPの値を4だけ加算した後にスタックに退避されているPCを復帰させる。そして、SPの値を4だけ加算した後にスタックに退避されているPSWを復帰させ、さらにSPの値を4だけ加算する。
In example 2, when returning from an interrupt, the original instruction saved in the stack is acquired as the designated instruction, stored in the instruction
例3は、割り込みから復帰する際に、スタックに退避されているPCを復帰させ、SPの値を4だけ加算した後にスタックに退避されているPSWを復帰させる。そして、さらにSPの値を4だけ加算してスタックに退避されている本来命令を指定命令として取得して本来命令一時保存レジスタ30に格納し、SPの値を4だけ加算する。
In the example 3, when returning from the interrupt, the PC saved in the stack is restored, and after adding the SP value by 4, the PSW saved in the stack is restored. Then, the SP value is further incremented by 4, and the original instruction saved in the stack is acquired as the designated instruction and stored in the original instruction
例4は、専用レジスタとしてPC退避用レジスタおよびPSW退避用レジスタを設けた場合を示しており、PC退避用レジスタの値をPCに復帰させ、PSW退避用レジスタの値をPSWに復帰させ、さらにスタックに退避されている本来命令を指定命令として取得して本来命令一時保存レジスタ30に格納し、SPの値を4だけ加算する。
Example 4 shows a case where a PC saving register and a PSW saving register are provided as dedicated registers. The value of the PC saving register is restored to PC, the value of the PSW saving register is restored to PSW, and The original instruction saved in the stack is acquired as the designated instruction and stored in the original instruction
例1〜例4のいずれの場合にも、上述のように、割り込みから復帰後に、PCに設定されているブレーク命令の代わりに、本来命令一時保存レジスタ30に格納された本来命令が実行されることになる。
In any case of Examples 1 to 4, as described above, after returning from the interrupt, the original instruction originally stored in the instruction
図4は、本発明の実施の形態におけるCPU11を含んだシステムのS/Wブレーク機能を説明するための図である。まず、デバッガ操作者がホストマシン1を用いてデバッガにS/Wブレークポイントを設定する指示を行なうと、デバッガ装置はS/Wブレークポイント設定アドレスにブレーク命令を埋め込む処理をCPU11に指示する。
この指示は、エミュレータ2と、デバッグ制御回路12またはモニタプログラムとの間の通信I/Fを介して行なわれる。ここで、デバッガ装置とは、ホストコンピュータ1上で動作するエミュレータ制御用ソフトウェア(デバッガ)およびエミュレータ2によって構成されるものとする。
FIG. 4 is a diagram for explaining the S / W break function of the system including the
This instruction is performed via a communication I / F between the
最後に、CPU11はエミュレータ2からの指示に応じて、S/Wブレークポイント設定アドレスの本来命令をブレーク命令に書き換える。
Finally, the
図5〜図7は、CPU11による命令実行がS/Wブレークポイントに到達したときの動作を説明するための図である。なお、PCの値およびPSWの値が退避される順番はCPU11の仕様によって異なる。
図5は、図3の例1の仕様に対応する場合を示している。CPU11が指定アドレスのブレーク命令を実行すると、割り込みが発生してブレーク状態に遷移する。このとき、CPU11は、PCの値をスタックに退避した後にPSWの値をスタックに退避する。
5 to 7 are diagrams for explaining operations when instruction execution by the
FIG. 5 shows a case corresponding to the specification of Example 1 of FIG. When the
図6は、図3の例2および例3の仕様に対応する場合を示している。CPU11が指定アドレスのブレーク命令を実行すると、割り込みが発生してブレーク状態に遷移する。このとき、CPU11は、PSWの値をスタックに退避した後にPCの値をスタックに退避する。
FIG. 6 shows a case corresponding to the specifications of Example 2 and Example 3 of FIG. When the
図7は、図3の例4の仕様に対応する場合を示している。専用レジスタとしてPC退避用レジスタおよびPSW退避用レジスタが設けられているため、図7(a)に示すように、PCの値およびPSWの値はスタックには退避されない。また、図7(b)に示すように、PCの値がPC退避用レジスタに格納され、PSWの値がPSW退避用レジスタに格納される。 FIG. 7 shows a case corresponding to the specification of Example 4 of FIG. Since the PC saving register and the PSW saving register are provided as the dedicated registers, the PC value and the PSW value are not saved in the stack as shown in FIG. Further, as shown in FIG. 7B, the PC value is stored in the PC saving register, and the PSW value is stored in the PSW saving register.
図8は、本発明の実施の形態におけるCPU11のブレーク命令による割り込み発生時の動作を説明するための図である。まず、CPU11がプログラムを順次実行してS/Wブレークポイントに到達すると、そのアドレスに埋め込まれたブレーク命令を実行して割り込みが発生する。
FIG. 8 is a diagram for explaining an operation when an interrupt is generated by the break instruction of the
CPU11は、割り込みが発生するとブレークポイントのPCの値とPSWの値とをスタックに退避する。この処理は、図5および図6の場合に対応している。
When the interrupt occurs, the
また、CPU11は、割り込みが発生するとブレークポイントのPCの値をPC退避用レジスタに退避し、PSWの値をPSW退避用レジスタに退避するようにしてもよい。この処理は、図7の場合に対応している。
Further, when an interrupt occurs, the
次に、CPU11は、割込み処理ルーチンに分岐して、デバッグ制御回路12によりエミュレータ2からの指示待ち状態となる。また、モニタプログラムによって処理を行なう場合には、割込み処理ルーチンによりエミュレータ2からの指示待ち状態となる。
Next, the
図9は、CPU11がブレーク状態から実行再開するときの処理を説明するための図である。まず、デバッガ操作者がホストマシン1を用いてデバッガにCPU11の実行再開を指示する。
デバッガ装置はCPU11に対してSPの移動(4だけ減算)を指示し、スタックにS/Wブレークポイントの本来命令を格納するように指示する。この処理は、図11、図12および図14に対応している。
FIG. 9 is a diagram for explaining processing when the
The debugger apparatus instructs the
また、デバッガ装置はCPU11に対してスタックに退避されているPCの値およびPSWの値をスタック内でコピーするように指示し、スタックにS/Wブレークポイントの本来命令を格納するように指示し、SPの移動(4だけ減算)を指示するようにしてもよい。この処理は、図13に対応している。
Further, the debugger device instructs the
CPU11は、デバッグ装置から指示を受けると、その指示に対応する処理を行なう。これらの処理は、図11〜図14を用いて後述する。
When the
次に、デバッグ装置がCPU11に対して指定命令付き割り込み復帰命令の実行を指示すると、CPU11は、指示された指定命令付き割り込み復帰命令を実行する。この処理は、図10および図15を用いて後述する。
Next, when the debug device instructs the
最後に、CPU11は、プログラムの以降の命令を順次実行する。
図10は、本発明の実施の形態におけるCPU11が指定命令付き割り込み復帰命令を実行するときの処理を説明するための図である。まず、CPU11は、スタックから本来命令、復帰先PC値およびPSW値を取得する。この処理は、図3の例1、例2および例3に対応している。
Finally, the
FIG. 10 is a diagram for explaining processing when the
また、CPU11は、スタックから本来命令のみを取得するようにしてもよい。この処理は、図3の例4に対応している。
The
次に、取得した本来命令が本来命令一時保存レジスタ30に保存された後、スタックから取得したPC値およびPSW値でPCおよびPSWを復帰する。この処理は、図3の例1、例2および例3に対応している。
Next, after the acquired original instruction is stored in the original instruction
また、取得した本来命令が本来命令一時保存レジスタ30に保存された後、PC退避用レジスタおよびPSW退避用レジスタから取得したPC値およびPSW値でPCおよびPSWを復帰するようにしてもよい。この処理は、図3の例4に対応している。
In addition, after the acquired original instruction is originally stored in the temporary
次に、復帰先PCから命令をフェッチする。このとき、ブレーク命令を含んだまま命令がフェッチされるので、命令置換部26がフェッチした命令を本来命令一時保存レジスタ30に保存される本来命令に置き換える。
Next, an instruction is fetched from the return destination PC. At this time, since the instruction is fetched while including the break instruction, the instruction fetched by the
次に、命令デコーダ24は、命令置換部26によって置換された本来命令をデコードし、制御部25が本来命令を実行する。
Next, the
図11〜図14は、本発明の実施の形態におけるCPU11がデバッガ装置から指示された処理を行なうときの動作を説明するための図である。なお、本来命令が退避されるアドレスはCPU11の仕様によって異なる。
FIGS. 11 to 14 are diagrams for explaining an operation when the
図11は、図3の例1の仕様に対応する場合を示している。CPU11は、SPの移動(4だけ減算)を行ない、スタックにS/Wブレークポイントの本来命令を格納する。なお、再開PCおよびPSWは、CPU11が割り込み発生時に退避させたものである。
FIG. 11 shows a case corresponding to the specification of Example 1 of FIG. The
図12は、図3の例2の仕様に対応する場合を示している。CPU11は、SPの移動(4だけ減算)を行ない、スタックにS/Wブレークポイントの本来命令を格納する。なお、PSWおよび再開PCは、CPU11が割り込み発生時に退避させたものである。
FIG. 12 shows a case corresponding to the specification of Example 2 of FIG. The
図13は、図3の例3の仕様に対応する場合を示している。CPU11は、4だけ減算したアドレスに再開PCの値をコピーし、さらに4だけ減算したアドレスにPSWの値をコピーし、元のPSWがあったアドレスにS/Wブレークポイントの本来命令を格納し、SPの移動(4だけ減算)を行なう。
FIG. 13 shows a case corresponding to the specification of Example 3 of FIG. The
図14は、図3の例4の仕様に対応する場合を示している。CPU11は、SPの移動(4だけ減算)を行ない、スタックにS/Wブレークポイントの本来命令を格納する。なお、再開PCおよびPSWは、PC退避用レジスタおよびPSW退避用レジスタに退避されている。
FIG. 14 shows a case corresponding to the specification of Example 4 of FIG. The
図15は、本発明の実施の形態におけるCPU11が指定命令付き割り込み復帰命令をフェッチして実行する時の全体動作を説明するための図である。まず、CPU11が指定命令付き割り込み復帰命令(図15においては発明命令と記載する。)をフェッチすると、命令デコーダ24が指定命令付き割り込み復帰命令をデコードし、制御部25が指定命令付き割り込み復帰命令の実行を開始する。
FIG. 15 is a diagram for explaining the overall operation when the
このとき、制御部25は、メモリアクセスによってスタックから本来命令、PC値およびPSW値を取得し、本来命令を本来命令一時保存レジスタ30に保存し、復帰PSWをPSWに設定し、復帰先PCをPCに設定する。この処理は、図3の例1〜例3に対応している。
At this time, the
また、制御部25は、メモリアクセスによってスタックから本来命令を取得して本来命令一時保存レジスタに保存し、PSW退避用レジスタから復帰PSWを取得してPSWに設定し、PC退避用レジスタから復帰先PCを取得してPCに設定するようにしてもよい。この処理は、図3の例4に対応している。
Further, the
次に、CPU11が復帰先PCの命令をフェッチすることになるが、この命令にはブレーク命令が含まれているため、命令置換部26は、ブレーク命令を本来命令一時保存レジスタ30に保存される本来命令に置換して命令レジスタ23に格納する。
Next, the
命令デコーダ24が命令レジスタ23に格納される本来命令をデコードすると、制御部25は、本来命令の実行を開始する。
When the
以上説明したように、本実施の形態におけるCPU11によれば、指定命令付き割り込み復帰命令を実行するときに、スタックに退避される本来命令を本来命令一時保存レジスタ30に格納し、ブレーク命令を含んだ復帰先PC値の命令を本来命令に置換するようにしたので、フラッシュメモリのブロック単位での消去/書き換えが不要となり、操作上の反応が遅くなるといった問題点を解消することが可能となった。
As described above, according to the
また、フラッシュメモリのブロック単位での消去/書き換えが不要となるため、フラッシュメモリの寿命が短くなるといった問題点を防止することが可能となった。 In addition, since it is not necessary to erase / rewrite the flash memory in units of blocks, it is possible to prevent the problem that the life of the flash memory is shortened.
今回開示された実施の形態は、すべての点で例示であって制限的なものではないと考えられるべきである。本発明の範囲は上記した説明ではなくて特許請求の範囲によって示され、特許請求の範囲と均等の意味および範囲内でのすべての変更が含まれることが意図される。 The embodiment disclosed this time should be considered as illustrative in all points and not restrictive. The scope of the present invention is defined by the terms of the claims, rather than the description above, and is intended to include any modifications within the scope and meaning equivalent to the terms of the claims.
1 ホストマシン、2 エミュレータ、3 ユーザシステム、11 CPU、12 デバッグ制御回路、13 RAM、14 ROM、15 バス、21 アドレスレジスタ、22 プログラムカウンタ、23 命令レジスタ、24 命令デコーダ、25 制御部、26 命令置換部、27 データレジスタ、28 ALU、29 アキュムレータ、30 本来命令一時保存レジスタ。 1 host machine, 2 emulator, 3 user system, 11 CPU, 12 debug control circuit, 13 RAM, 14 ROM, 15 bus, 21 address register, 22 program counter, 23 instruction register, 24 instruction decoder, 25 control unit, 26 instruction Replacement part, 27 Data register, 28 ALU, 29 Accumulator, 30 Original instruction temporary storage register.
Claims (5)
フェッチした命令をデコードするデコード手段と、
前記デコード手段によるデコード結果に応じて前記プロセッサの制御を行なう制御手段と、
前記プロセッサがブレーク状態のときに、前記デコード手段によって割り込み復帰命令がデコードされると、前記制御手段による制御に応じて、フェッチされた復帰先命令をスタックに退避される本来命令に置換して前記デコード手段にデコードさせる置換手段とを含む、プロセッサ。 A processor that transitions to a break state when an interrupt occurs when a break instruction is executed,
Decoding means for decoding the fetched instruction;
Control means for controlling the processor according to a decoding result by the decoding means;
When an interrupt return instruction is decoded by the decoding means when the processor is in a break state, the fetched return destination instruction is replaced with an original instruction saved in the stack according to control by the control means. A processor including substitution means for causing the decoding means to decode.
前記制御手段は、前記デコード手段によって前記割り込み復帰命令がデコードされたときに、前記スタックからプログラムカウンタの値を復帰させ、前記スタックからプログラムステータスワードの値を復帰させた後に、前記置換手段に前記スタックから取得した前記本来命令を前記保持手段に保持させ、前記置換手段は、フェッチされた復帰先命令を前記保持手段に保持した前記本来命令に置換する、請求項1記載のプロセッサ。 The replacement means includes holding means for holding the original instruction,
The control means, when the interrupt return instruction is decoded by the decoding means, returns the value of the program counter from the stack, and after returning the value of the program status word from the stack, The processor according to claim 1, wherein the original instruction acquired from the stack is held in the holding unit, and the replacement unit replaces the fetched return destination instruction with the original instruction held in the holding unit.
前記制御手段は、前記デコード手段によって前記割り込み復帰命令がデコードされたときに、前記スタックからプログラムステータスワードの値を復帰させ、前記スタックからプログラムカウンタの値を復帰させた後に、前記置換手段に前記スタックから取得した前記本来命令を前記保持手段に保持させ、前記置換手段は、フェッチされた復帰先命令を前記保持手段に保持した前記本来命令に置換する、請求項1記載のプロセッサ。 The replacement means includes holding means for holding the original instruction,
The control means, when the interrupt return instruction is decoded by the decoding means, returns the value of the program status word from the stack, and after returning the value of the program counter from the stack, The processor according to claim 1, wherein the original instruction acquired from the stack is held in the holding unit, and the replacement unit replaces the fetched return destination instruction with the original instruction held in the holding unit.
前記デバッグ装置は、前記割り込みが発生したときに前記プロセッサがスタックに退避させたプログラムカウンタおよびプログラムステータスワードに対応して、本来命令を前記スタックに退避させる本来命令退避手段を含み、
前記プロセッサは、フェッチした命令をデコードするデコード手段と、
前記デコード手段によるデコード結果に応じて前記プロセッサの制御を行なう制御手段と、
前記プロセッサがブレーク状態のときに、前記デコード手段によって割り込み復帰命令がデコードされると、前記制御手段による制御に応じて、フェッチされた復帰先命令を前記スタックに退避される前記本来命令に置換して前記デコード手段にデコードさせる置換手段とを含む、デバッグ装置。 A debugging device that debugs a system including a processor that generates an interrupt when a break instruction is executed and enters a break state.
The debugging device includes an original instruction saving unit that saves an original instruction to the stack in response to a program counter and a program status word that the processor saves to the stack when the interrupt occurs.
The processor includes decoding means for decoding the fetched instruction;
Control means for controlling the processor according to a decoding result by the decoding means;
When an interrupt return instruction is decoded by the decoding means while the processor is in a break state, the fetched return destination instruction is replaced with the original instruction saved in the stack according to control by the control means. And a replacement means for causing the decoding means to decode.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2011289065A JP2013137707A (en) | 2011-12-28 | 2011-12-28 | Processor and debug device using the same |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2011289065A JP2013137707A (en) | 2011-12-28 | 2011-12-28 | Processor and debug device using the same |
Publications (1)
Publication Number | Publication Date |
---|---|
JP2013137707A true JP2013137707A (en) | 2013-07-11 |
Family
ID=48913364
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2011289065A Pending JP2013137707A (en) | 2011-12-28 | 2011-12-28 | Processor and debug device using the same |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP2013137707A (en) |
-
2011
- 2011-12-28 JP JP2011289065A patent/JP2013137707A/en active Pending
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US7950001B2 (en) | Method and apparatus for instrumentation in a multiprocessing environment | |
US7836430B2 (en) | Reversing execution of instructions in a debugger | |
US7185321B1 (en) | Method and system for debugging through supervisory operating codes and self modifying codes | |
CN109726135B (en) | Multi-core debugging method and device and computer readable storage medium | |
JP4222370B2 (en) | Program for causing a computer to execute a debugging support apparatus and a debugging processing method | |
CN108139908B (en) | Move prefix instructions | |
US7506205B2 (en) | Debugging system and method for use with software breakpoint | |
JP2007128132A (en) | Thread debugging device, thread debugging method and program | |
US8943480B2 (en) | Setting breakpoints in optimized instructions | |
Visan et al. | URDB: a universal reversible debugger based on decomposing debugging histories | |
TW200837555A (en) | Debug method | |
CN102662845B (en) | A kind of method, Apparatus and system realized through property data breakpoint | |
JP3260083B2 (en) | Debug system and debugging method | |
CN115878363A (en) | Method, apparatus and computer readable storage medium for resolving processor exceptions | |
JP2013137707A (en) | Processor and debug device using the same | |
JP2007004400A (en) | Program debug method | |
Cormack | The rump kernel: A tool for driver development and a toolkit for applications | |
CN112802527B (en) | Method for realizing high-speed programming of embedded flash memory and programming system of embedded flash memory | |
JP2012242904A (en) | Debug apparatus and debug method | |
Dolev et al. | Stabilization enabling technology | |
WO2024069730A1 (en) | Debugging device and debugging method | |
KR101292572B1 (en) | File system management apparatus using virtual machine and method thereof | |
JP5850732B2 (en) | Semiconductor device and control method thereof | |
Arya et al. | DMTCP: Bringing Checkpoint-Restart to Python. | |
Cagnin | LLDBagility: practical macOS kernel debugging |