JPH11224185A - Device and method for analyzing variable influence - Google Patents

Device and method for analyzing variable influence

Info

Publication number
JPH11224185A
JPH11224185A JP10024355A JP2435598A JPH11224185A JP H11224185 A JPH11224185 A JP H11224185A JP 10024355 A JP10024355 A JP 10024355A JP 2435598 A JP2435598 A JP 2435598A JP H11224185 A JPH11224185 A JP H11224185A
Authority
JP
Japan
Prior art keywords
variable
analysis
influence analysis
source program
variable influence
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
JP10024355A
Other languages
Japanese (ja)
Other versions
JP3900223B2 (en
Inventor
Yumiko Matsui
優美子 松井
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.)
Nippon Steel Corp
Original Assignee
Nippon Steel 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 Nippon Steel Corp filed Critical Nippon Steel Corp
Priority to JP02435598A priority Critical patent/JP3900223B2/en
Publication of JPH11224185A publication Critical patent/JPH11224185A/en
Application granted granted Critical
Publication of JP3900223B2 publication Critical patent/JP3900223B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Landscapes

  • Debugging And Monitoring (AREA)
  • Stored Programmes (AREA)

Abstract

PROBLEM TO BE SOLVED: To provide a variable influence analyzing device capable of obtaining information useful to analyze the program by executing a certain degree of variable influence analyzing even when a program is a source program including more than two-stage pointers. SOLUTION: A variable information extracting means 10 reads the source program and extracts information concerning the depending relation of a variable. An influence analyzing method deciding means 11 decides the method for analyzing influence to be executed based on variable information which is obtained by the variable information extracting means 10. This device is provided with an influence analyzing means 12 for normally analyzing influence and a special variable analyzing means 13 for executing approximate analysis up to one stage for the source program which includes more than two-stage pointers. When it is judged that more than two-stage pointers are included by the influence analyzing method deciding means, approximate analysis is executed by the special variable analyzing means.

Description

【発明の詳細な説明】DETAILED DESCRIPTION OF THE INVENTION

【0001】[0001]

【発明の属する技術分野】本発明は、一般的なプログラ
ム言語システムのリバースエンジニアリングにおいて、
ソースプログラムを解析する際に利用される変数影響解
析装置及び変数影響解析方法に関する。
The present invention relates to a reverse engineering of a general programming language system.
The present invention relates to a variable influence analysis device and a variable influence analysis method used when analyzing a source program.

【0002】[0002]

【従来の技術】既存のソースプログラムを解析し、修正
する作業において、ある変数及びこの変数に関係する部
分については修正せずに、これら以外の部分だけを修正
したいという場合がある。プログラムの内容によって
は、その変数がプログラムの他の部分に直接的に、ある
いはパラメータ等を介して又は数式の一部として間接的
に影響を与えている場合がある。そのような場合には、
その変数に変更を加えたときに、そのプログラムのどの
部分まで影響が及ぶかが直ちには分からない。したがっ
て、単純にその変数が含まれていない部分だからといっ
て修正を施すと、予測しえない文法的な瑕疵等が発生し
て、そのプログラムが正常に動作しなくなることがあ
る。
2. Description of the Related Art In an operation of analyzing and modifying an existing source program, there is a case where it is desired to modify only a part other than a certain variable and a part related to the variable without modifying it. Depending on the contents of the program, the variables may directly affect other parts of the program, or indirectly via parameters or the like, or as part of mathematical formulas. In such a case,
It is not immediately apparent what part of the program will be affected when you change the variable. Therefore, if the correction is made simply because the variable is not included, an unpredictable grammatical defect or the like may occur, and the program may not operate normally.

【0003】したがって、ソースプログラムの解析・修
正作業においては、変数の影響がどの範囲まで及び、ど
の部分には及ばないかを解析することが、効率的な解析
・修正作業を行うために重要となる。このような解析を
行うための装置として、変数影響解析装置が知られてい
る。この装置は、変数の影響を解析したいソースプログ
ラムを読み込んで、その変数情報を抽出し、そのプログ
ラムにおいてどの変数がどの部分に影響を及ぼすかを解
析する。この依存関係に基づいて、どの変数がプログラ
ムのどの部分に影響を与えるかを知ることができる。か
かる情報に基づいて解析・修正作業を行えば、解析・修
正作業を効率化することができる。変数情報の抽出に
は、データ依存関係についての情報の抽出と、制御依存
関係についての情報の抽出がある。
[0003] Therefore, in the analysis and correction of a source program, it is important to analyze the extent to which a variable is affected and which part is not affected in order to perform the analysis and correction efficiently. Become. As an apparatus for performing such an analysis, a variable influence analysis apparatus is known. This device reads a source program for which the influence of a variable is to be analyzed, extracts the variable information, and analyzes which variable affects which part in the program. Based on this dependency, you can know which variables affect which parts of the program. If the analysis / correction work is performed based on such information, the analysis / correction work can be made more efficient. The extraction of the variable information includes the extraction of information on data dependence and the extraction of information on control dependence.

【0004】[0004]

【発明が解決しようとする課題】ところで、従来の変数
影響解析装置が行うデータ依存関係と制御依存関係の解
析のうち、データ依存関係の解析については、変数の現
れ方が少し複雑になると、プログラムを何度も解析しな
ければならなくなり、膨大な時間及びメモリ容量を要す
る。例えばC言語の場合だと、ポインタが二段階以上に
なると、解析すべき依存関係は指数関数的に増大し、解
析時間が膨大になる可能性があり、また、解析に必要と
するメモリが膨大になる可能性がある。このため、従来
の変数影響解析装置では、このポインタが二段階以上に
なるようなデータ依存関係があるプログラムは、実質的
に解析不可能となってしまうので、受け付けないように
なっている。
Among the data dependency analysis and the control dependency analysis performed by the conventional variable influence analysis apparatus, the analysis of the data dependency involves a problem that when the appearance of the variables becomes a little complicated, the Must be analyzed many times, which requires a huge amount of time and memory capacity. For example, in the case of the C language, when the number of pointers is two or more, the dependency to be analyzed increases exponentially, and the analysis time may become enormous, and the memory required for the analysis becomes enormous. Could be For this reason, in the conventional variable influence analysis device, a program having a data dependency such that the pointer has two or more stages is not accepted because it cannot be analyzed substantially.

【0005】しかしながら、実際に解析の対象となるプ
ログラムには二段階以上のポインタが含まれていること
も多く、このようなプログラムについても変数影響解析
を行いたいという要望があった。本発明は上記事情に基
づいてなされたものであり、二段階以上のポインタを含
むソースプログラムであっても、ある程度の変数影響解
析を行って、解析・修正作業に役立つ情報が得られる変
数影響解析装置及び変数影響解析方法を提供することを
目的とする。
However, a program to be actually analyzed often includes two or more stages of pointers, and there has been a demand for performing a variable influence analysis on such a program. The present invention has been made based on the above circumstances. Even if a source program includes two or more stages of pointers, a certain degree of variable influence analysis is performed to obtain information useful for analysis and correction work. It is an object of the present invention to provide an apparatus and a method for analyzing a variable influence.

【0006】[0006]

【課題を解決するための手段】上記の課題を解決するた
めに、本発明に係る変数影響解析装置は、ソースプログ
ラムに含まれる変数がそのソースプログラムのどの部分
にどのような影響を与えるかを解析するための変数影響
解析装置において、解析の対象となるソースプログラム
を読み込み、変数のデータ依存関係に関する情報を抽出
する変数情報抽出手段と、前記ソースプログラムに対し
て通常の変数影響解析を行う第1の変数影響解析手段
と、二段階以上のポインタを含むソースプログラムに対
して一段階までの近似的な変数影響解析を行う第2の変
数影響解析手段と、前記変数情報抽出手段が抽出したデ
ータ依存関係に関する情報に基づいて、そのソースプロ
グラムが二段階以上先のポインタを含むか否かを判断
し、二段階以以上のポインタを含まない場合には前記第
1の変数影響解析手段に変数影響解析を行わせることを
決定し、二段階以上のポインタを含む場合には前記第2
の変数影響解析手段に変数影響解析を行わせることを決
定する影響解析方法決定手段と、を具備することを特徴
とする。
In order to solve the above-mentioned problems, a variable influence analysis device according to the present invention determines which part of a source program is affected by a variable included in a source program. In a variable influence analysis apparatus for analyzing, a variable information extraction unit for reading a source program to be analyzed and extracting information on data dependency of a variable, and performing a normal variable influence analysis on the source program. (1) variable influence analyzing means, (2) second variable influence analyzing means for performing an approximate variable effect analysis of a source program including two or more steps up to one step, and data extracted by the variable information extracting means. Based on the information on the dependency, it is determined whether or not the source program includes a pointer that is two or more steps ahead. If without the printer decides to perform variable impact analysis to the first variable effect analysis means, if it contains two or more stages of pointers second
And an influence analysis method determining means for determining that the variable influence analysis means performs the variable influence analysis.

【0007】本発明に係る変数影響解析方法は、ソース
プログラムに含まれる変数がそのソースプログラムのど
の部分にどのような影響を与えるかを解析するための変
数影響解析方法において、解析の対象となるソースプロ
グラムを読み込み、変数のデータ依存関係に関する情報
を抽出する変数情報抽出工程と、前記ソースプログラム
に対して通常の変数影響解析を行う第1の変数影響解析
工程と、二段階以上のポインタを含むソースプログラム
に対して一段階までの近似的な変数影響解析を行う第2
の変数影響解析工程と、前記変数情報抽出工程において
抽出されたデータ依存関係に関する情報に基づいて、そ
のソースプログラムが二段階以上先のポインタを含むか
否かを判断し、二段階以以上のポインタを含まない場合
には前記第1の変数影響解析工程において変数影響解析
を行うことを決定し、二段階以上のポインタを含む場合
には前記第2の変数影響解析工程において変数影響解析
を行うことを決定する影響解析方法決定工程と、を具備
することを特徴とする。
A variable influence analysis method according to the present invention is an object of analysis in a variable influence analysis method for analyzing which part of a source program a variable included in a source program affects. A variable information extracting step of reading a source program and extracting information relating to data dependence of variables, a first variable influence analyzing step of performing a normal variable influence analysis on the source program, and two or more stages of pointers. Approximate variable effect analysis up to one stage for source program
Variable influence analysis step, based on the information on the data dependence extracted in the variable information extraction step, determine whether the source program includes a pointer two or more steps ahead, two or more pointers If not, it is determined that the variable influence analysis is performed in the first variable influence analysis step, and if two or more pointers are included, the variable influence analysis is performed in the second variable influence analysis step. And determining an influence analysis method.

【0008】本発明に係る機械読み取り可能な記録媒体
は、ソースプログラムに含まれる変数がそのソースプロ
グラムのどの部分にどのような影響を与えるかを解析す
るための変数影響解析機能を有するコンピュータプログ
ラムを記録した機械読み取り可能な記録媒体において、
解析の対象となるソースプログラムを読み込み、変数の
データ依存関係に関する情報を抽出する変数情報抽出機
能と、前記ソースプログラムに対して通常の変数影響解
析を行う第1の変数影響解析機能と、二段階以上のポイ
ンタを含むソースプログラムに対して一段階までの近似
的な変数影響解析を行う第2の変数影響解析機能と、前
記変数情報抽出工程において抽出されたデータ依存関係
に関する情報に基づいて、そのソースプログラムが二段
階以上先のポインタを含むか否かを判断し、二段階以以
上のポインタを含まない場合には前記第1の変数影響解
析工程において変数影響解析を行うことを決定し、二段
階以上のポインタを含む場合には前記第2の変数影響解
析工程において変数影響解析を行うことを決定する影響
解析方法決定機能と、を有するコンピュータプログラム
が記録されていることを特徴とする。
[0008] A machine-readable recording medium according to the present invention provides a computer program having a variable influence analysis function for analyzing which part of a source program is affected by a variable included in the source program. In the recorded machine-readable recording medium,
A variable information extraction function of reading a source program to be analyzed and extracting information on data dependence of variables; a first variable influence analysis function of performing a normal variable influence analysis on the source program; A second variable influence analysis function for performing an approximate variable influence analysis on the source program including the above-described pointers up to one stage, and a second function based on information on data dependency extracted in the variable information extracting step. It is determined whether the source program includes a pointer that is two or more steps ahead. If the source program does not include a pointer that is two or more steps, it is determined that the variable influence analysis is performed in the first variable influence analysis step. An influence analysis method determining function for determining that a variable influence analysis is to be performed in the second variable influence analysis step when the pointer includes a plurality of stages or more; , Characterized in that it is recorded a computer program having a.

【0009】本発明は、上記より、変数情報抽出手段に
よって抽出された変数情報に基づいて変数影響解析決定
手段が二段階以上先までのポインタを含むと判断した場
合でも、前記第2の変数影響解析手段によって一段階ま
での近似的な解析を行い、解析・修正作業に役立つ情報
が得られる。
According to the present invention, even when the variable influence analysis determining means determines that the pointer includes two or more steps ahead based on the variable information extracted by the variable information extracting means, By the analysis means, an approximate analysis up to one stage is performed, and information useful for analysis / correction work can be obtained.

【0010】[0010]

【発明の実施の形態】以下に図面を参照して、本発明の
一実施形態について説明する。まず、変数影響解析の概
略について説明する。変数影響解析には、データ依存関
係による解析手段と、制御依存関係による解析手段の二
つがあり、それらを組み合わせた結果が変数影響解析の
結果である。
DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS An embodiment of the present invention will be described below with reference to the drawings. First, an outline of the variable influence analysis will be described. In the variable influence analysis, there are two analysis means based on data dependency and two analysis means based on control dependency, and the result of combining them is the result of the variable influence analysis.

【0011】一般にプログラムにおいて、変数が定義さ
れるとは、記憶が割り当てられることを言い、変数が参
照されるとは、記憶された値が使用されることをいう。
また、文S2が、変数vに関して、文S1にデータ依存
するとは、 文S1において変数vが定義されること。 文S2において変数vが参照されること。
Generally, in a program, defining a variable means that storage is allocated, and referring to a variable means using a stored value.
Also, the statement S2 is dependent on the statement S1 for data regarding the variable v means that the variable v is defined in the statement S1. The variable v is referred to in the statement S2.

【0012】文S1から文S2への実行可能なパスで
あって、変数vを再定義しないパスが存在すること。 という3つの条件を満足することである。更に、文S2
が文S1に制御依存するとは、 文S1は制御の分岐点(C言語ではif文、whil
e文等をさす)であること。
There is an executable path from the statement S1 to the statement S2, which does not redefine the variable v. That is, the three conditions must be satisfied. Furthermore, the sentence S2
Is dependent on the statement S1. The statement S1 is a control branch point (if statement in C language, while statement
e).

【0013】文S2の実行の有無は、文S1の実行結
果に直接依存すること。 という二つの条件を満足することである。次に、上記の
データ依存および制御依存関係について、実際のプログ
ラムを例に挙げて説明する。図1は、C言語によるプロ
グラムの実例である。まず、同図のプログラムは、2行
目において、整数nが外部から与えられる値であること
を示す。4行目及び5行目は、宣言文である。6行目
は、変数jに0という値を入れる旨の命令であり、9行
目は変数iに0という値を入れる旨の命令であり、14
行目は変数iに−1を入れる旨の命令である。また、8
行目及び10行目にはif文がある。すなわち、8行目
で「n>0」であれば、9行目を実行し、「n>0」で
なければ14行目を実行する。「n>0」であって、更
に10行目で「n<10」であれば、11行目を実行す
る。ここで、11行目の「++j」は、現在の変数jの
値を1だけ繰り上げる旨の命令である。以上の手続きを
経たあと、16行目において、その時の変数iの値を返
している。
Whether the statement S2 is executed depends directly on the execution result of the statement S1. That is, the two conditions must be satisfied. Next, the data dependency and the control dependency described above will be described using an actual program as an example. FIG. 1 is an example of a program written in C language. First, the program shown in the figure shows on the second line that the integer n is a value given from the outside. The fourth and fifth lines are declaration statements. The sixth line is an instruction to insert a value of 0 into the variable j, and the ninth line is an instruction to insert a value of 0 into the variable i.
The line is an instruction to put -1 into the variable i. Also, 8
Lines 10 and 10 have an if sentence. That is, if “n> 0” in the eighth line, the ninth line is executed, and if “n> 0”, the fourteenth line is executed. If “n> 0” and if “n <10” in the tenth row, the eleventh row is executed. Here, “++ j” on the eleventh line is an instruction to increment the value of the current variable j by one. After the above procedure, the value of the variable i at that time is returned on the 16th line.

【0014】図1のプログラムの11行目の変数jの依
存関係を、データ依存及び制御依存に分けて考える。そ
のために、変数jに影響を与える行を遡って探してみる
と、10行目、8行目、6行目、2行目が変数jに影響
を与える行に該当する。このうち、変数jは、まず10
行目に制御依存し、この10行目は8行目に制御依存
し、更に、8行目は2行目にデータ依存する。また、1
1行目は、6行目にデータ依存していることが分かる。
したがって、解析・修正作業の際に、これら以外の行で
あれば、変数jに影響を与えることなくプログラムを修
正できることが分かる。
The dependence of the variable j on the eleventh line of the program in FIG. 1 is considered separately for data dependence and control dependence. For this reason, looking back at the rows that affect the variable j, the 10th, 8th, 6th, and 2nd rows correspond to the rows that affect the variable j. Of these, the variable j is 10
The control depends on the line, the 10th line depends on the control on the 8th line, and the 8th line depends on the data on the 2nd line. Also, 1
It can be seen that the first row is data dependent on the sixth row.
Therefore, it can be understood that the program can be corrected without affecting the variable j if the line is other than these at the time of the analysis and correction work.

【0015】図2は、C言語によるプログラムの別の例
である。このプログラムは、図1のプログラムと類似し
ているが、2行目、5行目、6行目、11行目、16行
目の部分が図1のプログラムと異なっている。図2のプ
ログラムにおいて、2行目、5行目、11行目、16行
目の「**(変数)」は、その変数の二段階先のポイン
タ、すなわちポインタへのポインタを示している。例え
ば、11行目の「++(**j)」という命令は、は、
「jの先の先、すなわちjの二段階先の値に1を加え、
それをここに入れ直しなさい。」という命令になる。す
なわち、まずjという値がどこを指しているかを調べな
ければならない。jが指している*jが分かったら、次
に、その*jの値がどこを指しているかを調べなければ
ならない。*jが指している**jが分かったら、最後
に**jの値を調べて、これに1を足して、得られた値
を新しく入れなおすという操作を行うことになる。
FIG. 2 shows another example of a program in C language. This program is similar to the program of FIG. 1, but is different from the program of FIG. 1 in the second, fifth, sixth, eleventh, and sixteenth rows. In the program of FIG. 2, “** (variable)” on the second, fifth, eleventh, and sixteenth lines indicates a pointer two steps ahead of the variable, that is, a pointer to the pointer. For example, the instruction “++ (** j)” on line 11 is
"Add 1 to the value of the point ahead of j, that is, the value of j two steps ahead,
Put it back here. ". That is, it is first necessary to check where the value j is pointing. Once we know the * j to which j points, we must then find out where the value of * j points. When ** j to which * j points is known, finally, the value of ** j is checked, 1 is added thereto, and an operation of re-entering the obtained value is performed.

【0016】図3は、このような状況を模式的に示した
図である。すなわち、jは*jを指し示し、*jは**
jを指し示す。しかし、jがどこを指しているかについ
て多数の場合があり、更に*jがどこを指しているかに
ついて多数の場合がある。したがって、ポインタが二段
階以上になると、調べるべき可能性のあるところは急速
に増大し、解析に要する時間及び使用されるメモリ容量
が膨大になる。このため、これまでの変数影響解析装置
では、このような二段階以上のポインタを含んだプログ
ラムにおいてデータ依存関係を解析しようとしても、実
質的には不可能であった。
FIG. 3 is a diagram schematically showing such a situation. That is, j indicates * j, and * j is **
j. However, there are many cases where j points, and there are many cases where * j points. Therefore, when the number of pointers is two or more, the possibility to be examined is rapidly increased, and the time required for analysis and the memory capacity used are enormous. For this reason, it has been practically impossible with a conventional variable influence analyzer to analyze data dependence in a program including such two or more stages of pointers.

【0017】これに対して、本実施形態に係る変数影響
解析装置では、このような二段階以上のポインタを含ん
だプログラムについて、直ちにデータ依存関係を解析不
可能とするのではなく、完全ではないにしてもある程度
の解析を行い、データ依存関係について何らかの見解を
導き出そうとする。すなわち、二段階以上先のポインタ
を含むと判断した場合には、一段分のポインタだけにつ
いて解析を行い、結果を出すことにする。
On the other hand, in the variable influence analysis apparatus according to the present embodiment, the data dependency of a program including such two or more stages of pointers is not immediately analyzed but not completely analyzed. Nevertheless, it does some analysis to try to derive some insight into data dependencies. That is, when it is determined that the pointer includes two or more steps ahead, the analysis is performed only on the pointer for one step and the result is output.

【0018】図4は、本実施形態に係る変数影響解析装
置のブロック図である。本装置は、ソースプログラムを
読み込んで、プログラム中のどの変数がプログラム中の
どの部分に影響を及ぼすかを、データ依存関係および制
御依存関係両方について解析するものである。それぞれ
の解析の結果を組み合わせて変数影響解析結果を得るこ
とができる。なお、これら二つの解析のうち、制御依存
関係の解析については、従来用いられている手法をその
まま用いることができるのでここでは説明を省き、デー
タ依存関係の解析について説明する。
FIG. 4 is a block diagram of the variable influence analysis apparatus according to the present embodiment. This apparatus reads a source program and analyzes which variable in the program affects which part in the program, for both data dependency and control dependency. Variable analysis results can be obtained by combining the results of each analysis. Note that, among the two analyses, the analysis of the control dependency relationship can be used as it is in the related art, so that the description thereof will be omitted here, and the analysis of the data dependency relationship will be described.

【0019】同図において、まず、変数情報抽出手段1
0は、ソースプログラムを読み込んで、変数のデータ依
存関係に関する情報を抽出する。つまり、「何行目の文
で変数vが定義されている」や、「何行目の文で変数v
が参照されている」という情報を抽出する働きをする。
影響解析方法決定手段11は、変数情報抽出手段10に
よって得られた変数情報に基づいて、解析対象のソース
プログラムに二段階以上のポインタが存在するかどうか
で、後段にある変数影響解析手段12あるいは特殊変数
影響解析手段13の何れの解析手段を用いて解析するか
を決定する働きをする。変数影響解析手段12は通常の
データ依存解析を行うものであり、特殊変数影響解析手
段13は二段階以上のポインタを含んでいるソースプロ
グラムに対して、一段階のポインタまでの解析を行うも
のである。
In FIG. 1, first, variable information extracting means 1
0 reads a source program and extracts information on data dependency of variables. In other words, "in which statement the variable v is defined" or "in which statement the variable v
Is referenced ".
Based on the variable information obtained by the variable information extracting means 10, the influence analyzing method determining means 11 determines whether or not there are two or more stages of pointers in the source program to be analyzed, and determines whether the variable effect analyzing means 12 or It functions to determine which of the special variable influence analysis means 13 to use for analysis. The variable influence analysis means 12 performs normal data dependence analysis, and the special variable influence analysis means 13 analyzes a source program including two or more stages of pointers up to one stage of pointers. is there.

【0020】つまり、解析対象のソースプログラムに二
段階以上のポインタが存在した場合だけ特殊変数影響解
析手段13で解析を行い、それ以外の場合は、変数影響
解析手段12において通常の解析が行われる。なお、解
析結果は、図示しない制御依存解析結果と組み合わせら
れ、変数影響解析結果として得られる。このように、本
実施形態の変数影響解析装置は、影響解析方法決定手段
11と、特殊変数影響解析手段13を備えたことで、従
来は解析不可能と判断されていた二段階以上のポインタ
を含んでいるソースプログラムに対しても、簡易的な解
析を行うことができるようになった。
That is, the analysis is performed by the special variable influence analysis means 13 only when there are two or more pointers in the source program to be analyzed, and otherwise, the normal analysis is performed by the variable influence analysis means 12. . The analysis result is obtained as a variable influence analysis result by being combined with a control dependent analysis result (not shown). As described above, the variable influence analysis device of the present embodiment includes the influence analysis method determination means 11 and the special variable influence analysis means 13, so that two or more stages of pointers which were conventionally determined to be impossible to analyze can be obtained. Simple analysis can now be performed on included source programs.

【0021】図5は、本実施形態に係る変数影響解析装
置の動作を示すフローチャートである。ステップS10
において、変数影響解析を行いたいプログラムのソース
コードを変数影響解析装置に読み込ませる。ステップS
11において、このソースプログラムから変数情報を抽
出する。ステップS12において、抽出されたこの変数
情報から、これに含まれる変数のポインタが一段階以下
のものであるか、二段階以上のものであるかという変数
の条件を判断する。ここで、変数のポインタが一段階以
下である場合には、ステップS13において、通常の変
数影響解析を行う。一方、ステップS12において変数
のポインタが、例えば図2に示すプログラムのように、
二段階以上であると判断された場合には、ステップS1
4において、そのポインタすべてについて変数影響解析
を行うのではなく、一段階だけの近似的な変数影響解析
を行って、なんらかの答を出す。この場合、オペレータ
に一段階だけの近似的な解析を行ったことを知らせるた
めに、必要に応じてその旨をCRTなどに表示する。
FIG. 5 is a flowchart showing the operation of the variable influence analyzer according to the present embodiment. Step S10
In step (1), a source code of a program to be subjected to a variable influence analysis is read into a variable influence analysis device. Step S
At 11, variable information is extracted from the source program. In step S12, based on the extracted variable information, it is determined whether the pointer of the variable included in the extracted variable information is one stage or less, or two or more stages. Here, when the pointer of the variable is one level or less, a normal variable influence analysis is performed in step S13. On the other hand, in step S12, the pointer of the variable is changed, for example, as in the program shown in FIG.
If it is determined that there are two or more steps, step S1
In step 4, instead of performing the variable influence analysis on all of the pointers, an approximate variable influence analysis is performed only in one step, and a certain answer is obtained. In this case, the fact is displayed on a CRT or the like as necessary in order to inform the operator that an approximate analysis of only one stage has been performed.

【0022】このようにして得られた答は、正確な解析
結果ではないが、デバッグ作業を行うのに十分役立つも
のであり、かかる結果に基づいてデバッグ作業を行え
ば、デバッグ作業の効率化を図ることができる。尚、本
発明は、上記実施形態には限定されず、その要旨の範囲
内で種々の変更が可能である。本発明の変数影響解析装
置の各手段は、コンピュータ上で動作するソフトウェア
で実現できるので、例えばCD−ROMなどの記録媒体
に、上記動作をするようなソフトウェアを記録し、当該
ソフトウェアをコンピュータに読み込ませることによっ
て、コンピュータを変数影響解析装置として利用するこ
とが可能である。
Although the answer obtained in this manner is not an accurate analysis result, it is sufficiently useful for performing a debugging operation. If the debugging operation is performed based on the result, the efficiency of the debugging operation can be improved. Can be planned. The present invention is not limited to the above embodiment, and various changes can be made within the scope of the gist. Since each means of the variable influence analysis device of the present invention can be realized by software operating on a computer, the software for performing the above operation is recorded on a recording medium such as a CD-ROM, and the software is read by a computer. By doing so, it is possible to use the computer as a variable influence analysis device.

【0023】[0023]

【発明の効果】以上説明したように、本発明によれば、
変数情報抽出手段によって抽出された変数情報に基づい
て変数影響解析決定手段が二段階以上先までのポインタ
を含むと判断した場合でも、前記第2の変数影響解析手
段によって一段階までの近似的な解析を行うので、従来
は膨大な解析量によって実質的に解析不可能であった二
段階以上先までのポインタを含むソースプログラムにつ
いても近似的ながら変数影響解析が行われ、デバッグ作
業に役立つ情報が得られる。これによってデバッグ作業
の効率化を図ることができる変数影響解析装置及び変数
影響解析方法を提供することができる。
As described above, according to the present invention,
Even if the variable influence analysis determining means determines that the pointer includes two or more steps ahead based on the variable information extracted by the variable information extracting means, the second variable influence analyzing means may perform an approximate Since the analysis is performed, a variable effect analysis is performed while approximating a source program that includes a pointer beyond two or more steps, which was practically impossible to analyze due to the huge amount of analysis in the past, and information useful for debugging work is provided. can get. As a result, it is possible to provide a variable influence analysis device and a variable influence analysis method capable of improving the efficiency of debugging work.

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

【図1】変数影響解析を行おうとするソースプログラム
の実例を示す図である。
FIG. 1 is a diagram showing an actual example of a source program for performing a variable influence analysis.

【図2】変数影響解析を行おうとするソースプログラム
の他の実例を示す図である。
FIG. 2 is a diagram showing another example of a source program for performing a variable influence analysis.

【図3】二段階以上のポインタを解析しようとしたとき
に要する時間が膨大になることを模式的に示した図であ
る。
FIG. 3 is a diagram schematically showing that the time required to analyze a pointer in two or more stages becomes enormous.

【図4】本実施形態に係る変数影響解析装置のブロック
図である。
FIG. 4 is a block diagram of a variable influence analysis device according to the present embodiment.

【図5】本実施形態に係る変数影響解析装置の動作を示
すフローチャートである。
FIG. 5 is a flowchart showing an operation of the variable influence analysis device according to the embodiment.

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

10 変数情報抽出手段 11 影響解析方法決定手段 12 影響解析手段 13 特殊変数影響解析手段 DESCRIPTION OF SYMBOLS 10 Variable information extraction means 11 Impact analysis method determination means 12 Impact analysis means 13 Special variable influence analysis means

Claims (9)

【特許請求の範囲】[Claims] 【請求項1】 ソースプログラムに含まれる変数がその
ソースプログラムのどの部分にどのような影響を与える
かを解析するための変数影響解析装置において、 解析の対象となるソースプログラムを読み込み、変数の
データ依存関係に関する情報を抽出する変数情報抽出手
段と、 前記ソースプログラムに対して通常の変数影響解析を行
う第1の変数影響解析手段と、 二段階以上のポインタを含むソースプログラムに対して
一段階までの近似的な変数影響解析を行う第2の変数影
響解析手段と、 前記変数情報抽出手段が抽出したデータ依存関係に関す
る情報に基づいて、そのソースプログラムが二段階以上
先のポインタを含むか否かを判断し、二段階以以上のポ
インタを含まない場合には前記第1の変数影響解析手段
に変数影響解析を行わせることを決定し、二段階以上の
ポインタを含む場合には前記第2の変数影響解析手段に
変数影響解析を行わせることを決定する影響解析方法決
定手段と、 を具備することを特徴とする変数影響解析装置。
1. A variable influence analysis apparatus for analyzing what effect a variable included in a source program has on which part of the source program, reads a source program to be analyzed, and stores data of the variable. Variable information extracting means for extracting information on a dependency, first variable influence analyzing means for performing a normal variable influence analysis on the source program, and up to one step for a source program including two or more stages of pointers A second variable influence analysis means for performing an approximate variable influence analysis of: based on the information on the data dependency extracted by the variable information extraction means, whether or not the source program includes a pointer two or more steps ahead; Is determined, and if the pointer does not include two or more stages, the first variable influence analysis means performs the variable influence analysis. Effect analysis method determining means for determining that the second variable influence analysis means performs the variable influence analysis when including a pointer of two or more stages. Impact analysis device.
【請求項2】 前記第2の変数影響解析手段で変数影響
解析を行う場合には、その旨を表示することを特徴とす
る請求項1記載の変数影響解析装置。
2. The variable influence analysis apparatus according to claim 1, wherein when the second variable influence analysis means performs the variable influence analysis, the fact is displayed.
【請求項3】 前記変数情報抽出手段は、更に制御依存
関係に関する情報を抽出することを特徴とする請求項1
又は2記載の変数影響解析装置。
3. The method according to claim 1, wherein the variable information extracting means further extracts information on a control dependency.
Or the variable influence analyzer according to 2.
【請求項4】 ソースプログラムに含まれる変数がその
ソースプログラムのどの部分にどのような影響を与える
かを解析するための変数影響解析方法において、 解析の対象となるソースプログラムを読み込み、変数の
データ依存関係に関する情報を抽出する変数情報抽出工
程と、 前記ソースプログラムに対して通常の変数影響解析を行
う第1の変数影響解析工程と、 二段階以上のポインタを含むソースプログラムに対して
一段階までの近似的な変数影響解析を行う第2の変数影
響解析工程と、 前記変数情報抽出工程において抽出されたデータ依存関
係に関する情報に基づいて、そのソースプログラムが二
段階以上先のポインタを含むか否かを判断し、二段階以
以上のポインタを含まない場合には前記第1の変数影響
解析工程において変数影響解析を行うことを決定し、二
段階以上のポインタを含む場合には前記第2の変数影響
解析工程において変数影響解析を行うことを決定する影
響解析方法決定工程と、 を具備することを特徴とする変数影響解析方法。
4. A variable influence analysis method for analyzing how a variable included in a source program affects which part of the source program, reads a source program to be analyzed, and stores data of the variable. A variable information extracting step of extracting information relating to a dependency, a first variable influence analyzing step of performing a normal variable influence analysis on the source program, and a first step for a source program including two or more stages of pointers A second variable influence analysis step of performing an approximate variable influence analysis, and whether or not the source program includes a pointer two or more steps ahead based on the information on the data dependency extracted in the variable information extraction step. Is determined, and if the pointer does not include two or more steps, the variable shadow is determined in the first variable influence analysis step. Determining to perform the analysis, and when including two or more stages of pointers, an impact analysis method determining step of deciding to perform the variable impact analysis in the second variable impact analysis step. Variable impact analysis method to be performed.
【請求項5】 前記第2の変数影響解析工程において変
数影響解析を行う場合には、その旨を表示することを特
徴とする請求項4記載の変数影響解析方法。
5. The variable influence analysis method according to claim 4, wherein, when the variable influence analysis is performed in the second variable influence analysis step, the fact is displayed.
【請求項6】 前記変数情報抽出工程では、更に制御依
存関係に関する情報を抽出することを特徴とする請求項
4又は5記載の変数影響解析方法。
6. The variable influence analysis method according to claim 4, wherein in the variable information extracting step, information on a control dependency is further extracted.
【請求項7】 ソースプログラムに含まれる変数がその
ソースプログラムのどの部分にどのような影響を与える
かを解析するための変数影響解析機能を有するコンピュ
ータプログラムを記録した機械読み取り可能な記録媒体
において、 解析の対象となるソースプログラムを読み込み、変数の
データ依存関係に関する情報を抽出する変数情報抽出機
能と、 前記ソースプログラムに対して通常の変数影響解析を行
う第1の変数影響解析機能と、 二段階以上のポインタを含むソースプログラムに対して
一段階までの近似的な変数影響解析を行う第2の変数影
響解析機能と、 前記変数情報抽出工程において抽出されたデータ依存関
係に関する情報に基づいて、そのソースプログラムが二
段階以上先のポインタを含むか否かを判断し、二段階以
以上のポインタを含まない場合には前記第1の変数影響
解析工程において変数影響解析を行うことを決定し、二
段階以上のポインタを含む場合には前記第2の変数影響
解析工程において変数影響解析を行うことを決定する影
響解析方法決定機能と、 を有するコンピュータプログラムが記録された記録媒
体。
7. A machine-readable recording medium on which a computer program having a variable influence analysis function for analyzing which part of a source program has a variable included in a source program is analyzed, A variable information extraction function for reading a source program to be analyzed and extracting information on data dependence of variables; a first variable influence analysis function for performing a normal variable influence analysis on the source program; A second variable influence analysis function for performing an approximate variable influence analysis of the source program including the above-mentioned pointers up to one stage, based on the information on the data dependency extracted in the variable information extraction step, Determines whether the source program contains a pointer that is two or more steps ahead. When no inter is included, it is determined that the variable influence analysis is performed in the first variable influence analysis step. When two or more pointers are included, the variable influence analysis is performed in the second variable influence analysis step. And a function for deciding an impact analysis method for deciding that a computer program is recorded.
【請求項8】 前記第2の変数影響解析機能により変数
影響解析を行う場合には、その旨を表示することを特徴
とする請求項7記載の変数影響解析方法。
8. The variable influence analysis method according to claim 7, wherein when the variable influence analysis is performed by the second variable influence analysis function, the effect is displayed.
【請求項9】 前記変数情報抽出機能は、更に制御依存
関係に関する情報を抽出する機能を有することを特徴と
する請求項7又は8記載の変数影響解析方法。
9. The variable influence analysis method according to claim 7, wherein said variable information extraction function further has a function of extracting information relating to control dependencies.
JP02435598A 1998-02-05 1998-02-05 Variable effect analysis apparatus and variable effect analysis method Expired - Fee Related JP3900223B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP02435598A JP3900223B2 (en) 1998-02-05 1998-02-05 Variable effect analysis apparatus and variable effect analysis method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP02435598A JP3900223B2 (en) 1998-02-05 1998-02-05 Variable effect analysis apparatus and variable effect analysis method

Publications (2)

Publication Number Publication Date
JPH11224185A true JPH11224185A (en) 1999-08-17
JP3900223B2 JP3900223B2 (en) 2007-04-04

Family

ID=12135898

Family Applications (1)

Application Number Title Priority Date Filing Date
JP02435598A Expired - Fee Related JP3900223B2 (en) 1998-02-05 1998-02-05 Variable effect analysis apparatus and variable effect analysis method

Country Status (1)

Country Link
JP (1) JP3900223B2 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2010191598A (en) * 2009-02-17 2010-09-02 Mitsubishi Electric Corp Information processor, information processing method, and program

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2010191598A (en) * 2009-02-17 2010-09-02 Mitsubishi Electric Corp Information processor, information processing method, and program

Also Published As

Publication number Publication date
JP3900223B2 (en) 2007-04-04

Similar Documents

Publication Publication Date Title
US5987250A (en) Transparent instrumentation for computer program behavior analysis
EP1130518B1 (en) Software analysis system having an apparatus for selectively collecting analysis data from a target system executing software instrumented with tag statements and method for use thereof
JP2749528B2 (en) Tracer system for error analysis
US9274923B2 (en) System and method for stack crawl testing and caching
US7571427B2 (en) Methods for comparing versions of a program
US8006229B2 (en) Program maintenance support device and program for the same
US20030033592A1 (en) Software debugger and software development support system
US5832273A (en) System for deleting redundant instructions from high level language source code containing in-line assembly instructions
JPH05257709A (en) Parallelism discriminating method and parallelism supporting method using the same
CN109086215B (en) Embedded software unit test case generation method and system
JP2004164554A (en) Device and method for executing and monitoring program
US6519768B1 (en) Instruction translation method
US6993749B2 (en) Conditional debug monitors
JP3418544B2 (en) Automatic test data generator for programs
JPH11224185A (en) Device and method for analyzing variable influence
JPH08305583A (en) Method for simulating cpu
US6343378B1 (en) Method of making link directive file and tool for making link directive file
JPH0554277A (en) Plant monitor device
US9274929B2 (en) Constraint derivation in context following for use with object code insertion
JPH10289102A (en) Data flow analyzer for program
JPH10187461A (en) Language processing system
JP3011115B2 (en) Debug system
JPH09288580A (en) Device and method for optimizing source program
JP2004287869A (en) Program execution monitoring device and method
KR0175469B1 (en) How to control the visibility of fill program variables

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20040913

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20060913

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20061113

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: 20061206

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20061219

R150 Certificate of patent or registration of utility model

Free format text: JAPANESE INTERMEDIATE CODE: R150

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20110112

Year of fee payment: 4

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20110112

Year of fee payment: 4

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20120112

Year of fee payment: 5

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20120112

Year of fee payment: 5

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20130112

Year of fee payment: 6

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20130112

Year of fee payment: 6

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20140112

Year of fee payment: 7

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

LAPS Cancellation because of no payment of annual fees