[go: up one dir, main page]

JP2003058392A - Software development environment program, its recording medium, program debugging device, and program debugging method - Google Patents

Software development environment program, its recording medium, program debugging device, and program debugging method

Info

Publication number
JP2003058392A
JP2003058392A JP2001242037A JP2001242037A JP2003058392A JP 2003058392 A JP2003058392 A JP 2003058392A JP 2001242037 A JP2001242037 A JP 2001242037A JP 2001242037 A JP2001242037 A JP 2001242037A JP 2003058392 A JP2003058392 A JP 2003058392A
Authority
JP
Japan
Prior art keywords
diagnostic
program
information
compiler
statement
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
JP2001242037A
Other languages
Japanese (ja)
Inventor
Seiji Terunuma
誠司 照沼
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.)
Fujitsu Ltd
Original Assignee
Fujitsu 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 Fujitsu Ltd filed Critical Fujitsu Ltd
Priority to JP2001242037A priority Critical patent/JP2003058392A/en
Publication of JP2003058392A publication Critical patent/JP2003058392A/en
Pending legal-status Critical Current

Links

Landscapes

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

Abstract

(57)【要約】 (修正有) 【課題】 コンパイルオプションでデバッグ用のステー
トメントを無効化するようにリコンパイルした製品版プ
ログラムのデバッグにおいても、テスト版プログラムに
記述した診断指示用ステートメントが有効であるかのよ
うにデバッグを可能とする。 【解決手段】 コンパイラはコンパイルオプションが指
示されると、デバッグ用ステートメントを無効としたオ
ブジェクトモジュールを生成するとともに診断指示用の
ステートメントに対する診断用のデバッグ情報を生成す
る。デバッガは診断用のデバッグ情報を検出すると、ロ
ードモジュールに対してソースプログラムの診断指示用
のステートメントが記述されている行位置に相当するア
ドレスに診断用の中断点を設定する。被デバッグプログ
ラムが実行され、診断用の中断点で割り込みが発生する
とデバッガは、恰も診断指示用ステートメントが有効で
あるかのように診断用のステートメントの処理を代行す
るように構成する。
(57) [Summary] (Modified) [Problem] In debugging a product version program recompiled so that a debugging statement is invalidated by a compile option, a statement for diagnosis instruction written in a test version program is valid. Enable debugging as if it were. SOLUTION: When a compile option is specified, a compiler generates an object module in which a debug statement is invalidated, and generates diagnostic debug information for a diagnostic instruction statement. When the debugger detects the debugging information for diagnosis, the debugger sets a break point for diagnosis at an address corresponding to a line position where a statement for instructing diagnosis of the source program is described for the load module. When the debugged program is executed and an interrupt occurs at the diagnostic interruption point, the debugger is configured to substitute for the processing of the diagnostic statement as if the diagnostic instruction statement is valid.

Description

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

【0001】[0001]

【発明の属する技術分野】本発明は、プログラムのデバ
ッグ支援機能に関し、特に顧客に提供する製品版プログ
ラムでのトラブル発生時においても、開発中のテスト版
プログラムに挿入するプログラムの正しさを診断するた
めに用意された診断指示用ステートメントの機能と同等
の処理を自動的に実行するコンパイラ及びデバッガ技術
に関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a debugging support function of a program, and in particular, diagnoses the correctness of a program to be inserted into a test version program under development even when a problem occurs in a product version program provided to a customer. The present invention relates to a compiler and debugger technology for automatically executing processing equivalent to the function of a diagnostic instruction statement prepared for the purpose.

【0002】[0002]

【従来の技術】コンピュータを動作させるプログラムに
おいて、アルゴリズムを表現する(隣接する)ステート
メントとステートメントの間で常にある関係式が成立し
なければならない場合、プログラムの実行時にこの関係
式が成立しない場合にプログラムにバクがあると判断す
ることができる。この特性を利用してプログラムの正し
さを診断するためにC/C++などの言語では、デバッグ
が容易に行なうことができるようにプログラムの正しさ
の診断指示のためのマクロ(assertマクロ)が用
意されている。
2. Description of the Related Art In a program for operating a computer, when a relational expression between (adjacent) statements expressing an algorithm must always be established, when this relational expression is not established when the program is executed. You can judge that there is a tap in the program. In order to diagnose the correctness of the program by utilizing this characteristic, in a language such as C / C ++, a macro (assert macro) for instructing the correctness of the program so that debugging can be easily performed. Is prepared.

【0003】assertマクロは、この関係式が成立
するかどうかをチェックし、もしこの関係式が成立しな
ければ、プログラムにバグがあるものとみなして、標準
エラーストリームなどに診断情報を出力する。また、こ
の関係式が成立すれば、プログラムにバグがないものと
みなして、何もせずにプログラムの実行を継続する。な
お、assertマクロはデバッグモード(定義文字列
「DEBUG」や「_DEBUG」を定義した場合)と
してコンパイルされた時のみマクロ命令がコードに変換
され、プログラム実行時に前記assertマクロの処
理が行なわれる。また、リリースモード(定義文字列
「NDEBUG」を定義したり、「DEBUG」や「_
DEBUG」を定義しない場合)としてコンパイルされ
た時には、assertマクロはvoid式に変換され
プログラム実行時には何も行なわれない。
The assert macro checks whether or not this relational expression holds, and if this relational expression does not hold, it is considered that the program has a bug and outputs diagnostic information to a standard error stream or the like. If this relational expression is satisfied, it is considered that the program has no bug, and the program execution is continued without doing anything. The assert macro is converted into a code only when it is compiled in the debug mode (when the definition character strings "DEBUG" and "_DEBUG" are defined), and the assert macro is processed when the program is executed. In addition, release mode (definition character string “NDEBUG” is defined, “DEBUG” and “_
(When "DEBUG" is not defined), the assert macro is converted into a void expression and nothing is done when the program is executed.

【0004】開発中のテスト版プログラムをデバッグす
る場合、通常はプログラムに中断点を設け変数や制御表
などを確認するための条件設定を行い、被テストプログ
ラム実行中、中断点によるプログラム割り込みが発生し
た時に設定した内容を確認しながら行なう。しかしなが
ら、パラメタ解析など変数の上限値・下限値が決まって
いるものや変数の属性が決まっているような処理に関す
るプログラムでは、変数の値を確認するだけで基本的な
デバッグが可能である。このような場合、assert
マクロをプログラムの要所要所に挿入しておけばプログ
ラム実行時にデバッグが可能である。そのたため、as
sertマクロはプログラム開発時に広く利用されてい
る。
When debugging a test version program under development, a break point is usually set in the program to set conditions for checking variables and control tables, and a program interrupt occurs due to the break point during execution of the program under test. Check while setting the contents when you do. However, in a program related to processing such as parameter analysis in which the upper and lower limits of variables are determined or the attributes of variables are determined, basic debugging is possible only by checking the values of variables. In such a case, assert
If you insert macros in the key points of the program, you can debug when the program is running. Therefore, as
The sert macro is widely used during program development.

【0005】開発中のテスト版プログラムは、プログラ
ム実行時にassertマクロが有効となるようにデバ
ッグモードでコンパイルする。一方、顧客に提供する製
品版プログラムは、プログラム実行時に診断情報は出力
されないようにデバッグ済のテスト版プログラムを基に
して再作成する。この場合、デバッグ済のテスト版ソー
スプログラムを変更せずに、リリースモードでリコンパ
イルしたものを提供することがよく行なわれている。こ
のような提供方式にしておけば、もし製品版プログラム
でトラブルが発生した場合、ソースプログラム・リスト
を参照してvoid式に変換されたassertマクロ
が記述されている行位置に中断点を設定し、asser
tマクロのパラメタで指定した関係式をデバッガのコマ
ンドを入力して表示・確認することが可能であった。
The test version program under development is compiled in the debug mode so that the assert macro is valid when the program is executed. On the other hand, the product version program provided to the customer is recreated based on the debugged test version program so that diagnostic information is not output when the program is executed. In this case, it is common to provide a recompiled release mode program without changing the debugged test version source program. With this provision method, if a problem occurs in the product version program, set the breakpoint at the line position where the assert macro converted into the void expression is described by referring to the source program list. , Asser
It was possible to display and confirm the relational expression specified by the parameter of the t macro by entering the command of the debugger.

【0006】[0006]

【発明が解決しようとする課題】しかしながら上記のよ
うな提供方法では、ソースプログラムには診断指示用の
ステートメントが挿入されているにも関わらず、顧客に
提供する製品版プログラムのデバッグでは手動で中断点
を設定し、デバッガのコマンドで真となる関係式の確認
を行なうか、デバッグ用ステートメントが有効になるよ
うにコンパイルオプションを指定してプログラムをリコ
ンパイルするなどしないと、テスト版プログラムと同等
なデバッグはできずデバッグ効率は非常に悪かった。
However, in the above-mentioned providing method, even if the statement for the diagnostic instruction is inserted in the source program, it is manually interrupted in debugging the product version program provided to the customer. If you do not set a point and check the relational expression that is true with the command of the debugger, or recompile the program by specifying the compile option so that the debug statement is valid, it is equivalent to the test version program. Debugging was not possible and debugging efficiency was very poor.

【0007】製品版プログラムのトラブル発生時におい
ても、ソースプログラムに挿入されている無効化された
診断指示用ステートメントを利用することができ、診断
指示用のステートメントの機能と同等なデバッグ処理が
自動的に行われると非常に便利であり、製品版プログラ
ムのデバッグ効率が向上する。
Even when trouble occurs in the product version program, the invalid diagnostic instruction statement inserted in the source program can be used, and the debug processing equivalent to the function of the diagnostic instruction statement is automatically performed. It is very convenient to do so, and the debugging efficiency of the product version program is improved.

【0008】[0008]

【課題を解決するための手段】図1は本発明の実施の形
態1の全体構成図を示すものである。本発明のソフトウ
ェアの開発環境プログラムは、コンパイラ1とデバッガ
2で構成され、コンピュータを用いて、コンパイラ1に
はソースプログラム中のプログラムの正しさを診断する
ための診断指示用ステートメントを識別する診断指示識
別手段12を含む構文解析などステートメントの解析を
司る解析手段11、ソースプログラムからオブジェクト
を生成するオブジェクト出力手段13、診断指示用ステ
ートメントに対する診断情報をデバッグ情報ファイル5
に出力する診断情報出力手段15を含むデバッグ情報出
力を司るデバッグ情報出力手段14、デバッガ2にはデ
バッガの制御を司る制御手段21、中断点によりプログ
ラム割り込みが発生すると、診断用の中断点によるもの
かどうかを識別する診断用中断点識別手段23を含む中
断点の管理を司る中断点管理手段22、デバッグ情報フ
ァイル5から診断情報を検出すると診断用の中断点を設
定する診断用中断点設定手段25を含むデバッグ情報の
管理を司るデバッグ情報管理手段24、診断用の中断点
によるプログラム割り込みが発生すると、診断情報に基
づき診断処理を行なう診断用中断点処理手段26、変数
処理を司る変数処理手段27、プロセス処理を司るプロ
セス処理手段28として機能するものである。
FIG. 1 shows an overall configuration diagram of a first embodiment of the present invention. The software development environment program of the present invention comprises a compiler 1 and a debugger 2, and the computer uses a diagnostic instruction to identify a diagnostic instruction statement for diagnosing the correctness of the program in the source program using a computer. A parsing means 11 for analyzing a statement such as a syntax analysis including an identifying means 12, an object output means 13 for generating an object from a source program, diagnostic information for a diagnostic instruction statement and a debug information file 5
Debug information output means 14 including the diagnostic information output means 15 for outputting to the control information, the control means 21 for controlling the debugger 2 in the debugger 2, and the program interruption caused by the interruption point. The breakpoint management means 22 including the diagnostic breakpoint identifying means 23 for identifying whether or not the diagnostic breakpoint is set, and the diagnostic breakpoint setting means for setting the diagnostic breakpoint when the diagnostic information is detected from the debug information file 5. Debug information managing means 24 for managing debug information including 25, diagnostic interrupt point processing means 26 for performing diagnostic processing based on diagnostic information when a program interrupt is generated due to diagnostic information, and variable processing means for managing variable processing. 27, which functions as a process processing unit 28 that controls process processing.

【0009】ソースプログラム3のデバッグ完了後、ソ
ースプログラム3に対して、デバッグ用ステートメント
を無効とするようにコンパイルオプションを指定してコ
ンパイラ1に翻訳指示があると、コンパイラ1の解析手
段は11は、ステートメンを解析し、デバッグ用のステ
ートメントを無効化した後、オブジェクト出力手段13
を経由してオブジェクトモジュール4を出力する。ステ
ートメント解析中に診断指示識別手段12が診断用ステ
ートメントを識別すると、デバッグ情報出力手段の一部
である診断情報出力手段15は、診断情報をデバッグ情
報ファイル5に出力する。
After the source program 3 is debugged, when the compiler instruction is given to the source program 3 by designating a compile option so as to invalidate the debugging statement, the analysis means 11 of the compiler 1 After analyzing the state statement and invalidating the debugging statement, the object output means 13
The object module 4 is output via. When the diagnostic instruction identification means 12 identifies a diagnostic statement during statement analysis, the diagnostic information output means 15, which is part of the debug information output means, outputs the diagnostic information to the debug information file 5.

【0010】その後、製品版を作成するためにリンケー
ジエディタ9によりオブジェクトモジュール4から、ロ
ードモジュール6が生成される。なお、製品版のプログ
ラムは、コンパイラ1が生成したデバッグ情報ファイル
が添付されている。製品版のプログラムに障害が発生
し、利用者によりデバッガ2が起動されると、デバッグ
情報管理手段24はデバッグ情報ファイル5を検索す
る。デバッグ情報管理手段24は、デバッグ情報ファイ
ル5中に診断情報を検出すると、診断用中断点設定手段
25を介して、ロードモジュール6に対して所定の場所
に診断用の中断点を設定する。ロードモジュール6は変
数処理手段27、プロセス処理手段28の処理を介して
被デバッグプロセス7として実行さるが、本発明の主要
な部分ではないため詳細は省略する。被デバッグプロセ
ス7は、中断点の位置でプログラム割り込みを発生す
る。被デバッグプロセス7が、中断点によるプログラム
割り込みを起こすと、中断点管理手段22は診断用中断
点識別手段23を介して、その割り込みが診断用の中断
点で発生したかどうか識別する。診断用の中断点による
割り込みが発生すると、診断用中断点処理手段26は、
デバッグ情報ファイル5に出力された診断情報に基づ
き、診断指示用ステートメントで定義されたデバッグ処
理を代行する。
After that, the load module 6 is generated from the object module 4 by the linkage editor 9 to create a product version. The product version of the program is attached with the debug information file generated by the compiler 1. When a failure occurs in the product version program and the user activates the debugger 2, the debug information management means 24 searches the debug information file 5. When the debug information management unit 24 detects the diagnostic information in the debug information file 5, the debug information management unit 24 sets a diagnostic breakpoint at a predetermined location in the load module 6 via the diagnostic breakpoint setting unit 25. The load module 6 is executed as the debugged process 7 through the processing of the variable processing means 27 and the process processing means 28, but since it is not a main part of the present invention, its details are omitted. The debugged process 7 generates a program interrupt at the position of the interruption point. When the process to be debugged 7 causes a program interrupt due to a break point, the break point management means 22 identifies whether or not the interrupt occurred at the break point for diagnosis through the break point identifying means 23 for diagnosis. When an interruption due to a diagnostic break point occurs, the diagnostic break point processing means 26
Based on the diagnostic information output to the debug information file 5, the debugging process defined by the diagnostic instruction statement is substituted.

【0011】以上のようにコンパイラとデバッガが連携
するソフトウェア開発環境では、ソースプログラムに診
断指示用ステートメントが挿入されていると、デバッグ
用ステートメントを無効とするようにコンパイルオプシ
ョンで指定して作成した製品版プログラムに対しても、
リコンパイルや中断点の設定などの操作をすることなく
テスト版と同等なデバッグが自動的に可能となる。
As described above, in the software development environment in which the compiler and the debugger cooperate, a product created by specifying the compile option so as to invalidate the debug statement when the diagnostic instruction statement is inserted in the source program. For the edition program,
Debugging equivalent to the test version can be performed automatically without recompiling or setting breakpoints.

【0012】[0012]

【発明の実施の形態】図1は本発明の実施の形態1の全
体構成図を示すものである。コンパイラ1及びデバッガ
2は連携してソフトウェア開発環境を提供するものであ
り、コンピュータ読み取り可能な記録媒体に記録されて
いる。なお、図1に記述した、コンパイラ1及びデバッ
ガ2にはプログラム全体ではなく本発明と関連する部分
が記述してある。また、説明上はC言語を使用した開発
環境プログラムに基づいているが本発明が適用できる開
発環境プログラムはC言語を使用したものに限定された
ものではない。
DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS FIG. 1 shows an overall configuration diagram of a first embodiment of the present invention. The compiler 1 and the debugger 2 cooperate to provide a software development environment and are recorded in a computer-readable recording medium. It should be noted that the compiler 1 and the debugger 2 described in FIG. 1 describe not the entire program but the parts related to the present invention. Although the description is based on the development environment program using the C language, the development environment program to which the present invention can be applied is not limited to the one using the C language.

【0013】コンパイラ1には、解析手段11に診断用
ステートメントを識別する診断指示識別手段12を、デ
バッグ情報出力手段14に診断用ステートメントに対す
るデバッグ情報(診断情報)を出力する診断情報出力手
段15を新たに設け、既存のコンパイラの機能追加とし
て、診断用ステートメントの診断情報が出力できるよう
にする。また、デバッガ2には、デバッグ情報管理手段
24に診断用ステートメントの機能をデバッガで代行で
きるように診断用の中断点を設定する診断用中断点設定
手段25を、中断点管理手段22に中断点によるプログ
ラム割り込みが発生した時に、その割り込みが診断用の
中断点によるものかどうかを識別する診断用中断点識別
手段23を、診断用の中断点による割り込みが発生した
時に診断用ステートメントの機能に相当する処理を実行
する診断用中断点処理手段26を新たに設け、前記機能
追加されたコンパイラと連携して課題を解決するもので
ある。
The compiler 1 includes a diagnostic instruction identifying means 12 for identifying a diagnostic statement in the analysis means 11, and a diagnostic information output means 15 for outputting debug information (diagnostic information) for the diagnostic statement in the debug information output means 14. A new function is added so that the diagnostic information of diagnostic statements can be output as an addition to the existing compiler functions. Further, the debugger 2 includes a diagnostic break point setting means 25 for setting a diagnostic break point in the debug information managing means 24 so that the debugger can substitute the function of the diagnostic statement, and a break point managing means 22 for the break point managing means 22. When a program interrupt occurs due to a diagnostic interrupt point, the diagnostic interrupt point identification means 23 for identifying whether the interrupt is due to a diagnostic interrupt point corresponds to the function of a diagnostic statement when an interrupt due to a diagnostic interrupt point occurs. The diagnostic interruption point processing means 26 for executing the processing is newly provided, and the problem is solved in cooperation with the compiler to which the function is added.

【0014】ソースプログラム3は、デバッグ対象のソ
ースプログラムである。本実施例では図2で示すプログ
ラムをデバッグする場合について説明する。オブジェク
トモジュール4は、ソースプログラム3をデバッグ用ス
テートメントを無効とするようにコンパイルオプション
で指定してコンパイラ1に翻訳させた結果である。
The source program 3 is a source program to be debugged. In this embodiment, a case of debugging the program shown in FIG. 2 will be described. The object module 4 is the result of the source program 3 being specified by the compile option so that the debug statement is invalidated and translated by the compiler 1.

【0015】デバッグ情報ファイル5は、ソースプログ
ラム3をデバッグ用ステートメントを無効とするように
コンパイルオプションで指定してコンパイラ1に翻訳さ
せた時に、assertマクロに対する図3で示すデバ
ッグ情報を格納するファイルである。ロードモジュール
6は、オブジェクトモジュール4をリンケージエディタ
を通し、実行形式のプログラムに変換したものである。
The debug information file 5 is a file for storing the debug information shown in FIG. 3 for the assert macro when the source program 3 is specified by a compile option so that the debug statement is invalidated and translated by the compiler 1. is there. The load module 6 is obtained by converting the object module 4 into an executable program through a linkage editor.

【0016】被デバッグプロセス7は、デバッグ対象の
ロードモジュール6に対し中断点を設定しデバッグ可能
な状態としたプロセスである。入出力装置8はデバッガ
に対するコマンドの入力やデバッガからのメッセージな
どを出力するためのものであり、CPUにローカルに接
続されたディスプレイやタイプライタ装置であってもリ
モート接続されたパーソナル・コンピュータや他の計算
機システムであってもよい。
The debugged process 7 is a process in which a break point is set for the load module 6 to be debugged so that the load module 6 can be debugged. The input / output device 8 is for inputting commands to the debugger and outputting messages from the debugger. Even if the display or typewriter device is locally connected to the CPU, it is a personal computer or other device remotely connected. This computer system may be used.

【0017】図2は、実施の形態1で使用するプログラ
ムの例を示したものである。このプログラムはエラー番
号から対応するメッセージを返却するサブルーチンの例
である。20行目、21行目、及び34行目に診断指示
用のステートメントであるassertマクロが挿入さ
れている。この例では、20行目のassertマクロ
は、整数型変数であるErrNoが0でない時(真とな
る関係式)は、プログラムにバグがないとみなし何もせ
ずにプログラムが継続されるが、変数ErrNoが0の
時にはプログラムにバグがあるとみなし、標準エラース
トリームに診断情報が出力されることを示している。2
1行目のassertマクロは、文字型変数pMsgが
空でない時は、プログラムにバグがないとみなし何もせ
ずにプログラムが継続されるが、変数pMsgが空の時
にはプログラムにバグがあるとみなし、標準エラースト
リームに診断情報が出力されることを示している。ま
た、34行目のassertマクロは、(ここに来る場
合にはメッセージが見つからなかった時であるため、)
常にプログラムにバグがある(常に偽である)とみな
し、標準エラーストリームに診断情報が出力されること
を示している。
FIG. 2 shows an example of a program used in the first embodiment. This program is an example of a subroutine that returns the corresponding message from the error number. An assert macro, which is a statement for a diagnostic instruction, is inserted in the 20th, 21st, and 34th lines. In this example, the assert macro in the 20th line assumes that there is no bug in the program and continues the program without doing anything when the integer type variable ErrNo is not 0 (a relational expression that is true). When ErrNo is 0, it is considered that the program has a bug, and the diagnostic information is output to the standard error stream. Two
When the character type variable pMsg is not empty, the assert macro in the first line assumes that the program has no bug and continues the program without doing anything. Indicates that diagnostic information will be output to the standard error stream. Also, the assert macro on the 34th line is (because it was when the message was not found when coming here)
It always indicates that the program is buggy (always false), indicating that diagnostic information will be printed to the standard error stream.

【0018】図3は、デバッグ情報ファイルに出力され
るデバッグ情報の例である診断情報が記述されている。
この例では、図2のプログラム例に対応したもので、図
2で示したソースプログラムの20行目のassert
マクロに対して、行位置が20行、真となる比較条件が
変数ErrNoが0でない時を示している。同様に21
行目のassertマクロに対して、行位置が21行、
真となる比較条件が文字型変数pMsgが空でない時を
示している。また、34行目のassertマクロに対
して、行位置が34行、常に偽であることを示してい
る。
FIG. 3 describes diagnostic information which is an example of the debug information output to the debug information file.
This example corresponds to the program example of FIG. 2, and the assert on the 20th line of the source program shown in FIG.
For the macro, the line position is 20 lines, and the true comparison condition is when the variable ErrNo is not 0. Similarly 21
The line position is 21 lines with respect to the assert macro of the line,
The true comparison condition indicates when the character type variable pMsg is not empty. Further, it is shown that the line position is 34 lines and is always false with respect to the assert macro of the 34th line.

【0019】図4は、中断点管理情報の例を示したもの
である。行位置6、30及び36は利用者がデバッガの
コマンドを使用して図2で示したサブルーチン(プログ
ラム)の入り口と出口にデバッグ用に設定した中断点を
示している。この場合、フラグがBreakとなってい
るが、これは診断用(assertマクロ)に自動設定
される中断点と区別できるようにしてあるためである。
行位置が20、21及び34は、診断用(assert
マクロ)の中断点を表し、フラグとしてAssert
が、中断点における真となる比較条件が設定される。
FIG. 4 shows an example of the breakpoint management information. Line positions 6, 30 and 36 indicate the break points set by the user for debugging at the entrance and exit of the subroutine (program) shown in FIG. 2 using the commands of the debugger. In this case, the flag is Break, because it can be distinguished from the interruption point that is automatically set for diagnosis (assert macro).
Row positions 20, 21 and 34 are for diagnostic (assert)
Macro) represents an interruption point, and as a flag, Assert
However, a true comparison condition at the break point is set.

【0020】図5は、コンパイラの診断指示用ステート
メントの処理動作を示してある。コンパイラ1は、解析
手段を介してソースプログラム3を読み込む(S50
1)と、診断指示識別手段12が読み込んだステートメ
ントがassertマクロであるかどうかを判別する
(S502)。assertマクロでない場合には、各
ステートメントの処理を行なう(S506)が、この処
理はコンパイラの処理本来のであり、本発明の主要な部
分でないので詳細は省略する。
FIG. 5 shows the processing operation of the diagnostic instruction statement of the compiler. The compiler 1 reads the source program 3 via the analysis means (S50
1), it is determined whether the statement read by the diagnostic instruction identification means 12 is an assert macro (S502). If it is not an assert macro, each statement is processed (S506), but since this processing is the original processing of the compiler and is not a main part of the present invention, its details are omitted.

【0021】読み込んだステートメントがassert
マクロであった場合には、翻訳オプションがデバッグ用
のステートメントを無効化するデバッグモードとなって
いるかどうかを判別する(S503)。デバッグモード
の場合は、assertマクロの処理を行なう(S50
4)。assertマクロの処理についても、1ステー
トメントの処理であるため詳細は省略する。デバッグモ
ードで無い場合には、assertマクロをvoid式
に変換するとともにassertマクロの診断情報をデ
バッグ情報ファイル5に出力する(S505)。以上の
処理を読み込んだステートメントすべてに対して行なっ
たかどうかを判別する(S507)。
The read statement is assert
If it is a macro, it is determined whether or not the translation option is in the debug mode for invalidating the debug statement (S503). In the debug mode, the process of the assert macro is performed (S50
4). The processing of the assert macro is also a processing of one statement, and therefore the details are omitted. When not in the debug mode, the assert macro is converted into a void expression and the diagnostic information of the assert macro is output to the debug information file 5 (S505). It is determined whether the above processing has been performed for all the read statements (S507).

【0022】図6は、本発明に関連したデバッガの処理
動作を示してある。デバッガが起動されると、デバッグ
情報管理手段24を介して、被デバッグプログラムのロ
ードモジュール6が読み込まれ(S601)、続いてデ
バッグ情報ファイル5から被デバッグプログラムに対す
るデバッグ情報が読み込まれる(S602)。読み込ま
れたデバッグ情報に診断情報があるかどうか判別し(S
603)、診断情報がある場合にはロードモジュール上
の、assertマクロが記述されているソースプログ
ラム上の行位置に相当するアドレスにassertマク
ロ用の中断点を設定する(S604)。ソースプログラ
ム上の行位置をロードモジュール上のアドレスに対応さ
せることは、コンパイラ・デバッガの従来からの機能で
あるため詳細は省略する。
FIG. 6 shows the processing operation of the debugger related to the present invention. When the debugger is activated, the load module 6 of the program to be debugged is read via the debug information management means 24 (S601), and subsequently the debug information for the program to be debugged is read from the debug information file 5 (S602). It is determined whether the read debug information has diagnostic information (S
603) If there is diagnostic information, an interruption point for the assert macro is set at the address on the load module corresponding to the line position on the source program in which the assert macro is described (S604). Corresponding the line position on the source program to the address on the load module is a conventional function of the compiler / debugger, and thus its details are omitted.

【0023】assertマクロに対する中断点の設定
が完了すると、デバッガ2は利用者からのデバッガに対
するコマンド待ちの状態に入る(S605)。デバッガ
に対するコマンドには、中断点の設定、解除、表示のコ
マンドやデータを表示したり変更するコマンド、及び被
デバッグプロセスを実行させたり、1ステップだけ実行
させたりする実行系のコマンドがある。利用者がコマン
ドを入力すると、実行系のコマンドかどうか判別し(S
507)、実行系のコマンドでない場合には入力された
コマンドの処理を行なう(S606)。この実施例で
は、利用者が図2で示すプログラムの入り口と出口にデ
バッグのために中断点を設定するコマンドを入力したこ
とと仮定し、図4で示す中断点管理情報には、行位置
6、30、36に対してBreakフラグを立てる。
When the setting of the break point for the assert macro is completed, the debugger 2 enters a state of waiting for a command from the user to the debugger (S605). The commands to the debugger include commands for setting and releasing breakpoints, commands for displaying and changing display data, and execution-type commands for executing a debugged process or executing only one step. When the user inputs a command, it is determined whether the command is an execution type command (S
507) If the command is not an execution command, the input command is processed (S606). In this embodiment, it is assumed that the user has input a command for setting a break point for debugging at the entrance and exit of the program shown in FIG. 2, and the break point management information shown in FIG. , 30 and 36, the Break flag is set.

【0024】実行系のコマンドが入力されると、デバッ
ガ2は被デバッグプロセス7を実行させる(S60
8)。被デバッグプロセス7が実行させられ、中断点に
よるプログラム割り込みが発生すると、その割り込みが
図4で示す中断点管理情報に基づきassertマクロ
による中断点かどうか判別し、assertマクロによ
るものでない場合にはステップS605のコマンド待ち
状態に入る(S609)。
When an execution system command is input, the debugger 2 executes the process to be debugged 7 (S60
8). When the debugged process 7 is executed and a program interrupt due to an interrupt point occurs, it is determined whether the interrupt is an interrupt point by the assert macro based on the interrupt point management information shown in FIG. 4, and if it is not by the assert macro, a step is executed. The command waiting state of S605 is entered (S609).

【0025】その割り込みがassertマクロによる
場合には、中断点管理情報からassertマクロの中
断条件を取り出しassertマクロで指定した関係式
が真であるか偽であるか判別し、真である場合にはステ
ップS608のプログラムの実行処理を行なう(S61
1)。偽である場合には、利用者にassertエラー
を通知し、ステップS605のコマンド入力待ちの状態
に入る(S612)ことでソースプログラムに診断指示
用ステートメントが挿入されていると、デバッグ用ステ
ートメントを無効とするようにコンパイルオプションで
指定して作成した製品版プログラムに対しても、リコン
パイルや中断点の設定などの操作をすることなくテスト
版と同等なデバッグが自動的に可能となる。
When the interrupt is caused by the assert macro, the interruption condition of the assert macro is extracted from the interruption point management information, and it is determined whether the relational expression designated by the assert macro is true or false. The program execution process of step S608 is performed (S61).
1). If it is false, the user is notified of the assert error, and if the diagnostic instruction statement is inserted in the source program by entering the command input waiting state in step S605 (S612), the debug statement is invalidated. Even for a product version program created by specifying with the compile option as described above, debugging equivalent to the test version can be automatically performed without performing operations such as recompilation and setting of break points.

【0026】[0026]

【発明の効果】以上説明したように、本発明によれば、
以下の効果がある。製品版のプログラムをリコンパイル
したり、中断点を設定するなどの操作をすることなく、
出荷時のロードモジュールのままで製品開発のテスト時
と同等のデバッグが自動的に可能となり、デバッグ効率
が向上する。
As described above, according to the present invention,
It has the following effects. Without recompiling the product version of the program or setting breakpoints,
Debugging efficiency is improved by automatically enabling the same debugging as during product development testing with the load module as shipped.

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

【図1】本発明の実施の形態1の全体構成図である。FIG. 1 is an overall configuration diagram of a first embodiment of the present invention.

【図2】プログラム例である。FIG. 2 is an example of a program.

【図3】デバッグ情報例である。FIG. 3 is an example of debug information.

【図4】中断点管理情報例である。FIG. 4 is an example of breakpoint management information.

【図5】コンパイラの診断指示用ステートメントの処理
を示すフローチャートである。
FIG. 5 is a flowchart showing processing of a diagnostic instruction statement of the compiler.

【図6】デバッガの処理を示すフローチャートである。FIG. 6 is a flowchart showing processing of a debugger.

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

1 コンパイラ 2 デバッガ 3 ソースプログラム 4 オブジェクトモジュール 5 デバッグ情報ファイル 6 ロードモジュール 7 被デバッグプロセス 8 入出力装置 9 リンケージエディタ 11 解析手段 12 診断指示識別手段 13 オブジェクト出力手段 14 デバッグ情報出力手段 15 診断情報出力手段 21 制御手段 22 中断点管理手段 23 診断用中断点識別手段 24 デバッグ情報管理手段 25 診断用中断点設定手段 26 診断用中断点処理手段 27 変数処理手段 28 プロセス処理手段 1 compiler 2 Debugger 3 Source program 4 Object module 5 Debug information file 6 load module 7 Process to be debugged 8 I / O device 9 Linkage Editor 11 Analytical means 12 Diagnostic instruction identification means 13 Object output means 14 Debug information output means 15 Diagnostic information output means 21 Control means 22 Break point management means 23 Diagnosis Break Point Identification Means 24 Debug information management means 25 Break point setting means for diagnosis 26 Breakpoint Processing Means for Diagnosis 27 variable processing means 28 Process processing means

Claims (4)

【特許請求の範囲】[Claims] 【請求項1】 コンパイラとデバッガを備え、高水準言
語で記述されたソースプログラムをコンパイラで翻訳し
た時に出力されるコンパイラ出力情報に基づき当該プロ
グラムをデバッグするソフトウェア環境プログラムにお
いて、 前記コンパイラは、診断指示用ステートメントを識別す
る診断指示識別手段と、 前記診断指示用ステートメントに対する診断情報をデバ
ッグ情報ファイルに出力する診断情報出力手段として、 前記デバッガは、前記デバッグ情報ファイルから前記診
断情報を検出すると、ロードモジュールに診断用の中断
点を設定する診断用中断点設定手段と、 中断点によりプログラム割り込みが発生すると、前記診
断用の中断点によるものかどうかを識別する診断用中断
点識別手段と、 前記診断用の中断点によるプログラム割り込みが発生す
ると、前記診断情報に基づき診断処理を行なう診断用中
断点処理手段としてコンピュータを機能させるソフトウ
ェア開発環境プログラム。
1. A software environment program comprising a compiler and a debugger, which debugs a source program described in a high-level language based on compiler output information output when the source program written in the high-level language is translated by the compiler. Diagnostic instruction identifying means for identifying a diagnostic statement, and diagnostic information output means for outputting diagnostic information for the diagnostic instruction statement to a debug information file, wherein the debugger detects the diagnostic information from the debug information file and loads the load module. A diagnostic break point setting means for setting a diagnostic break point, and a diagnostic break point identifying means for identifying whether or not the program is caused by the diagnostic break point when a program interrupt occurs due to the break point; Program by interruption point When write occurs, the software development environment program for causing a computer to function as a diagnostic interrupt point processing means for performing a diagnostic process on the basis of the diagnostic information.
【請求項2】 コンパイラとデバッガを備え、高水準言
語で記述されたソースプログラムをコンパイラで翻訳し
た時に出力されるコンパイラ出力情報に基づき当該プロ
グラムをデバッグするプログラムデバッグ装置におい
て、 前記コンパイラは、診断指示用ステートメントを識別す
る診断指示識別手段と、 前記診断指示用ステートメントに対する診断情報をデバ
ッグ情報ファイルに出力する診断情報出力手段として、 前記デバッガは、前記デバッグ情報ファイルから前記診
断情報を検出すると、ロードモジュールに診断用の中断
点を設定する診断用中断点設定手段と、 中断点によりプログラム割り込みが発生すると、前記診
断用の中断点によるものかどうかを識別する診断用中断
点識別手段と、 前記診断用の中断点によるプログラム割り込みが発生す
ると、前記診断情報に基づき診断処理を行なう診断用中
断点処理手段を有することを特徴とするプログラムデバ
ッグ装置。
2. A program debug device comprising a compiler and a debugger, which debugs a source program written in a high-level language based on compiler output information output when the compiler translates the program, wherein the compiler gives a diagnostic instruction. Diagnostic instruction identifying means for identifying a diagnostic statement, and diagnostic information output means for outputting diagnostic information for the diagnostic instruction statement to a debug information file, wherein the debugger detects the diagnostic information from the debug information file and loads the load module. A diagnostic break point setting means for setting a diagnostic break point, and a diagnostic break point identifying means for identifying whether or not the program is caused by the diagnostic break point when a program interrupt occurs due to the break point; Interruption by program interruption point When There occurs, program debugging apparatus characterized by having a diagnostic interrupt point processing means for performing a diagnostic process on the basis of the diagnostic information.
【請求項3】 コンパイラとデバッガを備え、高水準言
語で記述されたソースプログラムをコンパイラで翻訳し
た時に出力されるコンパイラ出力情報に基づき当該プロ
グラムをデバッグするソフトウェア環境プログラムを記
録した記録媒体において、 前記コンパイラは、診断指示用ステートメントを識別す
る診断指示識別手段と、 前記診断指示用ステートメントに対する診断情報をデバ
ッグ情報ファイルに出力する診断情報出力手段として、 前記デバッガは、前記デバッグ情報ファイルから前記診
断情報を検出すると、ロードモジュールに診断用の中断
点を設定する診断用中断点設定手段と、 中断点によりプログラム割り込みが発生すると、前記診
断用の中断点によるものかどうかを識別する診断用中断
点識別手段と、 前記診断用の中断点によるプログラム割り込みが発生す
ると、前記診断情報に基づき診断処理を行なう診断用中
断点処理手段としてコンピュータを機能させるソフトウ
ェア開発環境プログラムを記録した記録媒体。
3. A recording medium comprising a compiler and a debugger, and recording a software environment program for debugging the source program written in a high-level language based on the compiler output information output when the compiler translates the program. The compiler is a diagnostic instruction identifying unit that identifies a diagnostic instruction statement, and a diagnostic information output unit that outputs diagnostic information for the diagnostic instruction statement to a debug information file, and the debugger is configured to output the diagnostic information from the debug information file. When it is detected, a diagnostic breakpoint setting means for setting a diagnostic breakpoint in the load module, and a diagnostic breakpoint identifying means for identifying whether or not the diagnostic breakpoint is caused when a program interrupt occurs due to the breakpoint And the break point for the diagnosis If program interrupt due occurs, a recording medium which records the software development environment program for causing a computer to function as a diagnostic interrupt point processing means for performing a diagnostic process on the basis of the diagnostic information.
【請求項4】 コンパイラとデバッガを備え、高水準言
語で記述されたソースプログラムをコンパイラで翻訳し
た時に出力されるコンパイラ出力情報に基づき当該プロ
グラムをデバッグするデバッグ方法において、 前記コンパイラは、翻訳したオブジェクトモジュール、
及び少なくとも診断指示用ステートメントに対応したソ
ースプログラム上の行位置と真偽判定条件を有するデバ
ッグ情報からなるコンパイラ出力情報を出力し、 前記デバッガは前記デバッグ情報に基づき、前記診断指
示用ステートメンに対応した診断用の中断点を設定し、 前記診断用の中断点によるプログラム割り込みが発生し
たことを識別すると、前記デバッグ情報に基づき診断処
理を行なうプログラムデバッグ方法。
4. A debugging method, comprising a compiler and a debugger, for debugging a source program written in a high-level language based on compiler output information output when the compiler translates the source program, wherein the compiler is a translated object. module,
And at least output compiler output information consisting of debug information having a line position on the source program corresponding to the diagnostic instruction statement and a true / false judgment condition, and the debugger corresponds to the diagnostic instruction state-member based on the debug information. A program debugging method for performing diagnostic processing on the basis of the debug information, by setting an interrupt point for diagnostics described above, and identifying that a program interrupt has occurred due to the interrupt point for diagnostics.
JP2001242037A 2001-08-09 2001-08-09 Software development environment program, its recording medium, program debugging device, and program debugging method Pending JP2003058392A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2001242037A JP2003058392A (en) 2001-08-09 2001-08-09 Software development environment program, its recording medium, program debugging device, and program debugging method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2001242037A JP2003058392A (en) 2001-08-09 2001-08-09 Software development environment program, its recording medium, program debugging device, and program debugging method

Publications (1)

Publication Number Publication Date
JP2003058392A true JP2003058392A (en) 2003-02-28

Family

ID=19072381

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2001242037A Pending JP2003058392A (en) 2001-08-09 2001-08-09 Software development environment program, its recording medium, program debugging device, and program debugging method

Country Status (1)

Country Link
JP (1) JP2003058392A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2009093310A (en) * 2007-10-05 2009-04-30 Hitachi Ltd Execution code generation apparatus, execution code generation method, and source code management method
CN102667730A (en) * 2009-12-23 2012-09-12 微软公司 Design time debugging

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2009093310A (en) * 2007-10-05 2009-04-30 Hitachi Ltd Execution code generation apparatus, execution code generation method, and source code management method
CN102667730A (en) * 2009-12-23 2012-09-12 微软公司 Design time debugging
CN102667730B (en) * 2009-12-23 2015-05-06 微软公司 Design time debugging

Similar Documents

Publication Publication Date Title
KR101004543B1 (en) Debugging methods, debug systems, and computer-readable storage media
EP0785510B1 (en) Program debugging system for debugging a program having a graphical user interface
US9418230B2 (en) Automated tools for building secure software programs
US20060271830A1 (en) Auto-executing tool for developing test harness files
CN101739339A (en) Program dynamic dependency relation-based software fault positioning method
Rajan et al. Aspect language features for concern coverage profiling
US7689973B2 (en) Language for development of test harness files
US8533683B2 (en) Stack walking enhancements using sensorpoints
US11126527B2 (en) Software engineering method including tracing and visualizing
JPH03188535A (en) Program error detection method
US7702958B2 (en) Auto-recording tool for developing test harness files
JP4009517B2 (en) Program development support apparatus and compiling method
Zeller The future of programming environments: Integration, synergy, and assistance
CN112162921B (en) Industrial automation test and control system
JP2003058392A (en) Software development environment program, its recording medium, program debugging device, and program debugging method
JPH11110256A (en) Program debugging apparatus, program debugging method, and computer-readable recording medium recording the method
Hamann et al. Abstract runtime monitoring with USE
JPH10293683A (en) Program comparison / analysis device, program comparison / analysis method, and machine-readable recording medium storing program comparison / analysis program
Freeman Using the go tools
JP2001356928A (en) Test evaluation system
JP5974444B2 (en) Information processing system, information processing method, information processing program, and recording medium
JP4192519B2 (en) Information processing method and apparatus
Ostroff et al. E-tester: a contract-aware and agent-based unit testing framework for eiffel
CN120892315A (en) A program debugging method and system
CN119847903A (en) Static code analysis method suitable for domestic embedded integrated development environment

Legal Events

Date Code Title Description
RD02 Notification of acceptance of power of attorney

Free format text: JAPANESE INTERMEDIATE CODE: A7422

Effective date: 20040610

RD04 Notification of resignation of power of attorney

Free format text: JAPANESE INTERMEDIATE CODE: A7424

Effective date: 20040610

A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20040805

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20070824

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20070918

A02 Decision of refusal

Free format text: JAPANESE INTERMEDIATE CODE: A02

Effective date: 20080205