[go: up one dir, main page]

JPH06274369A - Optimization program debugging method - Google Patents

Optimization program debugging method

Info

Publication number
JPH06274369A
JPH06274369A JP5085509A JP8550993A JPH06274369A JP H06274369 A JPH06274369 A JP H06274369A JP 5085509 A JP5085509 A JP 5085509A JP 8550993 A JP8550993 A JP 8550993A JP H06274369 A JPH06274369 A JP H06274369A
Authority
JP
Japan
Prior art keywords
program
variable
register
debugging
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.)
Withdrawn
Application number
JP5085509A
Other languages
Japanese (ja)
Inventor
Yuugo Kashiwagi
有吾 柏木
Hiroshi Yajima
宏 矢島
Hiromi Nagayama
ひろみ 永山
Tsutomu Hayashi
努 林
Koji Yoneyama
浩司 米山
Hideya Fujita
秀哉 藤田
Yoichi Sudo
洋一 須藤
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 Microcomputer System Ltd
Hitachi Ltd
Original Assignee
Hitachi Microcomputer System Ltd
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 Microcomputer System Ltd, Hitachi Ltd filed Critical Hitachi Microcomputer System Ltd
Priority to JP5085509A priority Critical patent/JPH06274369A/en
Publication of JPH06274369A publication Critical patent/JPH06274369A/en
Withdrawn legal-status Critical Current

Links

Landscapes

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

Abstract

(57)【要約】 【目的】 コンパイラによって最適化されたオブジェク
トプログラムの高級言語記述レベルでのプログラムデバ
ッグを可能にするデバッグ方式を提供する。 【構成】 レジスタの割り付けが一定であるオブジェク
トプログラム上の区間毎に、変数と該変数が割り付けら
れるレジスタの対応を示すレジスタ割り付け情報テーブ
ル10を参照して、所要のプログラム点における変数を
取得するようにする。レジスタ割り付け情報テーブル1
0は、所定の変数の有効範囲内でコンパイラによってそ
の変数の将来における使用の可能性がないと判定された
結果として当該変数がレジスタに割り付けられていない
ことを示す情報を有する。
(57) [Summary] [Objective] To provide a debugging method that enables program debugging at the high-level language description level of an object program optimized by a compiler. [Configuration] A variable at a required program point is acquired by referring to a register allocation information table 10 indicating a correspondence between a variable and a register to which the variable is allocated for each section on an object program in which register allocation is constant. To Register allocation information table 1
Zero has information indicating that the variable is not allocated to a register as a result of the compiler determining that the variable is not likely to be used in the future within the valid range of the variable.

Description

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

【0001】[0001]

【産業上の利用分野】本発明は、情報処理システムにお
けるプログラムデバッグ、特にコンパイラによって最適
化されたオブジェクトプログラムの高級言語記述レベル
でのプログラムデバッグを可能にする方式に関するもの
である。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a method for enabling program debugging in an information processing system, and in particular, program debugging at a high level language description level of an object program optimized by a compiler.

【0002】[0002]

【従来の技術】高級言語のデバッグを行うためには、デ
バッグ時に必要な情報がプログラム実行時に容易に得ら
れるように、一定の実行方式に従ったオブジェクトプロ
グラムを生成する必要がある。上記デバッグのための一
定の実行方式とは、例えば、(1)変数の割り付けられ
る場所を、変数の有効範囲内で一定とする、(2)スタ
ック上に配置される自動変数、あるいはパラメタは、特
定のベースレジスタから一定のオフセットの場所にある
ようにする、(3)ソースプログラムの1行(1ステー
トメント)に対応するオブジェクトプログラムは、連続
したアドレス範囲に配置する、などである。
2. Description of the Related Art In order to debug a high-level language, it is necessary to generate an object program according to a certain execution method so that information necessary for debugging can be easily obtained during program execution. The constant execution method for debugging is, for example, (1) a location to which a variable is allocated is constant within the effective range of the variable, (2) an automatic variable or parameter arranged on the stack is The object program corresponding to one line (one statement) of the source program is arranged in a continuous address range, and so on.

【0003】一方、ループ中で実行する必要のないコー
ドをループ外に移動したり、コードの並べ替えによるオ
ブジェクトプログラムの効率化などのために、コンパイ
ラによるオブジェクトプログラムの最適化が行われてい
る。
On the other hand, the object program is optimized by a compiler in order to move the code that does not need to be executed in the loop to the outside of the loop and to improve the efficiency of the object program by rearranging the code.

【0004】[0004]

【発明が解決しようとする課題】しかしながら、斯る最
適化により、上記一定の実行方式に従わないオブジェク
トコードが生成されることになり、コンパイラにて生成
されるオブジェクトプログラムとソースプログラムとが
一対一に対応しなくなり、デバッガによってソースプロ
グラム記述レベルの表現でデータを参照したり、変更し
たりするようなことが一義的に行い難くなる。したがっ
て、最適化されたオブジェクトプログラムのデバッグを
行なう場合、デバッグによって得られる情報の精度が低
下することを免れない。逆に、上記一定の実行方式の制
約は、最適化の可能性を制限することになる。
However, such optimization results in the generation of an object code that does not follow the above-mentioned fixed execution method, and the object program generated by the compiler and the source program are in one-to-one correspondence. This makes it difficult for the debugger to unequivocally refer to or change data in a representation at the source program description level. Therefore, when debugging an optimized object program, the accuracy of the information obtained by debugging is unavoidable. On the contrary, the fixed execution method constraint limits the possibility of optimization.

【0005】本発明の目的は、上記実行方式の制約を緩
和し、それを補完する新たなデバッグ情報を追加するこ
とによって、最適化技術に対応したデバッグ方式を提供
することにある。更に本発明の別の目的は、それら実行
形式の制約を最適化によって破った場合でも、デバッグ
機能を実現するためには、変数の割り付け場所、ソース
プログラムのプログラム点に対応するオブジェクトプロ
グラムのアドレスなどを詳細に示す情報を、少ない情報
量を以って付加し、最適化されたプログラムに対する高
級言語記述レベルでのデバッグを、デバッグ情報のサイ
ズを最小限に留めて実現できるデバッグ方式を提供する
ことにある。
An object of the present invention is to provide a debugging method compatible with the optimization technique by relaxing the restriction of the above-mentioned execution method and adding new debug information to complement it. Further, another object of the present invention is to realize the debug function even if those execution format constraints are violated by optimization, in order to realize the debug function, the allocation location of the variable, the address of the object program corresponding to the program point of the source program, etc. To provide a debugging method that can add detailed information about the details with a small amount of information to enable debugging of an optimized program at a high-level language description level while minimizing the size of the debugging information. It is in.

【0006】本発明の前記並びにその他の目的と新規な
特徴は本明細書の記述及び添付図面から明らかになるで
あろう。
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.

【0007】[0007]

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

【0008】(1)プログラムの構造に従った、変数の
有効範囲に対応して変数の割り付け情報をデバッグ情報
として出力するだけでは、最適化によって変数の割り付
けが有効範囲内で動的に変わり得る場合には対応でき
ず、また、変数が使用されないためにレジスタに割り付
けられていない場合にはデバッグ時にその旨表示するこ
とができない。これに対しては、レジスタの割り付けが
一定であるオブジェクトプログラム上の区間毎に、変数
と該変数が割り付けられるレジスタの対応を示すレジス
タ割り付け情報テーブル(図3の対照表10)を参照し
て、所要のプログラム点における変数を取得するように
する。さらに、前記レジスタ割り付け情報テーブル(図
3の対照表10)は、所要のプログラム点における変数
の取得に際して、所定の変数の有効範囲内でコンパイラ
によってその変数の将来における使用の可能性がないと
判定された結果として当該変数がレジスタに割り付けら
れていないことを示す情報を有し、これを参照すること
によって、取得すべき変数にレジスタの割り付けがない
ときはその旨を表示する。また、デバッグ精度の劣化を
抑えつつレジスタ割り付け情報テーブルの情報量を少な
くするには、図4に示されるように、レジスタの割り付
けが一定であるオブジェクトプログラム上の区間を統合
した統合区間に対して、変数の参照回数をその変数が割
り付けられるレジスタ毎に集計し、参照回数の最も多い
レジスタを当該変数の割り付けレジスタとし、該変数と
そのレジスタを、当該統合区間でのレジスタ割り付け情
報とする、情報圧縮処理を採用する。 (2)最適化の結果として、レジスタにもメモリにも割
り付けられていない変数が、定数、あるいはレジスタや
メモリに割り付いている変数の値から特定の数式によっ
て対応付けられている場合、変数の割り付け情報として
レジスタ名、メモリアドレス値、あるいは特定のベース
レジスタからのオフセットアドレス値をデバッグ情報と
して出力するだけでは対応できない。この点に関して
は、コンパイラが上記数式を割り付け情報テーブル(図
5の変換表11)として生成し、所要のプログラム点に
おける変数の取得に際して、その数式を参照して変数の
値を取得する。 (3)スタックフレームをアクセスするための特定のベ
ースレジスタを想定したデバッグ情報を出力するので
は、変数のアクセスのためにスタックポインタ以外のベ
ースアドレスを用いないようにした最適化には対応でき
ない。これに関しては、手続き呼び出しの度に変化する
スタックポインタ値から所望の変数をアクセスするため
にプログラムカウンタの示すプログラム点におけるスタ
ックポインタ値と手続き入口でのスタックポインタ値と
の差分であるオフセット補正値をプログラムカウンタの
値に対応させて持つ情報テーブル(図6の対照表12)
を生成し、そのオフセット補正値を利用してスタックフ
レーム内の自動変数やパラメタをデバッグ時にアクセス
する。 (4)コンパイラの最適化によって、ソースプログラム
の行(本明細書においてはステートメントを含む概念と
して把握する)とオブジェクトプログラムの命令列が一
対一に順次対応しなくなるとき、オブジェクトプログラ
ムの各命令のアドレスに対して該命令の由来するソース
プログラムの行を対応付けたテーブル(図7の行番号対
照表13)を生成し、これに基づいてソースプログラム
の行をオブジェクトプログラムの命令と対応付けて指定
または表示する。コンパイラの最適化によって、ソース
プログラムの行とオブジェクトプログラムの命令列が一
対一に順次対応しなくなるとき、各命令に対して行番号
を対応付ける代わりに、各行番号に対して、その行に由
来する先頭命令のアドレスと、末尾命令のアドレスで示
すプログラム上の区間を対応付けたテーブル(図7の行
番号対照表14)を生成し、少ない情報によってソース
プログラムの行をオブジェクトプログラムの命令と対応
付けて指定または表示できるようにする。上記に対し
て、ユーザの使い勝手を向上させるため、ブレークポイ
ントとして、ソースプログラムの行からオブジェクトプ
ログラムの命令のアドレスを指定するとき、コマンドに
て前記先頭命令又は末尾命令のアドレスを選択的に指定
させる。 (5)呼び出しを行うアドレスの表を持たず、現在実行
中の行の範囲からプログラムカウンタが外れることによ
って飛び出しの検出を行っていたのでは、システムが用
意した処理ルーチンの呼び出しにおいても処理が中断
し、デバッガのオーバヘッドが増大する。この点に関し
ては、ソースプログラムの各行に対して、その行の範囲
内における所定のの手続き又は所定の関数呼び出しを行
うアドレス群を対応付けたテーブルを生成し、これを参
照することにより、呼び出される手続き又は関数の内部
への飛込み、及び呼び出された手続き又は関数の内部か
らの飛び出しを、前記テーブルに規定された手続き又は
関数についてのみ選択する(図8の手順)。
(1) According to the structure of the program, variable allocation can be dynamically changed within the effective range by optimization only by outputting variable allocation information as debug information corresponding to the effective range of the variable. The case cannot be dealt with, and when the variable is not used and is not assigned to the register, the fact cannot be displayed during debugging. On the other hand, for each section in the object program in which register allocation is constant, a register allocation information table (corresponding table 10 in FIG. 3) showing the correspondence between variables and registers to which the variables are allocated is referred to, Try to get the variable at the desired program point. Further, the register allocation information table (Comparison Table 10 in FIG. 3) determines that there is no possibility of future use of the variable by the compiler within the effective range of the predetermined variable when acquiring the variable at the required program point. As a result, the variable has information indicating that the variable is not allocated to a register. By referring to this, when the variable to be acquired has no register allocation, that fact is displayed. Further, in order to reduce the information amount of the register allocation information table while suppressing the deterioration of the debug accuracy, as shown in FIG. 4, for the integrated section in which the sections on the object program in which the register allocation is constant are integrated. , Information that counts the number of times a variable is referenced for each register to which the variable is allocated, sets the register with the highest number of references as the allocation register for the variable, and sets the variable and its register as register allocation information in the integration section. Adopt compression processing. (2) As a result of optimization, if a variable that is not assigned to a register or memory is associated with a constant or a value of the variable assigned to a register or memory by a specific mathematical expression, Outputting the register name, memory address value, or offset address value from a specific base register as the allocation information as debug information is not sufficient. With respect to this point, the compiler generates the above formula as an allocation information table (conversion table 11 in FIG. 5), and when acquiring a variable at a required program point, the formula is referenced to acquire the value of the variable. (3) Outputting debug information assuming a specific base register for accessing a stack frame cannot support optimization in which a base address other than a stack pointer is not used for accessing a variable. In this regard, an offset correction value, which is the difference between the stack pointer value at the program point indicated by the program counter and the stack pointer value at the procedure entry in order to access the desired variable from the stack pointer value that changes each time the procedure is called, Information table held in correspondence with the value of the program counter (Comparison table 12 in FIG. 6)
Is generated and the offset correction value is used to access the automatic variables and parameters in the stack frame during debugging. (4) When the line of the source program (which is understood as a concept including a statement in this specification) and the instruction sequence of the object program do not correspond one-to-one in sequence due to optimization of the compiler, the address of each instruction of the object program To the line of the source program from which the instruction originates (line number comparison table 13 in FIG. 7), and based on this, the line of the source program is specified in association with the instruction of the object program. indicate. When the line of the source program and the instruction sequence of the object program do not correspond one-to-one in sequence due to the optimization of the compiler, instead of associating a line number with each instruction, for each line number, the head from that line is derived. A table (line number comparison table 14 in FIG. 7) in which the address of the instruction is associated with the section on the program indicated by the address of the last instruction is generated, and the line of the source program is associated with the instruction of the object program with a small amount of information. Allows you to specify or display. On the other hand, in order to improve the usability for the user, when the address of the instruction of the object program is specified from the line of the source program as a breakpoint, the address of the first instruction or the last instruction is selectively specified by the command. . (5) If there is no table of addresses to call and the jump is detected by the program counter being out of the range of the line currently being executed, the processing is interrupted even when calling the processing routine prepared by the system. However, the debugger overhead increases. In this regard, for each line of the source program, a table is created by associating an address group for calling a predetermined procedure or a predetermined function within the range of the line, and is called by referring to this table. Jumping into a procedure or function and exiting from a called procedure or function are selected only for the procedure or function defined in the table (procedure in FIG. 8).

【0009】[0009]

【作用】上記した手段によれば、従来のデバッグ用に想
定されていたオブジェクトプログラム実行方式を緩和
し、これを補完するために、変数の割り付け場所、ソー
スプログラムのプログラム点に対応するオブジェクトプ
ログラムのアドレスなどをより詳細に示す情報を新たな
デバッグ情報として追加することは、最適化技術に対応
したデバッグ方式を実現する。さらに、デバッグ情報に
対する情報圧縮手法などは、最適化されたプログラムに
対する高級言語記述レベルでのデバッグを、デバッグ情
報のサイズを最小限に留めて実現する。
According to the above means, in order to alleviate and complement the conventional object program execution method assumed for debugging, the object program corresponding to the variable allocation location and the program point of the source program is Adding information indicating the address and the like in more detail as new debug information realizes a debug method corresponding to the optimization technology. Furthermore, the information compression method for the debug information realizes the debugging of the optimized program at a high level language description level while keeping the size of the debug information to a minimum.

【0010】[0010]

【実施例】 {1}デバッグシステム 図1には本発明に係る最適化プログラムデバッグ方式に
適用されるシステムの一例が示される。同図に示される
システムは、高級言語による計算機プログラムの開発と
そのデバッグに関わる全体的なシステムである。このシ
ステムは、ソースプログラム1を読み込み、オブジェク
トプログラム2とデバッグ情報3を出力するコンパイラ
4と、オブジェクトプログラム2とデバッグ情報3を読
み込み、プログラムの高級言語記述レベルでのデバッグ
機能を提供するデバッガシステム5から成り、ソースプ
ログラム1をコンパイルする際に、必要なデバッグ情報
3を作成し、オブジェクトプログラム2に付加する。例
えば、オブジェクトプログラム2とデバッグ情報3とを
論理的に分離させつつ同一ファイルに形成する。デバッ
グシステム5はシミュレータ6とデバッガ7を備え、デ
バッガ6はシミュレータ6によるオブジェクトプログラ
ムの実行を制御し、その実行結果を得ると共に、プログ
ラムのデバッグに必要な操作をデバッグ情報を用いて実
現する。
EXAMPLE {1} Debug System FIG. 1 shows an example of a system applied to an optimized program debug system according to the present invention. The system shown in the figure is an overall system relating to the development and debugging of a computer program in a high-level language. This system reads a source program 1 and outputs an object program 2 and debug information 3, and a debugger system 5 that reads the object program 2 and debug information 3 and provides a debug function at a high-level language description level of the program. When the source program 1 is compiled, necessary debug information 3 is created and added to the object program 2. For example, the object program 2 and the debug information 3 are logically separated and formed in the same file. The debug system 5 includes a simulator 6 and a debugger 7. The debugger 6 controls the execution of an object program by the simulator 6, obtains the execution result, and realizes an operation necessary for debugging the program using the debug information.

【0011】{2}変数に対するレジスタ割付けの最適
化に関するデバッグ方式 先ず、プログラム点と、変数の割り付け状態の対応に関
するデバッグ情報について説明する。コンパイラ4は、
レジスタ割り付け処理を最適化の一環として実施する
が、レジスタ割り付けを実施せずに、機械的に変数を割
り付けた非最適化オブジェクトプログラムでは、変数
は、該変数の有効な区間において、一定のレジスタ、あ
るいはメモリ上のアドレスに割り付けられている。レジ
スタ割り付け処理は、この割り付けを最適化するもの
で、一般に、この割り付けは変数の有効範囲内で一定で
はない。
{2} Debugging Method for Optimizing Register Allocation for Variables First, the debug information on the correspondence between program points and variable allocation states will be described. Compiler 4
Although register allocation processing is performed as part of optimization, in a non-optimized object program in which variables are mechanically allocated without register allocation, variables are stored in constant registers in the valid section of the variables. Alternatively, it is assigned to an address on the memory. The register allocation process optimizes this allocation, and generally this allocation is not constant within the effective range of the variable.

【0012】例えば、図2に示されるように、変数aに
定数1が代入され、その後に、新たに変数aに定数2が
代入された場合、レジスタ割り付けを施したプログラム
においては、これらの二つのプログラム点において変数
aを割り付けるレジスタが同一である必然性はない。な
ぜならば、新たな値の代入の時点で、今までの変数aの
情報は失われるからである。また、図2において、変数
aの参照が将来ないとわかっているプログラム点におい
ては、変数aの割り付けられたレジスタを、他の変数の
ために割り付ける場合がある。
For example, as shown in FIG. 2, when the constant 1 is assigned to the variable a and then the constant 2 is newly assigned to the variable a, these two values are set in the register-allocated program. The registers to which the variable a is allocated need not be the same at two program points. This is because the information of the variable a up to now is lost at the time of assigning a new value. In addition, in FIG. 2, at a program point where it is known that there will be no reference to the variable a in the future, the register to which the variable a is allocated may be allocated for another variable.

【0013】コンパイラ4は、変数に対するレジスタ割
り付けが一定であるプログラムの範囲(プログラムカウ
ンタの値の範囲)ごとに、変数と、該変数の割り付けら
れたレジスタとの対照表を作成し、デバッグ情報に付加
することができる。これにより、どのプログラム点にお
いても、変数の正しい値が得られる。また、変数の割り
付けがなされていないプログラムの範囲に対して、変数
の割り付けがないことを示すフラグを設定しておけば、
変数が割り付けられていないことが、デバッグ時に表示
できる。図3には、図2のプログラムに対するそのよう
なレジスタ割付の対照表10の一例が示される。図3の
対照表10において「割り付けなし」の記述は変数の割
り付けがないことを示すフラグを意味する。斯る対照表
10で示されるようなデバッグ情報は、各プログラム点
(プログラムカウンタの値毎)における変数のレジスタ
割り付けをデバッグ情報とする場合に比べて、その情報
量を減らすことができる。デバッグ情報を減らすことが
できれば、デバッグに必要なシステムのリソース例えば
ワークメモリ容量などが小さくても済むようになる。
The compiler 4 creates a reference table of variables and registers to which the variables are allocated for each range of the program (a range of the value of the program counter) in which the register allocation to the variables is constant, and uses it as debug information. Can be added. This gives the correct value for the variable at any program point. Also, if you set a flag indicating that variables are not assigned to the range of the program where variables are not assigned,
You can see when debugging that the variables are not assigned. FIG. 3 shows an example of a comparison table 10 of such register allocation for the program of FIG. In the comparison table 10 of FIG. 3, the description “no allocation” means a flag indicating that there is no variable allocation. The amount of the debug information as shown in the comparison table 10 can be reduced as compared with the case where the register allocation of the variable at each program point (each program counter value) is used as the debug information. If the debug information can be reduced, the system resources required for debugging, such as the work memory capacity, can be reduced.

【0014】変数の割り付けは、変数の有効範囲内で頻
繁に変化し得るので、その度に、全変数に対するレジス
タ割り付け情報をグローバルに出力すると、換言すれば
図3に示されるようなプログラムの範囲(PCの値の範
囲)ごとに着目して変数とレジスタとの対照表を出力す
ると、デバッグ情報のサイズが増大する。そこで、各変
数に着目し、各変数毎に一つずつ、プログラム範囲と割
り付けレジスタ情報の対照表を持ち、割り付けの変更が
無い変数に対しては新たなテーブルエントリを生成しな
い、換言すればレジスタ割り付けに変更が生ずる毎に当
該変数の対照表に新たなエントリを生成するようにす
る。
Since variable allocation can change frequently within the effective range of variables, the register allocation information for all variables is output globally each time, in other words, the range of the program as shown in FIG. When the comparison table of variables and registers is output by paying attention to each (PC value range), the size of the debug information increases. Therefore, paying attention to each variable, one for each variable has a comparison table of the program range and allocation register information, and does not generate a new table entry for the variable whose allocation is not changed. Each time the allocation is changed, a new entry is created in the variable reference table.

【0015】上記よりも更にレジスタ割り付け情報を削
減するには、上記のように、一つの変数に対して、個々
のレジスタ割り付け一定の範囲よりも大きなプログラム
範囲、例えば、プログラムの制御の飛びだし、飛込みが
ない命令列、すなわち、コンテキストが変更されない範
囲においてジャンプやブランチのような命令実行順序が
変更される処理が介在されない命令列、である基本ブロ
ックに対して、レジスタ割り付け情報を一定に保持する
ようにする。すなわち、各基本ブロックに対し、各変数
の参照回数を、その変数が割り付けられているレジスタ
毎に集計して、最も頻繁に割り付けられているレジスタ
を該変数の割り付けレジスタとし、これを当該基本ブロ
ックのプログラム範囲でのレジスタ割り付け情報とす
る。
To reduce the register allocation information further than the above, as described above, for one variable, a program range larger than a fixed range of individual register allocation, for example, jumping or jumping in control of the program, is performed. To keep the register allocation information constant for a basic block that is an instruction sequence that does not have a sequence, that is, an instruction sequence that does not involve processing that changes the instruction execution order such as jumps and branches in the range where the context does not change To That is, for each basic block, the reference count of each variable is aggregated for each register to which the variable is allocated, and the register that is most frequently allocated is the allocation register for that variable. Register allocation information in the program range of.

【0016】このようなレジスタ割り付け対照表の圧縮
処理の手順の一例は図4に示される。すなわち、コンパ
イラ4は、上記基本ブロック毎に、そして着目する基本
ブロック内の変数毎に、変数参照時のレジスタ番号に対
応するカウンタをインクリメントし(ステップS1)、
最大のカウント数を持つレジスタ番号を当該変数に対応
するレジスタ番号として対照表に設定する(ステップS
2)。斯る処理をステップS3〜ステップS8を介し
て、全ての基本ブロックにつき全ての変数の全ての参照
に対して行う。斯る処理手順は、より広いプログラム範
囲ごとにレジスタ割り付け情報を保持させるようにする
ので、デバッグ情報を削減できる。このような手法でデ
バッグ情報を削減すると、上記に比べてデバッグの精度
が低下すると考えられるが、そもそもコードの最適化を
施しているので、ソースプログラムとオブジェクトプロ
グラムの一対一対応の絶対的な関係は破られている以
上、それ是認した上で、相対的に操作性がよく且つ信頼
性の高いデバッグを少ないリソースで実現できるように
することが重要であり、またそれが望まれている。
FIG. 4 shows an example of the procedure of compression processing of such a register allocation comparison table. That is, the compiler 4 increments the counter corresponding to the register number at the time of variable reference for each of the basic blocks and for each variable in the focused basic block (step S1),
The register number having the maximum count is set in the reference table as the register number corresponding to the variable (step S
2). Such processing is performed for all references of all variables for all basic blocks through steps S3 to S8. According to such a processing procedure, since the register allocation information is held for each wider program range, the debug information can be reduced. It is thought that reducing the debug information by such a method will reduce the debugging accuracy compared to the above, but since the code has been optimized in the first place, the absolute relationship of one-to-one correspondence between the source program and the object program Since it has been broken, it is important, and desirable, to approve it and to realize relatively easy-to-use and reliable debugging with few resources.

【0017】オブジェクトプログラムの最適化には、ル
ープ変数の強度軽減等、変数の値自体を一定の規則で変
更してしまうものがある。例えば図5の(A)に示され
るプログラムでは、最適化の結果、変数nが、2nの値
でレジスタ上に保持される。この情報をデバッグ時に持
つためには、変数の割付け情報を、単なるレジスタやメ
モリアドレスの形式ではなく、数式で持つ必要が有る。
本例のプログラムでは、レジスタ(この場合はR6)に
実際に格納されている値は、実際の変数nの値ではなく
2nであるので、レジスタの値から変数の値を求める式
に対応したデータ構造、例えば、図5の(B)に示され
るように、逆ポーランド記法で、R6÷2を表現するデ
ータを、レジスタの値からソースプログラムでの値への
変換表11として保持すればよい。尚、図示はしない
が、斯る変換表11における変数は対応するプログラム
範囲に関連づけられていることは言うまでもない。上記
手法は、複雑な演算を含む場合だけでなく、たとえば、
コンパイラ4が、変数の値が一定であることから、最適
化の一環として変数をコンパイル時に定数に置き換えた
場合でも、変数の割付け情報として定数を持てば、デバ
ッグ時に値が参照できることになる。
Some optimization of the object program changes the value of the variable itself according to a certain rule, such as reducing the strength of the loop variable. For example, in the program shown in FIG. 5A, as a result of optimization, the variable n is held in the register with a value of 2n. In order to have this information at the time of debugging, it is necessary to have the variable allocation information in the form of a mathematical expression, not in the simple register or memory address format.
In the program of this example, the value actually stored in the register (R6 in this case) is 2n, not the actual value of the variable n, so the data corresponding to the formula for calculating the value of the variable from the value of the register The structure, for example, as shown in FIG. 5B, the data expressing R6 / 2 in the reverse Polish notation may be held as a conversion table 11 from the value of the register to the value in the source program. Although not shown, it goes without saying that the variables in the conversion table 11 are associated with the corresponding program range. The above method is not only applicable to cases involving complicated operations, but
Since the compiler 4 has a constant variable value, even if the variable is replaced with a constant at the time of compilation as part of optimization, if the constant is used as the variable allocation information, the value can be referred to during debugging.

【0018】{3}スタックポインタを専ら用いて参照
する最適化に関するデバッグ方式 スタック上の局自動変数やパラメタの参照について、ス
タックフレーム上のデータを、汎用のレジスタを用いず
に、スタックポインタ(SP)を用いて参照する最適化
に関するデバッグ方式の実施例について説明する。この
最適化は、フレームアクセスのためにフレームポインタ
のような余分なレジスタを用いないということにより、
実行速度及びメモリサイズ上の利点はあるが、プログラ
ム実行時にSPの値が変動するため、変数の割付けをベ
ースレジスタからのオフセットのようなデバッグ情報で
は表現できない。すなわち、手続きの入り口において、
スタックポインタに対する変数などのオフセットはデバ
ッグ情報として本来保持される。そして、処理が進み、
スタックポインタの値が変化された任意の状態でプログ
ラムの実行を止め、その変数を参照したい場合、それを
参照するための基礎となるべきスタックポインタの値が
可変されているので、何等かの手段を講じなければ前記
手続き入り口のスタックポインタの値に対するオフセッ
トを用いて当該変数などを参照することはできない。こ
のとき、スタックポインタの値を一命令実行毎にトレー
スしていけば、そのトレース情報に基づいて所要の変数
などを参照することができるが、斯るトレースが処理の
オーバーヘッドを増し、現実的ではない。
{3} Debugging method for optimization in which stack pointer is exclusively used For referring to station automatic variables and parameters on the stack, the data on the stack frame is referred to as a stack pointer (SP) without using a general-purpose register. ) Is used to describe an embodiment of a debugging method related to optimization. This optimization does not use extra registers like frame pointers for frame access,
Although there is an advantage in execution speed and memory size, since the value of SP changes during program execution, variable allocation cannot be expressed by debug information such as offset from the base register. That is, at the entrance of the procedure,
Offsets such as variables for the stack pointer are originally held as debug information. And the process proceeds,
If you want to stop the execution of the program in any state where the stack pointer value has changed and you want to reference that variable, the value of the stack pointer that is the basis for referencing it has changed, so some means Must be taken to refer to the variable using the offset for the value of the stack pointer at the entry of the procedure. At this time, if the value of the stack pointer is traced each time one instruction is executed, it is possible to refer to the required variable based on the trace information, but such tracing increases the processing overhead and is not realistic. Absent.

【0019】そこで、デバッグ情報として、プログラム
カウンタ(PC)をキーとして、手続きの入口点でのS
Pの値と、該プログラム点でのSPの値との差分を取得
できるような情報をコンパイラが生成し、デバッグ情報
に付加する。すなわち、図6に示されるように、関数内
におけるスタックポインタ(SP)とプログラムカウン
タ(PC)との対照表12をデバッグ情報として生成す
る。これにより、どのようなPCの値であっても、該プ
ログラム点のSPの値から手続き入り口のSPの値を減
算する(SPの差分値を減算する)ことによって、手続
き入口でのSPの値がわかり、該手続き入口点のSPの
値をベースアドレスとすれば、自動変数やパラメタのオ
フセットは一定であるので(これは本来デバッグ情報と
して保持されている)、プログラムを止めたとき、所望
の変数などをデバッガによって参照できるようになる。
Therefore, as debug information, the program counter (PC) is used as a key, and S at the entry point of the procedure is used.
The compiler generates information for obtaining the difference between the value of P and the value of SP at the program point, and adds the information to the debug information. That is, as shown in FIG. 6, a comparison table 12 of the stack pointer (SP) and the program counter (PC) in the function is generated as debug information. As a result, the value of SP at the procedure entry is subtracted by subtracting the value of SP at the procedure entry (subtracting the difference value of SP) from the value of SP at the program point, whatever the value of PC. If the SP value at the procedure entry point is used as the base address, the offsets of automatic variables and parameters are constant (this is originally held as debug information), so when the program is stopped, the desired Variables can be referenced by the debugger.

【0020】{4}ソース行とオブジェクトプログラム
の対応に関するデバッグ情報の強化 以下では、デバッグ時にブレークポイントの設定、ソー
スプログラムの表示、ステップ実行等を実行する際に必
要な、ソースステートメント(または行)とオブジェク
トプログラムの対応に関するデバッグ情報の強化につい
て説明する。
{4} Enhancement of debug information related to correspondence between source line and object program In the following, source statements (or lines) required for setting breakpoints, displaying source program, stepping, etc., during debugging. This section describes the enhancement of debug information related to the correspondence between the and object programs.

【0021】コンパイラ4は、パイプライン方式のマイ
クロコンピュータなどの計算機に対して、パイプライン
の流れを潤滑にするために、命令ソースをステートメン
トの境界を越えて並び換える最適化を行なう。また、そ
の他にも、ループの展開等のステートメントと命令の順
序が保持されないような最適化が存在する。したがっ
て、従来技術のようにステートメントとそれに対応され
る連続したアドレス範囲との一対一対応の表を用いて対
応づけることができない。そこで、図7の(A)に示す
ように、各命令のアドレスごとに、該命令の由来するソ
ースステートメントの行を対応させた行番号対照表13
を利用し、デバッグ時にブレークがソースステートメン
ト(行)に対して指定されたときは、該ステートメント
の最初の命令に由来するアドレスに実際のブレークをか
けることにより、プログラム点のソースレベルでの指定
を可能にすることができる。
The compiler 4 optimizes a computer such as a pipeline microcomputer to rearrange instruction sources across statement boundaries in order to lubricate the pipeline flow. In addition, there are other optimizations such as loop unrolling that do not preserve the order of statements and instructions. Therefore, unlike the prior art, it is not possible to use a one-to-one correspondence table between a statement and a continuous address range corresponding to the statement. Therefore, as shown in FIG. 7A, a line number comparison table 13 in which, for each address of each instruction, the line of the source statement from which the instruction originates is associated.
When a break is specified for a source statement (line) during debugging, the actual break is applied to the address derived from the first instruction of the statement to specify the program point at the source level. You can enable it.

【0022】但し、命令ごとにステートメント情報を出
力すると、デバッグ情報のサイズが増大する。これを抑
えるためには、ソースステートメントに対して、該ステ
ートメント(行)に対応する最初の命令のアドレス及び
最後の命令のアドレスをコンパイラ4で出力して、これ
をデバッグ情報としての行番号対照表14とすればよ
い。この場合、ソースステートメントが指定された場合
の、対応するメモリアドレスとして、先頭と末尾のアド
レスを、用途によって使い分けることができる。本方式
の出力内容は図7の(B)に示される。文の先頭、末尾
両方のアドレスを提供することによって、デバッガでプ
ログラム点にブレークをかける場合に、(1)ステート
メント実行前の状態を知る、(2)ステートメント実行
後の状態を知る、の二通りの機能を実現できる。したが
って、デバッガは、その両方の用途に供するため、上記
出力形式の先頭アドレスと末尾アドレスに対応する2種
類のブレークポイントを選択的にコマンドなどで指定で
きるようになっている。
However, outputting the statement information for each instruction increases the size of the debug information. In order to suppress this, for the source statement, the address of the first instruction and the address of the last instruction corresponding to the statement (line) are output by the compiler 4, and this is output as a line number comparison table as debug information. It should be 14. In this case, as the corresponding memory address when the source statement is specified, the start address and the end address can be used properly according to the purpose. The output contents of this method are shown in FIG. By providing both the beginning and end addresses of a statement, when a breakpoint is set at the program point by the debugger, (1) know the state before statement execution, and (2) know the state after statement execution. The function of can be realized. Therefore, the debugger can selectively specify two types of breakpoints corresponding to the start address and the end address of the output format by a command or the like in order to serve both purposes.

【0023】次に、ステップイン・ステップアウト等の
関数呼び出しを伴うデバッグ処理の手順に関して説明す
る。例えば、高級言語の1ステートメント単位に実行停
止させてデバッグを行うようなステップ実行において、
従来は、PCの値が、現在実行中の手続きのアドレス範
囲から外れると、その原因の如何を問わずに全てそのタ
イミングで当該ステートメントに対応される命令の実行
を中断する。例えば、1ステートメントの記述に対応す
るロードモジュールにジャンプサブルーチンのような処
理が存在されているような場合である。したがって、シ
ステムが用意した処理ルーチン例えば演算ルーチン(浮
動小数点演算等)の呼び出しなどにおいても中断し、デ
バッガのオーバヘッドが増加する。すなわち、システム
が用意した処理ルーチンについてはすでにデバッグ済み
であるから、あえて中断する必要はない。そこで、これ
ら演算ルーチンはその呼び出しアドレスに基づいてコン
パイラが認識できることを利用して、実質的なユーザル
ーチン(未だデバッグを完了していないルーチン)だけ
を対象にしてその呼び出しアドレスをデバッグ情報とし
て出力することにより、効率良くステップイン・ステッ
プアウトによるデバッグ機能を実現できる。図8にはそ
のためのデバッガでのステップインの処理方式が示され
る。すなわち、実質的なユーザルーチンだけを対象にし
てその呼び出しアドレスをデバッグ情報として持ち、1
ステートメント毎の命令実行処理における呼び出し点で
のステップイン(呼び出されるステートメントの処理へ
移行)の実現方式として、ステップ実行において次の呼
び出しアドレスを取得すると(ステップS10)、これ
が前記デバッグ情報として規定された呼び出しアドレス
(実質的なユーザルーチンだけを対象にした呼び出しア
ドレス)として存在すれば(ステップS11)、その呼
出点へステップインし(ステップS12)、ブレークの
ためのデバッグ用命令などを実行して(ステップS1
3)、処理を終了する。呼び出しアドレスとして存在し
なければ(ステップS11)次の文へ実行を進める(ス
テップS14)。
Next, the procedure of the debugging process involving function calls such as step-in / step-out will be described. For example, in step execution where debugging is performed by stopping execution for each statement in a high-level language,
Conventionally, when the value of PC deviates from the address range of the procedure currently being executed, the execution of the instruction corresponding to the statement is interrupted at that timing regardless of the cause. For example, this is a case where a processing such as a jump subroutine exists in the load module corresponding to the description of one statement. Therefore, the processing routine prepared by the system, for example, the calling of a calculation routine (floating point calculation or the like) is also interrupted, and the overhead of the debugger increases. In other words, the processing routine prepared by the system has already been debugged, so it is not necessary to interrupt it. Therefore, by utilizing the fact that these arithmetic routines can be recognized by the compiler based on the call address, the call address is output as debug information only for the actual user routine (routine that has not been debugged yet). As a result, the debug function by step-in / step-out can be efficiently realized. FIG. 8 shows a step-in processing method in the debugger for that purpose. In other words, the call address of only a substantial user routine is used as debug information and 1
As a method of realizing step-in (moving to the processing of a called statement) at the calling point in the instruction execution processing for each statement, when the next calling address is acquired in step execution (step S10), this is specified as the debug information. If it exists as a call address (a call address intended only for a substantial user routine) (step S11), step into that call point (step S12) and execute a debugging instruction for break ( Step S1
3), the process ends. If it does not exist as a call address (step S11), execution proceeds to the next statement (step S14).

【0024】以上本発明者によってなされた発明を実施
例に基づいて具体的に説明したが、本発明はそれに限定
されるものではなく、その要旨を逸脱しない範囲におい
て種々変更可能であることは言うまでもない。例えば、
ソースプログラムの1行はソースプログラムの1ステー
トメントとして読み替えることができる。また、レジス
タとは、語長が16ビットや32ビットのように一定に
されたフリップフロップから成るような所謂単体のレジ
スタに限定されず、メモリであってもよく、そのような
記憶手段を本明細書においてはレジスタと称している。
また、明細書中における各種デバッグ情報の対照表にお
いて、そのエントリは常に全てが存在している必要はな
く、デバッグ処理の進行と共にダイナミックに形成して
保持していけば十分である。
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,
One line of the source program can be read as one statement of the source program. Further, the register is not limited to a so-called single register such as a flip-flop having a constant word length of 16 bits or 32 bits, and may be a memory. It is called a register in the specification.
Further, in the comparison table of various debug information in the specification, it is not necessary that all the entries always exist, and it is sufficient that the entries are dynamically formed and held as the debug processing progresses.

【0025】[0025]

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

【0026】すなわち、従来のデバッグ用に想定されて
いたオブジェクトプログラム実行方式を緩和し、これを
補完するために、変数の割り付け場所、ソースプログラ
ムのプログラム点に対応するオブジェクトプログラムの
アドレスなどをより詳細に示す情報を新たなデバッグ情
報として追加することにより、最適化技術に対応したデ
バッグ方式を実現することができる。さらに、デバッグ
情報に対する情報圧縮手法などにより、最適化されたプ
ログラムに対する高級言語記述レベルでのデバッグを、
デバッグ情報のサイズを最小限に留めて実現することが
できる。上記により、最適化されたプログラムに対して
も、デバッグ能力を犠牲にすることなくデバッグでき、
高級言語によるプログラムの開発効率を高めることがで
きる。
That is, in order to alleviate and complement the conventional object program execution method assumed for debugging, the allocation location of variables, the address of the object program corresponding to the program point of the source program, etc. are described in more detail. By adding the information shown in 1) as new debug information, it is possible to realize a debug method corresponding to the optimization technique. Furthermore, by using the information compression method for debug information, it is possible to debug an optimized program at a high-level language description level.
This can be achieved by minimizing the size of debug information. Due to the above, you can debug even optimized programs without sacrificing debug capabilities,
It is possible to improve the development efficiency of programs in high-level languages.

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

【図1】本発明に係る最適化プログラムデバッグ方式に
適用されるシステムの一例ブロック図である。
FIG. 1 is a block diagram showing an example of a system applied to an optimized program debugging method according to the present invention.

【図2】変数に対するレジスタ割り付けが一定でない場
合の一例説明図である。
FIG. 2 is an explanatory diagram of an example in which register allocation to variables is not constant.

【図3】レジスタ割り付け対照表の一例説明図である。FIG. 3 is an explanatory diagram of an example of a register allocation comparison table.

【図4】圧縮されたレジスタ割り付け対照表生成の一例
処理手順説明図である。
FIG. 4 is an explanatory view of an example processing procedure of generating a compressed register allocation comparison table.

【図5】レジスタ割り付けが値通りではない場合の例
と、レジスタからの値変換表を示す説明図である。
FIG. 5 is an explanatory diagram showing an example of a case where register allocation is not exact and a value conversion table from registers.

【図6】関数内におけるスタックポインタ値とプログラ
ムカウンタ値の対照表の一例である。
FIG. 6 is an example of a comparison table of stack pointer values and program counter values in a function.

【図7】アドレスと行番号を対応させた行情報出力形式
を二つの例を以って示す説明図である。
FIG. 7 is an explanatory diagram showing two examples of line information output formats in which addresses and line numbers are associated with each other.

【図8】呼び出し点でのステップインの処理方式の一例
手順説明図である。
FIG. 8 is an explanatory diagram of an example of a step-in processing method at a calling point.

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

1 ソースプログラム 2 オブジェクトプログラム 3 デバッグ情報 4 コンパイラ 5 デバッガシステム 6 シミュレータ 7 デバッガ 10 レジスタ割り付けの対照表 11 変換表 12 対照表 13,14 行番号対照表 1 Source program 2 Object program 3 Debug information 4 Compiler 5 Debugger system 6 Simulator 7 Debugger 10 Register allocation comparison table 11 Conversion table 12 Comparison table 13, 14 Line number comparison table

【手続補正書】[Procedure amendment]

【提出日】平成5年10月18日[Submission date] October 18, 1993

【手続補正1】[Procedure Amendment 1]

【補正対象書類名】明細書[Document name to be amended] Statement

【補正対象項目名】図6[Name of item to be corrected] Figure 6

【補正方法】変更[Correction method] Change

【補正内容】[Correction content]

【図6】関数内におけるスタックポインタ値とプログラ
ムカウンタ値の対照表の一例説明図である。
FIG. 6 is an explanatory diagram of an example of a comparison table of stack pointer values and program counter values in a function.

───────────────────────────────────────────────────── フロントページの続き (72)発明者 永山 ひろみ 東京都小平市上水本町5丁目20番1号 株 式会社日立製作所半導体事業部内 (72)発明者 林 努 東京都小平市上水本町5丁目20番1号 株 式会社日立製作所半導体事業部内 (72)発明者 米山 浩司 東京都小平市上水本町5丁目20番1号 株 式会社日立製作所半導体事業部内 (72)発明者 藤田 秀哉 東京都小平市上水本町5丁目20番1号 株 式会社日立製作所半導体事業部内 (72)発明者 須藤 洋一 東京都小平市上水本町5丁目22番1号 株 式会社日立マイコンシステム内 ─────────────────────────────────────────────────── ─── Continuation of the front page (72) Hiromi Nagayama, 5-20-1 Kamimizuhoncho, Kodaira-shi, Tokyo Incorporated company, Hitachi, Ltd. Semiconductor Business Division (72) Tsutomu Hayashi 5 Kamimizumoto-cho, Kodaira-shi, Tokyo Hitachi Co., Ltd., Semiconductor Company, Ltd., Hitachi Ltd. (72) Koji Yoneyama, Kojimizuhonmachi, Kodaira-shi, Tokyo, 5-20-1 Company, Ltd., Semiconductor Company, Ltd. (72) Hideya Fujita, Tokyo 5-20-1 Kamimizuhoncho, Kodaira-shi Hitachi Ltd. Semiconductor Division (72) Inventor Yoichi Sudo 5-22-1 Kamimizuhoncho, Kodaira-shi, Tokyo Inside Hitachi Microcomputer System Ltd.

Claims (9)

【特許請求の範囲】[Claims] 【請求項1】 高級言語で記述されたソースプログラム
がコンパイラにて最適化処理されたオブジェクトプログ
ラムの高級言語記述レベルでのデバッグを可能にする最
適化プログラムのデバッグ方式であって、 レジスタの割り付けが一定であるオブジェクトプログラ
ム上の区間毎に、変数と該変数が割り付けられるレジス
タの対応を示すレジスタ割り付け情報テーブルを参照し
て、所要のプログラム点における変数を取得することを
特徴とする最適化プログラムのデバッグ方式。
1. A debug method of an optimized program, which enables debugging of an object program optimized in a high level language by a compiler at a high level language description level, wherein register allocation is performed. An optimization program characterized by acquiring a variable at a required program point by referring to a register allocation information table showing a correspondence between a variable and a register to which the variable is allocated for each section on the object program which is constant. Debug method.
【請求項2】 前記レジスタ割り付け情報テーブルは、
所要のプログラム点における変数の取得に際して、所定
の変数の有効範囲内でコンパイラによってその変数の将
来における使用の可能性がないと判定された結果として
当該変数がレジスタに割り付けられていないことを示す
情報を参照し、取得すべき変数にレジスタの割り付けが
ないときはその旨を表示することを特徴とする請求項1
記載の最適化プログラムのデバッグ方式。
2. The register allocation information table is
Information indicating that the variable is not assigned to a register as a result of the compiler determining that there is no possibility of future use of the variable within the valid range of the given variable when acquiring the variable at the required program point When the variable to be acquired has no register allocation, the fact is displayed.
Debugging method for the described optimization program.
【請求項3】 レジスタの割り付けが一定であるオブジ
ェクトプログラム上の区間を統合した統合区間に対し
て、変数の参照回数をその変数が割り付けられるレジス
タ毎に集計し、参照回数の最も多いレジスタを当該変数
の割り付けレジスタとし、該変数とそのレジスタを、当
該統合区間でのレジスタ割り付け情報とするものである
ことを特徴とする請求項1記載の最適化プログラムのデ
バッグ方式。
3. With respect to an integrated section in which sections on an object program in which register allocation is constant are integrated, the reference counts of variables are totaled for each register to which the variable is allocated, and the register with the highest reference count is concerned. The debugging method of the optimization program according to claim 1, wherein the variable allocation register is used as the variable allocation register, and the variable and its register are used as register allocation information in the integration section.
【請求項4】 高級言語で記述されたソースプログラム
がコンパイラにて最適化処理されたオブジェクトプログ
ラムの高級言語記述レベルでのデバッグを可能にする最
適化プログラムのデバッグ方式であって、 最適化の結果として、レジスタにもメモリにも割り付け
られていない変数が、定数、あるいはレジスタやメモリ
に割り付いている変数の値から特定の数式によって対応
付けられているとき、コンパイラが該数式を、割り付け
情報テーブルとして生成し、所要のプログラム点におけ
る変数の取得に際して、その数式を参照して変数の値を
取得することを特徴とする最適化プログラムのデバッグ
方式。
4. A debugging method of an optimizing program, which enables debugging at high level language description level of an object program optimized by a compiler, wherein a source program written in a high level language is the result of optimization. When a variable that is not assigned to a register or memory is associated with a constant or a value of a variable assigned to a register or memory by a specific mathematical expression, the compiler assigns the mathematical expression to the allocation information table. A method for debugging an optimization program, which is characterized in that the value of the variable is acquired by referring to the formula when acquiring the variable at the required program point.
【請求項5】 高級言語で記述されたソースプログラム
がコンパイラにて最適化処理されたオブジェクトプログ
ラムの高級言語記述レベルでのデバッグを可能にする最
適化プログラムのデバッグ方式であって、 コンパイラが、変数のアクセスのために、スタックポイ
ンタ以外のベースアドレスを用いないことでベースアド
レスに割り付けるレジスタを節約する最適化を施したと
き、手続き呼び出しの度に変化するスタックポインタの
値から所望の変数をアクセスするために、プログラムカ
ウンタの示すプログラム点におけるスタックポインタ値
と手続き入口でのスタックポインタ値との差分であるオ
フセット補正値をプログラムカウンタの値に対応させて
持つ情報テーブルを参照し、所望のプログラムカウンタ
の値に対応される前記オフセット補正値から手続き入り
口におけるスタックポインタ値をベースアドレス値とし
て取得し、このベースアドレス値と所要の変数のオフセ
ット値とから当該所要の変数を参照することを特徴とす
る最適化プログラムのデバッグ方式。
5. A debugging method of an optimized program, which enables debugging of an object program optimized by a compiler in a high-level language description level, the source program described in a high-level language, wherein the compiler is a variable. Access to a desired variable from the value of the stack pointer that changes each time the procedure is called when optimization is performed to save the registers allocated to the base address by not using the base address other than the stack pointer. In order to do this, an information table having an offset correction value, which is the difference between the stack pointer value at the program point indicated by the program counter and the stack pointer value at the procedure entry, is associated with the value of the program counter, and the desired program counter The offset corresponding to the value Get the stack pointer value as the base address value in the procedure the inlet from the correction value, debugging method of optimization program characterized by referring to the predetermined variable from the offset value of the base address value and the required variables.
【請求項6】 高級言語で記述されたソースプログラム
がコンパイラにて最適化処理されたオブジェクトプログ
ラムの高級言語記述レベルでのデバッグを可能にする最
適化プログラムのデバッグ方式であって、 コンパイラの最適化によって、ソースプログラムの行と
オブジェクトプログラムの命令列が一対一に順次対応し
なくなるとき、オブジェクトプログラムの各命令のアド
レスに対して該命令の由来するソースプログラムの行を
対応付けたテーブルを生成し、これを参照して、ソース
プログラムの行をオブジェクトプログラムの命令と対応
付けて指定又は表示することを特徴とする最適化プログ
ラムのデバッグ方式。
6. A debugging method of an optimizing program, which enables debugging at high-level language description level of an object program optimized by a compiler, wherein a source program written in high-level language is optimized. When the lines of the source program and the instruction sequence of the object program do not sequentially correspond one-to-one with each other, a table is generated in which the address of each instruction of the object program is associated with the line of the source program from which the instruction originates. With reference to this, a debugging method for an optimizing program characterized in that a line of a source program is designated or displayed in association with a command of an object program.
【請求項7】 高級言語で記述されたソースプログラム
がコンパイラにて最適化処理されたオブジェクトプログ
ラムの高級言語記述レベルでのデバッグを可能にする最
適化プログラムのデバッグ方式であって、 コンパイラの最適化によって、ソースプログラムの行と
オブジェクトプログラムの命令列が一対一に順次対応し
なくなるとき、各命令に対して行番号を対応付けする代
わりに、各行番号に対して、その行に由来する先頭命令
のアドレスと、末尾命令のアドレスで示すプログラム上
の区間を対応付けたテーブルを生成し、該テーブルを参
照して、ソースプログラムの行をオブジェクトプログラ
ムの命令と対応付けて指定または表示することを特徴と
する最適化プログラムのデバッグ方式。
7. A debugging method of an optimizing program, which enables debugging at high-level language description level of an object program optimized by a compiler, wherein a source program written in a high-level language is optimized. When a line of a source program and a sequence of instructions of an object program do not correspond one by one in sequence, instead of associating a line number with each instruction, for each line number, A table in which an address and a section on the program indicated by the address of the end instruction are associated with each other, and the row of the source program is specified or displayed in association with the instruction of the object program by referring to the table. Optimize program debugging method.
【請求項8】 ブレークポイントとして、ソースプログ
ラムの行からオブジェクトプログラムの命令のアドレス
を指定するとき、コマンドにて前記先頭命令又は末尾命
令のアドレスを選択的に指定することを特徴とする請求
項7記載の最適化プログラムのデバッグ方式。
8. The breakpoint, when the address of the instruction of the object program is specified from the line of the source program, the address of the start instruction or the end instruction is selectively specified by the command. Debugging method for the described optimization program.
【請求項9】 高級言語で記述されたソースプログラム
がコンパイラにて最適化処理されたオブジェクトプログ
ラムの高級言語記述レベルでのデバッグを可能にする最
適化プログラムのデバッグ方式であって、 ソースプログラムの各行に対して、その行の範囲内にお
ける所定手続き又は所定関数呼び出しを行うアドレス群
を対応付けたテーブルを生成し、呼び出されるべき手続
き又は関数の内部への飛込み、及び呼び出されるべき手
続き又は関数の内部からの飛び出しを、前記テーブルに
規定された手続き又は関数についてのみ選択することを
特徴とする最適化プログラムのデバッグ方式。
9. A debugging method of an optimization program, which enables debugging of an object program optimized by a compiler in a high-level language description level, the source program described in a high-level language, each line of a source program , A table is created that associates the address groups for calling a predetermined procedure or a predetermined function within the range of the line, jumps into the procedure or function to be called, and the inside of the procedure or function to be called. A method for debugging an optimizing program, characterized in that the jump out from is selected only for the procedure or function defined in the table.
JP5085509A 1993-03-19 1993-03-19 Optimization program debugging method Withdrawn JPH06274369A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP5085509A JPH06274369A (en) 1993-03-19 1993-03-19 Optimization program debugging method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP5085509A JPH06274369A (en) 1993-03-19 1993-03-19 Optimization program debugging method

Publications (1)

Publication Number Publication Date
JPH06274369A true JPH06274369A (en) 1994-09-30

Family

ID=13860907

Family Applications (1)

Application Number Title Priority Date Filing Date
JP5085509A Withdrawn JPH06274369A (en) 1993-03-19 1993-03-19 Optimization program debugging method

Country Status (1)

Country Link
JP (1) JPH06274369A (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6014516A (en) * 1996-12-27 2000-01-11 Nec Corporation Language processing system which generates debugging source file corresponding to optimization image and method therefor
US6732355B1 (en) 1999-01-29 2004-05-04 International Business Machines Corporation Method and device for generating registration data at compilation to enable trace of stack
KR100417655B1 (en) * 1996-06-28 2004-06-09 마츠시타 덴끼 산교 가부시키가이샤 A program development system consisting of a debug information generator that generates debug information to perform motion verification while referring to the optimization process, and a debug device that allows the programmer to perform motion verification while conscious of the optimization process.
US7028291B2 (en) 2001-08-06 2006-04-11 Matsushita Electric Industrial Co., Ltd. Debugging method and debugging device
JP2007052676A (en) * 2005-08-18 2007-03-01 Nec Corp Method for tracing data and trace module

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR100417655B1 (en) * 1996-06-28 2004-06-09 마츠시타 덴끼 산교 가부시키가이샤 A program development system consisting of a debug information generator that generates debug information to perform motion verification while referring to the optimization process, and a debug device that allows the programmer to perform motion verification while conscious of the optimization process.
US6014516A (en) * 1996-12-27 2000-01-11 Nec Corporation Language processing system which generates debugging source file corresponding to optimization image and method therefor
US6732355B1 (en) 1999-01-29 2004-05-04 International Business Machines Corporation Method and device for generating registration data at compilation to enable trace of stack
US7028291B2 (en) 2001-08-06 2006-04-11 Matsushita Electric Industrial Co., Ltd. Debugging method and debugging device
JP2007052676A (en) * 2005-08-18 2007-03-01 Nec Corp Method for tracing data and trace module

Similar Documents

Publication Publication Date Title
JP2810675B2 (en) Debug method
Richards The portability of the BCPL compiler
US5701487A (en) Method and apparatus for displaying locations of errors detected inside software macro calls
US6023583A (en) Optimized variable allocation method, optimized variable allocation system and computer-readable memory containing an optimized variable allocation program
EP1280056A1 (en) Generation of debugging information
US20080104365A1 (en) Configurable processor design apparatus and design method, library optimization method, processor, and fabrication method for semiconductor device including processor
JPH09330233A (en) Optimum object code generating method
JP4157016B2 (en) Compiler apparatus and compiling method
JP2007304840A (en) Compiling method, debugging method, compiling program and debugging program
US6330691B1 (en) Use of dynamic translation to provide breakpoints in non-writeable object code
JP4647164B2 (en) Indefinite size variables in intermediate languages
JPH06274369A (en) Optimization program debugging method
US6256782B1 (en) Compile apparatus, compile method and computer-readable medium storing compiler
US20050273666A1 (en) Information processing apparatus and test method for programs
US6178547B1 (en) Method and apparatus for generating non-redundant symbolic debug information in computer programs
US8612942B2 (en) System for debugging computer program
JP3327674B2 (en) Program translation apparatus and method
JP2002182926A (en) Compilation method and computer-readable recording medium
US5765148A (en) Database processing apparatus and database processing method for variable length objects, and computer-readable memory medium for storing database processing program
US6311227B1 (en) Procedure calling method
JP5021584B2 (en) Microcomputer simulator, simulation method thereof, program, and computer-readable medium
US20020116699A1 (en) Apparatus and method for checking the status of control systems
JPH0283749A (en) Microprocessor internal interrupt control method
JPH06242942A (en) Source code level debugging device
JPH05108404A (en) Debugger system

Legal Events

Date Code Title Description
A300 Application deemed to be withdrawn because no request for examination was validly filed

Free format text: JAPANESE INTERMEDIATE CODE: A300

Effective date: 20000530