JP2005174045A - Source program conversion device, source program conversion method, source program conversion program and program recording medium - Google Patents

Source program conversion device, source program conversion method, source program conversion program and program recording medium Download PDF

Info

Publication number
JP2005174045A
JP2005174045A JP2003414185A JP2003414185A JP2005174045A JP 2005174045 A JP2005174045 A JP 2005174045A JP 2003414185 A JP2003414185 A JP 2003414185A JP 2003414185 A JP2003414185 A JP 2003414185A JP 2005174045 A JP2005174045 A JP 2005174045A
Authority
JP
Japan
Prior art keywords
program
source program
interactive
routine
conversion
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
JP2003414185A
Other languages
Japanese (ja)
Inventor
Koichi Makita
廣一 牧田
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.)
Sharp Corp
Original Assignee
Sharp Corp
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 Sharp Corp filed Critical Sharp Corp
Priority to JP2003414185A priority Critical patent/JP2005174045A/en
Publication of JP2005174045A publication Critical patent/JP2005174045A/en
Pending legal-status Critical Current

Links

Images

Landscapes

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

Abstract

<P>PROBLEM TO BE SOLVED: To obtain debug information without using a debugger without reproducing a program when debugging, in a source program conversion device converting a source program to be debugged, a source program conversion method, a source program conversion program and a program recording medium. <P>SOLUTION: A source program conversion part 12 converts the source program 11 into a second program language to produce intermediate data 17, sequentially reads a processing program from the intermediate data 17, and adds an interactive debug routine calling instruction to produce a post-conversion source program 13. The source program conversion part 12 adds an interactive debug routine to the post-conversion source program 13. The post-conversion source program 13 obtained in this way is converted into an execution form file by a compiler 14, and is executed by a computer to perform a debug process. Accordingly, every time one processing program is executed, the interactive debug routine is executed interactively to an operator, and an analysis/execution process for a command inputted from the operator is performed. Thus, efficiency of debug operation is improved. <P>COPYRIGHT: (C)2005,JPO&NCIPI

Description

この発明は、デバッグ対象のソースプログラムを変換するソースプログラム変換装置、ソースプログラム変換方法、ソースプログラム変換プログラム、および、プログラム記録媒体に関する。   The present invention relates to a source program conversion apparatus, a source program conversion method, a source program conversion program, and a program recording medium for converting a source program to be debugged.

一般に、計算機で実行されるプログラムの開発は次のような流れで行われている。すなわち、先ず、計算機に実行させようとする処理がプログラム言語を用いて記述されたソースプログラムを作成する。通常、上記プログラム言語で記述されたソースプログラムは計算機で直接実行できないため、そのソースプログラムをコンパイラと呼ばれるソフトウエアによって、計算機で直接実行できる実行形式ファイルと呼ばれるものに変換する。そして、上記ソースプログラムの動作確認を、計算機上で上記実行形式ファイルを動作させることによって行う。   In general, a program executed on a computer is developed in the following flow. That is, first, a source program in which a process to be executed by a computer is described using a program language is created. Usually, since a source program described in the above programming language cannot be directly executed by a computer, the source program is converted into a so-called executable file that can be directly executed by a computer by software called a compiler. Then, the operation check of the source program is performed by operating the executable file on the computer.

こうして動作確認が行われた結果、上記ソースプログラムの動作がその作成者の意図したものと異なる場合には、上記ソースプログラムにバグ(不具合)があるとして、デバッグ(ソースプログラムのどの部分が不具合を発生させたかを調べて修正する作業)を行う。   If the operation of the source program is different from what the creator intended, as a result of checking the operation in this way, it is assumed that there is a bug (defect) in the source program, and debugging (which part of the source program has a defect) Check if it has occurred and correct it).

上記デバッグを行う場合には、デバッガと呼ばれるソフトウエア上で、不具合のある実行形式ファイルを動作させることによって行う。上記デバッガは、実行形式ファイルの任意の処理でその動作を停止させることができ、実行中の実行形式ファイルに相当するソースプログラム内の変数の値を表示することや、停止位置から1ステップずつ実行形式ファイルを動作させることなどができる。こうすることによって、上記ソースプログラム内の不具合の原因を特定することができるのである。   The debugging is performed by operating a faulty executable file on software called a debugger. The above-mentioned debugger can stop the operation by arbitrary processing of the executable file, display the value of the variable in the source program corresponding to the executable file being executed, and execute one step at a time from the stop position You can operate the format file. By doing so, the cause of the malfunction in the source program can be specified.

ところが、上記プログラム言語のなかには、その言語用のコンパイラは開発済みであっても、上記デバッガの開発が困難であるためにデバッガが未開発であり、デバッガを使用できない場合がある。このような場合には、当該プログラム言語で記述されたソースプログラムに関して、不具合の原因を特定するのが困難であるという問題がある。   However, among the programming languages described above, even if a compiler for the language has been developed, the debugger has not been developed because the development of the debugger is difficult, and the debugger may not be used. In such a case, there is a problem that it is difficult to specify the cause of the malfunction in the source program described in the program language.

そのために、上記デバッガを使用せずにデバッグを行うことができるプログラム生産システムが提案されている(例えば、特許文献1(特開平5‐224908号公報)参照)。このプログラム生産システムにおいては、図7に示すように、ソースプログラムを実行形式ファイル(オブジェクトファイル)に変換するコンパイラ2に、ソースプログラム1へのデバッグルーチンの追加の要否を判定するデバッグルーチン追加判定手段7と、追加すべきと判定されたソースプログラムに最も適したデバッグルーチンを生成するデバッグルーチン生成手段8と、生成されたデバッグルーチンのプログラムへの埋め込みを行うデバッグルーチン埋め込み手段10とを有するデバッグルーチン付加手段4を設けている。   Therefore, a program production system that can perform debugging without using the debugger has been proposed (see, for example, Patent Document 1 (Japanese Patent Laid-Open No. 5-224908)). In this program production system, as shown in FIG. 7, it is determined whether or not a debug routine should be added to the source program 1 for the compiler 2 that converts the source program into an executable file (object file). Debug having means 7, debug routine generation means 8 for generating a debug routine most suitable for the source program determined to be added, and debug routine embedding means 10 for embedding the generated debug routine in the program Routine adding means 4 is provided.

上記構成を有するプログラム生産システムは、以下のように動作する。すなわち、コンパイラ2は、文法解析手段5と翻訳手段6を用いて、読み込んだソースプログラム1の文法解析およびコードの変換処理を行う。その際に、翻訳手段6内でデバッグルーチンの追加が認められた場合には、デバッグルーチン追加判定手段7が起動される。そして、デバッグルーチン追加判定手段7によって、どのようなデバッグルーチンが最も相応しいかが判断されてデバッグルーチン生成手段8が起動される。   The program production system having the above configuration operates as follows. That is, the compiler 2 uses the grammar analysis means 5 and the translation means 6 to perform grammar analysis and code conversion processing of the read source program 1. At this time, if the addition of the debug routine is recognized in the translation means 6, the debug routine addition determination means 7 is activated. Then, the debug routine addition judging means 7 judges what kind of debug routine is most suitable, and the debug routine generating means 8 is activated.

そうすると、上記デバッグルーチン生成手段8は、上記デバッグルーチン追加判定手段7によって判断されたデバッグルーチンの種類(例えば、関数に関するものやディスク等の資源に対するアクセスに関するもの等)およびデバッグルーチンデータベース9に基づいて、当該ソースプログラム1に最も適しているデバッグルーチンを生成する。そして、デバッグルーチン埋め込み手段10によって、翻訳手段6が現在生成中のオブジェクトモジュール3に、このデバッグルーチン生成手段8によって生成されたデバッグルーチンが埋め込まれる。こうして生成されたオブジェクトモジュール3は、リンカによってリンクされてロードモジュール(目的プログラム)が生成される。   Then, the debug routine generation means 8 is based on the type of debug routine (for example, related to functions or access to resources such as a disk) determined by the debug routine addition determination means 7 and the debug routine database 9. A debug routine most suitable for the source program 1 is generated. Then, the debug routine embedded means 10 embeds the debug routine generated by the debug routine generation means 8 in the object module 3 currently being generated by the translation means 6. The object module 3 generated in this way is linked by the linker to generate a load module (target program).

こうして生成されたロードモジュールは、上記ソースプログラム1をコンパイルして得られてリンクされたプログラム本体と、各プログラム本体間に挿入されたデバッグルーチンと、から構成されている。そして、このロードモジュールをデバッグする際には、計算機によって、ロードモジュールの先頭からプログラム本体とデバッグルーチンとが交互に順次実行される。そして、各デバッグルーチンを実行した際に得られたデバッグ情報は、ファイルあるいはメモリ領域のデバッグ情報格納領域に蓄えられてユーザに提供される。こうして、上記デバッガを使用することなく、デバッグ情報が得られるのである。   The load module generated in this way is composed of a program body obtained by compiling the source program 1 and linked, and a debug routine inserted between the program bodies. When debugging this load module, the computer executes the program body and the debug routine alternately and sequentially from the beginning of the load module. The debug information obtained when each debug routine is executed is stored in the debug information storage area of the file or memory area and provided to the user. Thus, debug information can be obtained without using the debugger.

このように、上記特許文献1に開示されたプログラム生産システムにおいては、デバッグ時に上記デバッグ情報を生成してデバッグ情報格納領域に格納するようなデバッグルーチンを、プログラム生産システムの動作時に静的(出来上がったロードモジュールの実行時に変化しない状態)にロードモジュールへ埋め込むようにしている。そのために、予め不具合の原因が推測できる場合にはそれに見合ったデバッグ情報が得られるデバッグルーチンを埋め込むことができ、短時間で不具合の原因を特定することができるのである。   As described above, in the program production system disclosed in Patent Document 1, a debug routine that generates the debug information at the time of debugging and stores it in the debug information storage area is statically (completed) during the operation of the program production system. Embedded in the load module). Therefore, when the cause of the failure can be estimated in advance, a debugging routine for obtaining debug information corresponding to the cause can be embedded, and the cause of the failure can be specified in a short time.

しかしながら、上記特許文献1に開示されたプログラム生産システムには、以下のような問題がある。すなわち、このプログラム生産システムを利用して、上記デバッグルーチンが埋め込まれたロードモジュールのデバッグを計算機上で実行した結果、得られたデバッグ情報では不具合が特定できなかった場合には、再度本プログラム生産システムを利用して、さらに詳しく不具合の原因を調べるためのデバッグルーチンが埋め込まれたロードモジュールを作成する必要がある。   However, the program production system disclosed in Patent Document 1 has the following problems. In other words, if this program production system is used to debug a load module in which the above debugging routine is embedded on a computer, and the obtained debug information cannot identify a problem, the program production is performed again. It is necessary to create a load module in which a debugging routine for investigating the cause of the failure in more detail is embedded using the system.

したがって、不具合の原因が特定できない場合には、上記ロードモジュール(オブジェクトモジュール3)にデバッグルーチンを埋め込む処理を試行錯誤しながら変更して、何度も上記ロードモジュールを作り直す必要があり、デバッグ作業の効率が悪くなると言う問題がある。
特開平5‐224908号公報
Therefore, if the cause of the failure cannot be identified, it is necessary to change the process of embedding the debug routine in the load module (object module 3) through trial and error, and recreate the load module many times. There is a problem that efficiency decreases.
JP-A-5-224908

そこで、この発明の課題は、デバッガを使用することなく且つデバッグの際にプログラムを作り直すことなくデバッグ情報を得ることを可能にするソースプログラム変換装置、ソースプログラム変換方法、ソースプログラム変換プログラム、および、プログラム記録媒体を提供することにある。   Accordingly, an object of the present invention is to provide a source program conversion device, a source program conversion method, a source program conversion program, and a source program conversion program that can obtain debug information without using a debugger and without recreating a program at the time of debugging, and It is to provide a program recording medium.

上記課題を解決するため、この発明のソースプログラム変換装置は、デバッグ対象のソースプログラムにデバッグ処理を行うためのデバッグルーチンを追加するソースプログラム変換装置において、第1プログラム言語で記述された第1ソースプログラムを第2プログラム言語による記述に変換し,中間データとして出力するプログラム言語変換手段と、上記中間データから上記第1ソースプログラム内の1つのステートメントに相当する処理プログラムを処理順序に従って読み出し,この読み出した各処理プログラムに対話的デバッグルーチン呼出命令を追加して,第2プログラム言語の文法に従って第2ソースプログラムとして出力する対話的デバッグルーチン呼出命令追加手段と、上記対話的デバッグルーチン呼出命令によって起動されると共に,上記第2プログラム言語で記述されて,デバッグ作業者によって入力されるコマンドを受けて次に行うべき処理を決定することが可能な対話的デバッグルーチンを,上記第2ソースプログラムに追加する対話的デバッグルーチン追加手段を備えたことを特徴としている。   In order to solve the above problems, a source program conversion apparatus according to the present invention is a source program conversion apparatus for adding a debugging routine for performing a debugging process to a source program to be debugged. Program language conversion means for converting the program into a description in the second program language and outputting it as intermediate data, and reading out the processing program corresponding to one statement in the first source program from the intermediate data in accordance with the processing order. An interactive debug routine call instruction adding means for adding an interactive debug routine call instruction to each processing program and outputting it as a second source program in accordance with the grammar of the second program language, and activated by the interactive debug routine call instruction. Ru In both cases, an interactive debugging routine written in the second program language and receiving a command input by a debug operator and capable of determining a process to be performed next is added to the second source program. It is characterized by providing a means for adding a debugging routine.

上記構成によれば、最終的に得られる第2ソースプログラムには、上記第1ソースプログラムの各ステートメントに相当する各処理プログラムと夫々の処理プログラムに追加された対話的デバッグルーチン呼出命令とが交互に配置されると共に、上記夫々の対話的デバッグルーチン呼出命令によって起動される一つの対話的デバッグルーチンが設けられている。そして、上記対話的デバッグルーチンは、デバッグ作業者によって入力されるコマンドを受けて次に行うべき処理を決定することが可能になっている。   According to the above configuration, in the finally obtained second source program, each processing program corresponding to each statement of the first source program and an interactive debug routine call instruction added to each processing program are alternately displayed. And an interactive debug routine that is activated by each of the above interactive debug routine call instructions. The interactive debug routine can determine a process to be performed next in response to a command input by a debug operator.

したがって、上記対話的デバッグルーチン呼出命令および対話的デバッグルーチンが追加された第2ソースプログラムを実行形式ファイルに変換して、計算機によって実行することによって、上記第2ソースプログラム中の各対話的デバッグルーチン呼出命令が実行される毎に、同一の対話的デバッグルーチンが起動されることになる。そして、対話的デバッグルーチンが実行されるに際して、デバッグ作業者によってコマンドが入力された場合には、この入力コマンドに応じて次に行うべき処理が決定される。   Therefore, by converting the second source program to which the interactive debug routine calling instruction and the interactive debug routine are added into an executable file and executing it by the computer, each interactive debug routine in the second source program is executed. Each time a call instruction is executed, the same interactive debug routine will be invoked. When a command is input by the debug operator when the interactive debug routine is executed, a process to be performed next is determined according to the input command.

したがって、デバッグ作業者は、計算機によって現在実行中の処理プログラムに応じてソースプログラムの不具合の原因を特定できるようなコマンドを入力するだけで、的確なデバッグ情報を得ることができるのである。その結果、不具合の原因を特定できるまで試行錯誤的に追加するデバッグルーチンを変更する必要が無く、デバッグ作業の効率を飛躍的に向上できるである。   Therefore, the debug operator can obtain accurate debug information only by inputting a command that can identify the cause of the malfunction of the source program in accordance with the processing program currently being executed by the computer. As a result, it is not necessary to change the debug routine to be added on a trial and error basis until the cause of the failure can be identified, and the efficiency of debugging work can be dramatically improved.

さらに、上記プログラム言語変換手段によって、上記第1プログラム言語で記述された第1ソースプログラムを第2プログラム言語に変換して、中間データを生成するようにしている。したがって、上記第1プログラム言語で記述された第1ソースプログラムをそのまま実行形式ファイルに変換するコンパイラを必要とはしない。そのために、上記第1プログラム言語用のデバッガのみならず第1プログラム言語用のコンパイラも未開発である場合には、既にコンパイラが開発されているプログラム言語を上記第2プログラム言語として選択することによって、的確にデバッグ処理を行うことができるのである。   Further, the program language conversion means converts the first source program described in the first program language into the second program language to generate intermediate data. Therefore, there is no need for a compiler that converts the first source program described in the first program language as it is into an executable file. Therefore, when not only the debugger for the first program language but also the compiler for the first program language are not developed, the program language for which the compiler has already been developed is selected as the second program language. Therefore, the debugging process can be performed accurately.

また、1実施例のソースプログラム変換装置では、上記対話的デバッグルーチンには、当該対話的デバッグルーチンに停止条件が設定されているか否かを判定し、設定されている場合には上記第2ソースプログラムの実行を停止する停止条件判定処理部が設けられている。   In the source program conversion apparatus of one embodiment, the interactive debug routine determines whether or not a stop condition is set in the interactive debug routine. If the stop condition is set, the second source is converted. A stop condition determination processing unit for stopping execution of the program is provided.

この実施例によれば、上記対話的デバッグルーチン呼出命令および対話的デバッグルーチンが追加された第2ソースプログラムを実行形式ファイルに変換して計算機によって実行する際に、上記第2ソースプログラム中の対話的デバッグルーチン呼出命令によって上記対話的デバッグルーチンが起動されて実行されると、当該対話的デバッグルーチンに停止条件が設定されているか否かが判定され、設定されていると判定された場合には当該第2ソースプログラムの実行が停止される。   According to this embodiment, when the second source program to which the interactive debug routine call instruction and the interactive debug routine are added is converted into an executable file and executed by the computer, the dialog in the second source program is executed. When the interactive debug routine is started and executed by a call instruction for a dynamic debug routine, it is determined whether or not a stop condition is set for the interactive debug routine. Execution of the second source program is stopped.

また、1実施例のソースプログラム変換装置では、上記対話的デバッグルーチンには、デバッグ作業者によって上記停止条件を設定するコマンドが入力された際に、当該対話的デバッグルーチンに停止条件を設定する停止条件設定処理部が設けられている。   In the source program conversion apparatus of one embodiment, when the command for setting the stop condition is input to the interactive debug routine by the debug operator, the stop that sets the stop condition in the interactive debug routine is executed. A condition setting processing unit is provided.

この実施例によれば、上記対話的デバッグルーチン呼出命令および対話的デバッグルーチンが追加された第2ソースプログラムを実行形式ファイルに変換して計算機によって実行する際に、上記第2ソースプログラム中の対話的デバッグルーチン呼出命令によって上記対話的デバッグルーチンが起動される。そして、デバッグ作業者によって上記停止条件を設定するコマンドが入力されると、上記停止条件設定処理部によって当該対話的デバッグルーチンに停止条件が設定される。その結果、次回以降の対話的デバッグルーチンの実行時であって、上記停止条件判定処理部によって停止条件が設定されていると判定され、且つ、その停止条件が当該第2ソースプログラムにおける現在の行での停止である場合には、当該第2ソースプログラムの実行が停止される。   According to this embodiment, when the second source program to which the interactive debug routine call instruction and the interactive debug routine are added is converted into an executable file and executed by the computer, the dialog in the second source program is executed. The interactive debug routine is started by a static debug routine call instruction. When a debug operator inputs a command for setting the stop condition, the stop condition is set in the interactive debug routine by the stop condition setting processing unit. As a result, it is determined that the stop condition is set by the stop condition determination processing unit when the interactive debug routine is executed next time, and the stop condition is determined to be the current line in the second source program. In the case of the stop at, the execution of the second source program is stopped.

また、1実施例のソースプログラム変換装置では、上記対話的デバッグルーチンには、デバッグ作業者によって上記停止条件を変更するコマンドが入力された際に、既に当該対話的デバッグルーチンに設定されている停止条件を変更する停止条件変更処理部が設けられている。   In the source program conversion apparatus of one embodiment, when the command for changing the stop condition is input to the interactive debug routine by the debug operator, the stop already set in the interactive debug routine is performed. A stop condition change processing unit for changing the conditions is provided.

この実施例によれば、上記対話的デバッグルーチン呼出命令および対話的デバッグルーチンが追加された第2ソースプログラムを実行形式ファイルに変換して計算機によって実行する際に、上記第2ソースプログラム中の対話的デバッグルーチン呼出命令によって上記対話的デバッグルーチンが起動される。そして、デバッグ作業者によって上記停止条件を変更するコマンドが入力されると、上記停止条件変更処理部によって、既に当該対話的デバッグルーチンに設定されている停止条件が変更される。その結果、上記変更前の停止条件によって指定されていた当該第2ソースプログラムの行において上記対話的デバッグルーチンが実行された際には、上記停止条件判定処理部によって停止条件が設定されていないと判定されて当該第2ソースプログラムの実行が続行される。   According to this embodiment, when the second source program to which the interactive debug routine call instruction and the interactive debug routine are added is converted into an executable file and executed by the computer, the dialog in the second source program is executed. The interactive debug routine is started by a static debug routine call instruction. When the debug operator inputs a command for changing the stop condition, the stop condition already set in the interactive debug routine is changed by the stop condition change processing unit. As a result, when the interactive debug routine is executed in the line of the second source program specified by the stop condition before the change, the stop condition is not set by the stop condition determination processing unit. The determination is made and the execution of the second source program is continued.

また、この発明のソースプログラム変換方法は、デバッグの対象のソースプログラムにデバッグ処理を行うためのデバッグルーチンを追加するソースプログラム変換方法において、第1プログラム言語で記述された第1ソースプログラムを第2プログラム言語による記述に変換して中間データとして出力し、上記中間データから上記第1ソースプログラム内の1つのステートメントに相当する処理プログラムを処理順序に従って読み出し,この読み出した各処理プログラムに対話的デバッグルーチン呼出命令を追加して,第2プログラム言語の文法に従って第2ソースプログラムとして出力し、上記対話的デバッグルーチン呼出命令によって起動されると共に,上記第2プログラム言語で記述されて,デバッグ作業者によって入力されるコマンドを受けて次に行うべき処理を決定することが可能な対話的デバッグルーチンを,上記第2ソースプログラムに追加することを特徴としている。   According to another aspect of the present invention, there is provided a source program conversion method in which a debug routine for performing a debugging process is added to a source program to be debugged, wherein a first source program written in a first program language is converted into a second program. Converted to a description in a program language and output as intermediate data, reads a processing program corresponding to one statement in the first source program from the intermediate data according to the processing order, and interactively debugs each read processing program A call instruction is added and output as a second source program in accordance with the grammar of the second program language. The program is started by the interactive debug routine call instruction and written in the second program language and input by the debug operator. Command It is characterized in that an interactive debugging routine that can receive and determine the next processing to be performed is added to the second source program.

上記構成によれば、第2ソースプログラムに追加された対話的デバッグルーチンが計算機によって実行されるに際して、デバッグ作業者は、現在実行中の処理プログラムに応じてソースプログラムの不具合の原因を特定できるようなコマンドを入力するだけで、的確なデバッグ情報を得ることができる。したがって、不具合の原因を特定できるまで試行錯誤的に追加するデバッグルーチンを変更する必要が無く、デバッグ作業の効率を飛躍的に向上できる。   According to the above configuration, when the interactive debug routine added to the second source program is executed by the computer, the debug operator can specify the cause of the malfunction of the source program according to the currently executing processing program. You can get accurate debugging information just by entering a simple command. Therefore, it is not necessary to change the debugging routine to be added by trial and error until the cause of the failure can be identified, and the efficiency of debugging work can be dramatically improved.

さらに、上記第1プログラム言語で記述された第1ソースプログラムをそのまま実行形式ファイルに変換するコンパイラを必要とはしない。そのために、上記第1プログラム言語用のコンパイラが未開発である場合には、既にコンパイラが開発されているプログラム言語を上記第2プログラム言語として選択することによって、的確にデバッグ処理を行うことができる。   Furthermore, it is not necessary to have a compiler that converts the first source program described in the first program language as it is into an executable file. Therefore, when the compiler for the first programming language has not been developed, the debugging process can be accurately performed by selecting the programming language for which the compiler has already been developed as the second programming language. .

また、この発明のソースプログラム変換プログラムは、コンピュータを、この発明のソースプログラム変換装置におけるプログラム言語変換手段,対話的デバッグルーチン呼出命令追加手段および対話的デバッグルーチン追加手段として機能させる。   The source program conversion program of the present invention causes a computer to function as program language conversion means, interactive debug routine call instruction adding means, and interactive debug routine adding means in the source program conversion apparatus of the present invention.

上記構成によれば、第1プログラム言語で記述された第1ソースプログラムを、実行形式ファイルに変換して、計算機によって実行することによって、デバッガを使用することなく且つデバッグの際にプログラムを作り直すことなくデバッグ情報を得ることができるのでデバッグ作業の効率を飛躍的に向上でき、上記第1プログラム言語用のコンパイラが未開発の場合でも的確にデバッグ処理を行うことができる、第2ソースプログラムに変換することができる。   According to the above configuration, the first source program described in the first program language is converted into an executable format file and executed by the computer, thereby re-creating the program without using the debugger and at the time of debugging. Since the debugging information can be obtained without any problem, the efficiency of debugging work can be dramatically improved, and even when the compiler for the first programming language has not been developed, it can be accurately debugged and converted to a second source program. can do.

また、この発明のプログラム記録媒体は、この発明のソースプログラム変換プログラムが記録されている。   The program recording medium of the present invention records the source program conversion program of the present invention.

上記構成によれば、コンピュータによって読み出して実行することによって、第1プログラム言語で記述された第1ソースプログラムを、実行形式ファイルに変換して計算機上で実行することによって、デバッガを使用することなく且つデバッグの際にプログラムを作り直すことなくデバッグ情報を得ることができるのでデバッグ作業の効率を飛躍的に向上でき、上記第1プログラム言語用のコンパイラが未開発の場合でも的確にデバッグ処理を行うことができる、第2ソースプログラムに変換することができる。   According to the above configuration, the first source program written in the first program language is converted into an executable format file by being read and executed by the computer, and executed on the computer without using a debugger. In addition, debugging information can be obtained without re-creating a program at the time of debugging, so that the efficiency of debugging work can be greatly improved, and even when the compiler for the first programming language is not yet developed, the debugging process can be performed accurately. Can be converted into a second source program.

以上より明らかなように、この発明によれば、第1プログラム言語で記述された第1ソースプログラムに基づいて、第1ソースプログラムの各ステートメントに相当する各処理プログラムと夫々の処理プログラムに追加された対話的デバッグルーチン呼出命令とが交互に配置されると共に、上記夫々の対話的デバッグルーチン呼出命令によって呼び出されて起動される一つの対話的デバッグルーチンが設けられており、上記対話的デバッグルーチンは、デバッグ作業者によって入力されるコマンドを受けて次に行うべき処理を決定することが可能になっている、第2ソースプログラムを得ることができる。   As is apparent from the above, according to the present invention, each processing program corresponding to each statement of the first source program and each processing program are added based on the first source program described in the first program language. The interactive debug routine call instructions are alternately arranged, and one interactive debug routine that is invoked and activated by each of the interactive debug routine call instructions is provided. The second source program can be obtained which receives the command input by the debug operator and can determine the processing to be performed next.

したがって、得られた上記第2ソースプログラムを実行形式ファイルに変換して計算機によって実行することによって、デバッガを使用することなく且つデバッグの際にプログラムを作り直すことなくデバッグ情報を得ることができ、デバッグ作業の効率を飛躍的に向上でき、上記第1プログラム言語用のコンパイラが未開発の場合でも的確にデバッグ処理を行うことができる。   Therefore, by converting the obtained second source program into an executable format file and executing it by a computer, debug information can be obtained without using a debugger and without recreating the program at the time of debugging. The work efficiency can be dramatically improved, and even when the compiler for the first programming language is not yet developed, the debugging process can be performed accurately.

以下、この発明を図示の実施の形態により詳細に説明する。図1は、本実施の形態のソースプログラム変換装置における機能的構成を示すブロック図である。図1において、ソースプログラム格納部11には、第1プログラム言語で記述されたソースプログラムが格納されている。尚、以下においては、説明の便宜上、ソースプログラム格納部11に格納された各ソースプログラムに対しても、ソースプログラム格納部11と同じ符号「11」を付加することにする。また、変換後ソースプログラム格納部13には、ソースプログラム変換部12によって変換されると共に、第2プログラム言語で記述された変換後ソースプログラムが格納される。尚、以下においては、変換後ソースプログラム格納部13に格納された各変換後ソースプログラムに対しても、変換後ソースプログラム格納部13と同じ符号「13」を付加することにする。また、コンパイラ14は、変換後ソースプログラム13を実行形式ファイルに変換して実行形式ファイル格納部15に格納する。こうして得られた実行形式ファイルは、図示しない計算機上で実行される。   Hereinafter, the present invention will be described in detail with reference to the illustrated embodiments. FIG. 1 is a block diagram showing a functional configuration of the source program conversion apparatus according to the present embodiment. In FIG. 1, the source program storage unit 11 stores a source program written in the first program language. In the following, for convenience of explanation, the same reference numeral “11” as that of the source program storage unit 11 is added to each source program stored in the source program storage unit 11. The converted source program storage unit 13 stores the converted source program written in the second program language while being converted by the source program converting unit 12. In the following description, the same code “13” as that of the converted source program storage unit 13 is added to each converted source program stored in the converted source program storage unit 13. Further, the compiler 14 converts the converted source program 13 into an executable format file and stores it in the executable format file storage unit 15. The executable file thus obtained is executed on a computer (not shown).

上記ソースプログラム変換部12は、プログラム言語変換手段16,中間データ格納部17,対話的デバッグルーチン呼出命令追加手段18および対話的デバッグルーチン追加手段19から構成される。   The source program conversion unit 12 includes a program language conversion unit 16, an intermediate data storage unit 17, an interactive debug routine call instruction addition unit 18, and an interactive debug routine addition unit 19.

上記プログラム言語変換手段16は、上記ソースプログラム格納部11から読み出されたソースプログラム11を、既知の方法によって第2プログラム言語の処理プログラムに変換し、中間データとして中間データ格納部17に格納する。尚、以下においては、中間データ格納部17に格納された中間データに対しても、中間データ格納部17と同じ符号「17」を付加することにする。対話的デバッグルーチン呼出命令追加手段18は、中間データ格納部17から、ソースプログラム11内の1つのステートメントに対応する処理プログラムを処理順序に従って読み出し、この読み出された処理プログラムに対話的デバッグルーチンを呼び出す命令(第2プログラム言語で記述された対話的デバッグルーチン呼出命令)を追加して、第2プログラム言語の文法に従って変換後ソースプログラム格納部13に格納する。対話的デバッグルーチン追加手段19は、第2プログラム言語で記述された対話的デバッグルーチンを、変換後ソースプログラム13に追加する。   The program language conversion means 16 converts the source program 11 read from the source program storage unit 11 into a processing program of the second program language by a known method, and stores it in the intermediate data storage unit 17 as intermediate data. . In the following description, the same code “17” as that of the intermediate data storage unit 17 is added to the intermediate data stored in the intermediate data storage unit 17. The interactive debug routine call instruction adding means 18 reads out a processing program corresponding to one statement in the source program 11 from the intermediate data storage unit 17 in accordance with the processing order, and an interactive debugging routine is added to the read processing program. An instruction to be called (an interactive debug routine call instruction written in the second program language) is added and stored in the converted source program storage unit 13 in accordance with the grammar of the second program language. The interactive debug routine adding means 19 adds an interactive debug routine written in the second program language to the converted source program 13.

ここで、上記機能的構成を有するソースプログラム変換装置の具体的ハードウェア構成は、後述する各種の処理を実行するプログラムを含む各種プログラムを記憶するプログラムメモリ、各種情報を記憶するデータメモリ、インターネット等の通信ネットワークと接続する通信I/F、入力装置、出力装置、表示装置、外部記録媒体がセットされてこの外部記録媒体をアクセスする外部補助記憶装置、上記プログラムメモリ,データメモリ,通信I/F,入力装置,出力装置,表示装置および外部補助記憶装置等を制御して、プログラム言語の変換や対話的デバッグルーチン呼出命令追加や対話的デバッグルーチン追加等を実行するCPU(中央演算処理装置)等で成る。   Here, the specific hardware configuration of the source program conversion device having the above functional configuration includes a program memory for storing various programs including programs for executing various processes described later, a data memory for storing various information, the Internet, and the like. Communication I / F for connecting to a communication network, an input device, an output device, a display device, an external auxiliary storage device in which an external recording medium is set and accessing the external recording medium, the program memory, data memory, communication I / F CPU (Central Processing Unit) that controls program language conversion, interactive debug routine call instruction addition, interactive debug routine addition, etc. by controlling input devices, output devices, display devices, external auxiliary storage devices, etc. It consists of

すなわち、上記プログラム言語変換手段16,対話的デバッグルーチン呼出命令追加手段18,対話的デバッグルーチン追加手段19およびコンパイラ14は上記CPUで構成され、ソースプログラム格納部11,中間データ格納部17,変換後ソースプログラム格納部13および実行形式ファイル格納部15は上記データメモリや外部補助記憶装置で構成されるのである。また、上記CPUは、上述した各部16,18,19,14による本実施の形態に係る処理動作の他に、演算・判断処理,計時処理および入出力処理等の各種の処理動作をも行うようになっている。   That is, the program language conversion means 16, the interactive debug routine call instruction addition means 18, the interactive debug routine addition means 19 and the compiler 14 are constituted by the CPU, and the source program storage section 11, the intermediate data storage section 17, and the post-conversion The source program storage unit 13 and the execution format file storage unit 15 are composed of the data memory and the external auxiliary storage device. Further, the CPU performs various processing operations such as calculation / judgment processing, timing processing, and input / output processing in addition to the processing operations according to the present embodiment by the units 16, 18, 19, and 14 described above. It has become.

図2は、上記ソースプログラム変換部12によって実行されるソースプログラム変換処理動作のフローチャートである。以下、図2に従って、ソースプログラム変換処理動作について詳細に説明する。   FIG. 2 is a flowchart of the source program conversion processing operation executed by the source program conversion unit 12. Hereinafter, the source program conversion processing operation will be described in detail with reference to FIG.

ステップS1で、上記プログラム言語変換手段16によって、ソースプログラム格納部11から上記第1プログラム言語で記述されたソースプログラム11が読み出される。そして、上記第2プログラム言語の処理プログラムに変換され、中間データ17として中間データ格納部17に格納される。   In step S1, the program language conversion means 16 reads the source program 11 described in the first program language from the source program storage unit 11. Then, it is converted into the processing program of the second program language and stored in the intermediate data storage unit 17 as intermediate data 17.

ステップS2で、上記対話的デバッグルーチン呼出命令追加手段18によって、中間データ格納部17からソースプログラム11における1つのステートメントに対応する処理プログラムが読み出される。さらに、ステップS3で、上記読み出された処理プログラムに対話的デバッグルーチン呼出命令が追加される。さらに、ステップS4で、上記呼出命令が追加された処理プログラムが、第2プログラム言語の文法に従って、変換後ソースプログラム格納部13に格納される。さらに、ステップS5で、中間データ格納部17に格納されている中間データ17中の総ての処理プログラムに対する処理が終了したか否かが判別される。その結果、中間データ格納部17に未処理の処理プログラムが残っている場合は、上記ステップS2に戻って、次の処理プログラムに対する処理に移行する。一方、中間データ格納部17に未処理の処理プログラムが残っていない場合は、ステップS6に進む。   In step S2, the processing program corresponding to one statement in the source program 11 is read from the intermediate data storage unit 17 by the interactive debug routine call instruction adding means 18. In step S3, an interactive debug routine call instruction is added to the read processing program. Further, in step S4, the processing program to which the call instruction is added is stored in the converted source program storage unit 13 in accordance with the grammar of the second program language. Further, in step S5, it is determined whether or not the processing for all the processing programs in the intermediate data 17 stored in the intermediate data storage unit 17 has been completed. As a result, if an unprocessed processing program remains in the intermediate data storage unit 17, the process returns to step S2 and proceeds to processing for the next processing program. On the other hand, if no unprocessed processing program remains in the intermediate data storage unit 17, the process proceeds to step S6.

ここで、上記プログラム言語変換手段16によるソースプログラム11の中間データ17への変換と、対話的デバッグルーチン呼出命令追加手段18による対話的デバッグルーチン呼出命令の追加とについて、具体例を上げて説明する。図3は、ソースプログラム11,中間データ17および対話的デバッグルーチン呼出命令が追加された変換後ソースプログラム13の具体例を示す。図3において、ソースプログラム11内のステートメント21,22が、プログラム言語変換手段16によって、第2プログラム言語の処理プログラム23,24に変換されて中間データ17が生成される。そして、対話的デバッグルーチン呼出命令追加手段18によって、中間データ17における処理プログラム23,24が1つずつ読み出され、第2プログラム言語で記述された対話的デバッグルーチン呼出命令25,26が追加されて、変換後ソースプログラム13として出力されるのである。   Here, the conversion of the source program 11 into the intermediate data 17 by the program language conversion means 16 and the addition of the interactive debug routine call instruction by the interactive debug routine call instruction addition means 18 will be described with specific examples. . FIG. 3 shows a specific example of the converted source program 13 to which the source program 11, the intermediate data 17 and the interactive debug routine call instruction are added. In FIG. 3, statements 21 and 22 in the source program 11 are converted into processing programs 23 and 24 of the second program language by the program language conversion means 16 to generate intermediate data 17. Then, the interactive debug routine call instruction adding means 18 reads out the processing programs 23 and 24 in the intermediate data 17 one by one, and adds interactive debug routine call instructions 25 and 26 described in the second program language. Thus, it is output as a source program 13 after conversion.

ステップS6で、上記対話的デバッグルーチン追加手段19によって、上記対話的デバッグルーチン呼出命令追加手段18からの対話的デバッグルーチン呼出命令の追加処理が終了した旨の情報を受けて、上記変換後ソースプログラム格納部13に格納された変換後ソースプログラム13に対して第2プログラム言語で記述された対話的デバッグルーチンが追加される。そうした後、ソースプログラム変換処理動作を終了する。   In step S6, the interactive debug routine adding means 19 receives the information indicating that the interactive debug routine call instruction adding process from the interactive debug routine call instruction adding means 18 is completed, and the converted source program An interactive debug routine written in the second program language is added to the converted source program 13 stored in the storage unit 13. After that, the source program conversion processing operation is terminated.

図4は、上記対話的デバッグルーチンの具体例を示す。対話的デバッグルーチンは上述したように第2プログラム言語で記述されており、その処理としては、停止条件判定処理部31,コマンド受付処理部32およびコマンド解析・実行処理部33がある。尚、34〜37は上記コマンドの解析結果に応じた実行を行う各処理部である。   FIG. 4 shows a specific example of the interactive debugging routine. As described above, the interactive debugging routine is described in the second program language, and the processing includes a stop condition determination processing unit 31, a command reception processing unit 32, and a command analysis / execution processing unit 33. Reference numerals 34 to 37 denote processing units that perform execution according to the analysis result of the command.

上述のようなソースプログラム変換処理動作によって生成された変換後ソースプログラム13の構造は、図5に示すようになる。図5において、41a〜41eは、プログラム言語変換手段16によって変換されたソースプログラム11の変換結果であり、一つ一つはソースプログラム11内の各ステートメントに対応した処理プログラムである。また、42a〜42dは、対話的デバッグルーチン呼出命令追加手段18によって追加された対話的デバッグルーチン呼出命令である。そして、43は、対話的デバッグルーチン追加手段19によって追加された対話的デバッグルーチンである。   The structure of the converted source program 13 generated by the source program conversion processing operation as described above is as shown in FIG. In FIG. 5, 41 a to 41 e are conversion results of the source program 11 converted by the program language conversion means 16, and each one is a processing program corresponding to each statement in the source program 11. 42a to 42d are interactive debug routine call instructions added by the interactive debug routine call instruction adding means 18. Reference numeral 43 denotes an interactive debug routine added by the interactive debug routine adding means 19.

上記構成を有する変換後ソースプログラム13は、コンパイラ14によって上記実行形式ファイルに変換され、計算機上において実行されることによってデバッグ処理が行われる。その場合における実行形式ファイルに変換された変換後ソースプログラム(以下、説明の都合上、実行形式ファイルに変換後の変換後ソースプログラムにも変換前の変換後ソースプログラム13と同じ符号「13」を付加することにする)に対する実行は、変換後ソースプログラム13における各ステートメントに対応した処理プログラム41a〜41eのうち1つのステートメントに対応する処理プログラム41が実行される毎に、実行された処理プログラム41に追加されている対話的デバッグルーチン呼出命令42が実行されて、同一の対話的デバッグルーチン43が呼び出される(つまり、起動される)のである。   The post-conversion source program 13 having the above configuration is converted into the execution format file by the compiler 14 and executed on the computer for debugging. In this case, the converted source program converted into an executable format file (hereinafter, for convenience of explanation, the same code “13” as that of the converted source program 13 before conversion is also applied to the converted source program after conversion into the executable format file. The processing program 41 is executed each time the processing program 41 corresponding to one statement is executed among the processing programs 41a to 41e corresponding to each statement in the converted source program 13. The interactive debug routine call instruction 42 added to the above is executed, and the same interactive debug routine 43 is called (that is, started).

次に、上記呼び出された対話的デバッグルーチン43による対話的デバッグ処理動作について説明する。図6は、上記対話的デバッグ処理動作のフローチャートである。以下、図4に示す対話的デバッグルーチンの具体例と図6に示すフローチャートとに従って、対話的デバッグ処理動作について具体的に説明する。ここで、「対話的に」とは、「デバッグ作業者によって入力されるコマンドを受けて次に行うべき処理を決定する」ことを意味する。変換後ソースプログラム13における処理プログラム41の実行中において、対話的デバッグルーチンが呼び出されると、上記対話的デバッグ処理動作がスタートする。   Next, the interactive debug processing operation by the called interactive debug routine 43 will be described. FIG. 6 is a flowchart of the interactive debug processing operation. Hereinafter, the interactive debug processing operation will be described in detail with reference to a specific example of the interactive debug routine shown in FIG. 4 and a flowchart shown in FIG. Here, “interactively” means “receiving a command input by a debug operator and determining a process to be performed next”. When the interactive debug routine is called during the execution of the processing program 41 in the post-conversion source program 13, the interactive debug processing operation starts.

ステップS11で、上記停止条件判定処理部31によって、ブレーク条件が判定される。つまり、対話的デバッグルーチン43に停止条件が設定されているか否かが判定される。さらに、ステップS12で、ブレーク条件の判定結果に従って、変換後ソースプログラム13に対する実行を現在の行で停止するか否かが判別される。その結果、現在の行で停止しない場合には、対話的デバッグ処理動作を終了して、次の処理プログラム41の実行にリターンする。一方、現在の行で停止する場合にはステップS13に進む。   In step S11, the stop condition determination processing unit 31 determines a break condition. That is, it is determined whether or not a stop condition is set in the interactive debug routine 43. Further, in step S12, it is determined whether or not to stop execution on the converted source program 13 at the current line according to the determination result of the break condition. As a result, if the current line is not stopped, the interactive debug processing operation is terminated, and the process returns to the execution of the next processing program 41. On the other hand, when stopping at the current line, the process proceeds to step S13.

尚、上記対話的デバッグルーチン43が呼び出される毎に変換後ソースプログラム13に対する実行を停止させる場合には、対話的デバッグルーチン43中に停止条件判定処理部31を設けなくても良い。その場合には、図6に示すフローチャートにおける上記ステップS11およびステップS12が無くなるため、対話的デバッグルーチン43に停止条件が設定されているか否かが関わらず、ステップS13に進むことになる。   If the execution of the converted source program 13 is stopped each time the interactive debug routine 43 is called, the stop condition determination processing unit 31 may not be provided in the interactive debug routine 43. In this case, since the above steps S11 and S12 in the flowchart shown in FIG. 6 are eliminated, the process proceeds to step S13 regardless of whether or not a stop condition is set in the interactive debug routine 43.

ステップS13で、上記コマンド受付処理部32によって、作業者からの入力コマンドが受け付けられる。ステップS14で、コマンド解析・実行処理部33によって、上記受け付けられたコマンドが解析・実行される。その場合、例えば、現在実行中の処理プログラム41(つまり、ソースプログラム11の現在のステートメント)中の変数の値を参照するコマンドが入力された場合には、コマンド解析・実行処理部33における「変数の表示」処理部34によって、現在実行中の処理プログラム41中の対応する変数の値が表示された後、ステップS15に進む。また、変換後ソースプログラム13の停止条件を設定するコマンドまたは停止条件を変更するコマンドが入力された場合には、コマンド解析・実行処理部33における「停止条件の設定」処理部35または「停止条件の変更」処理部36によって、対話的デバッグルーチン43に対して停止条件の設定または変更が行われた後、ステップS15に進む。また、変換後ソースプログラム13の実行を続行するコマンドが入力された場合には、コマンド解析・実行処理部33における「プログラム続行」処理部37によってそのままステップS15に進む。   In step S13, the command reception processing unit 32 receives an input command from an operator. In step S14, the command analysis / execution processing unit 33 analyzes and executes the received command. In this case, for example, when a command that refers to the value of a variable in the processing program 41 that is currently being executed (that is, the current statement of the source program 11) is input, After the “display of” processing unit 34 displays the value of the corresponding variable in the currently executing processing program 41, the process proceeds to step S15. In addition, when a command for setting a stop condition of the source program 13 after conversion or a command for changing the stop condition is input, a “stop condition setting” processing unit 35 or “stop condition” in the command analysis / execution processing unit 33 is input. After the stop condition is set or changed for the interactive debug routine 43 by the "change of" processing unit 36, the process proceeds to step S15. If a command for continuing the execution of the converted source program 13 is input, the “program continuation” processing unit 37 in the command analysis / execution processing unit 33 directly proceeds to step S15.

ステップS15で、上記コマンド解析・実行処理部33によって、上記ステップS14において実行された処理は「プログラム続行」であるか否かが判別される。その結果、プログラム続行である場合には、対話的デバッグ処理動作が終了されて、次の処理プログラム41の実行にリターンする。一方、プログラム続行でない場合には、上記ステップS13に戻って作業者からの次の入力コマンドが受け付けられる。こうして、作業者から上記変換後ソースプログラム13の実行を続行するコマンドが入力されるまでは、上記ステップS13およびステップS14が繰り返されるのである。   In step S15, the command analysis / execution processing unit 33 determines whether or not the processing executed in step S14 is “program continuation”. As a result, if the program is to be continued, the interactive debug processing operation is terminated, and the process returns to the execution of the next processing program 41. On the other hand, if the program is not continued, the process returns to step S13 to accept the next input command from the operator. Thus, steps S13 and S14 are repeated until the operator inputs a command to continue execution of the converted source program 13.

尚、上記変換後ソースプログラム13の実行を続行するコマンドが入力されて変換後ソースプログラム13の実行が再開されると、次に対話的デバッグルーチン呼出命令が実行されるまで変換後ソースプログラム13の実行が継続される。そして、上記対話的デバッグルーチン呼出命令により対話的デバッグルーチンが呼び出されて実行された場合に、当該対話的デバッグルーチンに上記停止条件が設定されていれば、変換後ソースプログラム13の実行が停止される。一方、上記停止条件が設定されていなければ、変換後ソースプログラム13は、次に停止条件が設定された対話的デバッグルーチンが呼び出されて実行されるまで、停止することなく実行されるのである。   When the command for continuing the execution of the converted source program 13 is input and the execution of the converted source program 13 is resumed, the converted source program 13 is executed until the next interactive debug routine call instruction is executed. Execution continues. Then, when the interactive debug routine is called and executed by the interactive debug routine call instruction, if the stop condition is set in the interactive debug routine, the execution of the converted source program 13 is stopped. The On the other hand, if the stop condition is not set, the converted source program 13 is executed without stopping until the next interactive debug routine in which the stop condition is set is called and executed.

以上のごとく、本実施の形態においては、上記ソースプログラム変換部12によって、ソースプログラム11を第2プログラム言語に変換して中間データ17を生成する。そして、ソースプログラム11内の各ステートメントに対応する処理プログラムを中間データ17から順次読み出し、対話的デバッグルーチン呼出命令を追加することによって、変換後ソースプログラム13を生成する。さらに、変換後ソースプログラム13に、上記第2プログラム言語で記述されると共に、停止条件判定処理部31,コマンド受付処理部32および各種入力コマンドの解析・実行処理を行うコマンド解析・実行処理部33が設けられた対話的デバッグルーチンを追加する。そして、対話的デバッグルーチン呼出命令および対話的デバッグルーチンが付加された変換後ソースプログラム13を実行形式ファイルに変換して計算機によって実行することによって、デバッグ処理を行うようにしている。   As described above, in the present embodiment, the source program conversion unit 12 converts the source program 11 into the second program language to generate the intermediate data 17. Then, a processing program corresponding to each statement in the source program 11 is sequentially read from the intermediate data 17 and an interactive debug routine call instruction is added to generate the converted source program 13. Further, the post-conversion source program 13 is described in the second program language, and also includes a stop condition determination processing unit 31, a command reception processing unit 32, and a command analysis / execution processing unit 33 that performs analysis / execution processing of various input commands. Add an interactive debugging routine provided with Then, the converted source program 13 to which the interactive debug routine calling instruction and the interactive debug routine are added is converted into an executable file and executed by a computer to perform debugging processing.

そして、計算機上で変換後ソースプログラム13を実行することによって、ソースプログラム11内の1つのステートメントに対応する処理プログラムが実行される毎に、対話的デバッグルーチンが作業者と対話的に実行されて、作業者によって入力されたコマンドの解析・実行処理が1つの対話的デバッグルーチンによって行われる。   Then, by executing the converted source program 13 on the computer, an interactive debug routine is executed interactively with the worker each time a processing program corresponding to one statement in the source program 11 is executed. The analysis / execution processing of the command input by the operator is performed by one interactive debug routine.

したがって、特定の実行処理用のデバッグルーチンを埋め込む特許文献1の場合のように、不具合の原因が特定できるまで変換後ソースプログラム13に試行錯誤的にデバッグルーチンを埋め込む処理を行う必要が無く、デバッグ作業の効率を向上できる。さらに、上記対話的デバッグルーチンは、作業者によって入力された種々のコマンドを解析して実行するので、デバッグ対象のソースプログラムにおける各ステートメントに応じたデバッグ情報を的確に得ることができるのである。   Therefore, unlike the case of Patent Document 1 in which a debugging routine for a specific execution process is embedded, it is not necessary to perform a process of embedding a debugging routine in the converted source program 13 by trial and error until the cause of the defect can be identified, and debugging. Work efficiency can be improved. Furthermore, since the interactive debug routine analyzes and executes various commands input by the operator, it is possible to accurately obtain debug information corresponding to each statement in the source program to be debugged.

また、上記プログラム言語変換手段16によって、計算機に実行させる処理を記述するための上記第1プログラム言語を上記第2プログラム言語に変換するようにしている。そして、コンパイラ14によって、第2プログラム言語で記述されたソースプログラムを実行形式ファイルに変換するようにしている。したがって、本実施の形態においては、上記第1プログラム言語で記述されたソースプログラムを実行形式ファイルに変換するコンパイラを必要とはしないのである。すなわち、本実施の形態によれば、上記第2プログラム言語として、既にコンパイラが開発されているプログラム言語を選択することによって、例え、上記第1プログラム言語用のデバッガのみならず第1プログラム言語用のコンパイラも未開発の場合であっても、的確にデバッグ処理を行うことができるのである。   Further, the program language conversion means 16 converts the first program language for describing processing to be executed by the computer into the second program language. Then, the compiler 14 converts the source program described in the second program language into an executable format file. Therefore, in this embodiment, a compiler that converts the source program described in the first program language into an executable file is not required. That is, according to this embodiment, by selecting a program language for which a compiler has already been developed as the second program language, for example, not only the debugger for the first program language but also the first program language Even if this compiler is not developed yet, the debugging process can be performed accurately.

尚、上記実施の形態における上記第1プログラム言語と第2プログラム言語とは、例えばC言語等の同じプログラム言語であっても構わない。   The first program language and the second program language in the embodiment may be the same program language such as C language.

また、上記実施の形態においては、上記対話的デバッグルーチン呼出命令追加手段18は、中間データ17から読み出したソースプログラム11における1つのステートメントに対応する処理プログラムの後に対話的デバッグルーチン呼出命令を付加するようにしている。しかしながら、当該処理プログラムの前に対話的デバッグルーチン呼出命令を付加して、変換後ソースプログラム13に出力するようにしても構わない。   In the above embodiment, the interactive debug routine call instruction adding means 18 adds an interactive debug routine call instruction after the processing program corresponding to one statement in the source program 11 read from the intermediate data 17. I am doing so. However, an interactive debug routine call instruction may be added before the processing program and output to the source program 13 after conversion.

また、上記実施の形態においては、上記対話的デバッグルーチンでは、変数の値を参照するコマンドと変換後ソースプログラム13の停止条件を設定・変更するコマンドとを実行するようにしているが、上記以外のコマンドを実行可能にしてもよい。   In the above embodiment, in the interactive debugging routine, a command for referring to the value of a variable and a command for setting / changing the stop condition of the converted source program 13 are executed. The command may be executable.

ところで、上記実施の形態における上記プログラム言語変換手段16,対話的デバッグルーチン呼出命令追加手段18,対話的デバッグルーチン追加手段19およびコンパイラ14としての機能は、プログラム記録媒体に記録されたソースプログラム変換プログラムによって実現される。上記実施の形態における上記プログラム記録媒体は、ROM(リード・オンリ・メモリ)でなるプログラムメディアである。あるいは、上記外部補助記憶装置に装着されて読み出されるプログラムメディアであってもよい。尚、何れの場合においても、プログラムメディアからソースプログラム変換プログラムを読み出すプログラム読み出し手段は、上記プログラムメディアに直接アクセスして読み出す構成を有していてもよいし、RAM(ランダム・アクセス・メモリ)に設けられたプログラム記憶エリア(図示せず)にダウンロードし、上記プログラム記憶エリアにアクセスして読み出す構成を有していてもよい。尚、上記プログラムメディアから上記RAMのプログラム記憶エリアにダウンロードするためのダウンロードプログラムは、予め本体装置に格納されているものとする。   By the way, the functions of the program language conversion means 16, the interactive debug routine call instruction addition means 18, the interactive debug routine addition means 19 and the compiler 14 in the above embodiment are the source program conversion program recorded in the program recording medium. It is realized by. The program recording medium in the above embodiment is a program medium composed of a ROM (Read Only Memory). Alternatively, it may be a program medium that is loaded into the external auxiliary storage device and read out. In any case, the program reading means for reading the source program conversion program from the program medium may have a configuration in which the program medium is directly accessed and read, or provided in a RAM (Random Access Memory). The program storage area (not shown) may be downloaded, and the program storage area may be accessed and read. It is assumed that a download program for downloading from the program medium to the program storage area of the RAM is stored in the main unit in advance.

ここで、上記プログラムメディアとは、本体側と分離可能に構成され、磁気テープやカセットテープ等のテープ系、フロッピーディスク,ハードディスク等の磁気ディスクやCD(コンパクトディスク)‐ROM,MO(光磁気)ディスク,MD(ミニディスク),DVD(ディジタル多用途ディスク)等の光ディスクのディスク系、IC(集積回路)カードや光カード等のカード系、マスクROM,EPROM(紫外線消去型ROM),EEPROM(電気的消去型ROM),フラッシュROM等の半導体メモリ系を含めた、固定的にプログラムを坦持する媒体である。   Here, the program medium is configured to be separable from the main body side, and is a tape system such as a magnetic tape or a cassette tape, a magnetic disk such as a floppy disk or a hard disk, a CD (compact disk) -ROM, or MO (magneto-optical). Optical discs such as discs, MD (mini discs) and DVDs (digital versatile discs), card systems such as IC (integrated circuit) cards and optical cards, mask ROM, EPROM (ultraviolet erasable ROM), EEPROM (electrical This is a medium that carries a fixed program, including a semiconductor memory system such as a static erasable ROM) and a flash ROM.

また、上記実施の形態におけるソースプログラム変換装置は、インターネット等の通信ネットワークと通信I/Fを介して接続可能な構成を有している場合には、上記プログラムメディアは、通信ネットワークからのダウンロード等によって流動的にプログラムを坦持する媒体であっても差し支えない。尚、その場合における上記通信ネットワークからダウンロードするためのダウンロードプログラムは、予め本体装置に格納されているものとする。あるいは、別の記録媒体からインストールされるものとする。   When the source program conversion apparatus in the above embodiment has a configuration that can be connected to a communication network such as the Internet via a communication I / F, the program medium is downloaded from the communication network, etc. Even if it is a medium that carries the program in a fluid way, there is no problem. In this case, it is assumed that a download program for downloading from the communication network is stored in the main device in advance. Or it shall be installed from another recording medium.

尚、上記記録媒体に記録されるものはプログラムのみに限定されるものではなく、データも記録することが可能である。   Note that what is recorded on the recording medium is not limited to the program, and data can also be recorded.

本発明のソースプログラム変換装置は、第1プログラム言語で記述されたソースプログラムから入力コマンドに応じた処理を実行できる1つのデバッグルーチンが付加されると共に第2プログラム言語で記述された変換後ソースプログラムを生成するものであり、デバッガを使用せずにソースプログラムのデバッグを行う際に用いることができる。   A source program conversion apparatus according to the present invention is provided with a post-conversion source program described in a second program language, to which one debug routine capable of executing processing according to an input command is added from the source program described in the first program language Can be used when debugging a source program without using a debugger.

この発明のソースプログラム変換装置における概略構成を示すブロック図である。It is a block diagram which shows schematic structure in the source program conversion apparatus of this invention. 図1におけるソースプログラム変換部によって実行されるソースプログラム変換処理動作のフローチャートである。It is a flowchart of the source program conversion processing operation performed by the source program conversion part in FIG. ソースプログラム,中間データおよび対話的デバッグルーチン呼出命令が追加された変換後ソースプログラムの具体例を示す図である。It is a figure which shows the specific example of the source program after conversion to which the source program, intermediate data, and the interactive debug routine call instruction were added. 対話的デバッグルーチンの具体例を示す図である。It is a figure which shows the specific example of an interactive debugging routine. 変換後ソースプログラムの構造を示す図である。It is a figure which shows the structure of the source program after conversion. 対話的デバッグ処理動作のフローチャートである。It is a flowchart of an interactive debugging process operation. 従来のプログラム生産システムにおけるブロック図である。It is a block diagram in the conventional program production system.

符号の説明Explanation of symbols

11…ソースプログラム格納部,ソースプログラム、
12…ソースプログラム変換部、
13…変換後ソースプログラム格納部,変換後ソースプログラム、
14…コンパイラ、
15…実行形式ファイル格納部、
16…プログラム言語変換手段、
17…中間データ格納部,中間データ、
18…対話的デバッグルーチン呼出命令追加手段、
19…対話的デバッグルーチン追加手段、
21,22…ステートメント、
23,24,41a〜41e…処理プログラム、
25,26,42a〜42d…対話的デバッグルーチン呼出命令、
31…停止条件判定処理部、
32…コマンド受付処理部、
33…コマンド解析・実行処理部、
34…変数の表示処理部、
35…停止条件の設定処理部、
36…停止条件の変更処理部、
37…プログラム続行処理部、
43…対話的デバッグルーチン。
11 ... Source program storage unit, source program,
12 ... Source program conversion unit,
13 ... converted source program storage, converted source program,
14 ... Compiler
15 ... Execution format file storage unit,
16 ... Program language conversion means,
17: Intermediate data storage unit, intermediate data,
18 ... Interactive debug routine call instruction addition means,
19: Means for adding an interactive debugging routine,
21,22 ... statement,
23, 24, 41a to 41e ... processing program,
25, 26, 42a to 42d ... interactive debug routine call instruction,
31 ... Stop condition determination processing unit,
32 ... Command reception processing unit,
33 ... Command analysis / execution processing unit,
34 ... Variable display processing unit,
35 ... Stop condition setting processing unit,
36 ... Stop condition change processing unit,
37. Program continuation processing unit,
43 ... Interactive debug routine.

Claims (7)

デバッグ対象のソースプログラムに、デバッグ処理を行うためのデバッグルーチンを追加するソースプログラム変換装置において、
第1プログラム言語で記述された第1ソースプログラムを第2プログラム言語による記述に変換し、中間データとして出力するプログラム言語変換手段と、
上記中間データから上記第1ソースプログラム内の1つのステートメントに相当する処理プログラムを処理順序に従って読み出し、この読み出した各処理プログラムに対話的デバッグルーチン呼出命令を追加して、第2プログラム言語の文法に従って第2ソースプログラムとして出力する対話的デバッグルーチン呼出命令追加手段と、
上記対話的デバッグルーチン呼出命令によって起動されると共に、上記第2プログラム言語で記述されて、デバッグ作業者によって入力されるコマンドを受けて次に行うべき処理を決定することが可能な対話的デバッグルーチンを、上記第2ソースプログラムに追加する対話的デバッグルーチン追加手段
を備えたことを特徴とするソースプログラム変換装置。
In a source program conversion apparatus that adds a debugging routine for performing debugging processing to a source program to be debugged,
A program language conversion means for converting the first source program described in the first program language into a description in the second program language and outputting as intermediate data;
A processing program corresponding to one statement in the first source program is read from the intermediate data in accordance with the processing order, an interactive debug routine call instruction is added to each of the read processing programs, and according to the grammar of the second program language. Interactive debug routine call instruction adding means for outputting as a second source program;
An interactive debug routine that is activated by the interactive debug routine call instruction and that is described in the second programming language and that can receive a command input by a debug operator and determine a process to be performed next. A source program conversion apparatus comprising interactive debug routine adding means for adding a program to the second source program.
請求項1に記載のソースプログラム変換装置において、
上記対話的デバッグルーチンには、当該対話的デバッグルーチンに停止条件が設定されているか否かを判定し、設定されている場合には上記第2ソースプログラムの実行を停止する停止条件判定処理部が設けられていることを特徴とするソースプログラム変換装置。
The source program conversion apparatus according to claim 1,
The interactive debug routine includes a stop condition determination processing unit that determines whether or not a stop condition is set in the interactive debug routine, and if set, a stop condition determination processing unit that stops the execution of the second source program. A source program conversion apparatus characterized by being provided.
請求項2に記載のソースプログラム変換装置において、
上記対話的デバッグルーチンには、デバッグ作業者によって上記停止条件を設定するコマンドが入力された際に、当該対話的デバッグルーチンに停止条件を設定する停止条件設定処理部が設けられていることを特徴とするソースプログラム変換装置。
The source program conversion apparatus according to claim 2, wherein
The interactive debug routine is provided with a stop condition setting processing unit for setting a stop condition in the interactive debug routine when a command for setting the stop condition is input by a debug operator. A source program conversion device.
請求項3に記載のソースプログラム変換装置において、
上記対話的デバッグルーチンには、デバッグ作業者によって上記停止条件を変更するコマンドが入力された際に、既に当該対話的デバッグルーチンに設定されている停止条件を変更する停止条件変更処理部が設けられていることを特徴とするソースプログラム変換装置。
In the source program conversion apparatus according to claim 3,
The interactive debug routine is provided with a stop condition change processing unit that changes a stop condition already set in the interactive debug routine when a command for changing the stop condition is input by a debug operator. A source program conversion apparatus characterized by comprising:
デバッグ対象のソースプログラムに、デバッグ処理を行うためのデバッグルーチンを追加するソースプログラム変換方法において、
第1プログラム言語で記述された第1ソースプログラムを第2プログラム言語による記述に変換して中間データとして出力し、
上記中間データから上記第1ソースプログラム内の1つのステートメントに相当する処理プログラムを処理順序に従って読み出し、この読み出した各処理プログラムに対話的デバッグルーチン呼出命令を追加して、第2プログラム言語の文法に従って第2ソースプログラムとして出力し、
上記対話的デバッグルーチン呼出命令によって起動されると共に、上記第2プログラム言語で記述されて、デバッグ作業者によって入力されるコマンドを受けて次に行うべき処理を決定することが可能な対話的デバッグルーチンを、上記第2ソースプログラムに追加する
ことを特徴とするソースプログラム変換方法。
In a source program conversion method for adding a debugging routine for performing debugging processing to a source program to be debugged,
Converting the first source program described in the first programming language into a description in the second programming language and outputting it as intermediate data;
A processing program corresponding to one statement in the first source program is read from the intermediate data in accordance with the processing order, an interactive debug routine call instruction is added to each of the read processing programs, and according to the grammar of the second program language. Output as the second source program,
An interactive debug routine that is activated by the interactive debug routine call instruction and that is described in the second programming language and that can receive a command input by a debug operator and determine a process to be performed next. Is added to the second source program.
コンピュータを、
請求項1におけるプログラム言語変換手段,対話的デバッグルーチン呼出命令追加手段および対話的デバッグルーチン追加手段
として機能させることを特徴とするソースプログラム変換プログラム。
Computer
A source program conversion program which functions as the program language conversion means, interactive debug routine call instruction addition means and interactive debug routine addition means according to claim 1.
請求項6に記載のソースプログラム変換プログラムが記録されたことを特徴とするコンピュータ読出し可能なプログラム記録媒体。
A computer-readable program recording medium on which the source program conversion program according to claim 6 is recorded.
JP2003414185A 2003-12-12 2003-12-12 Source program conversion device, source program conversion method, source program conversion program and program recording medium Pending JP2005174045A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2003414185A JP2005174045A (en) 2003-12-12 2003-12-12 Source program conversion device, source program conversion method, source program conversion program and program recording medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2003414185A JP2005174045A (en) 2003-12-12 2003-12-12 Source program conversion device, source program conversion method, source program conversion program and program recording medium

Publications (1)

Publication Number Publication Date
JP2005174045A true JP2005174045A (en) 2005-06-30

Family

ID=34734060

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2003414185A Pending JP2005174045A (en) 2003-12-12 2003-12-12 Source program conversion device, source program conversion method, source program conversion program and program recording medium

Country Status (1)

Country Link
JP (1) JP2005174045A (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2009172887A (en) * 2008-01-25 2009-08-06 Canon Inc Image formation device, control method in image formation device, and program
WO2011067398A1 (en) * 2009-12-03 2011-06-09 Flexycore Software application fine-tuning method, system, and corresponding computer program product
JP2012254640A (en) * 2012-09-03 2012-12-27 Canon Inc Image formation device, control method in image formation method, and program
JP2013176994A (en) * 2013-04-25 2013-09-09 Canon Inc Printing device, method of controlling the same and program
CN105786688A (en) * 2014-12-23 2016-07-20 华润半导体(深圳)有限公司 Microcontroller application software debugging method
JPWO2021024472A1 (en) * 2019-08-08 2021-02-11

Cited By (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2009172887A (en) * 2008-01-25 2009-08-06 Canon Inc Image formation device, control method in image formation device, and program
WO2011067398A1 (en) * 2009-12-03 2011-06-09 Flexycore Software application fine-tuning method, system, and corresponding computer program product
FR2953612A1 (en) * 2009-12-03 2011-06-10 Flexycore METHOD FOR DEVELOPING SOFTWARE APPLICATION, SYSTEM AND CORRESPONDING COMPUTER PROGRAM PRODUCT.
US8776024B2 (en) 2009-12-03 2014-07-08 Google Inc. Software application fine-tuning method, system, and corresponding computer program product
JP2012254640A (en) * 2012-09-03 2012-12-27 Canon Inc Image formation device, control method in image formation method, and program
JP2013176994A (en) * 2013-04-25 2013-09-09 Canon Inc Printing device, method of controlling the same and program
CN105786688A (en) * 2014-12-23 2016-07-20 华润半导体(深圳)有限公司 Microcontroller application software debugging method
JPWO2021024472A1 (en) * 2019-08-08 2021-02-11
WO2021024472A1 (en) * 2019-08-08 2021-02-11 日本電気株式会社 Function estimation device, function estimation method, and computer-readable medium
JP7298692B2 (en) 2019-08-08 2023-06-27 日本電気株式会社 Function estimation device, function estimation method and program
US11868744B2 (en) 2019-08-08 2024-01-09 Nec Corporation Estimation of features corresponding to extracted commands used to divide code of software

Similar Documents

Publication Publication Date Title
JP4950454B2 (en) Stack hierarchy for test automation
JP6280126B2 (en) System and method for debugging domain specific languages
KR101246967B1 (en) Method and apparatus for executing unit tests in application host environment
US6931627B2 (en) System and method for combinatorial test generation in a compatibility testing environment
JP5415557B2 (en) User script code conversion for debugging
US8201143B2 (en) Dynamic mating of a modified user interface with pre-modified user interface code library
US20090144705A1 (en) Debugging device and debugging method
US7895575B2 (en) Apparatus and method for generating test driver
US20080209401A1 (en) Techniques for integrating debugging with decompilation
US9274930B2 (en) Debugging system using static analysis
CN113742119A (en) Call stack backtracking method and device of embedded system and computer equipment
JP2004164554A (en) Device and method for executing and monitoring program
JP5303795B2 (en) Application analysis method, analysis system, and analysis program
US7624381B1 (en) Portable detection of start and completion of object construction
JP2005174045A (en) Source program conversion device, source program conversion method, source program conversion program and program recording medium
JP2009104252A (en) Debugging support device and debugging support method
KR100790470B1 (en) Method and apparatus for automatically generating test case for device driver test
JP2008140263A (en) Unit test support device
JP2015146178A (en) Creation of test context
EP0801348A1 (en) Method of monitoring the operation of a computer
KR101476536B1 (en) The method and system for inspecting program
JP2014106770A (en) Type check device, type check method and type check program
JP5067705B2 (en) Abnormal test support device, abnormal test support method, and program
JP2004287869A (en) Program execution monitoring device and method
CN117093490A (en) Code processing method, device, computer equipment and storage medium