JPH0239331A - Debug sentence producing device - Google Patents
Debug sentence producing deviceInfo
- Publication number
- JPH0239331A JPH0239331A JP63190012A JP19001288A JPH0239331A JP H0239331 A JPH0239331 A JP H0239331A JP 63190012 A JP63190012 A JP 63190012A JP 19001288 A JP19001288 A JP 19001288A JP H0239331 A JPH0239331 A JP H0239331A
- Authority
- JP
- Japan
- Prior art keywords
- debug
- source program
- source
- statement
- program
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000000034 method Methods 0.000 abstract description 9
- 239000000284 extract Substances 0.000 abstract description 3
- 238000010586 diagram Methods 0.000 description 6
- 238000007796 conventional method Methods 0.000 description 2
- 230000000694 effects Effects 0.000 description 2
- 230000006870 function Effects 0.000 description 1
Landscapes
- Debugging And Monitoring (AREA)
Abstract
Description
【発明の詳細な説明】
〔産業上の利用分野〕
本発明は、プログラム実行時にデバッグ情報を自動的に
出力するデバッグ文自動生成装置に関する。DETAILED DESCRIPTION OF THE INVENTION [Field of Industrial Application] The present invention relates to an automatic debug statement generation device that automatically outputs debug information when a program is executed.
本発明は、プログラムを実行させてデバッグを行うとき
にデバッグ情報を収集する手段において、コンパイル時
にデバッグオプションが指定された範囲内でデバッグ文
を作成することにより、プログラム実行時にデバッグ情
報を自動的に出力することができるようにしたものであ
る。The present invention is a means for collecting debug information when a program is executed and debugged, and the present invention automatically collects debug information during program execution by creating debug statements within a range in which debug options are specified at compile time. This allows it to be output.
プログラムを実行させてデバッグを行うときに、デバッ
グ情報を収集する従来方法としては、(1)ソースプロ
グラム中にデバッグ情報を収集する文を挿入する方法、
(2)デバッガでプログラムを中断させ、そのときにデ
バッグ情報を収集する方法
とがある。Conventional methods for collecting debugging information when debugging a program are: (1) inserting a statement to collect debugging information into the source program; (2) interrupting the program with a debugger and then Sometimes there are ways to collect debug information.
このような従来方法のうち、(1)の方法では、文の挿
入に手間がかかるとともにソースを年修正する際にプロ
グラムのロジックを誤って破壊する欠点がある。また、
(2)の方法では、デバッガがサポートされてないコン
ピュータや、アドレスに基づくデバッグを行うデバッガ
でサポートされるコンピュータでは、高級言語の知識し
かない利用者にとってはデバッグ効率が著しく低下する
欠点がある。Among these conventional methods, method (1) has the disadvantage that it takes time and effort to insert statements, and that the logic of the program may be accidentally destroyed when modifying the source. Also,
Method (2) has the disadvantage that debugging efficiency is significantly reduced for users who only have knowledge of high-level languages on computers that do not support a debugger or on computers that are supported by a debugger that performs address-based debugging.
本発明はこのような欠点を除去するもので、プログラム
実行時にデバッグ情報を自動的に出力することができる
デバッグ文生成装置を提供することを目的とする。The present invention aims to eliminate such drawbacks, and aims to provide a debug statement generation device that can automatically output debug information when a program is executed.
本発明は、デバッグ情報文が含まれるソースプログラム
を格納する格納手段と、与えられたデバッグオプション
を解析し、デバッグ情報文を収集するソースプログラム
の名前およびこのソースプログラム内のデバッグ情報文
を収集する開始位置および終了位置を示す行番号を抽出
するオプション読込手段と、このオプション読込手段で
抽出された名前に一致するソースプログラムを上記格納
手段から抽出するソース読込手段と、このソース読込手
段が抽出したソースプログラムが上記オプション読込手
段で抽出した行番号の間に存在するか否かをfIi認す
る行番号読込手段と、この行番号読込手段で確認された
ソースプログラムが実行文か否かを確認するデバッグ文
生成判定手段と、このデバッグ文生成判定手段で実行文
であることが確認されたソースプログラムに基づきデバ
ッグ情報文を生成するデバッグ情報文生成手段とを備え
たことを特徴とする。The present invention provides a storage means for storing a source program including debug information statements, a storage means that analyzes a given debug option, and collects the name of the source program for which debug information statements are to be collected and the debug information statements within this source program. an option reading means for extracting line numbers indicating a start position and an end position; a source reading means for extracting a source program matching the name extracted by the option reading means from the storage means; A line number reading means that checks whether a source program exists between the line numbers extracted by the option reading means, and whether the source program checked by this line number reading means is an executable statement or not. The present invention is characterized by comprising a debug statement generation determination means and a debug information statement generation means for generating a debug information statement based on a source program that is confirmed to be an executable statement by the debug statement generation determination means.
当該プログラム名、デバッグ開始行番号、デバッグ終了
行番号のデバッグオプションを解析する。Analyzes the debug options for the program name, debug start line number, and debug end line number.
ソースプログラムがこのデバッグオプションと一致する
か否かを確認し、かつソースプログラムの文を読み込む
。デバッグオプションのデバッグ開始行番号とデバッグ
終了行番号に読み込んだソースプログラム文が該当する
か否かを確認する。その読み込んだソースプログラム文
が実行文か否かを判定する。実行文であった場合に、当
該文の変数の型にあったデバッグ情報文を生成する。Check whether the source program matches this debug option and read the source program statements. Check whether the loaded source program statement corresponds to the debugging start line number and debugging end line number in the debug option. It is determined whether the read source program statement is an executable statement. If it is an executable statement, generate a debug information statement that matches the type of the variable in the statement.
以下、本発明の一実施例を図面に基づき説明する。第1
図はこの実施例の構成を示すブロック構成図である。Hereinafter, one embodiment of the present invention will be described based on the drawings. 1st
The figure is a block configuration diagram showing the configuration of this embodiment.
この実施例は、第1図に示すように、プログラム名読込
処理手段1と、ソース読込処理手段2と、行番号読込処
理手段3と、デバッグ文生成判定処理手段4と、デバッ
グ文生成処理手段5と、オブジェクト生成処理手段6と
、ソースプログラム格納手段10とから成る。すなわち
、この実施例は、デバッグ情報文が含まれるソースプロ
グラムを格納する格納手段であるソースプログラム格納
手段10と、与えられたデバッグオプションを解析し、
デバッグ情報文を収集するソースプログラムの名前およ
びこのソースプログラム内のデバッグ情報文を収集する
開始位置および終了位置を示す行番号を抽出するオプシ
ョン読込手段であるプログラム名読込処理手段1と、こ
のオプション読込手段で抽出された名前に一致するソー
スプログラムを上記格納手段から抽出するソース読込手
段であるソース読込処理手段2と、このソース読込手段
が抽出したソースプログラムが上記オプション読込手段
で抽出した行番号の間に存在するか否かを確認する行番
号読込手段である行番号読込処理手段3と、この行番号
読込手段で確認されたソースプログラムが実行文か否か
を確認するデバッグ文生成判定手段であるデバッグ文生
成判定処理手段4と、このデバッグ文生成判定手段で実
行文であることが確認されたソースプログラムに基づき
デバッグ情報文を生成するデバッグ情報文生成手段であ
るデバッグ文生成処理手段5とを備える。As shown in FIG. 1, this embodiment includes a program name reading processing means 1, a source reading processing means 2, a line number reading processing means 3, a debug statement generation determination processing means 4, and a debug statement generation processing means. 5, object generation processing means 6, and source program storage means 10. That is, in this embodiment, the source program storage means 10, which is a storage means for storing a source program including a debug information statement, analyzes a given debug option,
A program name reading processing means 1 which is an option reading means for extracting the name of a source program for which debugging information statements are to be collected and line numbers indicating the start and end positions of collecting debugging information statements in this source program; A source reading processing means 2, which is a source reading means, extracts from the storage means a source program that matches the name extracted by the means, and a source program extracted by this source reading means has a line number corresponding to the line number extracted by the option reading means. a line number reading processing means 3, which is a line number reading means for checking whether or not the line number exists between the lines, and a debug statement generation determination means for checking whether the source program checked by the line number reading means is an executable statement. A certain debug statement generation judgment processing means 4, and a debug statement generation processing means 5 which is a debug information statement generation means that generates a debug information statement based on a source program that is confirmed to be an executable statement by this debug statement generation judgment means. Equipped with
第2図はこの実施例の動作を示すフロー図である。この
実施例の動作を第2図に基づき説明する。FIG. 2 is a flow diagram showing the operation of this embodiment. The operation of this embodiment will be explained based on FIG.
まず、プログラム名読込処理手段1は与えられたデバッ
グオプションを解析し、プログラム名、行番号1および
行番号2を抽出する(ステップS1)。これにつづき、
コンパイル処理が開始される。まず、ソース読込処理手
段2でソースプログラム文を読み込み、プログラム名読
込処理手段1で抽出したプログラム名と一致するか否か
を確認する(ステップS3)。次に、行番号読込処理手
段3で行番号1と行番号2との間に読み込んだソースプ
ログラム文が該当するか否かを確認する(ステップS3
)。この条件が一致した場合にデバッグ文生成判定処理
手段4でその文が実行文か否かの確認を行う(ステップ
S4)。実行文であった場合にデバッグ文生成処理手段
5で当該文の変数の型に適合したデバッグ情報文を自動
的に生成する(ステップS5)。オブジェクト生成処理
手段6で利用者がコーディングした文と同様に翻訳して
機械語を生成する(ステップ36)。人力するソースプ
ログラムがなくなるまでこの一連の処理が繰り返される
。First, the program name reading processing means 1 analyzes the given debug option and extracts the program name, line number 1, and line number 2 (step S1). Following this,
Compilation processing begins. First, the source program statement is read by the source reading processing means 2, and it is checked whether it matches the program name extracted by the program name reading processing means 1 (step S3). Next, the line number reading processing means 3 checks whether or not the read source program statement corresponds between line number 1 and line number 2 (step S3
). If this condition is met, the debug statement generation determination processing means 4 confirms whether the statement is an executable statement or not (step S4). If the statement is an executable statement, the debug statement generation processing means 5 automatically generates a debug information statement that matches the type of the variable of the statement (step S5). The object generation processing means 6 generates machine language by translating the sentence in the same manner as the sentence coded by the user (step 36). This series of processes is repeated until there are no more source programs left to manually perform.
第3図はソースプログラムとデバッグオプションとを指
定しコンパイルした結果のオブジェクトのソースプログ
ラムイメージでデバッグ情報文がうめ込まれた状態を示
す図である。FIG. 3 is a diagram showing a state in which a debug information statement is embedded in a source program image of an object resulting from compilation by specifying a source program and debug options.
たとえば、デバッグオプションの指定は−DB(プログ
ラム名、行番号1、行番号2)である。For example, the debug option specification is -DB (program name, line number 1, line number 2).
ここで、プログラム名は、デバッグ情報を収集したいプ
ログラムの名前(たとえばC言梧では関数名)であり、
行番号1は、プログラム名で指定したプログラム内のデ
バッグ情報を収集する開始位置を指定するものでプログ
ラム内の第1行目からの相対行番号であり、行番号2は
デバッグ情報の収集を終了する行番号であり、前述の行
番号1に対応するものである。これをコンパイル時のオ
プションとして指定する。デバッグ情報収集文はこのデ
バッグオプションを指定しないと生成されない。第3図
では−DB(main 、 6.7)としてデバッグオ
プションが指定されている。これはプログラム名mai
nの6行目から7行目までのデバッグ情報を出力するこ
とを示す。第3図下方がデバッグオプションでコンパイ
ルした後のソースプログラムイメージである。矢印が示
しているところが行番号6および7にそれぞれ対応する
デバッグ情報文であり、
printf(“main:3a CD =%dl二%
dXXn 、a [i] 、i);を実行すると、
main:3 a Ci’) =Oi=0と表示され
、プログラム名mainの3行目のa (i)の値とi
の値が変数の型にあった書式(%dすなわち10進表示
)で表示される。7行目も同様に表示される。Here, the program name is the name of the program for which you want to collect debug information (for example, the function name in C language),
Line number 1 specifies the starting position for collecting debugging information in the program specified by the program name, and is a relative line number from the first line in the program, and line number 2 ends collecting debugging information. This is the line number corresponding to the line number 1 mentioned above. Specify this as a compile-time option. Debug information collection statements will not be generated unless this debug option is specified. In FIG. 3, the debug option is specified as -DB (main, 6.7). This is the program name mai
Indicates that debug information from the 6th line to the 7th line of n is to be output. The lower part of Figure 3 is the source program image after being compiled with the debug option. The arrows indicate the debug information sentences corresponding to line numbers 6 and 7, respectively, and printf(“main:3a CD =%dl2%
When you execute dXXn , a [i] , i);, main: 3 a Ci') = Oi = 0 is displayed, and the value of a (i) in the 3rd line of the program name main and i
The value of is displayed in a format appropriate to the type of the variable (%d, ie, decimal notation). The seventh line is also displayed in the same way.
本発明は、以上説明したように、コンパイル時のデバッ
グオプションを指定することで、デバッグ情報を容易に
収集できる効果が−ある。As explained above, the present invention has the advantage that debug information can be easily collected by specifying debug options at the time of compilation.
第1図は本発明実施例の構成を示すブロック構成図。
第2図は本発明実施例の動作を示すフロー図。
第3図はソースプログラムとコンパイルしたソースプロ
グラムイメージとを示す対比図。
1・・・プログラム名読込処理手段、2・・・ソース読
込処理手段、3・・・行番号読込処理手段、4・・・デ
バッグ文生成判定処理手段、5・・・デバッグ文生成処
理手段、6・・・オブジェクト生成処理手段、10・・
・ソースプログラム格納手段。FIG. 1 is a block configuration diagram showing the configuration of an embodiment of the present invention. FIG. 2 is a flow diagram showing the operation of the embodiment of the present invention. FIG. 3 is a comparison diagram showing a source program and a compiled source program image. 1... Program name reading processing means, 2... Source reading processing means, 3... Line number reading processing means, 4... Debug statement generation determination processing means, 5... Debug statement generation processing means, 6...Object generation processing means, 10...
- Source program storage means.
Claims (1)
する格納手段(10)と、 与えられたデバッグオプションを解析し、デバッグ情報
文を収集するソースプログラムの名前およびこのソース
プログラム内のデバッグ情報文を収集する開始位置およ
び終了位置を示す行番号を抽出するオプション読込手段
(1)と、 このオプション読込手段で抽出された名前に一致するソ
ースプログラムを上記格納手段から抽出するソース読込
手段(2)と、 このソース読込手段が抽出したソースプログラムが上記
オプション読込手段で抽出した行番号の間に存在するか
否かを確認する行番号読込手段(3)と、 この行番号読込手段で確認されたソースプログラムが実
行文か否かを確認するデバッグ文生成判定手段(4)と
、 このデバッグ文生成判定手段で実行文であることが確認
されたソースプログラムに基づきデバッグ情報文を生成
するデバッグ情報文生成手段(5)と を備えたことを特徴とするデバッグ文生成装置。[Scope of Claims] 1. Storage means (10) for storing a source program including debug information statements, and the name of the source program for analyzing given debug options and collecting debug information statements and the information contained in this source program. an option reading means (1) for extracting line numbers indicating the start and end positions for collecting debug information sentences; and a source reading means (1) for extracting from the storage means a source program that matches the name extracted by this option reading means. means (2); line number reading means (3) for checking whether the source program extracted by this source reading means exists between the line numbers extracted by the option reading means; and this line number reading means. a debug statement generation determination means (4) for determining whether the source program confirmed by the above is an executable statement; 1. A debug statement generation device comprising: debug information statement generation means (5).
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP63190012A JPH0239331A (en) | 1988-07-29 | 1988-07-29 | Debug sentence producing device |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP63190012A JPH0239331A (en) | 1988-07-29 | 1988-07-29 | Debug sentence producing device |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| JPH0239331A true JPH0239331A (en) | 1990-02-08 |
Family
ID=16250905
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| JP63190012A Pending JPH0239331A (en) | 1988-07-29 | 1988-07-29 | Debug sentence producing device |
Country Status (1)
| Country | Link |
|---|---|
| JP (1) | JPH0239331A (en) |
-
1988
- 1988-07-29 JP JP63190012A patent/JPH0239331A/en active Pending
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| JP3380390B2 (en) | Debug information display device | |
| JPH0736680A (en) | Parallel program development support device | |
| JPH0239331A (en) | Debug sentence producing device | |
| US20040064301A1 (en) | Software development system, simulator, and recording medium | |
| JP4055197B2 (en) | Device for analyzing procedures included in the program | |
| CN111367937B (en) | Data processing method and device | |
| JP2956591B2 (en) | Method and apparatus for parallelizing a loop having a conditional jump out of the loop | |
| JPS59183441A (en) | Debug processing system of extended language | |
| JP2811804B2 (en) | Variable output range specification method | |
| JPH04540A (en) | Debugging device | |
| JPH02244341A (en) | Execution subroutine debugging information output trace system | |
| JPH01155438A (en) | Compiler test method | |
| JPH0566929A (en) | Reduction system for recompiling time of compiler | |
| JPH0628165A (en) | Automatic code diagnostic device based upon coding rule | |
| JP2786689B2 (en) | Compiler processing method | |
| JP3018783B2 (en) | Compilation method | |
| JPH1139155A (en) | Static analysis method of execution performance via collection of information in compiling mode | |
| JPH0439703B2 (en) | ||
| JPH03268029A (en) | Syntax checker | |
| JPH05341973A (en) | Program analysis device | |
| JPH01291329A (en) | High speed compile processing system | |
| JPH1185533A (en) | Automatic tool generation tool for microcomputer type and product type data used for it | |
| JP2001034482A (en) | Compile device, program optimizing device, compile processing method and recording medium | |
| JPH0231236A (en) | Compiler | |
| JPH0477928A (en) | Language processor |