JP2013080406A - Compilation device, information processing system, compilation method, compilation program, and storage medium - Google Patents

Compilation device, information processing system, compilation method, compilation program, and storage medium Download PDF

Info

Publication number
JP2013080406A
JP2013080406A JP2011220574A JP2011220574A JP2013080406A JP 2013080406 A JP2013080406 A JP 2013080406A JP 2011220574 A JP2011220574 A JP 2011220574A JP 2011220574 A JP2011220574 A JP 2011220574A JP 2013080406 A JP2013080406 A JP 2013080406A
Authority
JP
Japan
Prior art keywords
program
instruction
debug
output
execution
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.)
Granted
Application number
JP2011220574A
Other languages
Japanese (ja)
Other versions
JP5974444B2 (en
Inventor
Takahiro Ishikawa
貴洋 石川
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 JP2011220574A priority Critical patent/JP5974444B2/en
Publication of JP2013080406A publication Critical patent/JP2013080406A/en
Application granted granted Critical
Publication of JP5974444B2 publication Critical patent/JP5974444B2/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

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

Abstract

PROBLEM TO BE SOLVED: To provide a compilation device which collects information about variables and functions and generates output command to be outputted as debug information as one aspect.SOLUTION: A syntax semantic analysis part 32 generates an execution program including a debug information output command 341 which is a command to output debug information generated by analyzing program elements of an output target of an output instruction on the basis of structured data 33 showing a structure of a source program 2, when the source program 2 of a compilation processing target includes an embedded debug instruction row 21 which is the output instruction of the debug information. An optimization part 35, a code generation part 36, and a linker 38 generate an execution program including a debug information output command 41 which is a command to determine execution propriety of the execution program, as a result of compilation processing of the source program 2.

Description

本発明は、コンパイル装置、情報処理システム、コンパイル方法、コンパイルプログラム、記録媒体に関する。   The present invention relates to a compiling device, an information processing system, a compiling method, a compiling program, and a recording medium.

コンパイラによって生成された実行プログラムをデバッグする場合、大別して、3つの方法がある。デバッガによるデバッグ、メモリリークやメモリアクセスエラー検出ツール等によるデバッグ、デバッグ用コードによるデバッグの3つである。   There are roughly three methods for debugging an execution program generated by a compiler. There are three types of debugging: debugging with a debugger, debugging with a memory leak or memory access error detection tool, and debugging with debugging code.

デバッガによるデバッグの場合、実行プログラムのコンパイル時における翻訳オプションにより、デバッグ情報の生成を指示するオプションが指定された実行プログラムが生成される。デバッグ情報は、ユーザが実行プログラムをデバッグするための情報である。生成された実行プログラムは、GDB等のデバッガを用いて、対話型で、換言すれば、ユーザがデバッグ用コマンドを入力して実行プログラムを動作させることにより、デバッグされる。   In the case of debugging with a debugger, an execution program in which an option for instructing generation of debug information is specified by a translation option at the time of compiling the execution program. The debug information is information for the user to debug the execution program. The generated execution program is interactive using a debugger such as GDB. In other words, the execution program is debugged when the user inputs a debug command to operate the execution program.

また、メモリリークやメモリアクセスエラー検出ツール等によるデバッグの場合、実行プログラムの生成時に、検出に必要なツールのライブラリが結合された実行プログラムが生成される。生成された実行プログラムが実行されると、メモリリークやメモリアクセスエラー等があった場合に、メモリリークやメモリアクセスエラー等の検出メッセージが出力される。ユーザは、検出メッセージを利用して、実行プログラムをデバッグする。   In the case of debugging with a memory leak or memory access error detection tool or the like, an execution program in which a library of tools necessary for detection is combined is generated when the execution program is generated. When the generated execution program is executed, when there is a memory leak or a memory access error, a detection message such as a memory leak or a memory access error is output. The user uses the detection message to debug the execution program.

また、デバッグ用コードによるデバッグの場合、ユーザ自身が、ソースプログラムのデバッグしたい箇所に、デバッグ用コードを記述する。例えば、ユーザが、自分で、デバッグ対象のソースプログラムを詳細に検討して、デバッグに必要な変数や通過メッセージ等を抽出し、抽出した変数や通過メッセージ等を出力関数において具体的に記述する。これにより、実行プログラムの実行により、デバッグに必要な変数や通過メッセージ等が出力される。   In the case of debugging with debugging code, the user himself / herself writes the debugging code at a location where the source program is to be debugged. For example, the user himself / herself examines the source program to be debugged in detail, extracts variables and passing messages required for debugging, and specifically describes the extracted variables and passing messages in the output function. As a result, variables necessary for debugging, passing messages, and the like are output by executing the execution program.

なお、コンパイル装置において、機械語命令列の最適化のためのコンパイル装置に対する指示に基づいて、ソースプログラムを最適化された機械語命令列に翻訳するコード最適化部と、前記指示を、ソースプログラム中より検出する最適化ヒント情報記述検出部と、検出された前記指示に基づいて、当該指示が不正か否かを判断可能な前記機械語命令列上の位置を検出するエラーチェックポイント検出部と、前記指示の前記ソースプログラム中での記述位置と、前記位置と、前記指示が不正か否かを判断するために必要な情報とを含む最適化ヒント情報記述デバッグ情報を生成する最適化ヒント記述デバッグ情報生成部とを備えることが提案されている。   In the compiling device, a code optimizing unit that translates a source program into an optimized machine language instruction sequence based on an instruction to the compiling device for optimizing the machine language instruction sequence, and the instruction An optimization hint information description detection unit that detects from within, an error checkpoint detection unit that detects a position on the machine language instruction sequence that can determine whether or not the instruction is illegal based on the detected instruction; Optimization hint description for generating optimization hint information description debug information including a description position of the instruction in the source program, the position, and information necessary for determining whether the instruction is invalid It has been proposed to include a debug information generation unit.

また、デバッグ方法において、コンパイラは、通常の比較命令に検査項目特定用の識別子を付加したかたちの比較割り込み命令を出力し、デバッグ処理のときには、この比較割り込み命令を実行することによって識別子に対応の検査を行ない、例えば、配列の添字アクセス検査の場合、ソースプログラム(中間テキスト)の検査対象部分に、添字と配列宣言の上限値との比較条件からなる比較割り込み命令が埋め込まれ、デバッグ処理でこの比較条件が成立したときは添字のアクセス侵害が存在すると判断してエラー処理用ライブラリへの割り込みを発生し、また、この比較割り込み命令を用いた高速デバッグ方式と、詳細エラー情報を出力する詳細デバッグ方式とを併用することが提案されている。   In the debugging method, the compiler outputs a comparison interrupt instruction in which an identifier for specifying a test item is added to a normal comparison instruction. During debugging processing, the compiler supports the identifier by executing this comparison interrupt instruction. For example, in the case of an array subscript access check, a comparison interrupt instruction consisting of a comparison condition between the subscript and the upper limit value of the array declaration is embedded in the inspection target part of the source program (intermediate text). When the comparison condition is satisfied, it is determined that there is an access violation of the subscript and an interrupt to the error processing library is generated, and a high-speed debugging method using this comparison interrupt instruction and detailed debugging that outputs detailed error information It has been proposed to use the method together.

特開2006−155386号公報JP 2006-155386 A 特開平11−259334号公報JP-A-11-259334

デバッガによるデバッグは、関数での中断、ステップ実行、変数の値の表示や値の変更等を実行する、フルセットのデバッグである。このため、デバッグに不要な箇所のデバッグ情報も含んだ実行プログラムが必要であり、また、GDB等の外部ツールが必要不可欠である。また、デバッグ対象プログラムが大規模プログラム、長時間プログラム又は高並列プログラムである場合、ユーザの負担が大き過ぎて、対話型でのデバッグには限界がある。   Debugging by the debugger is a full set of debugging in which functions are interrupted, stepped, variable values are displayed and values are changed. For this reason, an execution program that includes debugging information that is unnecessary for debugging is required, and an external tool such as GDB is indispensable. Further, when the program to be debugged is a large-scale program, a long-time program, or a highly parallel program, the burden on the user is too great and interactive debugging has a limit.

また、メモリリークやメモリアクセスエラー等の検出ツール等によるデバッグは、メモリに関するエラー検出を主たる目的とする。このため、エラー検出ツールのライブラリを実行プログラムに結合する必要がある。また、実行性能の問題から、デバッグに使用した実行プログラムを、そのまま実行装置であるコンピュータにおいて実際に運用することはできない。このため、デバッグに使用した実行プログラムとは別に、実際に運用する実行プログラムを生成する必要がある。   In addition, debugging using a detection tool or the like such as a memory leak or a memory access error has a main purpose of detecting an error relating to the memory. For this reason, it is necessary to combine the library of the error detection tool with the execution program. In addition, due to the problem of execution performance, the execution program used for debugging cannot be actually used as it is in the computer that is the execution device. For this reason, it is necessary to generate an execution program that is actually operated separately from the execution program used for debugging.

また、デバッグ用コードによるデバッグにおいては、ユーザ自身が、実行プログラムのデバッグしたい箇所にデバッグ用コードを組込む。このため、デバッグ用コードをコーディングするユーザの負担が極めて大きい。例えば、ユーザが出力したい変数の値、ファイル名、関数名、行番号等を、ユーザ自身が、デバッグ対象のソースプログラムを分析して抽出し、変数の値等をコーディングの際に具体的に記述する必要がある。また、デバッグ用コードを含んだ実行プログラムを、そのまま実際に実行装置であるコンピュータにおいて運用することはできない。このため、デバッグに使用した実行プログラムとは別に、実際に運用する実行プログラムを生成する必要がある。又は、デバッグ用コードを含んだ実際に運用する実行プログラムにおいて、ユーザが、実行時オプションや環境変数等により、デバッグ用コードの実行を制御する必要がある。   Further, in debugging with debugging code, the user himself / herself incorporates debugging code into a portion of the execution program to be debugged. For this reason, the burden of the user who codes the code for debugging is very large. For example, the user himself / herself analyzes and extracts the variable value, file name, function name, line number, etc. that the user wants to output and analyzes the source program to be debugged. There is a need to. In addition, an execution program including debugging code cannot be used as it is in a computer that is actually an execution device. For this reason, it is necessary to generate an execution program that is actually operated separately from the execution program used for debugging. Alternatively, in an execution program that is actually operated including debug code, the user needs to control execution of the debug code by a runtime option, an environment variable, or the like.

本発明の一側面として、デバッグ用コードの付加による負荷の増大を抑制することを目的とする。   An object of one aspect of the present invention is to suppress an increase in load due to the addition of debugging code.

開示されるコンパイル装置は、一側面によれば、第1の生成部と、第2の生成部とを含む。第1の生成部は、コンパイル処理対象のソースプログラムにデバッグ情報の出力指示が含まれる場合に、ソースプログラムの構造を表す構造化データに基づいて、出力指示の出力対象であるプログラム要素を解析することにより生成したデバッグ情報を出力させる命令を含む実行プログラムを生成する。第2の生成部は、ソースプログラムのコンパイル処理結果として、実行プログラムの実行可否を判定する命令を含む実行プログラムを生成する。   According to one aspect, the disclosed compiling device includes a first generation unit and a second generation unit. The first generation unit analyzes the program element that is the output target of the output instruction based on the structured data that represents the structure of the source program when the output instruction of the debug information is included in the source program to be compiled. An execution program including an instruction for outputting the generated debug information is generated. The second generation unit generates an execution program including an instruction for determining whether or not the execution program can be executed as a result of compiling the source program.

開示されるコンパイル装置の一側面によれば、デバッグコードの付加による負荷の増大を抑制することができる。   According to one aspect of the disclosed compiling apparatus, an increase in load due to the addition of debug code can be suppressed.

コンパイル装置を含む情報処理システムの一例を示す図である。It is a figure which shows an example of the information processing system containing a compilation apparatus. 組込みデバッグ指示行の一例を示す図である。It is a figure which shows an example of an embedded debugging instruction | indication line. ソースプログラムの一例を示す図である。It is a figure which shows an example of a source program. 構造化データの一例を示す図である。It is a figure which shows an example of structured data. デバッグ情報出力の一例を示す図である。It is a figure which shows an example of debug information output. コンパイル装置のハードウェアの構成の一例を示す図である。It is a figure which shows an example of a hardware structure of a compiling apparatus. コンパイル処理フローである。It is a compilation processing flow.

図1は、コンパイル装置を含む情報処理システムの一例を示す図である。   FIG. 1 is a diagram illustrating an example of an information processing system including a compiling device.

情報処理システムは、生成装置1と、コンパイル装置3と、実行装置5とを含む。生成装置1は、ユーザがコンパイル処理対象のソースプログラム2を生成するコンピュータである。コンパイル装置3は、ソースプログラム2をコンパイル処理することにより、実行プログラム4を生成するコンピュータである。実行プログラム4は、ソースプログラム2の実行形式のプログラムである。実行装置5は、実行プログラム4を実行することにより、プログラム実行結果出力6を得るコンピュータである。プログラム実行結果出力6は、実行プログラム4を実行した結果である。   The information processing system includes a generation device 1, a compilation device 3, and an execution device 5. The generating device 1 is a computer that generates a source program 2 to be compiled by a user. The compiling device 3 is a computer that generates an execution program 4 by compiling the source program 2. The execution program 4 is a program in the execution format of the source program 2. The execution device 5 is a computer that obtains a program execution result output 6 by executing the execution program 4. The program execution result output 6 is a result of executing the execution program 4.

生成装置1は、例えばネットワークを介して、生成したソースプログラム2をコンパイル装置3に送信する。コンパイル装置3は、受信したソースプログラム2を記憶装置に格納し、格納したソースプログラム2を読み出してコンパイル処理して、実行プログラム4を生成する。   The generation apparatus 1 transmits the generated source program 2 to the compilation apparatus 3 via, for example, a network. The compiling device 3 stores the received source program 2 in a storage device, reads the stored source program 2, compiles it, and generates an execution program 4.

コンパイル装置3は、生成した実行プログラム4を記憶装置に格納し、格納した実行プログラム4を読み出して、例えばネットワークを介して、読み出した実行プログラム4を実行装置5に送信する。実行装置5は、受信した実行プログラム4を記憶装置に格納し、格納した実行プログラム4を読み出して実行する。   The compiling device 3 stores the generated execution program 4 in a storage device, reads the stored execution program 4, and transmits the read execution program 4 to the execution device 5 via a network, for example. The execution device 5 stores the received execution program 4 in a storage device, and reads and executes the stored execution program 4.

コンパイル装置3は、コンパイラ31と、リンカ38と、ライブラリ39とを含む。コンパイラ31は、構文意味解析部32と、最適化部35と、コード生成部36とを含む。コンパイラ31は、ソースプログラム2に基づいて、構造化データ33と、中間プログラム34と、オブジェクトプログラム37とを生成する。   The compiling device 3 includes a compiler 31, a linker 38, and a library 39. The compiler 31 includes a syntax and semantic analysis unit 32, an optimization unit 35, and a code generation unit 36. The compiler 31 generates structured data 33, an intermediate program 34, and an object program 37 based on the source program 2.

コンパイル装置3のコンパイラ31において、構文意味解析部32は、ソースプログラム2を記憶装置から読み出し、中間プログラム34の生成に先立って、ソースプログラム2を解析することにより、構造化データ33を生成する。具体的には、構文意味解析部32は、ソースプログラム2についての構文解析処理及び意味解析処理を実行することにより、構造化データ33を生成する。構造化データ33は、コンパイル装置3以外のコンピュータにより生成されて、コンパイル装置3に入力されるようにしても良い。構造化データ33は、記憶装置に格納される。   In the compiler 31 of the compiling device 3, the syntax and semantic analysis unit 32 reads the source program 2 from the storage device and analyzes the source program 2 before generating the intermediate program 34, thereby generating structured data 33. Specifically, the syntax and semantic analysis unit 32 generates structured data 33 by executing syntax analysis processing and semantic analysis processing for the source program 2. The structured data 33 may be generated by a computer other than the compiling device 3 and input to the compiling device 3. The structured data 33 is stored in a storage device.

ユーザにより作成されたソースプログラム2は、例えば、コーディング入力された複数のソースコードと、1又は複数の組込みデバッグ指示行21とを含む。組込みデバッグ指示行21は、デバッグ情報の出力指示である。具体的には、組込みデバッグ指示行21は、ユーザによって記述されることでソースプログラム2に組込まれたコードであって、デバッグ情報の収集及び出力を指示するコードである。組込みデバッグ指示行21は、ソースコードとは異なるコードであり、ソースコードとしては通常用いられないコードであって、予め定められる。デバッグ情報の収集及び出力は、実際には、実行プログラム4を実行する実行装置5に対して指示される。換言すれば、実際のデバッグ情報の収集及び出力は、実行装置5が実行プログラム4を実行することにより実行される。   The source program 2 created by the user includes, for example, a plurality of source codes input by coding and one or a plurality of embedded debug instruction lines 21. The embedded debug instruction line 21 is an instruction to output debug information. Specifically, the embedded debug instruction line 21 is a code that is written in the source program 2 by being described by the user, and is a code that instructs collection and output of debug information. The embedded debug instruction line 21 is a code different from the source code, and is a code that is not normally used as the source code, and is predetermined. The collection and output of debug information is actually instructed to the execution device 5 that executes the execution program 4. In other words, the collection and output of actual debug information is executed by the execution device 5 executing the execution program 4.

構文意味解析部32は、ソースプログラム2を解析することにより、中間プログラム34を生成する第1の生成部である。具体的には、構文意味解析部32は、ソースプログラム2についての構文解析処理及び意味解析処理を実行することにより、中間プログラム34を生成する。中間プログラム34は中間コードで記述される。従って、構文意味解析部32は、中間コードを生成するコード生成処理を実行するコード生成部を含む。中間プログラム34は、記憶装置に格納される。中間プログラム34は、ソースプログラム2から生成されるプログラムであると言う観点からは、実行プログラムの一形態であると考えることもできる。   The syntax and semantic analysis unit 32 is a first generation unit that generates the intermediate program 34 by analyzing the source program 2. Specifically, the syntax and semantic analysis unit 32 generates an intermediate program 34 by executing syntax analysis processing and semantic analysis processing for the source program 2. The intermediate program 34 is described by an intermediate code. Therefore, the syntax and semantic analysis unit 32 includes a code generation unit that executes a code generation process for generating an intermediate code. The intermediate program 34 is stored in a storage device. From the viewpoint that the intermediate program 34 is a program generated from the source program 2, it can also be considered as a form of an execution program.

なお、実際には、1回の構文解析処理及び意味解析処理により、構造化データ33及び中間プログラム34が生成される。換言すれば、構造化データ33が構文解析処理に基づいて生成されるようにしても良い。   In practice, the structured data 33 and the intermediate program 34 are generated by a single syntax analysis process and semantic analysis process. In other words, the structured data 33 may be generated based on the syntax analysis process.

中間プログラム34の生成において、構文意味解析部32は、ソースプログラム2に組込みデバッグ指示行21が含まれる場合に、組込みデバッグ指示行21に対応するデバッグ情報出力命令341を含む中間プログラム34を生成する。デバッグ情報出力命令341は、ソースプログラム2の構造を表す構造化データ33に基づいて、組込みデバッグ指示行21が指示する出力対象であるプログラム要素、換言すれば、組込みデバッグ指示行21が指示するプログラム要素を解析することにより生成される。デバッグ情報出力命令341は、デバッグ情報を出力させる命令であり、中間コードで記述される。プログラム要素は、例えば、後述するように、デバッグ対象である文又は式、デバッグ対象である文又は式において使用されている変数又は関数、デバッグ対象である関数、デバッグ対象である関数における仮引数、デバッグ対象である外部変数又は静的変数等である。   In the generation of the intermediate program 34, when the embedded debug instruction line 21 is included in the source program 2, the syntax and semantic analysis unit 32 generates the intermediate program 34 including the debug information output instruction 341 corresponding to the embedded debug instruction line 21. . The debug information output instruction 341 is based on the structured data 33 representing the structure of the source program 2, and is a program element that is an output target instructed by the embedded debug instruction line 21, in other words, a program instructed by the embedded debug instruction line 21. Generated by parsing elements. The debug information output instruction 341 is an instruction for outputting debug information, and is described in an intermediate code. The program element includes, for example, a statement or expression to be debugged, a variable or function used in the statement or expression to be debugged, a function to be debugged, a dummy argument in the function to be debugged, as described later. External variables or static variables to be debugged.

最適化部35は、中間プログラム34を最適化処理して、最適化処理により得られた最適化された中間プログラム34を、コード生成部36に渡す。中間プログラム34がデバッグ情報出力命令341を含む場合、デバッグ情報出力命令341も最適化される。   The optimization unit 35 optimizes the intermediate program 34 and passes the optimized intermediate program 34 obtained by the optimization process to the code generation unit 36. When the intermediate program 34 includes the debug information output instruction 341, the debug information output instruction 341 is also optimized.

コード生成部36は、最適化された中間プログラム34に基づいてオブジェクトコードを生成することにより、オブジェクトプログラム37を生成する。オブジェクトプログラム37はオブジェクトコードで記述される。中間プログラム34がデバッグ情報出力命令341を含む場合、オブジェクトプログラム37は、デバッグ情報出力命令371を含む。デバッグ情報出力命令371は、デバッグ情報を出力させる命令であり、最適化されたデバッグ情報出力命令341に基づいて生成される。   The code generation unit 36 generates an object program 37 by generating an object code based on the optimized intermediate program 34. The object program 37 is described in object code. When the intermediate program 34 includes the debug information output instruction 341, the object program 37 includes the debug information output instruction 371. The debug information output instruction 371 is an instruction for outputting debug information, and is generated based on the optimized debug information output instruction 341.

リンカ38は、オブジェクトプログラム37と、オブジェクトプログラム37において指定されたライブラリ39とをリンクすることにより、実行プログラム4を生成する。実行プログラム4は、実行可能なコードで記述された実行形式のプログラムである。オブジェクトプログラム37がデバッグ情報出力命令371を含む場合、実行プログラム4は、デバッグ情報出力命令41を含む。デバッグ情報出力命令41は、デバッグ情報出力命令371に基づいて生成される。換言すれば、ソースプログラム2が組込みデバッグ指示行21を含む場合、実行プログラム4は、組込みデバッグ指示行21に基づいて生成されたデバッグ情報出力命令41を含む。   The linker 38 generates the execution program 4 by linking the object program 37 and the library 39 specified in the object program 37. The execution program 4 is an execution format program described in executable code. When the object program 37 includes the debug information output instruction 371, the execution program 4 includes the debug information output instruction 41. The debug information output instruction 41 is generated based on the debug information output instruction 371. In other words, when the source program 2 includes the embedded debug instruction line 21, the execution program 4 includes the debug information output instruction 41 generated based on the embedded debug instruction line 21.

デバッグ情報出力命令41は、デバッグ情報の収集及び出力を指示する命令であるが、デバッガで実行されることはなく、実行装置5において実行される。換言すれば、デバッグ情報出力命令41は、実行装置5に対して、デバッグ情報の収集及び出力、換言すれば、デバッグ及びデバッグ結果の出力を指示する命令である。組込みデバッグ指示行21は、デバッグ情報出力命令41、換言すれば、実行装置5に対するデバッグ情報の収集及び出力を指示する命令を生成する命令である。また、デバッグ情報出力命令41の実行により、デバッグ及びデバッグ結果が出力される。出力されたデバッグ及びデバッグ結果に基づいて、実行プログラムが実際に実行可能なものか否かが判定される。従って、デバッグ情報出力命令41は、実行プログラムの実行可否を判定する命令であると言うことができる。   The debug information output instruction 41 is an instruction for instructing collection and output of debug information, but is not executed by the debugger but executed by the execution device 5. In other words, the debug information output instruction 41 is an instruction for instructing the execution apparatus 5 to collect and output debug information, in other words, debug and output of the debug result. The embedded debug instruction line 21 is an instruction for generating a debug information output instruction 41, in other words, an instruction for instructing collection and output of debug information to the execution device 5. In addition, by executing the debug information output instruction 41, debugging and a debugging result are output. Based on the output debug and the debug result, it is determined whether or not the execution program is actually executable. Therefore, it can be said that the debug information output instruction 41 is an instruction for determining whether or not the execution program can be executed.

以上のように、デバッグ情報出力命令41を含む実行プログラム4が、中間プログラム34から生成される。換言すれば、最適化部35、コード生成部36、リンカ38が、中間プログラム34に基づいて、実行プログラム4を生成する第2の生成部である。   As described above, the execution program 4 including the debug information output instruction 41 is generated from the intermediate program 34. In other words, the optimization unit 35, the code generation unit 36, and the linker 38 are the second generation unit that generates the execution program 4 based on the intermediate program 34.

実行装置5は、実行プログラム4を実行することにより、実行プログラム4のプログラム実行結果出力6を得る。実行装置5は、実行プログラム4の実行において、デバッグ情報出力命令41を、デバッグ情報の収集及び出力であることを意識することなく、他の命令と同様に実行する。   The execution device 5 obtains a program execution result output 6 of the execution program 4 by executing the execution program 4. In executing the execution program 4, the execution device 5 executes the debug information output instruction 41 in the same manner as other instructions without being aware of the collection and output of debug information.

実行プログラム4がデバッグ情報出力命令41を含む場合、プログラム実行結果出力6は、デバッグ情報出力61を含む。デバッグ情報出力61を除くプログラム実行結果出力6は、実行プログラム4のデバッグ情報出力命令41を除く部分を実行した結果である。デバッグ情報出力61は、実行プログラム4における予め定められた1又は複数の部分をデバッグした結果である。   When the execution program 4 includes the debug information output instruction 41, the program execution result output 6 includes the debug information output 61. The program execution result output 6 excluding the debug information output 61 is a result of executing a portion excluding the debug information output instruction 41 of the execution program 4. The debug information output 61 is a result of debugging one or more predetermined portions in the execution program 4.

以上のように、実行装置5は、実行プログラム4を実行することにより、実行プログラム4のプログラム実行結果出力6と、デバッグ情報出力命令41を実行することにより得られる実行プログラム4のデバッグ情報出力61とを生成する。   As described above, the execution device 5 executes the execution program 4, thereby executing the program execution result output 6 of the execution program 4 and the debug information output 61 of the execution program 4 obtained by executing the debug information output instruction 41. And generate

プログラム実行結果出力6は、例えば1個のファイルとして出力される。デバッグ情報出力61を、プログラム実行結果出力6のファイルとは独立の別のファイルに出力するようにしても良い。   The program execution result output 6 is output as one file, for example. The debug information output 61 may be output to a separate file independent of the program execution result output 6 file.

図2は、組込みデバッグ指示行の一例を示す図である。   FIG. 2 is a diagram illustrating an example of an embedded debug instruction line.

組込みデバッグ指示行21としては、図2(A)に示すように、プラグマ指令「#pragma」が用いられる。プラグマ指令は、C++言語の規格及びC言語の規格において、各々、規定されている指令であり、コンパイラに渡される指令である。従って、プラグマ指令を用いることにより、ソースプログラム2に影響を与えることなく、コンパイラ31の動作を制御することができる。   As the embedded debug instruction line 21, a pragma command “#pragma” is used as shown in FIG. The pragma command is a command defined in the C ++ language standard and the C language standard, and is a command passed to the compiler. Therefore, by using the pragma command, the operation of the compiler 31 can be controlled without affecting the source program 2.

組込みデバッグ指示行21には、図2(A)に示すように、「statement」「parameter」「global」の3種類がある。これにより、ソースプログラム2の殆ど全てのプログラム要素についてのデバッグ情報の収集及び出力を指示することができる。   As shown in FIG. 2A, there are three types of embedded debug instruction lines 21: “statement”, “parameter”, and “global”. Thereby, it is possible to instruct collection and output of debug information for almost all program elements of the source program 2.

種類が「statement」である組込みデバッグ指示行21は、ユーザが文や式で使われている変数や関数についてのデバッグ情報を出力したい場合に用いられる。換言すれば、種類が「statement」である組込みデバッグ指示行21は、デバッグしたい、換言すれば、デバッグ対象である文又は式を指定し、指定された文又は式において使用されている変数又は関数についてのデバッグを指示する命令である。   The built-in debug instruction line 21 whose type is “statement” is used when the user wants to output debug information about variables and functions used in statements and expressions. In other words, the embedded debug instruction line 21 of the type “statement” is to be debugged, in other words, a statement or expression to be debugged is specified, and a variable or function used in the specified statement or expression. This is an instruction to instruct debugging.

組込みデバッグ指示行21の種類が「statement」である場合、構文意味解析部32は、組込みデバッグ指示行21に対応するデバッグ情報出力命令341として、指定された文又は式において使用されている変数又は関数をソースプログラム2から抽出し、抽出した変数又は関数についての情報を収集する命令を生成する。   When the type of the embedded debug instruction line 21 is “statement”, the syntax and semantic analysis unit 32 uses the variable or the variable used in the specified sentence or expression as the debug information output instruction 341 corresponding to the embedded debug instruction line 21. A function is extracted from the source program 2 and an instruction for collecting information about the extracted variable or function is generated.

デバッグ情報出力命令341に基づいて生成されるデバッグ情報出力命令371及びデバッグ情報出力命令41も、デバッグ情報出力命令341と同様の命令である。組込みデバッグ指示行21の種類が「parameter」又は「global」である場合も同様である。   The debug information output instruction 371 and the debug information output instruction 41 generated based on the debug information output instruction 341 are the same instructions as the debug information output instruction 341. The same applies when the type of the embedded debug instruction line 21 is “parameter” or “global”.

種類が「statement」である組込みデバッグ指示行21は、図2(A)に示すように、例えば、「#pragma builtin_debug statement [変数並び]」のような形式で記述される。組込みデバッグ指示行「#pragma builtin_debug statement [変数並び]」は、例えば、デバッグ対象である文又は式の直前に組み込まれる。これにより、デバッグ対象である文又は式、更には、デバッグ対象である文又は式に記述されている変数や関数が指定される。組込みデバッグ指示行「#pragma builtin_debug statement [変数並び]」から生成されたデバッグ情報出力命令41により、指定した文又は式に記述されている変数や関数の情報が、ソースプログラム2から収集され、デバッグ情報として出力される。   The built-in debug instruction line 21 whose type is “statement” is described in a format such as “#pragma builtin_debug statement [variable list]” as shown in FIG. The built-in debug instruction line “#pragma builtin_debug statement [variable list]” is incorporated, for example, immediately before the statement or expression to be debugged. As a result, the statement or expression to be debugged, and further the variable or function described in the statement or expression to be debugged are specified. The debug information output instruction 41 generated from the built-in debug instruction line “#pragma builtin_debug statement [variable list]” collects information on variables and functions described in the specified statement or expression from the source program 2 and debugs them. Output as information.

例えば、ソースプログラム2がC++言語で記述されている場合、メンバ関数、コンストラクタ、オペレータ関数、テンプレート関数の情報が、収集されデバッグ情報として出力される。組込みデバッグ指示行「#pragma builtin_debug statement [変数並び]」がブロック文を指定する場合には、指定されたブロック文内に含まれる1又は複数の文又は1又は複数の式で使用されている全ての変数及び関数等のデバッグ情報が出力される。   For example, when the source program 2 is described in the C ++ language, information on member functions, constructors, operator functions, and template functions is collected and output as debug information. When the built-in debug instruction line “#pragma builtin_debug statement [variable list]” specifies a block statement, all of it is used in one or more statements or one or more expressions contained in the specified block statement Debug information such as variables and functions is output.

種類が「parameter」である組込みデバッグ指示行21は、ユーザが関数の仮引数についてのデバッグ情報を出力したい場合に用いられる。換言すれば、種類が「parameter」である組込みデバッグ指示行21は、デバッグ対象である関数を指定し、指定された関数における仮引数についてのデバッグを指示する命令である。   The built-in debug instruction line 21 of the type “parameter” is used when the user wants to output debug information about a function dummy argument. In other words, the built-in debug instruction line 21 of the type “parameter” is an instruction that designates a function to be debugged and instructs debugging of a dummy argument in the designated function.

組込みデバッグ指示行21の種類が「parameter」である場合、構文意味解析部32は、組込みデバッグ指示行21に対応するデバッグ情報出力命令341として、指定された関数における仮引数をソースプログラム2から抽出し、抽出した仮引数についての情報を収集する命令を生成する。   When the type of the embedded debug instruction line 21 is “parameter”, the syntax / semantic analysis unit 32 extracts, from the source program 2, the dummy argument in the specified function as the debug information output instruction 341 corresponding to the embedded debug instruction line 21. Then, an instruction for collecting information on the extracted dummy argument is generated.

種類が「parameter」である組込みデバッグ指示行21は、図2(A)に示すように、例えば、「#pragma builtin_debug parameter [変数並び]」のような形式で記述される。組込みデバッグ指示行「#pragma builtin_debug parameter [変数並び]」は、例えば、デバッグ対象である関数の先頭に組み込まれる。これにより、デバッグ対象である関数、更には、デバッグ対象である関数における仮引数が指定される。組込みデバッグ指示行「#pragma builtin_debug parameter [変数並び]」から生成されたデバッグ情報出力命令41により、仮引数の情報が収集され、デバッグ情報として出力される。   The built-in debug instruction line 21 of the type “parameter” is described in a format such as “#pragma builtin_debug parameter [variable list]” as shown in FIG. The built-in debug instruction line “#pragma builtin_debug parameter [variable list]” is, for example, incorporated at the head of a function to be debugged. As a result, the function to be debugged and further the dummy argument in the function to be debugged are specified. By using the debug information output instruction 41 generated from the built-in debug instruction line “#pragma builtin_debug parameter [variable list]”, information on the dummy argument is collected and output as debug information.

種類が「global」である組込みデバッグ指示行21は、ユーザが外部変数又は静的変数についてのデバッグ情報を出力したい場合に用いられる。換言すれば、種類が「global」である組込みデバッグ指示行21は、デバッグ対象である外部変数又は静的変数を指定し、指定された外部変数又は静的変数についてのデバッグを指示する命令である。   The embedded debug instruction line 21 of the type “global” is used when the user wants to output debug information about an external variable or a static variable. In other words, the built-in debug instruction line 21 of the type “global” is an instruction that designates an external variable or static variable to be debugged and instructs debugging of the designated external variable or static variable. .

組込みデバッグ指示行21の種類が「global」である場合、構文意味解析部32は、組込みデバッグ指示行21に対応するデバッグ情報出力命令341として、指定された外部変数又は静的変数をソースプログラム2から抽出し、抽出した外部変数又は静的変数についての情報を収集する命令を生成する。   When the type of the embedded debug instruction line 21 is “global”, the syntax / semantic analyzer 32 uses the specified external variable or static variable as the source program 2 as the debug information output instruction 341 corresponding to the embedded debug instruction line 21. And an instruction for collecting information about the extracted external variable or static variable.

種類が「global」である組込みデバッグ指示行21は、図2(A)に示すように、例えば、「#pragma builtin_debug global [変数並び]」のような形式で記述される。組込みデバッグ指示行「#pragma builtin_debug global [変数並び]」は、例えば、組み込まれた位置から可視の外部変数又は静的変数を指定する。組込みデバッグ指示行「#pragma builtin_debug global [変数並び]」よりも前の行で宣言されている変数は、コンパイラ31に対して可視になっている。これにより、デバッグ対象である可視の外部変数又は静的変数が指定される。組込みデバッグ指示行「#pragma builtin_debug global [変数並び]」から生成されたデバッグ情報出力命令41により、組み込まれた位置から可視の外部変数又は静的変数が収集され、デバッグ情報として出力される。   The built-in debug instruction line 21 of the type “global” is described in a format such as “#pragma builtin_debug global [variable list]” as shown in FIG. The built-in debug instruction line “#pragma builtin_debug global [variable list]” specifies, for example, an external variable or a static variable that is visible from the built-in position. The variables declared in the line before the built-in debug instruction line “#pragma builtin_debug global [variable list]” are visible to the compiler 31. Thereby, a visible external variable or static variable to be debugged is designated. The debug information output instruction 41 generated from the built-in debug instruction line “#pragma builtin_debug global [variable list]” collects visible external variables or static variables from the built-in position and outputs them as debug information.

組込みデバッグ指示行21においては、図2(B)に示すように、「変数並び」を指定することができる。「変数並び」においては、1個の識別子により、変数が指定される。又は、「変数並び」においては、変数を指定する1個の識別子に続けて、更に、「変数並び」を記述することができる。これにより、複数の変数を指定することができる。   In the embedded debug instruction line 21, “variable list” can be designated as shown in FIG. In “variable list”, a variable is specified by one identifier. Alternatively, in “variable list”, “variable list” can be further described after one identifier for designating a variable. Thereby, a plurality of variables can be specified.

「変数並び」が指定されている場合には、実行装置5による組込みデバッグ指示行21から生成されたデバッグ情報出力命令41の実行により、「変数並び」により指定された変数のデバッグ情報のみが生成される。「変数並び」の指定は、省略することができる。「変数並び」が指定されていない場合には、実行装置5による組込みデバッグ指示行21から生成されたデバッグ情報出力命令41の実行により、組込みデバッグ指示行21の組み込まれた位置により定まる変数や関数等のデバッグ情報が生成される。   When “variable list” is specified, only the debug information of the variable specified by “variable list” is generated by executing the debug information output instruction 41 generated from the embedded debug instruction line 21 by the execution device 5. Is done. The designation of “variable list” can be omitted. When the “variable list” is not designated, the execution of the debug information output instruction 41 generated from the embedded debug instruction line 21 by the execution device 5 causes a variable or function determined by the embedded position of the embedded debug instruction line 21. Debug information is generated.

例えば、種類が「statement」である組込みデバッグ指示行21において「変数並び」が指定されている場合には、「変数並び」において指定された変数又は関数のデバッグ情報のみが出力される。種類が「parameter」である組込みデバッグ指示行21において「変数並び」が指定されている場合には、「変数並び」において指定された仮引数のデバッグ情報のみが出力される。種類が「global」である組込みデバッグ指示行21において「変数並び」が指定されている場合には、「変数並び」において指定された外部変数又は静的変数のデバッグ情報のみが出力される。   For example, when “variable list” is specified in the embedded debug instruction line 21 of the type “statement”, only the debug information of the variable or function specified in the “variable list” is output. When “variable list” is specified in the built-in debug instruction line 21 whose type is “parameter”, only the debug information of the dummy argument specified in “variable list” is output. When “variable list” is specified in the built-in debug instruction line 21 whose type is “global”, only the debug information of the external variable or static variable specified in “variable list” is output.

なお、実際には、いずれの種類の組込みデバッグ指示行21においても、以上に述べたデバッグ情報に加えて、ファイル名、カレントの関数名、行番号が、共に出力される。ファイル名、カレントの関数名、行番号は、出力しないようにしても良い。   Actually, in any type of embedded debug instruction line 21, in addition to the debug information described above, the file name, the current function name, and the line number are output together. The file name, current function name, and line number may not be output.

図3は、ソースプログラムの一例を示す図である。   FIG. 3 is a diagram illustrating an example of a source program.

例えば、ソースプログラム2は、高級プログラム言語、例えばオブジェクト指向言語であるC++言語又はC言語により記述される。また、例えば、ソースプログラム2は、3種類の組込みデバッグ指示行21を含む。具体的には、19行目、24行目、27行目に、各々、組込みデバッグ指示行21を含む。このように、組込みデバッグ指示行21をソースプログラム2に埋め込むことができるので、ソースプログラム2を把握している開発者が容易に使用することができ、また、組込みデバッグ指示行21をルートテスト用としても使用することができる。   For example, the source program 2 is described in a high-level program language such as C ++ language or C language which is an object-oriented language. For example, the source program 2 includes three types of built-in debug instruction lines 21. Specifically, the 19th, 24th, and 27th lines each include an embedded debug instruction line 21. Since the embedded debug instruction line 21 can be embedded in the source program 2 in this way, the developer who knows the source program 2 can easily use it, and the embedded debug instruction line 21 is used for route testing. Can also be used.

図3に示すように、1個のソースプログラム2に含まれる組込みデバッグ指示行21の数は、1個であっても良く、複数個であっても良い。組込みデバッグ指示行21の数は、デバッグ対象の数に応じて定まる。   As shown in FIG. 3, the number of embedded debug instruction lines 21 included in one source program 2 may be one or plural. The number of embedded debug instruction lines 21 is determined according to the number of debug targets.

なお、図3のソースプログラム2において、左端の数字は、ソースプログラム2における行数を表す。また、ソースプログラム2の名前は、例えば「sample.cc」である。   In the source program 2 in FIG. 3, the leftmost number represents the number of lines in the source program 2. The name of the source program 2 is “sample.cc”, for example.

組込みデバッグ指示行21は、予め定められたコンパイル装置3において実行される命令であって、予め定められたコンパイル装置3以外のコンパイル装置においてはエラーを発生せずかつ実行されない命令である。具体的には、組込みデバッグ指示行21としてプラグマ指令「#pragma」を使用することにより、ソースプログラム2の可搬性を保障することができる。換言すれば、ソースプログラム2は、コンパイラ31以外のコンパイラでコンパイルされても、エラーを発生しない。   The embedded debug instruction line 21 is an instruction that is executed in a predetermined compiling device 3 and that does not generate an error and is not executed in a compiling device other than the predetermined compiling device 3. Specifically, the portability of the source program 2 can be ensured by using the pragma command “#pragma” as the embedded debug instruction line 21. In other words, even if the source program 2 is compiled by a compiler other than the compiler 31, no error occurs.

組込みデバッグ指示行21は、ソースプログラム2において、デバッグ対象である文又は式を指定する位置であって文又は式に対して予め定められた関係にある位置、デバッグ対象である関数を指定する位置であって関数に対して予め定められた関係にある位置、又は、デバッグ対象である外部変数又は静的変数を指定する位置であって外部変数又は静的変数に対して予め定められた関係にある位置に含まれる。組込みデバッグ指示行21の位置については後述する。   The embedded debug instruction line 21 is a position in the source program 2 that specifies a statement or expression to be debugged, a position that has a predetermined relationship with the sentence or expression, and a position that specifies a function to be debugged. A position that is in a predetermined relationship with the function, or a position that specifies an external variable or static variable to be debugged, and has a predetermined relationship with the external variable or static variable. It is included in a certain position. The position of the embedded debug instruction line 21 will be described later.

従って、ソースプログラム2において、組込みデバッグ指示行21の記述される位置、換言すれば、組込みデバッグ指示行21が組込まれる位置は、ソースプログラム2のコーディングの際に、ユーザにより定められる。換言すれば、組込みデバッグ指示行21が組込まれる位置は、ユーザによりデバッグ対象の部分の位置に応じて定められる。これにより、ユーザは、ソースプログラム2において、自分がデバッグ対象とした箇所のみを、デバッグすることができる。   Therefore, in the source program 2, the position where the embedded debug instruction line 21 is described, in other words, the position where the embedded debug instruction line 21 is embedded is determined by the user when the source program 2 is coded. In other words, the position where the embedded debug instruction line 21 is incorporated is determined by the user according to the position of the debug target portion. As a result, the user can debug only the portion of the source program 2 that is the debug target.

19行目の組込みデバッグ指示行「#pragma builtin_debug parameter」は、種類が「parameter」の組込みデバッグ指示行21である。種類が「parameter」の組込みデバッグ指示行21は、前述したように、デバッグ対象である関数を指定し、指定された関数における仮引数についてのデバッグを指示する。一方、19行目の組込みデバッグ指示行「#pragma builtin_debug parameter」は、17行目から始まる関数funcにおいて、先頭の位置に指定されている。従って、19行目の組込みデバッグ指示行「#pragma builtin_debug parameter」は、17行目の関数funcを指定し、関数funcの仮引数paramのデバッグを指示するデバッグ情報出力命令であると言うことができる。   The embedded debug instruction line “#pragma builtin_debug parameter” on line 19 is the embedded debug instruction line 21 of the type “parameter”. As described above, the built-in debug instruction line 21 of the type “parameter” designates a function to be debugged and instructs to debug a dummy argument in the designated function. On the other hand, the built-in debug instruction line “#pragma builtin_debug parameter” on the 19th line is specified at the top position in the function func starting on the 17th line. Accordingly, it can be said that the built-in debug instruction line “#pragma builtin_debug parameter” on the 19th line is a debug information output instruction that specifies the function func on the 17th line and instructs the debugging of the formal parameter param of the function func. .

24行目の組込みデバッグ指示行「#pragma builtin_debug global」は、種類が「global」の組込みデバッグ指示行21である。種類が「global」の組込みデバッグ指示行21は、前述したように、デバッグ対象である外部変数又は静的変数を指定し、指定された外部変数又は静的変数についてのデバッグを指示する。一方、24行目の組込みデバッグ指示行「#pragma builtin_debug global」からは、2行目の「int data=10」及び5行目の「int data=20」が可視である。従って、24行目の組込みデバッグ指示行「#pragma builtin_debug global」は、ソースプログラム2に含まれる可視の外部変数又は静的変数である2行目の「data=10」及び5行目の「data=20」のデバッグを指示するデバッグ情報出力命令であると言うことができる。   The embedded debug instruction line “#pragma builtin_debug global” on line 24 is the embedded debug instruction line 21 of the type “global”. As described above, the built-in debug instruction line 21 of the type “global” designates an external variable or static variable to be debugged, and instructs to debug the designated external variable or static variable. On the other hand, from the built-in debug instruction line “#pragma builtin_debug global” on the 24th line, “int data = 10” on the second line and “int data = 20” on the fifth line are visible. Therefore, the embedded debug instruction line “#pragma builtin_debug global” on the 24th line is “data = 10” on the 2nd line which is a visible external variable or static variable included in the source program 2 and “data” on the 5th line. It can be said that this is a debug information output instruction instructing debugging of “= 20”.

27行目の組込みデバッグ指示行「#pragma builtin_debug statement」は、種類が「statement」の組込みデバッグ指示行21である。種類が「statement」の組込みデバッグ指示行21は、前述したように、デバッグ対象である文又は式を指定し、指定された文又は式において使用されている変数又は関数についてのデバッグを指示する。一方、27行目の組込みデバッグ指示行「#pragma builtin_debug statement」は、28行目の「ret = clsobj+data;」の直前に組み込まれている。従って、27行目の組込みデバッグ指示行「#pragma builtin_debug statement」は、28行目の「ret = clsobj+data;」のデバッグを指示するデバッグ情報出力命令であると言うことができる。   The embedded debug instruction line “#pragma builtin_debug statement” on line 27 is the embedded debug instruction line 21 of the type “statement”. As described above, the built-in debug instruction line 21 of the type “statement” designates a statement or expression to be debugged, and instructs to debug a variable or function used in the designated sentence or expression. On the other hand, the built-in debug instruction line “#pragma builtin_debug statement” on the 27th line is incorporated immediately before “ret = clsobj + data;” on the 28th line. Therefore, it can be said that the built-in debug instruction line “#pragma builtin_debug statement” on the 27th line is a debug information output instruction that instructs debugging of “ret = clsobj + data;” on the 28th line.

以上のように、コンパイラ31の構文意味解析部32がデバッグ情報を出力するためのコードを生成するため、ユーザは、デバッグ用のソースプログラム2をコーディングしたりコンパイルする必要がない。また、ソースプログラム2が変更された結果、デバッグ対象の変数等が増加した場合に、ユーザは、ソースプログラム2を再度コーディングする必要がなく、ソースプログラム2をリコンパイルするだけで、デバッグ対象の増加に対応したデバッグ情報を出力することができる。更に、コンパイル可能なソースプログラム2であれば、どのようなソースプログラム2でも、どのような文又は式でも、デバッグ情報を出力することができる。   As described above, since the syntax and semantic analysis unit 32 of the compiler 31 generates code for outputting debug information, the user does not need to code or compile the debug source program 2. In addition, when the variables to be debugged increase as a result of the change in the source program 2, the user does not need to recode the source program 2 and only increases the number of debug targets by recompiling the source program 2. Debug information corresponding to can be output. Furthermore, any source program 2 that can be compiled and any statement or expression can output debug information.

図4は、構造化データの一例を示す図である。   FIG. 4 is a diagram illustrating an example of structured data.

コンパイラ31の構文意味解析部32は、構文解析処理に基づいて、図3に示すソースプログラム2から、図4に示す構造化データ33を生成する。   The syntactic and semantic analysis unit 32 of the compiler 31 generates structured data 33 shown in FIG. 4 from the source program 2 shown in FIG. 3 based on the syntax analysis processing.

具体的には、構文意味解析部32は、ソースプログラム2の名前「sample.cc」に基づいて、「sample.cc」というコンパイルの単位「CompileUnit」を抽出する。「CompileUnit」は、ソースプログラム2のデータ構造における最上位の階層である。   Specifically, the syntax and semantic analysis unit 32 extracts a compile unit “CompileUnit” “sample.cc” based on the name “sample.cc” of the source program 2. “CompileUnit” is the highest hierarchy in the data structure of the source program 2.

更に、構文意味解析部32は、「CompileUnit」の1つ下位の階層として、名前空間、クラス等のタイプ、using文、関数等を抽出する。   Further, the syntax and semantic analysis unit 32 extracts a name space, a class type, a using statement, a function, and the like as a hierarchy one level lower than “CompileUnit”.

具体的には、「CompileUnit」の1つ下位の階層として、最初に、1行目の「namespace NS1 {」と3行目の「};」とに基づいて、「NS1」という「Namespace」が抽出される。   Specifically, as a hierarchy one level below “CompileUnit”, first, “Namespace” named “NS1” is based on “namespace NS1 {” on the first line and “};” on the third line. Extracted.

更に、構文意味解析部32は、「Namespace」の1つ下位の階層として、変数等を抽出する。具体的には、2行目の「int data=10;」は、「NS1」という「Namespace」内に「{}」で囲まれている。従って、「int data=10;」に基づいて、「NS1」という「Namespace」の1つ下位の階層として、「data=10」という「Variable」が抽出される。   Further, the syntax and semantic analysis unit 32 extracts variables and the like as a hierarchy one level lower than “Namespace”. Specifically, “int data = 10;” on the second line is surrounded by “{}” in “Namespace” “NS1”. Therefore, based on “int data = 10;”, “Variable” “data = 10” is extracted as a hierarchy one level lower than “Namespace” “NS1”.

同様に、「CompileUnit」の1つ下位の階層として、4行目の「namespace NS2 {」と6行目の「};」とに基づいて、「NS2」という「Namespace」が抽出される。また、5行目の「int data=20;」に基づいて、「NS2」という「Namespace」の1つ下位の階層として、「data=20」という「Variable」が抽出される。   Similarly, “Namespace” of “NS2” is extracted based on “namespace NS2 {” on the fourth line and “};” on the sixth line as a hierarchy one level lower than “CompileUnit”. Also, based on “int data = 20;” on the fifth line, “Variable” of “data = 20” is extracted as a hierarchy one level lower than “Namespace” of “NS2”.

次に、「CompileUnit」の1つ下位の階層として、8行目の「class CLS {」と13行目の「};」とに基づいて、「CLS」という「Type」が抽出される。   Next, “Type” “CLS” is extracted based on “class CLS {” on the eighth line and “};” on the thirteenth line as a hierarchy one level lower than “CompileUnit”.

更に、構文意味解析部32は、クラス等の「Type」の1つ下位の階層として、変数等を抽出する。具体的には、10行目の「int mem;」、及び、11行目の「int operator + (int i) ....;」は、「CLS」という「Type」内に「{}」で囲まれている。従って、10行目の「int mem;」に基づいて、「CLS」という「Type」の1つ下位の階層として、「mem」という「Member」が抽出される。また、11行目の「int operator + (int i) ....;」に基づいて、「CLS」という「Type」の1つ下位の階層として、「operator + (int)」という「Member」が抽出される。なお、10行目と11行目は、クラスにおけるデータメンバ又はメンバ関数であり、階層構造として抽出される。また、9行目と12行目は、クラスにおけるキーワード等であり、階層構造として抽出されず、無視される。   Further, the syntax and semantic analysis unit 32 extracts a variable or the like as a hierarchy one level lower than “Type” such as a class. Specifically, “int mem;” on line 10 and “int operator + (int i) ....;” on line 11 are “{}” in “Type” of “CLS”. Surrounded by Therefore, based on “int mem;” on the 10th line, “Member” “mem” is extracted as a layer one level lower than “Type” “CLS”. Also, based on “int operator + (int i) ....;” on the 11th line, “Member” “operator + (int)” is one level lower than “Type” “CLS”. Is extracted. The 10th and 11th lines are data members or member functions in the class, and are extracted as a hierarchical structure. The 9th and 12th lines are keywords in the class and are not extracted as a hierarchical structure but ignored.

次に、「CompileUnit」の1つ下位の階層として、15行目の「using namespace NS1;」に基づいて、「NS1」という「using namespace」が抽出される。   Next, “using namespace” “NS1” is extracted based on “using namespace NS1;” on the 15th line as a hierarchy one level lower than “CompileUnit”.

次に、「CompileUnit」の1つ下位の階層として、17行目の「int func(int param)」、18行目の「{」及び31行目の「}」に基づいて、「func(int)」という「Function」が抽出される。19行目〜31行目は、「func(int)」という「Function」内に「{}」で囲まれている。従って、19行目〜31行目は、「func(int)」という「Function」の下位の階層として抽出される。   Next, based on “int func (int param)” on the 17th line, “{” on the 18th line, and “}” on the 31st line, “func (int "Function") is extracted. The 19th to 31st lines are surrounded by “{}” in “Function” called “func (int)”. Accordingly, the 19th to 31st lines are extracted as a lower hierarchy of “Function” called “func (int)”.

更に、構文意味解析部32は、関数の1つ下位の階層として、パラメータ、プラグマ指令、変数、文又は式等を抽出する。   Further, the syntax and semantic analysis unit 32 extracts a parameter, a pragma command, a variable, a sentence, an expression, or the like as a lower hierarchy of the function.

具体的には、「func(int)」という「Function」内において、17行目の「int func(int param)」に基づいて、「func(int)」という「Function」の1つ下位の階層として、「param」という「Parameter」が抽出される。また、19行目の「#pragma builtin_debug parameter」に基づいて、「func(int)」という「Function」の1つ下位の階層として、「builtin_debug parameter」という「Pragma」が抽出される。従って、プラグマ指令は、関数Function内において、データ構造という観点からはパラメータや変数と同列である。   Specifically, in the “Function” “func (int)”, based on the “int func (int param)” on the 17th line, the hierarchy one level lower than the “Function” “func (int)” As a result, “Parameter” “param” is extracted. Also, based on “#pragma builtin_debug parameter” on the 19th line, “Pragma” “builtin_debug parameter” is extracted as a layer one level lower than “Function” “func (int)”. Therefore, the pragma command is the same as the parameter or variable in the function Function from the viewpoint of the data structure.

また、21行目の「CLS clsobj;」に基づいて、「func(int)」という「Function」の1つ下位の階層として、「clsobj」という「Variable」が抽出される。また、22行目の「int ret=0;」に基づいて、「func(int)」という「Function」の1つ下位の階層として、「ret」という「Variable」が抽出される。また、24行目の「#pragma builtin_debug global」に基づいて、「func(int)」という「Function」の1つ下位の階層として、「builtin_debug global」という「Pragma」が抽出される。   Also, based on “CLS clsobj;” on the 21st line, “Variable” “clsobj” is extracted as a hierarchy one level lower than “Function” “func (int)”. In addition, based on “int ret = 0;” on the 22nd line, “Variable” “ret” is extracted as a layer one level lower than “Function” “func (int)”. Also, based on “#pragma builtin_debug global” on the 24th line, “Pragma” “builtin_debug global” is extracted as a layer one level lower than “Function” “func (int)”.

また、26行目の「if (param && data) {」と29行目の「}」とに基づいて、「func(int)」という「Function」の1つ下位の階層として、「if (param && data)」という「Statement」が抽出される。27行目〜28行目は、「if (param && data)」という「Statement」内に「{}」で囲まれている。従って、27行目〜28行目は、「if (param && data)」という「Statement」の下位の階層として抽出される。   Also, based on “if (param && data) {” on the 26th line and “}” on the 29th line, “if (param && data) "is extracted. The 27th to 28th lines are surrounded by “{}” in “Statement” “if (param && data)”. Accordingly, the 27th to 28th lines are extracted as a lower hierarchy of “Statement” of “if (param && data)”.

更に、「if (param && data)」という「Statement」内において、28行目の「ret=clsobj+data;」に基づいて、「if (param && data)」という「Statement」の1つ下位の階層として、「ret=clsobj+data」という「Statement」が抽出される。   Furthermore, in the “Statement” “if (param && data)”, based on “ret = clsobj + data;” on the 28th line, it is one level lower than the “Statement” “if (param && data)”. As a hierarchy, “Statement” “ret = clsobj + data” is extracted.

また、27行目の「#pragma builtin_debug statement」に基づいて、「builtin_debug statement」という「Pragma」が抽出される。27行目の「#pragma builtin_debug statement」は、28行目の「ret=clsobj+data;」についてのデバッグ指示行であるので、28行目の1つ下位の階層とされる。従って、27行目と28行目とでは、行の位置の上下と階層の上下とが逆転している。   Also, “Pragma” “builtin_debug statement” is extracted based on “#pragma builtin_debug statement” on the 27th line. The “#pragma builtin_debug statement” on the 27th line is a debug instruction line for “ret = clsobj + data;” on the 28th line, and is therefore one level below the 28th line. Therefore, in the 27th and 28th lines, the upper and lower positions of the lines are reversed from the upper and lower positions of the hierarchy.

更に、構文意味解析部32は、ソースプログラム2がオブジェクト指向言語であるので、各階層の間における関連を抽出し、抽出した階層の間を関連付ける。   Furthermore, since the source program 2 is an object-oriented language, the syntax and semantic analysis unit 32 extracts a relationship between the layers and associates the extracted layers.

具体的には、28行目から生成された階層「ret=clsobj+data;」に含まれる「ret」は、同一の名前を持つので、22行目から生成された「ret」である。そこで、28行目から生成された階層に含まれる「ret」が22行目から生成された「ret」であることを構造的に表現するために、図4に点線で示すように、28行目から生成された階層に含まれる「ret」と22行目から生成された「ret」とが関連付けられる。同様に、28行目から生成された階層に含まれる「clsobj」と21行目から生成された「clsobj」とが、図4に点線で示すように、関連付けられる。   Specifically, since “ret” included in the hierarchy “ret = clsobj + data;” generated from the 28th line has the same name, it is “ret” generated from the 22nd line. Therefore, in order to structurally express that “ret” included in the hierarchy generated from the 28th line is “ret” generated from the 22nd line, as shown by a dotted line in FIG. “Ret” included in the hierarchy generated from the eyes is associated with “ret” generated from the 22nd line. Similarly, “clsobj” included in the hierarchy generated from the 28th line and “clsobj” generated from the 21st line are associated with each other as shown by a dotted line in FIG.

また、28行目から生成された階層に含まれる「+」は、加算を定義する演算子である。クラスにおいて加算に関連するデータメンバ又はメンバ関数は、11行目から生成された「operator + (int)」である。そこで、28行目から生成された階層に含まれる「+」と11行目から生成された「operator + (int)」とが、図4に点線で示すように、関連付けられる。   Further, “+” included in the hierarchy generated from the 28th line is an operator that defines addition. The data member or member function related to addition in the class is “operator + (int)” generated from the 11th line. Therefore, “+” included in the hierarchy generated from the 28th line and “operator + (int)” generated from the 11th line are associated with each other as shown by a dotted line in FIG.

また、15行目のusing文において「NS1」という「Namespace」を使用することを宣言しているので、28行目から生成された階層に含まれる「data」は、「NS1」という「Namespace」における「data=10」という「Variable」、換言すれば、2行目から生成された「data=10」である。そこで、28行目から生成された階層に含まれる「data」と2行目から生成された「data=10」とが、図4に点線で示すように、関連付けられる。   Also, because the “namespace” named “NS1” is declared to be used in the using statement on the 15th line, “data” included in the hierarchy generated from the 28th line is “Namespace” named “NS1”. “Data = 10” in “Variable”, in other words, “data = 10” generated from the second line. Therefore, “data” included in the hierarchy generated from the 28th line and “data = 10” generated from the 2nd line are associated with each other as shown by a dotted line in FIG.

以上のような構文意味解析部32による構文解析処理により、図3に示すソースプログラム2から、図4に示す構造化データ33が得られる。   The structured data 33 shown in FIG. 4 is obtained from the source program 2 shown in FIG. 3 by the syntax analysis processing by the syntax semantic analysis unit 32 as described above.

図5は、デバッグ情報出力の一例を示す図である。   FIG. 5 is a diagram illustrating an example of debug information output.

実行装置5は、図3に示すソースプログラム2から生成された実行プログラム4を実行して、図5に示すプログラム実行結果出力6を得る。プログラム実行結果出力6は、デバッグ情報出力61を含む。   The execution device 5 executes the execution program 4 generated from the source program 2 shown in FIG. 3, and obtains a program execution result output 6 shown in FIG. The program execution result output 6 includes a debug information output 61.

プログラム実行結果出力6において、1行目〜2行目は、実行プログラム4のデバッグ情報出力命令41を除く部分を実行した結果である。3行目〜12行目は、デバッグ情報出力61であり、デバッグ情報出力命令41を実行した結果である。   In the program execution result output 6, the first and second lines are the results of executing the portion of the execution program 4 excluding the debug information output instruction 41. The third to twelfth lines are the debug information output 61 and are the results of executing the debug information output instruction 41.

プログラム実行結果出力6において、実行プログラム4の実行時におけるデバッグ情報出力61の出力の有無は、環境変数、換言すれば、フラグにより制御される。フラグの値は、例えば、ソースプログラム2の生成時に、ユーザにより例えばソースプログラム2において指定される。なお、ソースプログラム2のコンパイル処理に先立って、フラグの値を指定するようにしても良い。   In the program execution result output 6, whether or not the debug information output 61 is output when the execution program 4 is executed is controlled by an environment variable, in other words, a flag. The value of the flag is specified by the user, for example, in the source program 2 when the source program 2 is generated. Prior to the compilation process of the source program 2, a flag value may be designated.

構文意味解析部32は、フラグの値が「0」である場合には、ソースプログラム2に含まれた組込みデバッグ指示行21をコンパイルしない。従って、中間プログラム34にはデバッグ情報出力命令341が含まれず、実行プログラム4にはデバッグ情報出力命令41が含まれず、実行装置5によりデバッグ情報出力61が出力されない。構文意味解析部32は、フラグの値が「1」である場合には、ソースプログラム2に含まれた組込みデバッグ指示行21をコンパイルする。従って、中間プログラム34にはデバッグ情報出力命令341が含まれ、実行プログラム4にはデバッグ情報出力命令41が含まれ、実行装置5によりデバッグ情報出力61が出力される。   When the flag value is “0”, the syntax / semantic analysis unit 32 does not compile the embedded debug instruction line 21 included in the source program 2. Accordingly, the intermediate program 34 does not include the debug information output instruction 341, the execution program 4 does not include the debug information output instruction 41, and the execution apparatus 5 does not output the debug information output 61. The syntax and semantic analysis unit 32 compiles the embedded debug instruction line 21 included in the source program 2 when the value of the flag is “1”. Therefore, the intermediate program 34 includes the debug information output instruction 341, the execution program 4 includes the debug information output instruction 41, and the execution apparatus 5 outputs the debug information output 61.

これにより、実行プログラム4の実行時に、デバッグ情報の出力の有無を制御することができる。従って、デバッグ用のコードである組込みデバッグ指示行21を含んだままのソースプログラム2を、フラグの値を「1」から「0」に変更するのみで実際の運用において使用することができ、また、運用時における実行速度への影響も少なくすることができる。   Thus, whether or not debug information is output can be controlled when the execution program 4 is executed. Therefore, the source program 2 including the embedded debug instruction line 21 that is a code for debugging can be used in actual operation only by changing the flag value from “1” to “0”. The influence on the execution speed during operation can be reduced.

フラグの値は、例えば、プログラム実行結果出力6において、1行目の最後尾に出力される。図5においては、フラグの値が「1」であるので、プログラム実行結果出力6がデバッグ情報出力61を含む状態で出力される。これにより、ユーザは、プログラム実行結果出力6に含まれるプログラム実行結果出力6以外の部分がデバッグ情報出力61であるか否かを知り、また、デバッグの結果を知ることができる。   The value of the flag is output at the end of the first line in the program execution result output 6, for example. In FIG. 5, since the flag value is “1”, the program execution result output 6 is output in a state including the debug information output 61. Thereby, the user can know whether or not the part other than the program execution result output 6 included in the program execution result output 6 is the debug information output 61, and can know the debug result.

プログラム実行結果出力6の2行目には、プログラム実行結果出力6の出力先のファイルの名前が出力される。換言すれば、実行プログラム4のデバッグ情報出力命令41を除く部分を実行した結果は、「a.out」というファイルに出力される。   In the second line of the program execution result output 6, the name of the output destination file of the program execution result output 6 is output. In other words, the result of executing the portion of the execution program 4 excluding the debug information output instruction 41 is output to a file “a.out”.

構文意味解析部32は、組込みデバッグ指示行21を解析する第1の解析処理を実行し、組込みデバッグ指示行21の指示対象を解析する第2の解析処理を実行し、第1及び第2の解析処理に基づいてデバッグ情報出力命令341を生成する。   The syntax and semantic analysis unit 32 executes a first analysis process for analyzing the embedded debug instruction line 21, executes a second analysis process for analyzing the instruction target of the embedded debug instruction line 21, and executes the first and second analysis processes. A debug information output instruction 341 is generated based on the analysis processing.

例えば、デバッグ情報出力61において、3行目〜4行目は、ソースプログラム2における19行目の組込みデバッグ指示行「#pragma builtin_debug parameter」から生成されたデバッグ情報出力命令41を実行した結果である。具体的には、ソースプログラム2の17行目の関数funcの仮引数paramのデバッグ情報が出力される。   For example, in the debug information output 61, the third to fourth lines are the results of executing the debug information output instruction 41 generated from the 19th built-in debug instruction line “#pragma builtin_debug parameter” in the source program 2. . Specifically, debug information of the dummy argument param of the function func on the 17th line of the source program 2 is output.

構文意味解析部32は、組込みデバッグ指示行「#pragma builtin_debug parameter」が、19行目に記述されていることを解析し、更に、この解析に基づいて、図3を参照して前述したように、17行目の関数funcを指定し、関数funcの仮引数paramのデバッグを指示することを解析する。   The syntax and semantic analysis unit 32 analyzes that the built-in debug instruction line “#pragma builtin_debug parameter” is described in the 19th line, and further, based on this analysis, as described above with reference to FIG. The function func on the 17th line is specified, and it is analyzed that the debugging of the formal parameter param of the function func is instructed.

そこで、以上の解析に基づいて、構文意味解析部32は、19行目の組込みデバッグ指示行「#pragma builtin_debug parameter」から、17行目の関数funcの仮引数paramについての全ての情報をソースプログラム2の内部から収集して出力するデバッグ情報出力命令341を生成する。これにより、実行プログラム4には、17行目の関数funcの仮引数paramについての情報を収集して出力するデバッグ情報出力命令41が含まれる。   Therefore, based on the above analysis, the syntax and semantic analysis unit 32 obtains all information about the formal parameter param of the function func on the 17th line from the built-in debug instruction line “#pragma builtin_debug parameter” on the 19th line. 2 generates a debug information output instruction 341 that is collected from the inside and output. Thus, the execution program 4 includes a debug information output instruction 41 that collects and outputs information about the dummy argument param of the function func on the 17th line.

実行装置5は、19行目の組込みデバッグ指示行「#pragma builtin_debug parameter」から生成されたデバッグ情報出力命令41を実行することにより、17行目の関数funcの仮引数paramについての情報を収集して、デバッグ情報として出力する。   The execution device 5 collects information on the dummy argument param of the function func on the 17th line by executing the debug information output instruction 41 generated from the built-in debug instruction line “#pragma builtin_debug parameter” on the 19th line. And output as debug information.

次に、デバッグ情報出力61において、5行目〜7行目は、ソースプログラム2における24行目の組込みデバッグ指示行「#pragma builtin_debug global」から生成されたデバッグ情報出力命令41を実行した結果である。具体的には、ソースプログラム2の2行目及び5行目の可視の外部変数又は静的変数「data=10」及び「data=10」のデバッグ情報が出力される。   Next, in the debug information output 61, the 5th to 7th lines are the results of executing the debug information output instruction 41 generated from the built-in debug instruction line “#pragma builtin_debug global” of the 24th line in the source program 2. is there. Specifically, debug information of visible external variables or static variables “data = 10” and “data = 10” in the second and fifth lines of the source program 2 is output.

構文意味解析部32は、組込みデバッグ指示行「#pragma builtin_debug global」が、24行目に記述されていることを解析し、更に、この解析に基づいて、図3を参照して前述したように、可視の外部変数又は静的変数である2行目の「data=10」及び5行目の「data=10」のデバッグを指示する命令であることを解析する。   The syntax and semantic analysis unit 32 analyzes that the embedded debug instruction line “#pragma builtin_debug global” is described in the 24th line, and further, based on this analysis, as described above with reference to FIG. Then, it is analyzed that the instruction is for instructing debugging of “data = 10” on the second line and “data = 10” on the fifth line, which are visible external variables or static variables.

そこで、以上の解析に基づいて、構文意味解析部32は、24行目の組込みデバッグ指示行「#pragma builtin_debug global」から、2行目及び5行目の可視の外部変数又は静的変数「data=10」及び「data=10」についての全ての情報をソースプログラム2の内部から収集して出力するデバッグ情報出力命令341を生成する。これにより、実行プログラム4には、2行目及び5行目の可視の外部変数又は静的変数「data=10」及び「data=10」についての情報を収集して出力するデバッグ情報出力命令41が含まれる。   Therefore, based on the above analysis, the syntax-separation analysis unit 32 starts the visible external variable or static variable “data” in the second and fifth lines from the built-in debug instruction line “#pragma builtin_debug global” on the 24th line. = 10 ”and“ data = 10 ”are generated from the source program 2 to collect and output a debug information output instruction 341 for output. As a result, the execution program 4 collects and outputs information about the visible external variables or static variables “data = 10” and “data = 10” on the second and fifth lines, and outputs the debug information output instruction 41. Is included.

実行装置5は、24行目の組込みデバッグ指示行「#pragma builtin_debug global」から生成されたデバッグ情報出力命令41を実行することにより、2行目及び5行目の可視の外部変数又は静的変数「data=10」及び「data=10」についての情報を収集して、デバッグ情報として出力する。   The execution device 5 executes the debug information output instruction 41 generated from the built-in debug instruction line “#pragma builtin_debug global” on the 24th line, thereby making visible external variables or static variables on the 2nd line and the 5th line. Information on “data = 10” and “data = 10” is collected and output as debug information.

次に、デバッグ情報出力61において、8行目〜12行目は、ソースプログラム2における27行目の組込みデバッグ指示行「#pragma builtin_debug statement」から生成されたデバッグ情報出力命令41を実行した結果である。具体的には、ソースプログラム2の28行目の「ret = clsobj+data;」のデバッグ情報が出力される。   Next, in the debug information output 61, the 8th to 12th lines are the results of executing the debug information output instruction 41 generated from the 27th built-in debug instruction line “#pragma builtin_debug statement” in the source program 2. is there. Specifically, debug information of “ret = clsobj + data;” on line 28 of the source program 2 is output.

構文意味解析部32は、組込みデバッグ指示行「#pragma builtin_debug statement」が、27行目に記述されていることを解析し、更に、この解析に基づいて、図3を参照して前述したように、28行目の「ret = clsobj+data;」のデバッグを指示する命令であることを解析する。   The syntax and semantic analysis unit 32 analyzes that the built-in debug instruction line “#pragma builtin_debug statement” is described in the 27th line, and further, based on this analysis, as described above with reference to FIG. , Line 28, “ret = clsobj + data;” is analyzed to be an instruction instructing debugging.

そこで、以上の解析に基づいて、構文意味解析部32は、27行目の組込みデバッグ指示行「#pragma builtin_debug statement」から、28行目の「ret = clsobj+data;」についての全ての情報をソースプログラム2の内部から収集して出力するデバッグ情報出力命令341を生成する。これにより、実行プログラム4には、28行目の「ret = clsobj+data;」についての情報を収集して出力するデバッグ情報出力命令41が含まれる。   Therefore, based on the above analysis, the syntax-semantic analysis unit 32 obtains all information about “ret = clsobj + data;” on the 28th line from the built-in debug instruction line “#pragma builtin_debug statement” on the 27th line. A debug information output instruction 341 that is collected from the inside of the source program 2 and output is generated. Thus, the execution program 4 includes a debug information output instruction 41 that collects and outputs information about “ret = clsobj + data;” on the 28th line.

デバッグ情報出力命令341の生成において、構文意味解析部32は、更に、構造化データ33を参照する。これにより、構文意味解析部32は、デバッグ対象である「ret = clsobj+data;」が、2行目の変数「data」、11行目のオペレータ関数「CLS::operator +(int)」、21行目の変数「clsobj」、22行目の変数「ret」に、各々、関連付けられていることを知る。そこで、構文意味解析部32は、デバッグ情報出力命令341として、単に28行目の「ret = clsobj+data;」の情報を収集して出力するのみでなく、これに加えて、変数「ret」、変数「clsobj」、変数「data」、オペレータ関数「CLS::operator +(int)」についての情報を収集して出力する命令を生成する。   In generating the debug information output instruction 341, the syntax and semantic analysis unit 32 further refers to the structured data 33. As a result, the syntax and semantic analysis unit 32 sets “ret = clsobj + data;” to be debugged as a variable “data” on the second line, an operator function “CLS :: operator + (int)” on the eleventh line, It is known that the variable “clsobj” on the 21st line and the variable “ret” on the 22nd line are associated with each other. Therefore, the syntax and semantic analysis unit 32 not only collects and outputs the information “ret = clsobj + data;” on the 28th line as the debug information output instruction 341 but also adds the variable “ret”. , A command for collecting and outputting information on the variable “clsobj”, the variable “data”, and the operator function “CLS :: operator + (int)”.

実行装置5は、27行目の組込みデバッグ指示行「#pragma builtin_debug statement」から生成されたデバッグ情報出力命令41を実行することにより、28行目の「ret = clsobj+data;」についての情報を収集して、デバッグ情報として出力する。   The execution unit 5 executes the debug information output instruction 41 generated from the built-in debug instruction line “#pragma builtin_debug statement” on the 27th line, thereby obtaining information on “ret = clsobj + data;” on the 28th line. Collect and output as debug information.

この時、ソースプログラム2の28行目の「ret = clsobj+data;」において使用されている、変数「clsobj」、変数「ret」、変数「data」のデバッグ情報が出力される。ここで、変数「clsobj」は、クラス型のためクラス名を表示している。また、変数「data」は、「NS1」という「Namespace」と「NS2」という「Namespace」の双方で定義されているが、15行目のusing文により 「NS1」という「Namespace」で定義されているdataが参照されていることを表している。12行目の「CLS::operator +(int)」は、CLSクラスで宣言されたオペレータ関数が使用されたことを表している。これは、「clsobj+data」の加算演算が、実際には、オペレータ関数「CLS::operator +(int)」が使用されている、換言すれば、呼び出されているためである。   At this time, debug information of the variable “clsobj”, the variable “ret”, and the variable “data” used in “ret = clsobj + data;” on the 28th line of the source program 2 is output. Here, since the variable “clsobj” is a class type, a class name is displayed. The variable “data” is defined in both “Namespace” “NS1” and “Namespace” “NS2”, but it is defined in “Namespace” “NS1” by using statement on the 15th line. Indicates that the data is referenced. “CLS :: operator + (int)” on the 12th line indicates that the operator function declared in the CLS class is used. This is because the addition operation of “clsobj + data” actually uses the operator function “CLS :: operator + (int)”, in other words, is called.

なお、ソースプログラム2に含まれる複数の組込みデバッグ指示行21の中で、特定の組込みデバッグ指示行21に基づくデバッグ情報のみを出力するようにしても良い。この場合、例えば、制御用関数インタフェースが設けられ、その関数内において、例えば、「char builtin_debug_table[]={“test.c:17”, “test.c:26”};のように、ファイル名と行番号が規定の配列の初期値として指定される。これにより、特定の組込みデバッグ指示行21についてのデバッグ情報のみを出力することができる。   It should be noted that only debug information based on a specific embedded debug instruction line 21 may be output among a plurality of embedded debug instruction lines 21 included in the source program 2. In this case, for example, a control function interface is provided, and in the function, for example, “char builtin_debug_table [] = {“ test.c: 17 ”,“ test.c: 26 ”}; And the line number are specified as the initial value of the specified array, so that only the debug information for the specific embedded debug instruction line 21 can be output.

以上のように、実行装置5がデバッグ情報出力命令41を実行することによりデバッグ情報を出力するので、デバッグ用の外部ツールやデバッグ用のライブラリ等を何ら用いることなく、デバッグ情報を収集し出力することができる。また、コンパイル装置3がデバッグ情報出力命令41を生成するので、ユーザは、デバッグ情報出力命令41をコーディングする必要がない。   As described above, since the execution device 5 outputs debug information by executing the debug information output instruction 41, the debug information is collected and output without using any debugging external tool or debug library. be able to. Further, since the compiling device 3 generates the debug information output instruction 41, the user does not need to code the debug information output instruction 41.

また、例えば、ソースプログラム2がC++言語で記述されたプログラムである場合、ユーザは、識別子解決結果、関数のオーバーロード/オーバーライドの解決結果、ソースプログラム2において記述された式のコンパイラ31における解析結果や解決結果を、デバッグ情報として知ることができる。例えば、識別子解決結果は、どのネームスペースの識別子を参照したのかを示す。関数のオーバーロード/オーバーライドの解決結果は、例えばオペレータ演算子を含む。ソースプログラム2において記述された式は、例えばテンプレート関数等を含む。   Further, for example, when the source program 2 is a program described in the C ++ language, the user can analyze the identifier resolution result, the function overload / override resolution result, and the analysis result in the compiler 31 of the expression described in the source program 2. And the resolution result can be known as debug information. For example, the identifier resolution result indicates which namespace identifier is referred to. The function overload / override resolution result includes, for example, an operator operator. The expression described in the source program 2 includes, for example, a template function.

図6は、コンパイル装置のハードウェアの構成の一例を示す図である。   FIG. 6 is a diagram illustrating an example of a hardware configuration of the compiling device.

CPU101は、ROM102に格納された制御プログラムに従って、コンパイル装置3を制御する。CPU101は、例えば主メモリであるRAM103上のコンパイルプログラムを実行する。これにより、コンパイラ31及びリンカ38が実現される。コンパイルプログラムは、例えば、CD−ROMやDVD等の記録媒体109に格納され、記録媒体109からハードディスク106に入力され、ハードディスク106からCD−ROMドライブやDVDドライブ等を介してRAM103にロードされる。   The CPU 101 controls the compiling device 3 according to a control program stored in the ROM 102. The CPU 101 executes a compile program on the RAM 103, which is a main memory, for example. As a result, the compiler 31 and the linker 38 are realized. The compile program is stored in, for example, a recording medium 109 such as a CD-ROM or DVD, input from the recording medium 109 to the hard disk 106, and loaded from the hard disk 106 to the RAM 103 via the CD-ROM drive, DVD drive, or the like.

プログラム及びデータ格納部は、例えばハードディスク106に設けられ、ソースプログラム2、構造化データ33、中間プログラム34、オブジェクトプログラム37、ライブラリ39、実行プログラム4を格納する。換言すれば、プログラム及びデータは、例えばハードディスク106に格納される。ライブラリ39は、例えば、CD−ROMやDVD等の記録媒体109に格納され、記録媒体109からCD−ROMドライブやDVDドライブ等を介してハードディスク106に入力され、必要に応じてハードディスク106からRAM103にロードされ、リンカ38により処理される。構造化データ33、中間プログラム34、オブジェクトプログラム37、実行プログラム4は、コンパイラ31又はリンカ38により生成される。   The program and data storage unit is provided in the hard disk 106, for example, and stores the source program 2, structured data 33, intermediate program 34, object program 37, library 39, and execution program 4. In other words, the program and data are stored in the hard disk 106, for example. For example, the library 39 is stored in a recording medium 109 such as a CD-ROM or DVD, and is input from the recording medium 109 to the hard disk 106 via a CD-ROM drive or DVD drive, and from the hard disk 106 to the RAM 103 as necessary. Loaded and processed by linker 38. The structured data 33, the intermediate program 34, the object program 37, and the execution program 4 are generated by the compiler 31 or the linker 38.

入力装置104は、例えばキーボードであり、マウス等を含んでも良い。出力装置105は、例えばディスプレイであり、プリンタ等の出力装置を含んでも良い。CPU101、ROM102、RAM103、入力装置104、出力装置105、及び、ハードディスク106、ネットワーク接続部107は、バス108を介して、相互に接続される。   The input device 104 is a keyboard, for example, and may include a mouse or the like. The output device 105 is a display, for example, and may include an output device such as a printer. The CPU 101, ROM 102, RAM 103, input device 104, output device 105, hard disk 106, and network connection unit 107 are connected to each other via a bus 108.

ネットワーク接続部107は、例えば、送受信装置であり、ネットワークに接続され、ネットワークを介して他のコンピュータ、例えば生成装置1及び実行装置5に接続される。これにより、コンパイル装置3は、生成装置1及び実行装置5との間で通信を行う。ソースプログラム2は、例えば、生成装置1からネットワークを介してハードディスク106に入力され、必要に応じてハードディスク106からRAM103にロードされ、コンパイラ31及びリンカ38により処理される。実行プログラム4は、コンパイル装置3からネットワークを介して実行装置5に送信され実行される。   The network connection unit 107 is, for example, a transmission / reception device, is connected to the network, and is connected to other computers, for example, the generation device 1 and the execution device 5 via the network. As a result, the compiling device 3 communicates with the generation device 1 and the execution device 5. For example, the source program 2 is input to the hard disk 106 from the generation apparatus 1 via the network, loaded from the hard disk 106 to the RAM 103 as necessary, and processed by the compiler 31 and the linker 38. The execution program 4 is transmitted from the compiling device 3 to the execution device 5 via the network and executed.

図7は、コンパイラ31が実行するコンパイル処理フローであって、特に、ソースプログラムからデバッグ情報出力命令を含む中間プログラムを生成する処理フローを示す。   FIG. 7 shows a compile processing flow executed by the compiler 31, and particularly shows a processing flow for generating an intermediate program including a debug information output instruction from a source program.

コンパイル装置3において、コンパイラ31がソースプログラム2を読込むと(ステップS1)、構文意味解析部32が、読み込まれたソースプログラム2の字句解析処理を実行し(ステップS2)、字句解析処理の結果に基づいて、読み込まれたソースプログラム2の構文解析処理及び意味解析処理を実行する(ステップS3)。構文解析処理及び意味解析処理により、ソースプログラム2の構造化データ33が生成される。   In the compiling device 3, when the compiler 31 reads the source program 2 (step S1), the syntax / semantic analysis unit 32 executes the lexical analysis processing of the read source program 2 (step S2), and the result of the lexical analysis processing is obtained. Based on the read source program 2, syntax analysis processing and semantic analysis processing are executed (step S3). The structured data 33 of the source program 2 is generated by the syntax analysis process and the semantic analysis process.

構文意味解析部32は、ソースプログラム2の先頭から順に1行ずつコードを抽出し、抽出した行において組込みデバッグ指示行21が指定されているか否かを判断する(ステップS4)。組込みデバッグ指示行21が指定されていない場合には(ステップS4 No)、構文意味解析部32は、ステップS3を繰り返す。   The syntax and semantic analysis unit 32 extracts the code one line at a time from the top of the source program 2, and determines whether or not the embedded debug instruction line 21 is specified in the extracted line (step S4). When the embedded debug instruction line 21 is not designated (No at Step S4), the syntax and semantic analysis unit 32 repeats Step S3.

組込みデバッグ指示行21が指定されている場合には(ステップS4 Yes)、構文意味解析部32は、組込みデバッグ指示行21の種類が「statement」であるか、「parameter」 であるか、「global」であるかを判断する(ステップS5)。   If the embedded debug instruction line 21 is designated (Yes in step S4), the syntax-separation analyzer 32 determines whether the type of the embedded debug instruction line 21 is “statement”, “parameter”, or “global”. Is determined (step S5).

次に、構文意味解析部32は、組込みデバッグ指示行21において「変数並び」が指定されているか否かを判断し、更に、指定されている場合には、その変数が宣言されているか否かを検査する(ステップS6)。   Next, the syntax and semantic analysis unit 32 determines whether or not “variable list” is specified in the embedded debug instruction line 21 and, if so, whether or not the variable is declared. Is inspected (step S6).

一方、ステップS6において、組込みデバッグ指示行21において「変数並び」が指定されていない場合は、構文意味解析部32は、組込みデバッグ指示行21が指定された位置に基づいて、ソースプログラム2において指定されている変数や関数を調べる(ステップS7)。   On the other hand, if “variable list” is not specified in the embedded debug instruction line 21 in step S6, the syntax and semantic analysis unit 32 specifies in the source program 2 based on the position where the embedded debug instruction line 21 is specified. The checked variables and functions are checked (step S7).

次に、構文意味解析部32は、変数や関数のデバッグ情報を収集し出力するための命令を生成し、併せてファイル名、関数名、行番号の情報出力命令も生成する(ステップS8)。   Next, the syntax and semantic analysis unit 32 generates an instruction for collecting and outputting variable and function debugging information, and also generates an information output instruction for a file name, a function name, and a line number (step S8).

次に、構文意味解析部32は、図5に示す環境変数、換言すれば、フラグを判定条件として用いて、組込みデバッグ指示行21の中間コードであるデバッグ情報出力命令341を生成する(ステップS9)。   Next, the syntax and semantic analysis unit 32 generates a debug information output instruction 341 that is an intermediate code of the embedded debug instruction line 21 by using the environment variable shown in FIG. 5, in other words, the flag as a determination condition (step S9). ).

次に、構文意味解析部32は、ソースプログラム2における全ての行の処理を終了したか否かを判断する(ステップS10)。全ての行の処理を終了していない場合には(ステップS10 No)、構文意味解析部32は、ステップS3を繰り返す。全ての行の処理を終了した場合には(ステップS10 Yes)、構文意味解析部32は、処理を終了する。   Next, the syntax and semantic analysis unit 32 determines whether or not the processing of all lines in the source program 2 has been completed (step S10). If all the lines have not been processed (No at Step S10), the syntax and semantic analysis unit 32 repeats Step S3. When all the lines have been processed (Yes in step S10), the syntax and semantic analysis unit 32 ends the process.

以上の説明から理解されるように、以下のような実施の態様が把握される。   As will be understood from the above description, the following embodiments are grasped.

(付記1) コンパイル処理対象のソースプログラムにデバッグ情報の出力指示が含まれる場合に、前記ソースプログラムの構造を表す構造化データに基づいて、前記出力指示の出力対象であるプログラム要素を解析することにより生成したデバッグ情報を出力させる命令を含む実行プログラムを生成する第1の生成部と、
前記ソースプログラムのコンパイル処理結果として、前記実行プログラムの実行可否を判定する命令を含む実行プログラムを生成する第2の生成部とを含む
ことを特徴とするコンパイル装置。
(Additional remark 1) When the output instruction | indication of debug information is included in the source program of a compilation process target, the program element which is the output object of the said output instruction | indication is analyzed based on the structured data showing the structure of the said source program A first generation unit that generates an execution program including an instruction for outputting debug information generated by:
A compiling apparatus comprising: a second generation unit that generates an execution program including an instruction for determining whether or not the execution program can be executed as a result of compiling the source program.

(付記2) 前記第1の生成部は、前記出力指示を解析する第1の解析処理を実行し、前記出力指示の指示対象を解析する第2の解析処理を実行し、前記第1及び第2の解析処理に基づいて前記デバッグ情報出力命令を生成する
ことを特徴とする付記1に記載のコンパイル装置。
(Supplementary Note 2) The first generation unit executes a first analysis process for analyzing the output instruction, executes a second analysis process for analyzing an instruction target of the output instruction, and performs the first and second The compiling device according to appendix 1, wherein the debug information output instruction is generated based on the analysis processing of No. 2.

(付記3) 前記第1の生成部は、前記実行プログラムの生成に先立って、前記ソースプログラムを解析することにより、前記構造化データを生成する
ことを特徴とする付記1に記載のコンパイル装置。
(Supplementary note 3) The compiling device according to supplementary note 1, wherein the first generation unit generates the structured data by analyzing the source program prior to generation of the execution program.

(付記4) 前記出力指示は、予め定められたコンパイル装置において実行される命令であって、前記予め定められたコンパイル装置以外のコンパイル装置においてはエラーを発生せずかつ実行されない命令である
ことを特徴とする付記1に記載のコンパイル装置。
(Supplementary Note 4) The output instruction is an instruction that is executed in a predetermined compiling device, and is an instruction that does not generate an error and is not executed in a compiling device other than the predetermined compiling device. The compiling device according to Supplementary Note 1, which is characterized.

(付記5) 前記出力指示は、前記ソースプログラムにおいて、デバッグ対象である文又は式を指定する位置であって前記文又は式に対して予め定められた関係にある位置、デバッグ対象である関数を指定する位置であって前記関数に対して予め定められた関係にある位置、又は、デバッグ対象である外部変数又は静的変数を指定する位置であって前記外部変数又は静的変数に対して予め定められた関係にある位置に含まれる
ことを特徴とする付記1に記載のコンパイル装置。
(Additional remark 5) The said output instruction | indication is the position which designates the sentence or expression which is a debug object in the said source program, Comprising: The position which has a predetermined relationship with respect to the said sentence or expression, The function which is a debug object A position that is designated and has a predetermined relationship with respect to the function, or a position that designates an external variable or static variable to be debugged and that is designated in advance with respect to the external variable or static variable. The compiling device according to appendix 1, wherein the compiling device is included in a position having a predetermined relationship.

(付記6) 前記出力指示は、デバッグ対象である文又は式を指定し、指定された前記文又は式において使用されている変数又は関数についてのデバッグを指示する命令である
ことを特徴とする付記5に記載のコンパイル装置。
(Additional remark 6) The said output instruction | indication is the instruction | indication which designates the debug about the variable or the function which designates the sentence or expression which is a debug object, and is used in the designated said sentence or expression. 5. The compiling device according to 5.

(付記7) 前記第1の生成部は、前記出力指示に対応する前記デバッグ情報出力命令として、前記ソースプログラムから指定された前記文又は式において使用されている変数又は関数を抽出し、抽出した前記変数又は関数についての情報を収集する命令を生成する
ことを特徴とする付記6に記載のコンパイル装置。
(Additional remark 7) The said 1st production | generation part extracted and extracted the variable or function used in the said sentence or expression designated from the said source program as the said debug information output instruction corresponding to the said output instruction | indication The compiling device according to appendix 6, wherein an instruction for collecting information on the variable or function is generated.

(付記8) 前記出力指示は、デバッグ対象である関数を指定し、指定された前記関数における仮引数についてのデバッグを指示する命令である
ことを特徴とする付記5に記載のコンパイル装置。
(Supplementary note 8) The compiling device according to supplementary note 5, wherein the output instruction is an instruction that designates a function to be debugged, and instructs to debug a dummy argument in the designated function.

(付記9) 前記第1の生成部は、前記出力指示に対応する前記デバッグ情報出力命令として、前記ソースプログラムから指定された前記関数における仮引数を抽出し、抽出した前記仮引数についての情報を収集する命令を生成する
ことを特徴とする付記8に記載のコンパイル装置。
(Supplementary Note 9) The first generation unit extracts a dummy argument in the function specified from the source program as the debug information output instruction corresponding to the output instruction, and stores information on the extracted dummy argument. The compiling device according to appendix 8, wherein the instruction to be collected is generated.

(付記10) 前記出力指示は、デバッグ対象である外部変数又は静的変数を指定し、指定された前記外部変数又は静的変数についてのデバッグを指示する命令である
ことを特徴とする付記5に記載のコンパイル装置。
(Additional remark 10) The said output instruction | indication is the instruction | indication which designates the external variable or static variable which is a debug object, and instruct | indicates the debugging about the designated external variable or static variable. The compiling device described.

(付記11) 前記第1の生成部は、前記出力指示に対応する前記デバッグ情報出力命令として、前記ソースプログラムから指定された前記外部変数又は静的変数を抽出し、抽出した前記外部変数又は静的変数についての情報を収集する命令を生成する
ことを特徴とする付記10に記載のコンパイル装置。
(Supplementary Note 11) The first generation unit extracts the external variable or static variable designated from the source program as the debug information output instruction corresponding to the output instruction, and extracts the external variable or static variable extracted. 13. The compiling device according to appendix 10, wherein an instruction for collecting information on a static variable is generated.

(付記12) 前記ソースプログラムは、オブジェクト指向言語であるC++言語又はC言語により記述され、前記出力指示は、前記C++言語の規格及びC言語においてコンパイラに渡される指令として規定されているプラグマ指令である
ことを特徴とする付記1に記載のコンパイル装置。
(Supplementary Note 12) The source program is described in C ++ language or C language, which is an object-oriented language, and the output instruction is a standard of the C ++ language and a pragma command defined as a command passed to a compiler in the C language. The compiling device according to appendix 1, wherein there is a compiling device.

(付記13) ソースプログラムをコンパイル処理することにより実行プログラムを生成するコンパイル装置と、
前記実行プログラムを実行する実行装置とを含む情報処理システムであって、
前記コンパイル装置は、
コンパイル処理対象のソースプログラムにデバッグ情報の出力指示が含まれる場合に、前記ソースプログラムの構造を表す構造化データに基づいて、前記出力指示の出力対象であるプログラム要素を解析することにより生成したデバッグ情報を出力させる命令を含む実行プログラムを生成する第1の生成部と、
前記ソースプログラムのコンパイル処理結果として、前記実行プログラムの実行可否を判定する命令を含む実行プログラムを生成する第2の生成部とを含み
前記実行装置は、前記実行プログラムを実行することにより、前記実行プログラムの実行結果と、前記デバッグ情報出力命令を実行することにより得られる前記実行プログラムのデバッグ情報とを生成する
ことを特徴とする情報処理システム。
(Supplementary note 13) a compiling device that generates an execution program by compiling a source program;
An information processing system including an execution device that executes the execution program,
The compiling device is:
Debug generated by analyzing a program element that is the output target of the output instruction based on structured data representing the structure of the source program when the source program to be compiled includes an instruction to output debug information A first generation unit that generates an execution program including an instruction for outputting information;
A second generation unit that generates an execution program including an instruction for determining whether or not the execution program can be executed as a compile processing result of the source program, and the execution device executes the execution program by executing the execution program An information processing system for generating a program execution result and debug information of the execution program obtained by executing the debug information output instruction.

(付記14) コンパイル処理対象のソースプログラムにデバッグ情報の出力指示が含まれる場合に、前記ソースプログラムの構造を表す構造化データに基づいて、前記出力指示の出力対象であるプログラム要素を解析することにより生成したデバッグ情報を出力させる命令を含む実行プログラムを生成し、
前記ソースプログラムのコンパイル処理結果として、前記実行プログラムの実行可否を判定する命令を含む実行プログラムを生成する
ことを特徴とするコンパイル方法。
(Supplementary note 14) When a debug information output instruction is included in a compile processing target source program, analyzing a program element that is the output target of the output instruction based on structured data representing the structure of the source program Generate an execution program that includes instructions to output debug information generated by
An execution program including an instruction for determining whether or not the execution program can be executed is generated as a compilation processing result of the source program.

(付記15) ソースプログラムをコンパイル処理することにより実行プログラムを生成するコンパイルプログラムであって、
前記コンパイルプログラムは、コンピュータに、
コンパイル処理対象のソースプログラムにデバッグ情報の出力指示が含まれる場合に、前記ソースプログラムの構造を表す構造化データに基づいて、前記出力指示の出力対象であるプログラム要素を解析することにより生成したデバッグ情報を出力させる命令を含む実行プログラムを生成する第1の生成処理と、
前記ソースプログラムのコンパイル処理結果として、前記実行プログラムの実行可否を判定する命令を含む実行プログラムを生成する第2の生成処理とを実行させる
ことを特徴とするコンパイルプログラム。
(Supplementary note 15) A compiling program for generating an execution program by compiling a source program,
The compile program is stored in a computer.
Debug generated by analyzing a program element that is the output target of the output instruction based on structured data representing the structure of the source program when the source program to be compiled includes an instruction to output debug information A first generation process for generating an execution program including an instruction for outputting information;
A compile program, wherein a second generation process for generating an execution program including an instruction for determining whether or not the execution program can be executed is executed as a compile process result of the source program.

(付記16) ソースプログラムをコンパイル処理することにより実行プログラムを生成するコンパイルプログラムを記録する記録媒体であって、
前記コンパイルプログラムは、コンピュータに、
コンパイル処理対象のソースプログラムにデバッグ情報の出力指示が含まれる場合に、前記ソースプログラムの構造を表す構造化データに基づいて、前記出力指示の出力対象であるプログラム要素を解析することにより生成したデバッグ情報を出力させる命令を含む実行プログラムを生成する第1の生成処理と、
前記ソースプログラムのコンパイル処理結果として、前記実行プログラムの実行可否を判定する命令を含む実行プログラムを生成する第2の生成処理とを実行させる
ことを特徴とする記録媒体。
(Supplementary note 16) A recording medium for recording a compile program for generating an execution program by compiling a source program,
The compile program is stored in a computer.
Debug generated by analyzing a program element that is the output target of the output instruction based on structured data representing the structure of the source program when the source program to be compiled includes an instruction to output debug information A first generation process for generating an execution program including an instruction for outputting information;
A recording medium, wherein a second generation process for generating an execution program including an instruction for determining whether or not the execution program can be executed is executed as a compile process result of the source program.

1 生成装置
2 ソースプログラム
3 コンパイル装置
4 実行プログラム
5 実行装置
6 プログラム実行結果出力
31 コンパイラ
32 構文意味解析部
33 構造化データ
34 中間プログラム
35 最適化部
36 コード生成部
37 オブジェクトプログラム
38 リンカ
39 ライブラリ
61 デバッグ情報出力
DESCRIPTION OF SYMBOLS 1 Generation apparatus 2 Source program 3 Compile apparatus 4 Execution program 5 Execution apparatus 6 Output of program execution result 31 Compiler 32 Syntax and semantic analysis section 33 Structured data 34 Intermediate program 35 Optimization section 36 Code generation section 37 Object program 38 Linker 39 Library 61 Debug information output

Claims (8)

コンパイル処理対象のソースプログラムにデバッグ情報の出力指示が含まれる場合に、前記ソースプログラムの構造を表す構造化データに基づいて、前記出力指示の出力対象であるプログラム要素を解析することにより生成したデバッグ情報を出力させる命令を含む実行プログラムを生成する第1の生成部と、
前記ソースプログラムのコンパイル処理結果として、前記実行プログラムの実行可否を判定する命令を含む実行プログラムを生成する第2の生成部とを含む
ことを特徴とするコンパイル装置。
Debug generated by analyzing a program element that is the output target of the output instruction based on structured data representing the structure of the source program when the source program to be compiled includes an instruction to output debug information A first generation unit that generates an execution program including an instruction for outputting information;
A compiling apparatus comprising: a second generation unit that generates an execution program including an instruction for determining whether or not the execution program can be executed as a result of compiling the source program.
前記第1の生成部は、前記実行プログラムの生成に先立って、前記ソースプログラムを解析することにより、前記構造化データを生成する
ことを特徴とする請求項1に記載のコンパイル装置。
The compiling apparatus according to claim 1, wherein the first generation unit generates the structured data by analyzing the source program prior to generation of the execution program.
前記出力指示は、予め定められたコンパイル装置において実行される命令であって、前記予め定められたコンパイル装置以外のコンパイル装置においてはエラーを発生せずかつ実行されない命令である
ことを特徴とする請求項1に記載のコンパイル装置。
The output instruction is an instruction that is executed in a predetermined compiling device, and is an instruction that does not generate an error and is not executed in a compiling device other than the predetermined compiling device. Item 2. The compiling device according to Item 1.
前記出力指示は、前記ソースプログラムにおいて、デバッグ対象である文又は式を指定する位置であって前記文又は式に対して予め定められた関係にある位置、デバッグ対象である関数を指定する位置であって前記関数に対して予め定められた関係にある位置、又は、デバッグ対象である外部変数又は静的変数を指定する位置であって前記外部変数又は静的変数に対して予め定められた関係にある位置に含まれる
ことを特徴とする請求項1に記載のコンパイル装置。
In the source program, the output instruction is a position for designating a statement or expression to be debugged, a position having a predetermined relationship with the sentence or expression, or a position for designating a function to be debugged. A position that is in a predetermined relationship with the function, or a position that specifies an external variable or static variable to be debugged and has a predetermined relationship with the external variable or static variable The compiling device according to claim 1, wherein the compiling device is included in a position in
ソースプログラムをコンパイル処理することにより実行プログラムを生成するコンパイル装置と、
前記実行プログラムを実行する実行装置とを含む情報処理システムであって、
前記コンパイル装置は、
コンパイル処理対象のソースプログラムにデバッグ情報の出力指示が含まれる場合に、前記ソースプログラムの構造を表す構造化データに基づいて、前記出力指示の出力対象であるプログラム要素を解析することにより生成したデバッグ情報を出力させる命令を含む実行プログラムを生成する第1の生成部と、
前記ソースプログラムのコンパイル処理結果として、前記実行プログラムの実行可否を判定する命令を含む実行プログラムを生成する第2の生成部とを含み、
前記実行装置は、前記実行プログラムを実行することにより、前記実行プログラムの実行結果と、前記デバッグ情報出力命令を実行することにより得られる前記実行プログラムのデバッグ情報とを生成する
ことを特徴とする情報処理システム。
A compiling device for generating an execution program by compiling a source program;
An information processing system including an execution device that executes the execution program,
The compiling device is:
Debug generated by analyzing a program element that is the output target of the output instruction based on structured data representing the structure of the source program when the source program to be compiled includes an instruction to output debug information A first generation unit that generates an execution program including an instruction for outputting information;
A second generation unit that generates an execution program including an instruction for determining whether or not the execution program can be executed as a result of compiling the source program;
The execution device generates the execution result of the execution program and the debug information of the execution program obtained by executing the debug information output instruction by executing the execution program. Processing system.
コンパイル処理対象のソースプログラムにデバッグ情報の出力指示が含まれる場合に、前記ソースプログラムの構造を表す構造化データに基づいて、前記出力指示の出力対象であるプログラム要素を解析することにより生成したデバッグ情報を出力させる命令を含む実行プログラムを生成し、
前記ソースプログラムのコンパイル処理結果として、前記実行プログラムの実行可否を判定する命令を含む実行プログラムを生成する
ことを特徴とするコンパイル方法。
Debug generated by analyzing a program element that is the output target of the output instruction based on structured data representing the structure of the source program when the source program to be compiled includes an instruction to output debug information Generate an execution program that includes instructions to output information,
An execution program including an instruction for determining whether or not the execution program can be executed is generated as a compilation processing result of the source program.
ソースプログラムをコンパイル処理することにより実行プログラムを生成するコンパイルプログラムであって、
前記コンパイルプログラムは、コンピュータに、
コンパイル処理対象のソースプログラムにデバッグ情報の出力指示が含まれる場合に、前記ソースプログラムの構造を表す構造化データに基づいて、前記出力指示の出力対象であるプログラム要素を解析することにより生成したデバッグ情報を出力させる命令を含む実行プログラムを生成する第1の生成処理と、
前記ソースプログラムのコンパイル処理結果として、前記実行プログラムの実行可否を判定する命令を含む実行プログラムを生成する第2の生成処理とを実行させる
ことを特徴とするコンパイルプログラム。
A compilation program that generates an execution program by compiling a source program,
The compile program is stored in a computer.
Debug generated by analyzing a program element that is the output target of the output instruction based on structured data representing the structure of the source program when the source program to be compiled includes an instruction to output debug information A first generation process for generating an execution program including an instruction for outputting information;
A compile program, wherein a second generation process for generating an execution program including an instruction for determining whether or not the execution program can be executed is executed as a compile process result of the source program.
ソースプログラムをコンパイル処理することにより実行プログラムを生成するコンパイルプログラムを記録する記録媒体であって、
前記コンパイルプログラムは、コンピュータに、
コンパイル処理対象のソースプログラムにデバッグ情報の出力指示が含まれる場合に、前記ソースプログラムの構造を表す構造化データに基づいて、前記出力指示の出力対象であるプログラム要素を解析することにより生成したデバッグ情報を出力させる命令を含む実行プログラムを生成する第1の生成処理と、
前記ソースプログラムのコンパイル処理結果として、前記実行プログラムの実行可否を判定する命令を含む実行プログラムを生成する第2の生成処理とを実行させる
ことを特徴とする記録媒体。
A recording medium for recording a compile program for generating an execution program by compiling a source program,
The compile program is stored in a computer.
Debug generated by analyzing a program element that is the output target of the output instruction based on structured data representing the structure of the source program when the source program to be compiled includes an instruction to output debug information A first generation process for generating an execution program including an instruction for outputting information;
A recording medium, wherein a second generation process for generating an execution program including an instruction for determining whether or not the execution program can be executed is executed as a compile process result of the source program.
JP2011220574A 2011-10-05 2011-10-05 Information processing system, information processing method, information processing program, and recording medium Expired - Fee Related JP5974444B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2011220574A JP5974444B2 (en) 2011-10-05 2011-10-05 Information processing system, information processing method, information processing program, and recording medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2011220574A JP5974444B2 (en) 2011-10-05 2011-10-05 Information processing system, information processing method, information processing program, and recording medium

Publications (2)

Publication Number Publication Date
JP2013080406A true JP2013080406A (en) 2013-05-02
JP5974444B2 JP5974444B2 (en) 2016-08-23

Family

ID=48526721

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2011220574A Expired - Fee Related JP5974444B2 (en) 2011-10-05 2011-10-05 Information processing system, information processing method, information processing program, and recording medium

Country Status (1)

Country Link
JP (1) JP5974444B2 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2017174443A (en) * 2013-07-31 2017-09-28 日本電信電話株式会社 Utterance sentence generation device, method and program thereof
JP2020537228A (en) * 2017-10-10 2020-12-17 インターナショナル・ビジネス・マシーンズ・コーポレーションInternational Business Machines Corporation Abstraction and portability for intent recognition

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH06168111A (en) * 1992-11-30 1994-06-14 Fuji Facom Corp System for automatically generating debugged statement
JPH11110256A (en) * 1997-10-06 1999-04-23 Toshiba Corp Device and method for debugging program, and computer readable recording medium recorded with the method for the same
JP2000207246A (en) * 1999-01-13 2000-07-28 Toshiba Corp Debugging support device, method therefor and recording medium recorded with softwater for supporting debugging
JP2002230065A (en) * 2001-02-02 2002-08-16 Toshiba Corp System lsi developing device and method
JP2004280476A (en) * 2003-03-17 2004-10-07 Matsushita Electric Ind Co Ltd Program development device and program development program
JP2006031331A (en) * 2004-07-15 2006-02-02 Mitsubishi Electric Corp Computer for executing program conversion, method for executing program conversion, and program

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH06168111A (en) * 1992-11-30 1994-06-14 Fuji Facom Corp System for automatically generating debugged statement
JPH11110256A (en) * 1997-10-06 1999-04-23 Toshiba Corp Device and method for debugging program, and computer readable recording medium recorded with the method for the same
JP2000207246A (en) * 1999-01-13 2000-07-28 Toshiba Corp Debugging support device, method therefor and recording medium recorded with softwater for supporting debugging
JP2002230065A (en) * 2001-02-02 2002-08-16 Toshiba Corp System lsi developing device and method
JP2004280476A (en) * 2003-03-17 2004-10-07 Matsushita Electric Ind Co Ltd Program development device and program development program
JP2006031331A (en) * 2004-07-15 2006-02-02 Mitsubishi Electric Corp Computer for executing program conversion, method for executing program conversion, and program

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2017174443A (en) * 2013-07-31 2017-09-28 日本電信電話株式会社 Utterance sentence generation device, method and program thereof
JP2020537228A (en) * 2017-10-10 2020-12-17 インターナショナル・ビジネス・マシーンズ・コーポレーションInternational Business Machines Corporation Abstraction and portability for intent recognition
JP7064274B2 (en) 2017-10-10 2022-05-10 インターナショナル・ビジネス・マシーンズ・コーポレーション Abstraction and portability for intent recognition

Also Published As

Publication number Publication date
JP5974444B2 (en) 2016-08-23

Similar Documents

Publication Publication Date Title
RU2668973C2 (en) Debugging native code by transitioning from execution in native mode to execution in interpreted mode
US7478366B2 (en) Debugger and method for debugging computer programs across multiple programming languages
US9411559B2 (en) Resolution of textual code in a graphical hierarchical model of a technical computing environment
JP5893038B2 (en) Compile-time boundary checking for user-defined types
US20110314337A1 (en) Method and Apparatus for Locating Input-Model Faults Using Dynamic Tainting
Chiş et al. Practical domain-specific debuggers using the Moldable Debugger framework
US20080250231A1 (en) Program code conversion apparatus, program code conversion method and recording medium
Bouchhima et al. Automatic instrumentation of embedded software for high level hardware/software co-simulation
Křoustek Retargetable analysis of machine code
Ardito et al. rust-code-analysis: A rust library to analyze and extract maintainability information from source codes
Anand Techniques to facilitate symbolic execution of real-world programs
Bouraqadi et al. Test-driven development for generated portable Javascript apps
JP5974444B2 (en) Information processing system, information processing method, information processing program, and recording medium
Marcozzi et al. Taming coverage criteria heterogeneity with LTest
Zeller The future of programming environments: Integration, synergy, and assistance
Pereira et al. An IOPT-net state-space generator tool
Wu et al. Unit testing for domain-specific languages
Culpepper et al. Debugging macros
Ročkai et al. A simulator for llvm bitcode
Rask et al. Decoupling of Core Analysis Support for Specification Languages from User Interfaces in Integrated Development Environments
JPH11110256A (en) Device and method for debugging program, and computer readable recording medium recorded with the method for the same
Kreindl et al. Debugging native extensions of dynamic languages
JP2014106770A (en) Type check device, type check method and type check program
Lilis et al. An Integrated Approach to Source Level Debugging and Compile Error Reporting in Metaprograms.
Kalkus An Interactive Visualisation for Definite Clause Grammars

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20140603

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20150213

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20150310

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20150511

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20151104

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20160104

TRDD Decision of grant or rejection written
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20160621

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20160704

R150 Certificate of patent or registration of utility model

Ref document number: 5974444

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150

LAPS Cancellation because of no payment of annual fees