JP2001014185A - Compiling and debugging method - Google Patents

Compiling and debugging method

Info

Publication number
JP2001014185A
JP2001014185A JP11187783A JP18778399A JP2001014185A JP 2001014185 A JP2001014185 A JP 2001014185A JP 11187783 A JP11187783 A JP 11187783A JP 18778399 A JP18778399 A JP 18778399A JP 2001014185 A JP2001014185 A JP 2001014185A
Authority
JP
Japan
Prior art keywords
function
object code
code
program
optimized
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
Application number
JP11187783A
Other languages
Japanese (ja)
Inventor
Yoshinari Ando
喜成 安藤
Eiji Shamoto
英司 社本
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
NEC IC Microcomputer Systems Co Ltd
Original Assignee
NEC IC Microcomputer Systems Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by NEC IC Microcomputer Systems Co Ltd filed Critical NEC IC Microcomputer Systems Co Ltd
Priority to JP11187783A priority Critical patent/JP2001014185A/en
Publication of JP2001014185A publication Critical patent/JP2001014185A/en
Pending legal-status Critical Current

Links

Abstract

PROBLEM TO BE SOLVED: To provide a compiling and debugging method for shortening a program execution time till a debug interruption point and a time required for a whole debug process. SOLUTION: A larger code size between an optimizing object code size and a non-optimizing object code size is set as function size information by a compiler A, an object program 108 is outputted from an object file output means 107, a debugger B loads an optimizing object code in the object program 108 to a target memory by an object program input means 109 and the non- optimizing object code corresponding to a function in the object program 108 is re-loaded to the same address of the target memory when the debug interruption point is set to the optimizing object code.

Description

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

【0001】[0001]

【発明の属する技術分野】この発明は、コンパイル処理
時に最適化した最適化オブジェクトコード(以降、最適
化ありコードと称する)と最適化していない非最適化オ
ブジェクトコード(以降、最適化なしコードと称する)
を同時に生成し、それらの最適化ありコードを最初にデ
バッガによりターゲットメモリにロードし、デバッガで
デバッグ中断点が設定された関数についてのみ最適化な
しコードをターゲットメモリに再ロードすることによ
り、デバッグ中断点までのプログラム実行時間を短縮
し、それに伴い、デバッグ工程全体に要する時間も短縮
することができるようにしたコンパイルおよびデバッグ
方法に関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to an optimized object code optimized at the time of compiling (hereinafter referred to as an optimized code) and a non-optimized object code (hereinafter referred to as an unoptimized code). )
At the same time, load those optimized codes into the target memory by the debugger first, and then reload the non-optimized code into the target memory only for the functions for which the debug breakpoint has been set by the debugger. The present invention relates to a compiling and debugging method capable of reducing a program execution time up to a point, and accordingly, a time required for an entire debugging process.

【0002】[0002]

【従来の技術】ユーザがプログラムを開発する際の一般
的なフローを図7に示す。この図7において、言語でソ
ースプログラムの作成を行い(ステップ701)、その
ソースプログラムを、コンパイル(ステップ702)
し、リンク(ステップ703)し、オブジェクトプログ
ラム704の作成を行う。次に、オブジェクトプログラ
ム704に対してデバッガを使って、デバッグを行う
(ステップ705)。デバッグで修正すべき箇所が見つ
かった場合(ステップ706)、ソースプログラムの修
正を行い(ステップ707)、再度コンパイル、リンク
を行い、その後デバッグを行う。
2. Description of the Related Art A general flow when a user develops a program is shown in FIG. In FIG. 7, a source program is created in a language (step 701), and the source program is compiled (step 702).
Then, a link is made (step 703), and an object program 704 is created. Next, debugging is performed on the object program 704 using a debugger (step 705). If a part to be corrected is found by debugging (step 706), the source program is corrected (step 707), and the program is compiled and linked again, and then debugged.

【0003】このプログラムデバッグ工程において、ユ
ーザがデバッグに要する時間を短縮することはユーザの
開発効率向上のために非常に重要である。デバッグにお
いて、最適化したプログラムに対して、ソースプログラ
ムの意味どおりのステップ実行やトレースを行うことは
できない。
In this program debugging process, it is very important to reduce the time required for debugging by the user in order to improve the development efficiency of the user. In debugging, it is not possible to perform step execution or tracing according to the meaning of a source program on an optimized program.

【0004】たとえば、特開平10−133911号公
報(『デバッグ装置』)では、コンパイラによる最適化
がかけられたプログラムのデバッグを行う装置が提案さ
れている。この装置では、デバッグ中断点における変数
の値を最適化による命令の並べ替えが行われていない場
合と同じ値が表示されるような方式になっているが、表
示のために最適化によって後方に位置することになった
未実行分の実行を行っている。
For example, Japanese Patent Laying-Open No. 10-133911 ("Debugger") proposes an apparatus for debugging a program that has been optimized by a compiler. In this device, the value of the variable at the debug interruption point is displayed in the same value as when the instruction is not rearranged by optimization. The execution of the unexecuted part that has been positioned is being performed.

【0005】[0005]

【発明が解決しようとする課題】しかしながら、この方
式では、デバッグ中断点以降のステップ実行で変数の値
が最適化されていないプログラムと同じにならない。こ
のように最適化されたプログラムを厳密にソースプログ
ラムの意味どおりに行うことは現在提案されている方式
ではできない。また、コンパイラの最適化技術は年々複
雑になっており、デバッガの方式を変更してソースプロ
グラムの意味に近づけることは難しくなっている。
However, in this method, the value of a variable is not the same as that of an unoptimized program in the step execution after the debug interruption point. It is not possible with the currently proposed method to execute a program optimized in this way exactly as the meaning of the source program. In addition, the technology for optimizing compilers is becoming more and more complex year by year, and it is difficult to change the method of the debugger to approximate the meaning of the source program.

【0006】したがって、従来ユーザがソースプログラ
ムの意味どおりにデバッグを行う必要がある際は、コン
パイラによる最適化を行わないプログラムでデバッグを
行う。しかしながら、最適化を行わないプログラムでの
デバッグは、プログラム自体の実行に時間がかかるた
め、ユーザのデバッグ時間が長くなってしまう。
Therefore, when a user conventionally needs to perform debugging according to the meaning of a source program, debugging is performed using a program that is not optimized by a compiler. However, debugging with a program that does not perform optimization takes a long time to execute the program itself, so that the user's debugging time becomes longer.

【0007】この発明は、上記従来の課題を解決するた
めになされたもので、全オブジェクトコードが最適化な
しの場合に比べて、プログラム実行時間を短縮すること
ができ、それに伴い、デバッグ工程全体に要する時間も
短縮することができるコンパイルおよびデバッグ方法を
提供することを目的とする。
The present invention has been made to solve the above-mentioned conventional problems, and can reduce the program execution time as compared with the case where all object codes are not optimized. It is an object of the present invention to provide a compiling and debugging method that can also reduce the time required for debugging.

【0008】[0008]

【課題を解決するための手段】上記目的を達成するため
に、この発明のコンパイルおよびデバッグ方法は、コン
パイル処理時に生成された最適化オブジェクトコードと
非最適化オブジェクトコードを関数サイズ調整手段に入
力して上記最適化オブジェクトコードと上記非最適化オ
ブジェクトコードの各コードサイズを調整してコードサ
イズ調整が行われた最適化オブジェクトコードと非最適
化オブジェクトコードをオブジェクトプログラムとして
出力する第1ステップと、デバッガにおいて、上記オブ
ジェクトプログラム中の最適化オブジェクトコードをタ
ーゲットメモリ上にロードしてこの最適化オブジェクト
コードに対してデバッグ中断点が設定されると、その設
定された関数を認識して上記オブジェクトプログラム中
のその関数に対応した非最適化オブジェクトコードを上
記ターゲットメモリ上の同じアドレスに再ロードする第
2ステップとを含むことを特徴とする。
In order to achieve the above object, a compile and debug method according to the present invention comprises: inputting an optimized object code and a non-optimized object code generated during a compile process to a function size adjusting means; A first step of adjusting the respective code sizes of the optimized object code and the non-optimized object code to output the optimized object code and the non-optimized object code whose code size has been adjusted as an object program; In the above, when the optimized object code in the object program is loaded on the target memory and a debugging break point is set for the optimized object code, the set function is recognized and the Corresponding to that function Unoptimized object code, characterized in that it comprises a second step of reloading the same address on the target memory.

【0009】そのため、コンパイラにおいて、コンパイ
ル処理時に関数サイズ調整手段により最適化オブジェク
トコードと非最適化オブジェクトコードの各コードサイ
ズを調整してオブジェクトファイル出力手段からコード
サイズ調整が行われた最適化オブジェクトコードと非最
適化オブジェクトコードをオブジェクトプログラムとし
てデバッガに出力し、デバッガにおいて、最初にターゲ
ットメモリ上に最適化オブジェクトコードをロードし、
この最適化オブジェクトコードにデバッグ中断点が設定
されると、オブジェクトプログラム入力手段がデバッグ
中断点が設定された関数に対する非最適化オブジェクト
コードの再ロードの指示を受けて、オブジェクトプログ
ラムの非最適化オブジェクトコードをターゲットメモリ
へロードするようにしたので、全オブジェクトコードが
最適化なしの場合に比べて、プログラム実行時間を短縮
することができ、それに伴い、デバッグ工程全体に要す
る時間も短縮することができる。
Therefore, the compiler adjusts the code size of the optimized object code and the non-optimized object code by the function size adjusting means during the compiling process, and adjusts the code size of the optimized object code by the object file output means. And the non-optimized object code are output to the debugger as an object program, and the debugger first loads the optimized object code on the target memory,
When a debug break point is set in the optimized object code, the object program input means receives an instruction to reload the non-optimized object code for the function for which the debug break point has been set, and outputs the non-optimized object code of the object program. Since the code is loaded into the target memory, the program execution time can be reduced as compared with the case where all object codes are not optimized, and the time required for the entire debugging process can be reduced accordingly. .

【0010】[0010]

【発明の実施の形態】次に、この発明によるコンパイル
およびデバッグ方法の実施の形態について図面に基づき
説明する。図1は、この発明のコンパイルおよびデバッ
グ方法の第1実施の形態に適用されるコンパイラとデバ
ッガの構成を示したブロック図である。この図1におけ
るコンパイラAは、構文解析手段101、ソース行番号
とコードアドレスの対応関係であるソースデバッグ情報
を生成する行情報作成手段102、命令の入れ替えなど
コードの最適化を行う最適化手段103、最適化手段1
03が生成する最適化ありコード104、最適化手段1
03を経由せずに生成される最適化なしコード105、
これら2つのコードを入力して個々のコードサイズを関
数単位で調整する関数サイズ調整手段106、オブジェ
クトプログラム108を出力するオブジェクトファイル
出力手段107を備えている。
DESCRIPTION OF THE PREFERRED EMBODIMENTS Next, an embodiment of a compiling and debugging method according to the present invention will be described with reference to the drawings. FIG. 1 is a block diagram showing a configuration of a compiler and a debugger applied to the first embodiment of the compiling and debugging method of the present invention. Compiler A in FIG. 1 includes syntax analyzing means 101, line information creating means 102 for generating source debug information which is the correspondence between source line numbers and code addresses, and optimizing means 103 for optimizing codes such as replacing instructions. , Optimization means 1
03 with optimization code 104, optimization means 1
03, without optimization code 105 generated without going through
There are provided a function size adjusting means 106 for inputting these two codes and adjusting the code size of each code in function units, and an object file output means 107 for outputting an object program 108.

【0011】また、この第1実施の形態に適用されるデ
バッガBは、デバッグ対象プログラムであるオブジェク
トプログラム108を読み込むためのオブジェクトプロ
グラム入力手段109、ソースプログラムレベルでのス
テップ実行を行うソースレベルステップ実行手段11
0、デバッグ中断点が設定された関数の最適化なしコー
ドの再ロード要求を行う関数入力指示手段111を備え
ている。デバッガBに接続するターゲットとして、エミ
ュレータ112またはシミュレータ113を使用する。
The debugger B applied to the first embodiment includes an object program input means 109 for reading an object program 108 which is a program to be debugged, a source level step execution for executing a step execution at a source program level. Means 11
0, a function input instructing unit 111 for requesting reloading of a code without optimization of a function for which a debug interruption point has been set. The emulator 112 or the simulator 113 is used as a target connected to the debugger B.

【0012】関数サイズ調整手段106では、最適化手
段103から出力された最適化ありコード104と最適
化手段103を経由しない最適化なしコード105を入
力して処理を行う。なお、構文解析手段101、最適化
手段103、行情報生成手段102の処理は、この発明
と直接関係ないので、その説明を割愛する。
The function size adjusting means 106 performs processing by inputting the optimized code 104 output from the optimizing means 103 and the non-optimized code 105 not passing through the optimizing means 103. Note that the processes of the syntax analysis unit 101, the optimization unit 103, and the line information generation unit 102 are not directly related to the present invention, and thus description thereof is omitted.

【0013】次に、このように構成された図1のコンパ
イラA、デバッガBに適用されるこの発明によるコンパ
イルおよびデバッグ方法の第1実施の形態の動作につい
て説明する。まず、コンパイラAでは、コンパイル処理
実行時に、最適化ありコード104と最適化なしコード
105の2つを生成する。この2つのコードは、関数サ
イズ調整手段106により関数単位で関数サイズ情報が
同じになるように調整される。つまり、関数サイズ情報
として最適化ありコードと最適化なしコードのうち、大
きい方のコードサイズを設定する。
Next, the operation of the first embodiment of the compiling and debugging method according to the present invention applied to the compiler A and the debugger B shown in FIG. 1 will be described. First, the compiler A generates two codes, an optimized code 104 and a non-optimized code 105, at the time of executing the compiling process. These two codes are adjusted by the function size adjusting means 106 so that the function size information is the same for each function. That is, the larger code size of the code with optimization and the code without optimization is set as the function size information.

【0014】デバッガBは、最初にターゲットメモリ上
に、このようにして生成したオブジェクトプログラム1
08中の最適化ありコードをロードする。その最適化あ
りコードに対しデバッグ中断点が設定された場合、設定
された関数を認識し、オブジェクトプログラム108中
の該当する関数に対応した最適化なしコードを同アドレ
スに再ロードする。これにより、デバッグ中断点が設定
された関数以外は最適化ありコードのままであるため、
デバッグ中断点が設定された関数内をソースデバッグす
ることができ、かつそのデバッグ中断点までのプログラ
ム実行時間を短縮することを可能にする。
The debugger B first stores the object program 1 thus generated on the target memory.
Load code with optimization in 08. When a debug break point is set for the optimized code, the set function is recognized, and the code without optimization corresponding to the corresponding function in the object program 108 is reloaded at the same address. As a result, the code other than the function for which the debug break point is set remains the optimized code,
Source debugging can be performed in a function in which a debug break point is set, and the program execution time up to the debug break point can be reduced.

【0015】図2は、関数サイズ調整手段106への入
力直前の関数情報テーブルの内容である。この関数情報
テーブルは、関数名記憶領域201、関数サイズ記憶領
域202、最適化ありコードサイズ記憶領域203、最
適化なしコードサイズ記憶領域204、最適化ありコー
ド207の格納領域へのポインタ205、最適化なしコ
ード208の格納領域へのポインタ206より構成され
る。なお、このテーブルは、関数の数nだけ存在する。
FIG. 2 shows the contents of the function information table immediately before input to the function size adjusting means 106. The function information table includes a function name storage area 201, a function size storage area 202, a code size storage area with optimization 203, a code size storage area without optimization 204, a pointer 205 to a storage area of code 207 with optimization, It is composed of a pointer 206 to a storage area of the unencoded code 208. It should be noted that this table exists for the number n of functions.

【0016】図3は、関数サイズ調整手段106の処理
フローである。図3において、関数情報テーブルよりサ
イズ調整対象の未処理関数があるかどうか判断する(ス
テップ301)。ここで、未処理関数がある場合は、関
数情報テーブルより該当する関数情報を読み込み(ステ
ップ302)、該当する関数の最適化ありコードサイズ
と最適化なしコードサイズが同じかどうか判断する(ス
テップ303)。
FIG. 3 is a processing flow of the function size adjusting means 106. In FIG. 3, it is determined from the function information table whether there is an unprocessed function whose size is to be adjusted (step 301). If there is an unprocessed function, the corresponding function information is read from the function information table (step 302), and it is determined whether the code size of the corresponding function with optimization is the same as the code size without optimization (step 303). ).

【0017】この判断の結果、コードサイズが同じであ
れば、何もせずにステップ301に戻る。また、ステッ
プ303での判断の結果、コードサイズが異なる場合
は、次に最適化ありコードサイズが最適化なしコードサ
イズより大きいかどうか判断する(ステップ304)。
この判断の結果、最適化ありコードサイズが最適化なし
コードサイズより大きい場合は、関数情報テーブルの関
数サイズ記憶領域202に最適化ありコードサイズ記憶
領域203の情報を書き込み(ステップ305)、ステ
ップ301に戻る。
If the result of this determination is that the code sizes are the same, the process returns to step 301 without doing anything. If the result of the determination in step 303 is that the code sizes are different, it is next determined whether or not the code size with optimization is larger than the code size without optimization (step 304).
As a result of this determination, if the code size with optimization is larger than the code size without optimization, the information of the code size storage area with optimization 203 is written into the function size storage area 202 of the function information table (step 305), and step 301 Return to

【0018】ステップ304での判断の結果、最適化あ
りコードサイズが最適化なしコードサイズより小さい場
合は、関数情報テーブルの関数サイズ記憶領域202に
最適化なしコードサイズ記憶領域204の情報を書き込
み(ステップ306)、ステップ301に戻る。ステッ
プ301で未処理関数がない場合は、オブジェクトファ
イル出力手段107により、サイズ調整を行った最適化
ありコード、最適化なしコードと関数情報テーブルをオ
ブジェクトプログラム108として出力して終了する。
If the result of the determination in step 304 is that the code size with optimization is smaller than the code size without optimization, the information of the code size storage area without optimization 204 is written into the function size storage area 202 of the function information table ( Step 306), and return to step 301. If there is no unprocessed function in step 301, the object file output unit 107 outputs the code with optimization and the code without optimization and the function information table whose size has been adjusted as the object program 108, and ends.

【0019】オブジェクトプログラム入力手段109
は、オブジェクトプログラム108中の最適化ありコー
ドまたは最適化なしコードを選択的にエミュレータ11
2またはシミュレータ113上のターゲットメモリへロ
ードする。関数入力指示手段111では、デバッグ中断
点が設定された関数に対する最適化なしコードの再ロー
ドをオブジェクトプログラム入力手段109に指示す
る。
Object program input means 109
The emulator 11 selectively selects the code with optimization or the code without optimization in the object program 108.
2 or to the target memory on the simulator 113. The function input instructing unit 111 instructs the object program inputting unit 109 to reload the code without optimization for the function for which the debug interruption point has been set.

【0020】図4は、デバッグ工程におけるこの第1実
施の形態の動作フローである。図4において、デバッガ
Bは、まずオブジェクトプログラム108中の最適化あ
りコードをエミュレータ112またはシミュレータ11
3のターゲットメモリへロードする(ステップ40
1)。次に、プログラム実行の指定があるかどうか判断
する(ステップ402)。この判断の結果、プログラム
実行が指定された場合、デバッグ中断点が設定されてい
るかどうか判断する(ステップ403)。
FIG. 4 is an operation flow of the first embodiment in a debugging step. In FIG. 4, the debugger B first converts the code with optimization in the object program 108 into the emulator 112 or the simulator 11.
3 (Step 40)
1). Next, it is determined whether or not the program execution is specified (step 402). If the result of this determination is that program execution has been specified, it is determined whether a debug breakpoint has been set (step 403).

【0021】この判断の結果、デバッグ中断点が設定さ
れている場合、その設定された該当する関数名を認識し
(ステップ404)、その関数に対応したオブジェクト
プログラム108中の最適化なしコードの再ロードをオ
ブジェクトプログラム入力手段109に指示する(ステ
ップ405)。その指示にしたがい、オブジェクトプロ
グラム入力手段109は最適化なしコードをエミュレー
タ112またはシミュレータ113のターゲットメモリ
へ再ロードする(ステップ406)。再ロード完了後に
プログラム実行を開始する(ステップ407)。
If the result of this determination is that a debugging breakpoint has been set, the set corresponding function name is recognized (step 404), and the code without optimization in the object program 108 corresponding to that function is re-created. The load is instructed to the object program input means 109 (step 405). According to the instruction, the object program input means 109 reloads the non-optimized code into the target memory of the emulator 112 or the simulator 113 (step 406). After the reloading is completed, the program execution is started (step 407).

【0022】ステップ402で、プログラム実行が指定
されていない場合は、他の処理を行うか判断する(ステ
ップ408)。他の処理を行うように指定されていれ
ば、他の処理409を行い、ステップ402に戻る。他
の処理の指定がなければデバッガを終了する。なお、他
の処理としてはステップ実行も含まれ、ステップ実行し
てステップ402に戻る。ステップ403でデバッグ中
断点が設定されていない場合は、ステップ407に移
り、プログラム実行を開始する。上記では、関数サイズ
の格納方法として図2を用いて説明したが、関数単位以
外にも他のデータ構造で格納した場合も同等の効果が得
られることは明らかである。
If it is determined in step 402 that the program execution has not been specified, it is determined whether another process is to be performed (step 408). If another process is specified, another process 409 is performed, and the process returns to step 402. If no other processing is specified, terminate the debugger. Note that the other processing includes step execution, and the processing returns to step 402 after step execution. If the debug interruption point has not been set in step 403, the process moves to step 407, and the program execution is started. In the above description, the method of storing the function size has been described with reference to FIG. 2. However, it is apparent that the same effect can be obtained when the data is stored in another data structure in addition to the function unit.

【0023】次に、図4、図5、図6を参照して、具体
的な例としてあるCソースが入力されたときのこの第1
実施の形態の動作を説明する。コンパイラAにより、オ
ブジェクトプログラムが作成される。次に、そのオブジ
ェクトプログラムがデバッガBに入力され、図4のステ
ップ401により、図5のコード配置イメージになる。
この図5において、ターゲットメモリ501、最適化あ
りコード格納テーブル502には最適化ありコードが格
納され、最適化なしコード格納テーブル503には最適
化なしコードが格納される。
Next, referring to FIGS. 4, 5 and 6, the first example when a certain C source is inputted as a specific example will be described.
The operation of the embodiment will be described. An object program is created by the compiler A. Next, the object program is input to the debugger B, and the code arrangement image of FIG. 5 is obtained by step 401 of FIG.
In FIG. 5, a code with optimization is stored in a target memory 501 and a code storage table with optimization 502, and a code without optimization is stored in a code storage table 503 without optimization.

【0024】図6は、図4の各ステップに対するターゲ
ットメモリ上のコードの配置イメージである。ステップ
403でデバッグ中断点の設定が行われると、ステップ
404、405、406が実行されて図6に示す配置イ
メージになる。デバッグ中断点601が設定されると、
ステップ404が設定された関数名としてfuncCを認識
して、ステップ405、406によって最適化なしコー
ド格納テーブル503のfuncCに対応したコード503
Cがターゲットメモリ501に再ロードされる。その
後、ステップ407によってターゲットメモリ501の
コードの実行がなされ、一通りのデバッグが完了する。
FIG. 6 is an image of a code arrangement on the target memory for each step of FIG. When the setting of the debug interruption point is performed in step 403, steps 404, 405, and 406 are executed, and the layout image shown in FIG. 6 is obtained. When the debug break point 601 is set,
In step 404, funcC is recognized as the set function name, and in steps 405 and 406, the code 503 corresponding to funcC in the non-optimized code storage table 503 is set.
C is reloaded into the target memory 501. After that, the code in the target memory 501 is executed in step 407, and one type of debugging is completed.

【0025】このように、第1実施の形態では、オブジ
ェクトプログラムのソースデバッグ時、デバッグ中断点
が設定された関数のみ最適化なしコードを使用すること
により、全オブジェクトコードが最適化なしの場合に比
べ、プログラム実行時間を短縮することができる。これ
により、一般に複数回実行されるデバッグ工程に要する
時間も短縮することが可能である。
As described above, in the first embodiment, when the source program of the object program is debugged, only the function for which the debug interruption point is set uses the code without optimization. In comparison, the program execution time can be reduced. As a result, it is also possible to reduce the time required for the debugging process which is generally performed a plurality of times.

【0026】以下に、例を取って効果を説明する。ここ
で一例として、あるコンパイラの最適化ありコードと最
適化なしコードの実行時間を比較した結果では、最適化
ありの方が約2.5倍、プログラム実行速度が高速にな
ることがわかっている。次に、ソースデバッグ工程での
プログラム実行時間について算出してみる。ソースデバ
ッグ工程に入った場合、コンパイル1回につき実行され
るデバッグ回数を平均5回とする。
The effect will be described below by taking an example. Here, as an example, a comparison of the execution times of code with optimization and code without optimization by a certain compiler shows that program execution speed is about 2.5 times faster with optimization than with optimization. . Next, the program execution time in the source debugging process will be calculated. When the source debugging process is started, the average number of times of debugging executed for each compilation is five.

【0027】コンパイル実行に要する処理時間は、最適
化ありコードと最適化なしコードを2つ出力するため、
オブジェクトコード生成工程は従来比2倍程度となり、
関数サイズ調整手段の処理も加わるが、その他の処理は
従来と共通であるため、全体としてコンパイル工程の時
間は、従来比1.5倍程度である。プログラムの構成モ
ジュル数を100個とし、従来の1モジュル当たりのコ
ンパイル時間を1秒とすると、全モジュルのコンパイル
時間は、従来は100秒であるが、この発明では上記の
説明から1.5倍の150秒となる。
The processing time required for compiling execution is as follows: two codes with optimization and two codes without optimization are output.
The object code generation process is about twice the conventional process,
Although the processing of the function size adjusting means is added, the other processing is the same as the conventional processing, so that the time required for the compiling process as a whole is about 1.5 times that of the conventional processing. Assuming that the number of modules constituting a program is 100 and the conventional compile time per module is 1 second, the compile time of all modules is 100 seconds in the past. 150 seconds.

【0028】プログラム規模にもよるが、1回のデバッ
グ工程で要する最適化なしコードのプログラム実行時間
を平均5分とすると、デバッグ5回の実行では、従来は
25分であるが、この発明では上記の説明から1/2.
5の10分となる。したがって、1回のコンパイルに対
するデバッグ工程内の時間は、従来の26分40秒に対
し、この発明では12分30秒となり、約2.2倍高速
化することができる。
Assuming that the program execution time of the code without optimization required in one debugging step is 5 minutes on average, depending on the program size, the execution of 5 debugging cycles would conventionally take 25 minutes. From the above description, 1/2.
5 of 10 minutes. Therefore, the time in the debugging process for one compilation is 12 minutes and 30 seconds in the present invention, compared to the conventional 26 minutes and 40 seconds, and the speed can be increased by about 2.2 times.

【0029】一般に、デバッグ工程では、ターゲットと
して上述したように,デバッガにエミュレータ112ま
たはシミュレータ113を接続して使用する。ターゲッ
ト上でのプログラム実行速度は、シミュレータ上の方が
遅いため、この発明による第1実施の形態による効果
は、ターゲットとしてシミュレータを使用した場合が顕
著になる。
Generally, in the debugging step, as described above, the emulator 112 or the simulator 113 is connected to a debugger and used as a target. Since the program execution speed on the target is slower on the simulator, the effect of the first embodiment according to the present invention becomes remarkable when the simulator is used as the target.

【0030】[0030]

【発明の効果】以上のように、この発明によれば、コン
パイラにおいて、コンパイル処理時に最適化オブジェク
トコードと非最適化オブジェクトコードの各コードサイ
ズを調整してコードサイズ調整が行われた最適化オブジ
ェクトコードと非最適化オブジェクトコードをオブジェ
クトプログラムとしてデバッガに出力し、デバッガにお
いて、最初にターゲットメモリ上に最適化オブジェクト
コードをロードし、この最適化オブジェクトコードにオ
ブジェク中断点が設定されると、デバッグ中断点が設定
された関数に対するオブジェクトプログラムの非最適化
オブジェクトコードをターゲットメモリの同じアドレス
へ再ロードするようにしたので、デバッグ中断点までの
プログラム実行時間を短縮することができ、それに伴
い、デバッグ工程全体に要する時間も短縮することがで
きる。
As described above, according to the present invention, an optimized object in which a code size is adjusted by adjusting each code size of an optimized object code and a non-optimized object code in a compile process in a compiler according to the present invention. The code and the non-optimized object code are output to the debugger as an object program. The debugger first loads the optimized object code on the target memory, and when an object break point is set in the optimized object code, the debugger stops. The non-optimized object code of the object program for the function for which the point has been set is reloaded to the same address in the target memory, so that the program execution time up to the debug interruption point can be shortened. all It is also possible to shorten the time required to.

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

【図1】この発明によるコンパイルおよびデバッグ方法
の第1実施の形態に適用されるコンパイラおよびデバッ
ガの構成を示すブロック図である。
FIG. 1 is a block diagram showing a configuration of a compiler and a debugger applied to a first embodiment of a compiling and debugging method according to the present invention.

【図2】図1のコンパイラにおける関数サイズ調整手段
への入力直前の関数サイズ情報テーブルの内容を示す説
明図である。
FIG. 2 is an explanatory diagram showing the contents of a function size information table immediately before input to a function size adjusting means in the compiler of FIG. 1;

【図3】図1のコンパイラにおける関数サイズ調整手段
の処理手順を示すフローチャートである。
FIG. 3 is a flowchart showing a processing procedure of a function size adjusting means in the compiler of FIG. 1;

【図4】この発明によるコンパイルおよびデバッグ方法
におけるデバッグ工程処理手順を示すフローチャートで
ある。
FIG. 4 is a flowchart showing a debugging process procedure in a compiling and debugging method according to the present invention;

【図5】この発明によるコンパイルおよびデバッグ方法
により生成されたオブジェクトプログラムがデバッガに
入力されてターゲットメモリにロードされる最適化あり
コードと最適化なしコードのコード配置イメージ図であ
る。
FIG. 5 is a code layout image diagram of an optimized code and an unoptimized code in which an object program generated by the compiling and debugging method according to the present invention is input to a debugger and loaded into a target memory.

【図6】図4のフローチャートにおける各処理ステップ
に対するターゲットメモリ上の最適化なしコードの配置
イメージ図である。
6 is an arrangement image diagram of a code without optimization on a target memory for each processing step in the flowchart of FIG. 4;

【図7】一般的なプログラム開発する際の手順を示すフ
ローチャートである。
FIG. 7 is a flowchart showing a procedure for developing a general program.

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

A……コンパイラ、B……デバッガ、101……構文解
析手段、102……行情報生成手段、103……最適化
手段、104……最適化ありコード、105……最適化
なしコード、106……関数サイズ調整手段、107…
…オブジェクトファイル出力手段、108……オブジェ
クトプログラム、109……オブジェクトプログラム入
力手段、110……ソースレベルステップ実行手段、1
11……関数入力指示手段、112……エミュレータ、
113……シミュレータ、201……関数名記憶領域、
202……関数サイズ記憶領域、203……最適化あり
コードサイズ記憶領域、204……最適化なしコードサ
イズ記憶領域、205……最適化ありコード格納領域へ
のポインタ、206……最適化なしコード格納領域への
ポインタ、207……最適化ありコード、208……最
適化なしコード、501……ターゲットメモリ、502
……最適化ありコード格納テーブル、503……最適化
なしコード格納テーブル、502A……funcAの最適化
ありコード、502B……funcBの最適化ありコード、
502C……funcCの最適化ありコード、503A……f
uncAの最適化なしコード、503B……funcBの最適化
なしコード、503C……funcCの最適化なしコード、
601……デバッグ中断点の設定。
A: compiler, B: debugger, 101: syntax analysis means, 102: line information generation means, 103: optimization means, 104: code with optimization, 105: code without optimization, 106: ... function size adjustment means, 107 ...
... object file output means, 108 ... object program, 109 ... object program input means, 110 ... source level step execution means, 1
11 ... function input instruction means, 112 ... emulator,
113: Simulator, 201: Function name storage area,
202: Function size storage area, 203: Code size storage area with optimization, 204: Code size storage area without optimization, 205: Pointer to code storage area with optimization, 206: Code without optimization Pointer to storage area, 207: code with optimization, 208: code without optimization, 501: target memory, 502
... Code table with optimization, 503 ... Code storage table without optimization, 502A ... Code with optimization of funcA, 502B ... Code with optimization of funcB,
502C... FuncC optimized code, 503A... F
Unoptimized code of uncA, 503B... unoptimized code of funcB, 503C... unoptimized code of funcC,
601... Debug interrupt point setting.

フロントページの続き (72)発明者 社本 英司 神奈川県川崎市中原区小杉町一丁目403番 53 日本電気アイシーマイコンシステム株 式会社内 Fターム(参考) 5B042 GA02 GA03 HH07 HH22 HH23 HH33 HH39 Continuation of the front page (72) Inventor Eiji Shamoto 53-1 Kosugi-cho, Nakahara-ku, Kawasaki-shi, Kanagawa Prefecture 53 F-term in NEC Ic Microcomputer System Co., Ltd. 5B042 GA02 GA03 HH07 HH22 HH23 HH33 HH39

Claims (11)

【特許請求の範囲】[Claims] 【請求項1】 コンパイル処理時に生成された最適化オ
ブジェクトコードと非最適化オブジェクトコードを関数
サイズ調整手段に入力して上記最適化オブジェクトコー
ドと上記非最適化オブジェクトコードの各コードサイズ
を調整してコードサイズ調整が行われた最適化オブジェ
クトコードと非最適化オブジェクトコードをオブジェク
トプログラムとして出力する第1ステップと、 デバッガにおいて、上記オブジェクトプログラム中の最
適化オブジェクトコードをターゲットメモリ上にロード
してこの最適化オブジェクトコードに対してデバッグ中
断点が設定されると、その設定された関数を認識して上
記オブジェクトプログラム中のその関数に対応した非最
適オブジェクトコードを上記ターゲットメモリ上の同じ
アドレスに再ロードする第2ステップと、 を含むことを特徴とするコンパイルおよびデバッグ方
法。
1. An optimized object code and a non-optimized object code generated during a compile process are input to a function size adjusting means to adjust respective code sizes of the optimized object code and the non-optimized object code. A first step of outputting, as an object program, the optimized object code and the non-optimized object code whose code size has been adjusted; and loading the optimized object code in the object program into a target memory by a debugger. When a debug break point is set for the optimized object code, the set function is recognized, and the non-optimal object code corresponding to the function in the object program is reloaded at the same address on the target memory. No. Compiling and debugging method characterized by comprising the steps, a.
【請求項2】 上記コンパイラは、構文解析手段と、ソ
ース行番号とコードアドレスの対応関係となるソースデ
バッグ情報を生成する行情報作成手段と、オブジェクト
コードの最適化を行う最適化手段と、上記最適化手段が
生成する最適化オブジェクトコードと上記最適化手段を
経由せずに生成される非最適的化オブジェクトコードと
を入力して個々のオブジェクトコードサイズを関数単位
で調整する関数サイズ調整手段と、上記関数サイズ調整
手段で調整された最適化オブジェクトコードと非最適化
オブジェクトコードと関数情報テーブルとを入力してオ
ブジェクトプログラムとして出力するオブジェクトファ
イル出力手段とを備えることを特徴とする請求項1記載
のコンパイルおよびデバッグ方法。
2. The compiler according to claim 1, wherein the compiler includes: a syntax analyzer; a line information generator configured to generate source debug information corresponding to a source line number and a code address; an optimization unit configured to optimize an object code; Function size adjusting means for inputting an optimized object code generated by the optimizing means and a non-optimized object code generated without passing through the optimizing means and adjusting the size of each object code in function units; 2. An object file output means for inputting an optimized object code, a non-optimized object code and a function information table adjusted by the function size adjusting means and outputting the function information table as an object program. How to compile and debug.
【請求項3】 上記関数情報テーブルは、関数名記録領
域と、関数サイズ記憶領域と、最適化オブジェクトコー
ドサイズ記録領域と、非最適化オブジェクトコードサイ
ズ記憶領域と、最適化オブジェクトコードの格納領域へ
のポインタと、非最適化オブジェクトコードの格納領域
へのポインタとを備えることを特徴とする請求項2記載
のコンパイルおよびデバッグ方法。
3. The function information table includes a function name recording area, a function size storage area, an optimized object code size recording area, a non-optimized object code size storage area, and an optimized object code storage area. 3. The compiling and debugging method according to claim 2, further comprising a pointer to a storage area of the non-optimized object code.
【請求項4】 上記関数サイズ調整手段は、上記関数情
報テーブルよりオブジェクトコードサイズ調整対象の未
処理関数がないと判断した場合に、上記オブジェクトフ
ァイル出力手段から上記オブジェクトプログラムを出力
することを特徴とする請求項2記載のコンパイルおよび
デバッグ方法。
4. The object size output means outputs the object program from the object file output means when it is determined from the function information table that there is no unprocessed function whose object code size is to be adjusted. 3. The compiling and debugging method according to claim 2, wherein:
【請求項5】 上記関数サイズ調整手段は、上記関数情
報テーブルより上記最適化オブジェクトコードサイズが
上記非最適化オブジェクトコードサイズより大きい場合
には関数情報テーブルの関数サイズ記憶領域に最適化オ
ブジェクトコードサイズ記憶領域の情報を書き込むこと
を特徴とする請求項2記載のコンパイルおよびデバッグ
方法。
5. The function size adjusting means according to claim 1, wherein said optimized object code size is larger than said non-optimized object code size in said function information table, and said optimized object code size is stored in a function size storage area of said function information table. 3. The compiling and debugging method according to claim 2, wherein information of a storage area is written.
【請求項6】 上記関数サイズ調整手段は、上記関数情
報テーブルより上記最適化オブジェクトコードサイズが
上記非最適化オブジェクトコードサイズより小さい場合
には関数情報テーブルの関数サイズ記憶領域に非最適化
オブジェクトコードサイズ記憶領域の情報を書き込むこ
とを特徴とする請求項2記載のコンパイルおよびデバッ
グ方法。
6. The function size adjusting means, if the optimized object code size is smaller than the non-optimized object code size in the function information table, stores the non-optimized object code in a function size storage area of the function information table. 3. The compiling and debugging method according to claim 2, wherein information of the size storage area is written.
【請求項7】 上記関数指示手段は、プログラム実行が
指定された場合に、デバッグ中断点が設定されると、設
定された関数名に対応したオブジェクトプログラム中の
非最適化オブジェクトコードの再ロードを上記オブジェ
クトプログラム入力手段に指示することを特徴とする請
求項2記載のコンパイルおよびデバッグ方法。
7. The function designating means reloads a non-optimized object code in an object program corresponding to a set function name when a program breakpoint is set when program execution is specified. 3. The compiling and debugging method according to claim 2, wherein an instruction is given to said object program input means.
【請求項8】 上記関数指示手段は、プログラム実行が
指定されていない場合に、他の処理を行うように指定さ
れていると、他の処理を行うことを特徴とする請求項2
記載のコンパイルおよびデバッグ方法。
8. The method according to claim 2, wherein the function designating means performs another processing when the execution of the program is not specified and when it is specified to perform another processing.
Compiling and debugging methods described.
【請求項9】 上記他の処理は、ステップ実行を含むこ
とを特徴とする請求項8記載のコンパイルおよびデバッ
グ方法。
9. The compiling and debugging method according to claim 8, wherein said other processing includes step execution.
【請求項10】 上記デバッガは、デバッグ中断点が設
定された関数の非最適化オブジェクトコードの再ロード
要求を行う関数入力指示手段と、デバッグ対象となる上
記オブジェクトプログラムを読み込むためのオブジェク
トプログラム入力手段と、ソースプログラムレベルでの
ステップ実行を行うソースレベルステップ実行手段とを
備えることを特徴とする請求項1記載のコンパイルおよ
びデバッグ方法。
10. A debugger, comprising: a function input instructing unit for requesting reloading of a non-optimized object code of a function for which a debug break point has been set; and an object program inputting unit for reading the object program to be debugged. 2. The compiling and debugging method according to claim 1, further comprising: source level step executing means for performing step execution at a source program level.
【請求項11】 上記オブジェクトプログラム中の最適
化オブジェクトコードまたは非最適化オブジェクトコー
ドは、オブジェクトプログラム入力手段により選択的に
エミュレータまたはシミュレータ上のターゲットメモリ
へロードされることを特徴とする請求項1記載のコンパ
イルおよびデバッグ方法。
11. The object program according to claim 1, wherein the optimized object code or the non-optimized object code in the object program is selectively loaded into a target memory on an emulator or a simulator by an object program input means. How to compile and debug.
JP11187783A 1999-07-01 1999-07-01 Compiling and debugging method Pending JP2001014185A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP11187783A JP2001014185A (en) 1999-07-01 1999-07-01 Compiling and debugging method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP11187783A JP2001014185A (en) 1999-07-01 1999-07-01 Compiling and debugging method

Publications (1)

Publication Number Publication Date
JP2001014185A true JP2001014185A (en) 2001-01-19

Family

ID=16212155

Family Applications (1)

Application Number Title Priority Date Filing Date
JP11187783A Pending JP2001014185A (en) 1999-07-01 1999-07-01 Compiling and debugging method

Country Status (1)

Country Link
JP (1) JP2001014185A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7096458B2 (en) 2001-10-31 2006-08-22 International Business Machines Corporation Method and apparatus to create and compare debug scenarios of a computer process
JP2012027639A (en) * 2010-07-22 2012-02-09 Fuji Electric Co Ltd Programmable controller and debug method of programmable controller

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7096458B2 (en) 2001-10-31 2006-08-22 International Business Machines Corporation Method and apparatus to create and compare debug scenarios of a computer process
JP2012027639A (en) * 2010-07-22 2012-02-09 Fuji Electric Co Ltd Programmable controller and debug method of programmable controller

Similar Documents

Publication Publication Date Title
US20140325488A1 (en) Systems and methods for debugging applications using dual code generation
US6067415A (en) System for assisting a programmer find errors in concurrent programs
EP0703532B1 (en) Embedded program flow information for object code manipulation
KR0125605B1 (en) Method and device for verifying operation of machine language program
JP2001014185A (en) Compiling and debugging method
JP3196675B2 (en) Language processing method
Stepney Incremental development of a high integrity compiler: experience from an industrial development
US20110225400A1 (en) Device for Testing a Multitasking Computation Architecture and Corresponding Test Method
JP2005174045A (en) Source program conversion device, source program conversion method, source program conversion program and program recording medium
JPH11110256A (en) Device and method for debugging program, and computer readable recording medium recorded with the method for the same
KR101548960B1 (en) Method for making and debuging program using virtual platform and appparatus therof
JPH08137684A (en) Program transfer method, system and device, for program development, and program execution device
JP3745968B2 (en) Test system, test method, test program, and computer-readable recording medium recording the test program
WO2024069730A1 (en) Debugging device and debugging method
JP7295469B2 (en) Function generation program, function generation method, and information processing device
JP2812302B2 (en) Program development equipment
KR100293932B1 (en) A technology for post image processig of compiled s/w code
JP2005276092A (en) Debug system for program
JP3352893B2 (en) Debug information creation method, debug method and debug system
JPH02245934A (en) Data processor
JP2001222447A (en) Debug method and device to be debugged under operating environment
JPH113221A (en) Debugging system
CN113283211A (en) Microprocessor automatic verification method and verification device based on Verilog
JPS58169637A (en) Compile processing system
JPH1083311A (en) Simulator