JPS61206050A - Action analyzing system for program - Google Patents

Action analyzing system for program

Info

Publication number
JPS61206050A
JPS61206050A JP60047864A JP4786485A JPS61206050A JP S61206050 A JPS61206050 A JP S61206050A JP 60047864 A JP60047864 A JP 60047864A JP 4786485 A JP4786485 A JP 4786485A JP S61206050 A JPS61206050 A JP S61206050A
Authority
JP
Japan
Prior art keywords
program
execution
terminal
command
debuggable
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
JP60047864A
Other languages
Japanese (ja)
Inventor
Naomi Fukuhara
福原 直巳
Chikao Nishida
西田 親生
Jun Fujikake
藤掛 遵
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.)
Mitsubishi Electric Corp
Original Assignee
Mitsubishi Electric 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 Mitsubishi Electric Corp filed Critical Mitsubishi Electric Corp
Priority to JP60047864A priority Critical patent/JPS61206050A/en
Publication of JPS61206050A publication Critical patent/JPS61206050A/en
Pending legal-status Critical Current

Links

Landscapes

  • Debugging And Monitoring (AREA)

Abstract

PURPOSE:To execute the action analyzing program function without using the special function depending upon the operating system by linking an acting analyzing program to an acted analyzing program and constituting the executable program. CONSTITUTION:When an execution stop setting command is inputted at a user terminal 22, the execution control is shifted to the control routine 36 of an action analyzing program 26, and again, a prompt to accelerate the input of the next debugging command of the terminal 22 is outputted. After the prompt output of a command input, the execution continuing command is inputted from the terminal 22, and then, the execution control reciprocates between a user program 28 and an action analyzing program 26. The program 26 retrieves a line number register table 38 and investigates whether or not the execution stop point is loaded to the line to be executed. When the stop point is loaded, the execution is stopped, and the prompt of the next input command input is outputted to the terminal 22. When the stop point is not loaded, the execution control is shifted from the program 26 to the user program 28 and the program of the line is executed.

Description

【発明の詳細な説明】 〔産業上の利用分野〕 この発明は、計算機を動作させるための特定の機能を果
すプログラムの動作解析、特に例えばC言語のようなプ
ログラム言語によるソースプログラムの動作解析方式に
関するものである。
[Detailed Description of the Invention] [Industrial Application Field] The present invention relates to a method for analyzing the behavior of a program that performs a specific function for operating a computer, especially a method for analyzing the behavior of a source program using a programming language such as C language. It is related to.

〔従来の技術〕[Conventional technology]

従来の動作解析方式は、特定の計算機の処理方式に依存
した動作解析方式をとっており、汎用性が無い。
Conventional motion analysis methods depend on the processing method of a specific computer, and are not versatile.

例えば、オペレーティングシステム[U N I Xj
For example, the operating system [UNIXj
.

下で動作する動作解析プログラム「8 D BJは、オ
ペレーティングシステム「U N I XJの保有する
特殊な機能を用いて作成されており、異なる機能を有す
るオペレーティングシステムの下で利用するのは困難で
ある。
The motion analysis program "8D BJ" that operates under the operating system "UNI .

オペレーティングシステムl’−UNIXJで動作スル
動作解析プログラムl’−8D B Jの処理方式につ
いて簡単に説明する。
The processing method of the motion analysis program l'-8D BJ, which operates on the operating system l'-UNIXJ, will be briefly described.

上記「5DBJは、  [8DBJ単体で動作可能な実
行プログラムであり、このプログラムを起動することに
より被動作解析プログラムの実行が可能となる。この被
動作解析プログラムの起動にあたっては、オペレーティ
ングシステム[UNIXJに設置されている特殊な機能
(例えばfork、 exec)が用いられている。
The above "5DBJ is an executable program that can run on the [8DBJ] alone, and by starting this program, it is possible to execute the operated analysis program. When starting this operated analysis program, the operating system [UNIXJ] Special installed functions (for example, fork, exec) are used.

「8DBjにより被動作解析プログラムが起動されると
、プログラムの実行に関する制御が[5DBlから被動
作解析プログラムに渡される。動作解析のため、被実行
プログラムの実行手順を追跡することや実行停止点の確
認を行う事も、オペレーティングシステム[UNIXJ
特有の機能(ptrace )を用いて実現している。
"When the operated analysis program is started by 8DBj, control regarding the execution of the program is passed from [5DBl to the operated analysis program. To analyze the operation, it is possible to trace the execution procedure of the executed program and find the execution stopping point. You can also check the operating system [UNIXJ
This is achieved using a unique function (ptrace).

〔発明が解決しようとする問題点〕[Problem that the invention seeks to solve]

従来の動作解析方式は、特にC言語を用いたソースプロ
グラムの場合、オペレーティングシステムl”UNIX
J以外での適用は困難であった。
Conventional behavior analysis methods, especially in the case of source programs using the C language,
It was difficult to apply it to anything other than J.

この発明は、上記のような問題点を解消するためになさ
れたもので、オペレーティングシステムに設置された特
殊な機能を利用せずに動作解析プログラム機能を実現可
能とすることを目的とじている。
This invention was made to solve the above-mentioned problems, and aims to make it possible to realize a behavior analysis program function without using special functions installed in an operating system.

〔問題点を解決するための手段〕[Means for solving problems]

この発明による動作解析方式は、オペレーティングシス
テムに依存する特殊な機能を利用して動作解析のための
機能を実現することを止め、動作解析プログラムを被動
作解析(被検査)プログラムと結合して実行可能なプロ
グラムを構成するようにしたものである。
The motion analysis method according to the present invention does not utilize special functions that depend on the operating system to implement motion analysis functions, and instead executes the motion analysis program by combining it with the motion analysis target (tested) program. It is designed to configure possible programs.

〔作用〕[Effect]

この発明における動作解析方式は、被検査ソースプログ
ラムをデバッグ可能実行プログラムに変換する際に特定
の指令により、動作解析プログラムと制御を交換するた
めの手続を組み込み、動作解析プログラムを結合して実
行可能プログラムを作成する点に特徴があシ、デバッグ
時のプログラムの実行制御は被検査プログラムと動作解
析プログラムの間を行き交うことになる。
The behavior analysis method in this invention incorporates a procedure for exchanging control with the behavior analysis program by a specific instruction when converting the source program to be inspected into a debuggable executable program, so that the behavior analysis program can be combined and executed. The feature is that the program is created, and program execution control during debugging is passed back and forth between the program under test and the behavior analysis program.

〔発明の実施例〕[Embodiments of the invention]

以下、この発明の一実施例を図について説明する。 An embodiment of the present invention will be described below with reference to the drawings.

この発明においては、ある機能を果すプログラム(被検
査プログラム)の動作解析を行おうとする場合、先ず、
当該被検査ソースプログラムから。
In this invention, when attempting to analyze the operation of a program (program under test) that performs a certain function, first,
From the source program to be inspected.

このプログラムの各ソース行に対応させて、デバッグル
ーチン呼出命令並びに行番号やシンボルテーブルなどデ
バッグ時に必要な情報を含んだ形のデバッグ可能被検査
プログラムを作成する。
A debuggable test program is created that includes information necessary for debugging, such as a debug routine call instruction, line numbers, and symbol tables, corresponding to each source line of this program.

第4図は、デバッグ可能被検査グログラム(デバッグ可
能ロードモジュール)作成の流れを示しており9例えば
第2図に示すよりなC言語で作成された被検査ソースプ
ログラム(1)は、デバッグ指定を行った上でコンパイ
ラ(2)によりアセンプランース(3)に変換し、この
ア七ンプランース(3)をアセンブラ(4)によりリー
ダプルオブジェクトモシュー−ル(5)に変換し、更に
リンカ−(6)によシュデバッグライブ21月7)及び
標準関数ライブラリ(8)とリンクさせることにより、
デバッグ可能ロードモジュール(9)を得る。
FIG. 4 shows the flow of creating a debuggable test program (debuggable load module).9For example, the test source program (1) created in the C language shown in FIG. After that, the compiler (2) converts it into an assembly line (3), the assembler (4) converts this assembly line (3) into a reader-pull object model (5), and then the linker (6) converts it into an assembly line (3). By linking with Yoshu Debug Live 21/7) and standard function library (8),
Obtain a debuggable load module (9).

第3図は第2図に示したソースプログラムの各ソース行
に対応させて、デバッグ可能ロードモジエールの内容を
示したものである。第3図において、αGelυは第2
図のソースプログラムの第5行に対応する内容、(L1
αJは上記第5行の内容に付加したデバッグルーチン呼
出命令、αΦはデバッグ時に必要な情報で、C9はその
行番号、叫は同シンボルテーブルである。
FIG. 3 shows the contents of the debuggable load module corresponding to each source line of the source program shown in FIG. In Figure 3, αGelυ is the second
The content corresponding to the 5th line of the source program in the figure, (L1
αJ is a debug routine call instruction added to the contents of the fifth line, αΦ is information necessary for debugging, C9 is the line number, and C9 is the same symbol table.

次に、上記のようにして得たデバッグ可能ロードモジュ
ール(9)を2例えば第5図に示すようなデバッグ用計
算機にロードする。
Next, the debuggable load module (9) obtained as described above is loaded into a debugging computer such as the one shown in FIG. 5, for example.

第5図において、圓はデバッグ用計算機の中央処理装置
、C21)はその主記憶装置、@はデバッグ作業の各種
指示を入力しかつデバッグ結果を出力するユーザー端末
、Elはこの端末■と上記中央処理装置圓との間の入出
力インター7エイスで、上記中央処理装置■には、この
入出力インターフェイス(ハ)を介して、ソースプログ
ラムファイル(至)及びデバッグ可能ロードモジエール
ファイル(ハ)が接続されている。なお、この第5図中
においては計算機の制御部などは図示を省略している。
In Figure 5, En is the central processing unit of the debugging computer, C21) is its main memory, @ is the user terminal that inputs various instructions for debugging work and outputs the debugging results, El is this terminal ■ and the center of the above At the input/output interface 7A between the processing unit and the central processing unit ■, the source program file (to) and the debuggable load module file (c) are sent to the central processing unit ■ via this input/output interface (c). It is connected. Note that in FIG. 5, the control section of the computer and the like are omitted from illustration.

上記計算機の主記憶装置−には、デバッグルーチンとし
ての動作解析用プログラム圓が、他のルーチン例えば標
準関数ルーチン鰭と共に準備されており、その主記憶装
置−に、デバッグ可能ロードモジエールファイル(ハ)
からデバッグ可能ロードモジュールがユーザープログラ
ム■としてロードされる。
In the main memory of the above-mentioned computer, a program for operation analysis as a debug routine is prepared together with other routines such as standard function routines, and in the main memory, a debuggable load module file ( )
The debuggable load module is loaded as a user program.

第1図は、ユーザープログラム(2)及び動作解析プロ
グラム国の内部構成、並びに−両プログラム間及び端末
@との間の制御及び情報の流れを示したもので、 ci
l+−(至)はユーザープログラム(至)内のものであ
り、clυは実行制御がわたってくる関数の入口点であ
るエントリ、C(51はコンパイル単位に生成されるシ
ンボルテーブル、(至)はこのシンボルテーブル(至)
を指すポインタ、(2)は動作解析用プログラム(至)
に制御を移すためのデバッグルーチン呼出命令であり、
制御を移すとき行番号(至)も引数として動作解析用プ
ログラム(至)に渡す。(至)〜(至)は動作解析用プ
ログラム(至)内のもので、制御ルーチン(至)は動作
解析用プログラム(至)で?マント解析やデバッグのた
めの処理を行うルーチンである。−は関数名スタックで
、ユーザープログラム適での実行制御がエントリ(31
1にあるとき関数名を書き込む。(至)は、実行停止点
の設定が行われたときにその行番号を登録する行番号登
録表である。制御ルーチン(至)がデバッグ処理を行う
とき、スタック■や表(至)を参照して、関数のトレー
ス・実行停止点での処理を行う。
Figure 1 shows the internal structure of the user program (2) and the behavior analysis program, as well as the flow of control and information between the two programs and the terminal @.
l + - (to) is the one in the user program (to), clυ is the entry that is the entry point of the function to which execution control is passed, C (51 is the symbol table generated for each compilation unit, (to) is This symbol table (to)
(2) is the motion analysis program (to)
This is a debug routine call instruction to transfer control to
When transferring control, the line number (to) is also passed as an argument to the behavior analysis program (to). (To) - (To) are in the motion analysis program (To), and the control routine (To) is in the motion analysis program (To)? This is a routine that performs processing for cloak analysis and debugging. - is the function name stack, and the execution control in the user program is the entry (31
When it is 1, write the function name. (To) is a line number registration table in which the line number is registered when the execution stop point is set. When the control routine (to) performs debugging processing, it refers to the stack (■) and table (to) and performs processing at the trace and execution stop point of the function.

囚は端末を示し2この端末からユーザーはデバッグコマ
ンドを入力し、動作解析用プログラム■と情報を交換し
ながら、ユーザープログラム(至)の動作解析を行う。
The prisoner indicates a terminal.2 The user inputs debugging commands from this terminal and analyzes the operation of the user program (to) while exchanging information with the operation analysis program.

(至)はユーザープログラムのソースプログラムファイ
ルでアリ、ソースプログラムの表示を要求するコマンド
が端末■から入力されたときにアクセスされる。
(to) is the source program file of the user program, and is accessed when a command requesting display of the source program is input from the terminal ■.

以下にこの発明による処理の流れについて説明する。先
ずユーザープログラム■に起動がかかる。
The flow of processing according to the present invention will be explained below. First, the user program ■ starts up.

すると関数の入口エントリC(11で、シンボルテーブ
ル關に記述されている関数名を関数名スタック■に登録
し、デバッグルーチン呼出命令儲により実行制御を動作
解析プログラム■に移す。このデバッグルーチン呼出命
令は1通常の計算機に存在する機械命令であり、特定の
計算機の特定の機能に依存していない。
Then, in function entry entry C (11), the function name written in the symbol table is registered in the function name stack ■, and execution control is transferred to the behavior analysis program ■ by the debug routine call command.This debug routine call command is a machine instruction that exists in a normal computer and is not dependent on the specific functions of a specific computer.

制御ルーチン(至)は、ユーザー端末@を介して使用者
と会話型に操作指令の指示受入れ、応答を行い、関数名
スタック−や行番号登録表(至)を参照して動作解析を
行う。
The control routine (to) accepts and responds to operation commands interactively with the user via the user terminal @, and performs operation analysis with reference to the function name stack and line number registration table (to).

例えばユーザー端末@で実行停止点設定コマンドが入力
されたとき、実行制御がプログラム■の制御ルーチン(
至)に移り2行番号登録表(至)に実行を停止する行番
号を登録し、再び端末■に次のデバッグコマンドの入力
を促すプロンプトを出力する。
For example, when an execution stop point setting command is input on the user terminal @, the execution control is set to the program ■ control routine (
Move to (To), register the line number at which execution is to be stopped in the 2nd line number registration table (To), and again output a prompt to the terminal ■ to prompt the input of the next debug command.

行番号登録表(至)への登録方法については後で説明す
る。
The method of registering in the line number registration table (to) will be explained later.

コマンド入力のプロンプト出力後、端末■から実行継続
コマンドを入力すると、実行制御はユーザープログラム
(2)と動作解析プログラム(2)の間を往復する。
After a command input prompt is output, when a command to continue execution is input from the terminal (2), execution control is reciprocated between the user program (2) and the motion analysis program (2).

プログラム(ト)では2行番号登録表(至)を検索して
実行する行に実行停止点がかかつているか調査する。こ
こで実行する行く実行停止点がかかつていると実行を中
断し2次の入力コマンド入力のプロンプトを端末■に出
力する。実行停止点がかかりていない場合は、動作解析
プログラム(至)からユーザープログラム■へ実行制御
が移り、その行のプログラムが実行される。
In the program (g), the 2nd line number registration table (to) is searched to check whether the line to be executed has an execution stop point. If the execution stop point to be executed is reached, the execution is interrupted and a prompt for inputting the secondary input command is output to the terminal (2). If the execution stop point has not been reached, execution control is transferred from the motion analysis program (to) to the user program (2), and the program in that line is executed.

実行停止点の設定登録方法について説明する。The method of setting and registering the execution stop point will be explained.

ユーザー端末@に入力プロンブトが出力されているとき
実行停止点設定コマンドを入力すると。
If you enter the execution stop point setting command while the input prompt is being output to the user terminal @.

プログラム(至)の制御ルーチン国が行番号登録表(至
)に実行を停止する行番号を登録する。
The control routine of the program (to) registers the line number at which execution is to be stopped in the line number registration table (to).

この登録表は計算機の主記憶装置上に動的に割り当てら
れ、J@次次の登録表のアドレスを指すようにする(こ
れをチェイン構造と称する)。実行停止点を設定するに
は、ファイル名と行番号の両方が必要であるので、ファ
イル名の登録もチェイン構造で行う。即ち、ファイル名
だけをチェイン構造でつなぎ、各々のファイル名登録簿
から2行番号をチェイン構造でつなぐ、二次元的なチェ
イン構造を持っている。
This registration table is dynamically allocated on the main memory of the computer, and J@points to the address of the next registration table (this is called a chain structure). Since both the file name and line number are required to set the execution stop point, the file name is also registered in a chain structure. That is, it has a two-dimensional chain structure in which only file names are connected in a chain structure and two line numbers from each file name register are connected in a chain structure.

なお、この発明の動作解析方式は、C言語で記述された
プログラムだけではなく、他のどの言語プロセッサにも
適用可能である。前述したように。
Note that the behavior analysis method of the present invention is applicable not only to programs written in C language but also to any other language processor. As previously mentioned.

この方式は、計算機、オペレーティングシステムと独立
しているので、各種の計算機の各種のオペレーティング
システムの下で動作する各種の言語プロセッサに適用可
能である。
Since this method is independent of computers and operating systems, it is applicable to various language processors operating under various operating systems of various computers.

〔発明の効果〕〔Effect of the invention〕

以上のように、この発明によれば、動作解析プログラム
の実現を、特定の計算機の特定のオペレーティングシス
テムの特定の機能に依存していないので、同一のユーザ
ーインタフェイスを持った動作解析プログラムを他の計
算機に移行することが容易で、プログラム言語で記述さ
れたソースプログラムのデバッグ効率を向上できる効果
がある。
As described above, according to the present invention, the implementation of a motion analysis program does not depend on the specific functions of a specific operating system of a specific computer, so that other motion analysis programs with the same user interface can be implemented. It is easy to migrate to other computers, and has the effect of improving debugging efficiency of source programs written in programming languages.

【図面の簡単な説明】[Brief explanation of the drawing]

第1図はこの発明の一実施例で、被動作解析プログラム
(ユーザープログラム)と動作解析プログラムの制御の
やりとり動作解析処理の流れについて示し九図、第2図
はC言語で作成された被検査ソースプログラム例を示す
図、第3図はこのソースプログラムから作成したデバッ
グ可能ロードモジュールの内容を示す図、第4図はデバ
ッグ可能ロードモジュール作成の流れを示す図、第5図
はデバッグを行う計算機システムの一例を示すブロック
図である。 図中、■は中央処理装置、(社)は主記憶装置、■はユ
ーザー端末、(至)はソースプログラムファイル。 (ハ)ilt デバッグ可能ロードモジュールファイル
、CBは動作解析プログラム、(支)はユーザープログ
ラム。 なお1図中同一符号は同一部分を示す。
Fig. 1 shows an embodiment of the present invention, and shows the flow of control exchange between the movement analysis program (user program) and the movement analysis program, and the movement analysis process. Figure 3 shows an example of a source program. Figure 3 shows the contents of a debuggable load module created from this source program. Figure 4 shows the flow of creating a debuggable load module. Figure 5 shows the computer used for debugging. FIG. 1 is a block diagram showing an example of a system. In the figure, ■ is the central processing unit, (corporate) is the main memory, ■ is the user terminal, and (to) is the source program file. (c) ilt is a debuggable load module file, CB is a behavior analysis program, and (branch) is a user program. Note that the same reference numerals in Figure 1 indicate the same parts.

Claims (1)

【特許請求の範囲】[Claims] 被検査ソースプログラムからデバッグ可能実行プログラ
ムを作成する際にソースプログラムの各ソース行に対応
させてデバッグルーチン呼出命令及びデバッグ時に必要
な情報を含んだ形でデバッグ可能実行プログラムを作成
すると共に、デバッグルーチンとして動作解析用プログ
ラムを計算機の主記憶装置に準備し、上記デバッグ可能
実行プログラムと動作解析用プログラムとを上記デバッ
グ可能実行プログラム中のデバッグルーチン呼出命令に
より結合させて上記計算機の中央処理装置の制御の下で
実行させ、上記計算機に接続したユーザー端末からの指
示により被検査プログラムの一連の実行手順の任意の個
所で被検査プログラムの動作解析を可能としたことを特
徴とするプログラムの動作解析方式。
When creating a debuggable executable program from a source program to be inspected, the debuggable executable program is created in a form that includes a debug routine call instruction and information necessary for debugging corresponding to each source line of the source program, and the debug routine is A behavior analysis program is prepared in the main memory of the computer, and the debuggable execution program and the behavior analysis program are combined by a debug routine call instruction in the debuggable execution program to control the central processing unit of the computer. A method for analyzing the behavior of a program, characterized in that it is possible to analyze the behavior of a program to be inspected at any point in a series of execution steps of the program to be inspected in response to instructions from a user terminal connected to the computer. .
JP60047864A 1985-03-11 1985-03-11 Action analyzing system for program Pending JPS61206050A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP60047864A JPS61206050A (en) 1985-03-11 1985-03-11 Action analyzing system for program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP60047864A JPS61206050A (en) 1985-03-11 1985-03-11 Action analyzing system for program

Publications (1)

Publication Number Publication Date
JPS61206050A true JPS61206050A (en) 1986-09-12

Family

ID=12787234

Family Applications (1)

Application Number Title Priority Date Filing Date
JP60047864A Pending JPS61206050A (en) 1985-03-11 1985-03-11 Action analyzing system for program

Country Status (1)

Country Link
JP (1) JPS61206050A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS6466748A (en) * 1987-09-08 1989-03-13 Fujitsu Ltd System for setting number of times of interruption in debugger
JPH02170242A (en) * 1988-12-23 1990-07-02 Hitachi Ltd Autonomous trouble dianostic analysis system

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS6466748A (en) * 1987-09-08 1989-03-13 Fujitsu Ltd System for setting number of times of interruption in debugger
JPH02170242A (en) * 1988-12-23 1990-07-02 Hitachi Ltd Autonomous trouble dianostic analysis system

Similar Documents

Publication Publication Date Title
US8266608B2 (en) Post-compile instrumentation of object code for generating execution trace data
US8196109B2 (en) Common debug adaptor in a multiple computer programming language environment
JP2003050715A (en) Compiler and debugging device
JP2004164554A (en) Device and method for executing and monitoring program
US6330691B1 (en) Use of dynamic translation to provide breakpoints in non-writeable object code
JPS61206050A (en) Action analyzing system for program
JPS62113244A (en) Program test device
Almajed et al. Binary transformation of applications to run on bare PCs
Morais ID World: An Environment for the Development of a Dataflow Programs Written in ID
JPH05127945A (en) Program execution situation analysis system
JPH1165885A (en) Device and method for debugging software
JPS62147534A (en) Program test system
JP2001256075A (en) Developing system and developing method and recording medium
JP2815178B2 (en) Compiler unit
CN105446822A (en) Software exception handling system and method based on Linux
JPH01251239A (en) Debugging device
Kuang et al. Implementing java programming language on RTEMS operating system
JPH02181236A (en) Debug device
Pépin et al. Concurrent implementation of a fast vortex method
JPH03144832A (en) Symbolic debugging device for precompiler language program
Vlahović et al. Extending valgrind framework with the MIPS MSA support
JPH03142538A (en) Dynamic interruption point setting processing method
JP2004133827A (en) Core analysis system
JPH0293947A (en) Electronic computer
JPH0353335A (en) Compiler processing system