JP2018147106A - Program analyzer, program analysis method and program analysis program - Google Patents

Program analyzer, program analysis method and program analysis program Download PDF

Info

Publication number
JP2018147106A
JP2018147106A JP2017039644A JP2017039644A JP2018147106A JP 2018147106 A JP2018147106 A JP 2018147106A JP 2017039644 A JP2017039644 A JP 2017039644A JP 2017039644 A JP2017039644 A JP 2017039644A JP 2018147106 A JP2018147106 A JP 2018147106A
Authority
JP
Japan
Prior art keywords
program
branch
statement
slicing
unit
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
JP2017039644A
Other languages
Japanese (ja)
Other versions
JP6790921B2 (en
Inventor
前田 芳晴
Yoshiharu Maeda
芳晴 前田
昭彦 松尾
Akihiko Matsuo
昭彦 松尾
健一 平井
Kenichi Hirai
健一 平井
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Fujitsu Ltd
Original Assignee
Fujitsu Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Fujitsu Ltd filed Critical Fujitsu Ltd
Priority to JP2017039644A priority Critical patent/JP6790921B2/en
Publication of JP2018147106A publication Critical patent/JP2018147106A/en
Application granted granted Critical
Publication of JP6790921B2 publication Critical patent/JP6790921B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Debugging And Monitoring (AREA)

Abstract

PROBLEM TO BE SOLVED: To provide a program analyzer, a program analysis method and a program analysis program which symbolically execute a program obtained by program slicing.SOLUTION: A slicing unit 11 extracts instruction statements from a program 2 on the basis of a slicing base point 3 to generate an instruction statement list and stores the list in an instruction statement list storage unit 12. Then, a restoration unit 13 reads the instruction statement list from the instruction statement list storage unit 12 to restore an executable program and stores the executable program in a restored program storage unit 14. Then, a symbolic execution unit 15 reads the program from the restored program storage unit 14 to symbolically execute the program.SELECTED DRAWING: Figure 2

Description

本発明は、プログラム分析装置、プログラム分析方法及びプログラム分析プログラムに関する。   The present invention relates to a program analysis device, a program analysis method, and a program analysis program.

既存の情報システムの保守や再構築の作業では、既存システムの現状を理解し把握するため、既存システムに関するドキュメントや有識者の知識などの情報が必要である。しかし、長期に運用保守された情報システムでは、ドキュメントの不備や有識者の不在などの要因により、保守や再構築の作業に必要な情報が不足することがある。   In maintenance and rebuilding of an existing information system, in order to understand and grasp the current state of the existing system, information such as documents on the existing system and knowledge of experts is necessary. However, in an information system that has been operated and maintained for a long period of time, information necessary for maintenance and reconstruction work may be insufficient due to factors such as document deficiencies and the absence of experts.

このような場合、ドキュメントや有識者から得られる情報の代替として、情報システムの実装実体であるプログラムを分析することによって、不足する知識を補うことが行われる。このようなプログラムの分析は、プログラムのロジック抽出と呼ばれる。ここで、プログラムのロジックとは、プログラムに記述された処理の内容であり、具体的には、プログラムの実行結果としての入出力関係である。   In such a case, as a substitute for information obtained from a document or an expert, a lacking knowledge is compensated by analyzing a program which is an implementation entity of the information system. Such program analysis is called program logic extraction. Here, the logic of the program is the content of the process described in the program, and specifically, the input / output relationship as the execution result of the program.

プログラムのロジック抽出の方式の1つに、シンボリック実行(Symbolic Execution、記号実行)技術を利用する手法がある。ここで、シンボリック実行は、入力変数にシンボル値(記号値)を設定して、プログラムの実行可能なパスを抽出することによって、プログラムを分析する技術である。   One method of program logic extraction is to use symbolic execution technology. Here, symbolic execution is a technique for analyzing a program by setting a symbol value (symbol value) to an input variable and extracting an executable path of the program.

シンボリック実行技術は、プログラムに記述された命令文に従って変数値の参照と更新を行い、条件分岐文やループ文のような制御文ではプログラム記述通りに命令文の実行を制御する。特に、条件分岐では条件式の真偽値に従って分岐が選択されるが、シンボリック実行技術は、条件式を構成する変数値にシンボル値が含まれる場合は条件式の真偽値を算出できない。   The symbolic execution technique refers to and updates variable values according to an instruction statement described in a program, and controls the execution of the instruction statement according to the program description in a control statement such as a conditional branch statement or a loop statement. In particular, in a conditional branch, a branch is selected according to the true / false value of the conditional expression. However, the symbolic execution technique cannot calculate the true / false value of the conditional expression if the symbol value is included in the variable value constituting the conditional expression.

このため、シンボリック実行技術は、代わりに条件式の充足可能性(条件式が真となりうること)を判定して条件分岐の分岐選択を制御する。充足可能性の判定には、SMT(Satisfiability Modulo Theories)ソルバやSAT(SATisfiability problem)ソルバが利用される。条件分岐の複数の分岐が充足可能な場合は、これら複数の分岐は共に実行可能なので、シンボリック実行技術は、複数の分岐のうち順に1つを仮定し選択することによって、実行可能パスを抽出する。   For this reason, the symbolic execution technique controls branch selection of the conditional branch by determining whether the conditional expression is satisfiable (the conditional expression can be true) instead. For the determination of satisfiability, an SMT (Satisfiability Modulo Theories) solver or an SAT (SATisfiability problem) solver is used. When a plurality of conditional branches can be satisfied, the plurality of branches can be executed together. Therefore, the symbolic execution technique extracts an executable path by assuming and selecting one of the plurality of branches in order. .

シンボリック実行の分析結果は、実行可能なパス毎の、パス条件とパス出力である。これらの結果を整理し、分析対象プログラムから仕様抽出した結果の1つ形式がロジック表、あるいは、決定表である。ロジック表は、入力に関する条件とその条件が満たされた場合の出力を表す。   The analysis result of symbolic execution is a path condition and a path output for each executable path. One form of the result of organizing these results and extracting the specifications from the analysis target program is a logic table or a decision table. The logic table represents a condition regarding input and an output when the condition is satisfied.

以下、シンボリック実行を利用したプログラムのロジック抽出の動作例について説明する。図21は、シンボリック実行の説明に用いるプログラム91を示す図である。図21は、COBOLで記述されたプログラム91を示す。図21に示すように、プログラム91には、14行目と19行目にそれぞれIF文#1及びIF文#2で示されるIF文がある。   Hereinafter, an operation example of program logic extraction using symbolic execution will be described. FIG. 21 is a diagram showing a program 91 used for explaining symbolic execution. FIG. 21 shows a program 91 written in COBOL. As shown in FIG. 21, in the program 91, there are IF sentences indicated by IF sentence # 1 and IF sentence # 2 in the 14th and 19th lines, respectively.

図22は、図21に示したプログラム91のフロー図である。図22に示すように、フロー図は、プログラム91の条件による分岐構造と各分岐における処理内容を表す。例えば、プログラム91のIF文#1に対応して分岐条件「性別=男性」に基づく2つの分岐の処理内容は、それぞれ「出力=‘M’」と「出力=‘’」である。   FIG. 22 is a flowchart of the program 91 shown in FIG. As shown in FIG. 22, the flowchart shows the branch structure according to the condition of the program 91 and the processing contents in each branch. For example, the processing contents of two branches based on the branch condition “gender = male” corresponding to the IF statement # 1 of the program 91 are “output =“ M ”” and “output =“ ”, respectively.

図23は、図21に示したプログラム91のシンボリック実行により抽出されたパスを示す図であり、図24は、図21に示したプログラム91のシンボリック実行による分析結果を示すロジック表である。図23に示すように、シンボリック実行によりパス#1〜パス#3で表される3つのパスが抽出され、図24に示すように、各パスに対応するパス条件及びパス出力が抽出される。   23 is a diagram showing paths extracted by symbolic execution of the program 91 shown in FIG. 21, and FIG. 24 is a logic table showing analysis results by symbolic execution of the program 91 shown in FIG. As shown in FIG. 23, three paths represented by path # 1 to path # 3 are extracted by symbolic execution, and as shown in FIG. 24, path conditions and path outputs corresponding to each path are extracted.

ここで、パスは実行された命令文の系列であり、パス条件はパスが終了するまでに経由する条件のうち、条件が充足可能となるシンボル値の条件式である。パスが実行可能とは、パス条件が充足可能である場合に該当する。   Here, the path is a sequence of executed statements, and the path condition is a conditional expression of a symbol value that can satisfy the condition among the conditions that are passed until the path ends. The path is executable when the path condition can be satisfied.

パス条件は、プログラムに記述されたIF文等の条件分岐文の条件式から単純に抽出されるものではなく、条件分岐文の間に実行された変数の更新結果も取り込んだものである。4番目のパスは、パス条件が「(性別=男性)∧(性別=女性)」であり、パス条件が充足不能(成立不可能)であるため、実行不可能なパスと判定され抽出されない。パス出力は、パスが実行された結果の出力である。Noは、パスを識別する番号である。   The path condition is not simply extracted from a conditional expression of a conditional branch statement such as an IF statement described in the program, but also includes a variable update result executed between conditional branch statements. The fourth path has a path condition of “(gender = male) = (gender = female)” and the path condition is unsatisfiable (cannot be established), so it is determined as an infeasible path and is not extracted. The path output is an output resulting from the execution of the path. No is a number that identifies the path.

シンボリック実行によるプログラムのロジック抽出では、ロジックを漏れなく抽出するために、プログラムの実行可能なパスを網羅的に抽出する必要がある。シンボリック実行での網羅的なパス抽出には、深さ優先探索や幅優先探索に基づく方法があるが、網羅的パス抽出には、パス爆発という欠点がある。ここで、パス爆発には、以下の2つの場合がある。   In the program logic extraction by symbolic execution, it is necessary to exhaustively extract the executable paths of the program in order to extract the logic without omission. For exhaustive path extraction in symbolic execution, there are methods based on depth-first search and breadth-first search, but exhaustive path extraction has the disadvantage of path explosion. Here, there are the following two cases of path explosion.

(1)対象プログラムの実行可能なパス数が無限である場合。パス数が無限となるのは、プログラムにループ処理があり、かつ、ループ終了条件に記号値が含まれる場合である。この場合、ループを継続する条件が常に充足可能となるためパス数が無限となる。   (1) The number of paths that can be executed by the target program is infinite. The number of passes is infinite when the program has a loop process and the loop end condition includes a symbol value. In this case, since the condition for continuing the loop can always be satisfied, the number of passes becomes infinite.

(2)パス抽出処理において分析時間やメモリが制限を超過する場合。例えば、独立なIF文がN個連続しているプログラムでは、パス数は、2のN乗個となるので、Nが大きくなると、パス数は、無限ではないが、分析可能な時間やメモリが制限を超過する。   (2) When the analysis time or memory exceeds the limit in the path extraction process. For example, in a program in which N independent IF statements are continued, the number of paths is 2 to the Nth power. Therefore, when N increases, the number of paths is not infinite, but the time and memory that can be analyzed are limited. The limit is exceeded.

そこで、プログラムスライシング技術を用いてパス爆発を防ぐことが考えられる。プログラムスライシング技術とは、複数の処理が混在するプログラムに対して注目する処理だけを抽出する技術である。   Therefore, it is conceivable to prevent path explosion by using program slicing technology. The program slicing technique is a technique for extracting only a process of interest for a program in which a plurality of processes are mixed.

図25は、プログラムスライシングの説明に用いるプログラム92を示す図である。図25に示すように、プログラム92にはXとYの2個の変数に関する処理があり、Xに関する処理及びYに関する処理は、それぞれ前処理とメイン処理に分けられ、混在する形式で実装されている。そこで、プログラムスライシング技術は、例えば、Xに関する処理だけを抽出する。   FIG. 25 is a diagram showing a program 92 used for explanation of program slicing. As shown in FIG. 25, the program 92 has processing related to two variables X and Y. The processing related to X and the processing related to Y are divided into preprocessing and main processing, respectively, and are implemented in a mixed format. Yes. Therefore, the program slicing technique extracts only processing related to X, for example.

プログラムスライシング技術は、プログラム中のある命令文Sと変数Vをスライシング基点として、スライシング基点に影響する命令文を抽出する。スライシング基点は(S,V)の形式で記述される。プログラムスライシング技術は、プログラム中の命令文に対して制御依存関係とデータ依存関係からプログラム依存グラフを構築し、スライシング基点からこれらの依存関係を辿ることによって影響する命令文を抽出する。   The program slicing technique extracts a command statement that affects a slicing base point by using a command statement S and a variable V in the program as a slicing base point. The slicing base point is described in the format (S, V). In the program slicing technique, a program dependence graph is constructed from the control dependence and the data dependence for the statements in the program, and the influence statements are extracted by tracing these dependences from the slicing base point.

図26は、プログラムスライシングの第1の例を示す図であり、図27は、プログラムスライシングの第2の例を示す図である。図26において、スライス結果#1は、対象プログラム93をスライシング基点(9,X)でスライシングした場合を示し、スライス結果#2は、対象プログラム93をスライシング基点(9,Y)でスライシングした場合を示す。なお、「9」は命令文の行を示す。また、抽出された命令文は、太字で表される。   FIG. 26 is a diagram illustrating a first example of program slicing, and FIG. 27 is a diagram illustrating a second example of program slicing. In FIG. 26, slice result # 1 shows a case where the target program 93 is sliced at the slicing base point (9, X), and slice result # 2 shows a case where the target program 93 is sliced at the slicing base point (9, Y). Show. Note that “9” indicates a line of a command statement. In addition, the extracted command sentence is shown in bold.

スライス結果#1に示すように、9行目の「DISPLAY X Y Z」の変数Xに影響する命令文が抽出される。また、スライス結果#2に示すように、9行目の「DISPLAY X Y Z」の変数Yに影響する命令文が抽出される。2行目の「Y=X+1」によりYはXに依存するため、1行目の「X=X+1」も9行目の「DISPLAY X Y Z」の変数Yに影響する命令文として抽出される。   As shown in the slice result # 1, a statement that affects the variable X of “DISPLAY X Y Z” on the ninth line is extracted. Also, as shown in the slice result # 2, a command statement that affects the variable Y of “DISPLAY X Y Z” on the ninth line is extracted. Since Y depends on X due to “Y = X + 1” on the second line, “X = X + 1” on the first line is also extracted as a statement that affects the variable Y of “DISPLAY X Y Z” on the ninth line. .

図27は、図25に示したプログラム92の23行目のCOMPUTE文をスライシング基点(23,X)とした場合のスライシング結果を示す。なお、23行目のCOMPUTE文は変数Xだけを参照更新するので、スライシング基点として変数Xを陽に指定しなくてもよい。   FIG. 27 shows the slicing result when the COMPUTE statement on the 23rd line of the program 92 shown in FIG. 25 is set as the slicing base point (23, X). Since the COMPUTE statement on the 23rd line references and updates only the variable X, the variable X need not be explicitly specified as the slicing base point.

図27の右図では、スライシング基点3に関係しない命令文には取り消し線が引かれており、取り消し線がない命令文がスライシング基点(23,X)に影響する命令文である。プログラムスライシングを実行することにより、23行目のCOMPUTE文に影響する命令文だけを抽出できるので、デバッグ作業やテストを効率化することができる。   In the right diagram of FIG. 27, a command statement not related to the slicing base point 3 is marked with a strikethrough, and a command statement without a strikethrough is a command statement that affects the slicing base point (23, X). By executing the program slicing, it is possible to extract only the imperative statement that affects the COMPUTE statement on the 23rd line, so that debugging work and testing can be made more efficient.

なお、プログラムの変数の一部に関する属性情報から、変数の依存関係を辿りつつ、他の変数の属性を推論することにより、プログラムのユーザが全ての変数について属性情報を調査する必要をなくす技術がある。この技術によれば、システムの検証モデルをソフトウェアモデルと外部環境モデルから合成する際に、ソフトウェアモデルと外部環境モデルとの入出力を整合させる手間を低減することができる。   A technology that eliminates the need for the user of the program to investigate the attribute information for all variables by inferring the attributes of other variables while tracing the dependency relationships of the variables from the attribute information about some of the program variables. is there. According to this technology, when the system verification model is synthesized from the software model and the external environment model, it is possible to reduce time and effort for matching input / output between the software model and the external environment model.

また、2変数間の代入依存関係、データ依存関係、制御依存関係から複数ステートメント間に渡る変数依存関係をグラフとして表示することで、ソフトウェアの構成や処理概要に関する情報をユーザに提供する技術がある。   In addition, there is a technology that provides information on the software configuration and processing overview to the user by displaying variable dependency relationships between multiple statements from assignment dependency relationships, data dependency relationships, and control dependency relationships between two variables. .

特開2014−48856号公報JP 2014-48856 A 特開2013−156786号公報JP2013-156786A

プログラムスライシング技術は、スライシング基点に影響する命令文を抽出できるので、シンボリック実行技術と組み合わせることによって、パス爆発を防ぐことができる。しかしながら、プログラムスライシングの結果は、実行可能なプログラムではないため、シンボリック実行に使えないという問題がある。   Since the program slicing technique can extract statements that affect the slicing base point, path explosion can be prevented by combining with the symbolic execution technique. However, since the result of program slicing is not an executable program, there is a problem that it cannot be used for symbolic execution.

例えば、図27では、10行目のDISPLAY文はスライシング基点に影響しない命令文であり、この命令文には取り消し線が引かれているが、この命令文を「影響なし」として除外してしまうと、9行目のIF文のTHEN分岐の命令文が皆無となる。このため、スライシング結果のプログラムでは記述が不完全となり、スライシング結果のプログラムが「実行不可能」となる。   For example, in FIG. 27, the DISPLAY statement on the 10th line is a command statement that does not affect the slicing base point, and this command statement is marked with a strikethrough, but this command statement is excluded as “no effect”. Then, there is no statement for the THEN branch of the IF statement on the 9th line. For this reason, the description of the slicing result program is incomplete, and the slicing result program becomes “unexecutable”.

本発明は、1つの側面では、プログラムスライシングにより得られるプログラムをシンボリック実行することを目的とする。   An object of one aspect of the present invention is to symbolically execute a program obtained by program slicing.

1つの態様では、プログラム分析装置は、スライシング部と、復元部と、シンボリック実行部とを有する。スライシング部は、プログラム中の命令文と変数を指定するスライシング基点に影響する命令文を抽出して命令文リストを作成する。復元部は、スライシング部により作成された命令文リストを用いてシンボリック実行が可能なプログラムを復元する。シンボリック実行部は、復元部により復元されたプログラムをシンボリック実行してロジック表を出力する。   In one aspect, the program analysis apparatus includes a slicing unit, a restoration unit, and a symbolic execution unit. The slicing unit extracts an imperative sentence that influences a slicing base point that specifies an imperative sentence and a variable in the program, and creates an imperative sentence list. The restoration unit restores a program that can be symbolically executed using the command statement list created by the slicing unit. The symbolic execution unit symbolically executes the program restored by the restoration unit and outputs a logic table.

1つの側面では、本発明は、プログラムスライシングにより得られるプログラムをシンボリック実行することができる。   In one aspect, the present invention can symbolically execute a program obtained by program slicing.

図1は、実施例に係るプログラム分析装置によるプログラムの復元を説明するための図である。FIG. 1 is a diagram for explaining program restoration by the program analysis apparatus according to the embodiment. 図2は、実施例に係るプログラム分析装置の機能構成を示す図である。FIG. 2 is a diagram illustrating a functional configuration of the program analysis apparatus according to the embodiment. 図3は、プログラム及びスライシング基点の一例を示す図である。FIG. 3 is a diagram illustrating an example of a program and a slicing base point. 図4は、スライシング部の動作例を示す図である。FIG. 4 is a diagram illustrating an operation example of the slicing unit. 図5は、復元部の動作例を示す図である。FIG. 5 is a diagram illustrating an operation example of the restoration unit. 図6は、復元されたプログラムのシンボリック実行結果を示す図である。FIG. 6 is a diagram showing a symbolic execution result of the restored program. 図7は、分岐設定部の動作例を示す図である。FIG. 7 is a diagram illustrating an operation example of the branch setting unit. 図8は、分岐制御部の動作例を示す図である。FIG. 8 is a diagram illustrating an operation example of the branch control unit. 図9は、プログラム分析装置による処理のフローを示すフローチャートである。FIG. 9 is a flowchart showing a flow of processing by the program analysis apparatus. 図10は、プログラムスライシング処理のフローを示すフローチャートである。FIG. 10 is a flowchart showing the flow of the program slicing process. 図11は、プログラムを復元する処理のフローを示すフローチャートである。FIG. 11 is a flowchart showing a flow of processing for restoring a program. 図12は、分岐設定を行う処理のフローを示すフローチャートである。FIG. 12 is a flowchart illustrating a flow of processing for performing branch setting. 図13は、入れ子構造の条件分岐文を有するプログラム及び制御依存関係を示す図である。FIG. 13 is a diagram illustrating a program having a nested conditional branch statement and a control dependency relationship. 図14は、図13に示したプログラムから作成される固定選択情報の例を示す図である。FIG. 14 is a diagram showing an example of fixed selection information created from the program shown in FIG. 図15は、分岐制御を行う処理のフローを示すフローチャートである。FIG. 15 is a flowchart illustrating a flow of processing for performing branch control. 図16は、図3に示したプログラムのシンボリック実行の結果を示す図である。FIG. 16 is a diagram showing the result of symbolic execution of the program shown in FIG. 図17は、図3に示したプログラムのロジック表を示す図である。FIG. 17 is a diagram showing a logic table of the program shown in FIG. 図18は、プログラム分析装置によるシンボリック実行の結果を示す第1の図である。FIG. 18 is a first diagram illustrating a result of symbolic execution by the program analysis apparatus. 図19は、プログラム分析装置によるシンボリック実行の結果を示す第2の図である。FIG. 19 is a second diagram illustrating the result of symbolic execution by the program analysis apparatus. 図20は、実施例に係るプログラム分析プログラムを実行するコンピュータのハードウェア構成を示す図である。FIG. 20 is a diagram illustrating a hardware configuration of a computer that executes the program analysis program according to the embodiment. 図21は、シンボリック実行の説明に用いるプログラムを示す図である。FIG. 21 is a diagram showing a program used to explain symbolic execution. 図22は、図21に示したプログラムのフロー図である。FIG. 22 is a flowchart of the program shown in FIG. 図23は、図21に示したプログラムのシンボリック実行により抽出されたパスを示す図である。FIG. 23 is a diagram showing paths extracted by symbolic execution of the program shown in FIG. 図24は、図21に示したプログラムのシンボリック実行による分析結果を示すロジック表である。FIG. 24 is a logic table showing the analysis result of the symbolic execution of the program shown in FIG. 図25は、プログラムスライシングの説明に用いるプログラムを示す図である。FIG. 25 is a diagram showing a program used to explain program slicing. 図26は、プログラムスライシングの第1の例を示す図である。FIG. 26 is a diagram illustrating a first example of program slicing. 図27は、プログラムスライシングの第2の例を示す図である。FIG. 27 is a diagram illustrating a second example of program slicing.

以下に、本願の開示するプログラム分析装置、プログラム分析方法及びプログラム分析プログラムの実施例を図面に基づいて詳細に説明する。なお、この実施例は開示の技術を限定するものではない。   Embodiments of a program analysis device, a program analysis method, and a program analysis program disclosed in the present application will be described below in detail with reference to the drawings. Note that this embodiment does not limit the disclosed technology.

まず、実施例に係るプログラム分析装置によるプログラムの復元について説明する。図1は、実施例に係るプログラム分析装置によるプログラムの復元を説明するための図である。図1は、図27に示したプログラムスライシング結果から復元された実行可能なプログラムと、復元された実行可能なプログラムのフロー図を示す。   First, restoration of a program by the program analysis apparatus according to the embodiment will be described. FIG. 1 is a diagram for explaining program restoration by the program analysis apparatus according to the embodiment. FIG. 1 shows an executable program restored from the program slicing result shown in FIG. 27 and a flow diagram of the restored executable program.

図1に示すように、実施例に係るプログラム分析装置は、プログラムの10行目と25行目にダミーの命令文であるCONTINUE文を挿入することによって、実行可能なプログラムを復元する。図27のプログラムスライシング結果では、9行目のIF文のTHEN分岐に命令文がない。このため、実施例に係るプログラム分析装置は、9行目のIF文のTHEN分岐にCONTINUE文を挿入する。同様に、図27のプログラムスライシング結果では、22行目のIF文のELSE分岐に命令文がない。このため、実施例に係るプログラム分析装置は、22行目のIF文のELSE分岐にCONTINUE文を挿入する。   As shown in FIG. 1, the program analysis apparatus according to the embodiment restores an executable program by inserting a CONTINUE statement, which is a dummy command statement, in the 10th and 25th lines of the program. In the program slicing result of FIG. 27, there is no instruction statement in the THEN branch of the IF statement on the ninth line. For this reason, the program analysis apparatus according to the embodiment inserts a CONTINUE statement in the THEN branch of the IF statement on the ninth line. Similarly, in the program slicing result of FIG. 27, there is no command statement in the ELSE branch of the IF statement on the 22nd line. Therefore, the program analysis apparatus according to the embodiment inserts a CONTINUE statement in the ELSE branch of the IF statement on the 22nd line.

このように、実施例に係るプログラム分析装置は、プログラムスライシング結果において有効な命令文がない分岐箇所にCONTINUE文を挿入することによって、実行可能なプログラムを復元することができる。   As described above, the program analysis apparatus according to the embodiment can restore an executable program by inserting a CONTINUE statement at a branch point where there is no valid command statement in the program slicing result.

次に、実施例に係るプログラム分析装置の機能構成について説明する。図2は、実施例に係るプログラム分析装置の機能構成を示す図である。図2に示すように、実施例に係るプログラム分析装置1は、スライシング部11と、命令文リスト記憶部12と、復元部13と、復元プログラム記憶部14と、シンボリック実行部15と、分岐設定部16と、分岐制御部17とを有する。   Next, a functional configuration of the program analysis apparatus according to the embodiment will be described. FIG. 2 is a diagram illustrating a functional configuration of the program analysis apparatus according to the embodiment. As illustrated in FIG. 2, the program analysis apparatus 1 according to the embodiment includes a slicing unit 11, a command statement list storage unit 12, a restoration unit 13, a restoration program storage unit 14, a symbolic execution unit 15, and a branch setting. Unit 16 and branch control unit 17.

スライシング部11は、プログラム2とスライシング基点3を入力してプログラムスライスを実行し、スライシング基点3に影響する命令文のリストを命令文リスト記憶部12に格納する。命令文リスト記憶部12は、スライシング基点3に影響する命令文のリストを記憶する。スライシング部11は、例えば、プログラム2をファイルから読み込み、ユーザが端末から入力したスライシング基点3を受け取る。命令文リスト記憶部12は、例えば、メインメモリ上の領域である。   The slicing unit 11 inputs the program 2 and the slicing base point 3, executes program slicing, and stores a list of command statements that affect the slicing base point 3 in the command statement list storage unit 12. The command statement list storage unit 12 stores a list of command statements that affect the slicing base point 3. For example, the slicing unit 11 reads the program 2 from a file and receives the slicing base point 3 input from the terminal by the user. The command statement list storage unit 12 is an area on the main memory, for example.

図3は、プログラム2及びスライシング基点3の一例を示す図である。図3のプログラム2及びスライシング基点3は、図27に示したプログラム92及びスライシング基点3と同じである。   FIG. 3 is a diagram illustrating an example of the program 2 and the slicing base point 3. The program 2 and the slicing base point 3 in FIG. 3 are the same as the program 92 and the slicing base point 3 shown in FIG.

図4は、スライシング部11の動作例を示す図である。図4に示すように、スライシング部11は、例えば、図3に示したプログラム2を入力する。また、スライシング部11は、例えば、スライシング基点3として、23行目のCOMPUTE文とXの指定を受け取る。そして、スライシング部11は、スライシング基点3に影響する命令文のリストとして、9行目のIF文、13行目のADD文、22行目のIF文、23行目のCOMPUTE文を抽出する。なお、スライシング基点3に影響する命令文のリストは、図27において、取り消し線で消されていない文である。   FIG. 4 is a diagram illustrating an operation example of the slicing unit 11. As shown in FIG. 4, the slicing unit 11 inputs, for example, the program 2 shown in FIG. Further, the slicing unit 11 receives, for example, the COMPUTE statement on the 23rd line and the designation of X as the slicing base point 3. Then, the slicing unit 11 extracts the 9th IF statement, the 13th ADD statement, the 22nd IF statement, and the 23rd COMPUTE statement as a list of command statements that affect the slicing base point 3. Note that the list of command statements affecting the slicing base point 3 is a statement that is not erased by a strikethrough in FIG.

復元部13は、スライシング基点3に影響する命令文のリストを命令文リスト記憶部12から読み出し、スライシング基点3に影響する命令文のリストを用いて実行可能なプログラムを復元する。そして、復元部13は、復元したプログラムを復元プログラム記憶部14に格納する。復元プログラム記憶部14は、復元部13により復元された実行可能プログラムを記憶する。復元プログラム記憶部14は、例えば、メインメモリ上の領域である。   The restoration unit 13 reads a list of command statements that affect the slicing base point 3 from the command statement list storage unit 12 and restores an executable program using the list of command statements that affect the slicing base point 3. Then, the restoration unit 13 stores the restored program in the restoration program storage unit 14. The restoration program storage unit 14 stores the executable program restored by the restoration unit 13. The restoration program storage unit 14 is an area on the main memory, for example.

図5は、復元部13の動作例を示す図である。図5に示すように、復元部13は、スライシング基点3に影響する命令文のリストにおいて命令文がない行番号10と行番号25の分岐箇所にダミー命令文としてCONTINUE文を挿入した中間データを作成し、中間データを用いて実行可能なプログラムを復元する。ここで、ダミー命令文とは、何も実行しない命令文である。図5の復元されたプログラムは、行番号10と行番号25の分岐箇所にCONTINUE文が挿入されることによって、実行可能なプログラムとなっている。   FIG. 5 is a diagram illustrating an operation example of the restoration unit 13. As shown in FIG. 5, the restoration unit 13 obtains intermediate data in which a CONTINUE statement is inserted as a dummy instruction statement at a branch point of line number 10 and line number 25 where there is no instruction statement in the list of instruction statements affecting the slicing base point 3. Create and restore an executable program using the intermediate data. Here, the dummy command statement is a command statement that does nothing. The restored program of FIG. 5 is an executable program by inserting a CONTINUE statement at the branch point of line number 10 and line number 25.

シンボリック実行部15は、復元部13により復元されたプログラムを復元プログラム記憶部14から読み出し、シンボリック実行を行う。そして、シンボリック実行部15は、ロジック表4を出力する。復元部13は、ロジック表4を表示装置に表示してもよいし、ファイルに出力してもよい。   The symbolic execution unit 15 reads the program restored by the restoration unit 13 from the restoration program storage unit 14 and performs symbolic execution. Then, the symbolic execution unit 15 outputs the logic table 4. The restoration unit 13 may display the logic table 4 on a display device or may output it to a file.

ユーザは、ロジック表4を用いてプログラム2のロジックを簡単に理解することができる。すなわち、ロジック表4は、どのような条件のパスにおいてどのような出力が得られるかをユーザが理解することを支援する。したがって、プログラム分析装置1は、既存の情報システムの保守や再構築の作業を支援することができる。   The user can easily understand the logic of the program 2 using the logic table 4. That is, the logic table 4 assists the user in understanding what kind of output is obtained in what kind of path. Therefore, the program analysis apparatus 1 can support maintenance and reconstruction work of the existing information system.

図6は、復元されたプログラムのシンボリック実行結果を示す図である。図6は、復元されたプログラムのフロー図及び抽出されたパスと、ロジック表4を示す。図6に示すように、シンボリック実行により3つのパスが抽出される。パス#1については、パス条件は(X > 0)であり、パス出力は(X + 1)である。パス#2については、パス条件は(X NOT > 0) AND ((X + 10) > 0)であり、パス出力は((X + 10) + 1)である。パス#3については、パス条件は(X NOT > 0) AND ((X + 10) NOT > 0)であり、パス出力は(X + 10)である。   FIG. 6 is a diagram showing a symbolic execution result of the restored program. FIG. 6 shows the flow diagram of the restored program, the extracted paths, and the logic table 4. As shown in FIG. 6, three paths are extracted by symbolic execution. For path # 1, the path condition is (X> 0) and the path output is (X + 1). For path # 2, the path condition is (XNOT> 0) AND ((X + 10)> 0) and the path output is ((X + 10) +1). For path # 3, the path condition is (X NOT> 0) AND ((X + 10) NOT> 0), and the path output is (X + 10).

図6では、スライシング基点(23,X)を通過しないパス#3が含まれている。すなわち、プログラムスライス後に復元部13によって復元されたプログラムをそのままシンボリック実行すると、スライシング基点3を通過しないパスも抽出され、パスの個数削減が不十分となる。その理由は、スライシング基点(23,X)が22行目のIF文に制御依存するためである。すなわち、スライシング基点(23,X)に到達するためには、22行目のIF文において固定的にTHEN分岐が選択されなければならないが、シンボリック実行では、ELSE分岐も選択されてしまう。   In FIG. 6, path # 3 that does not pass through the slicing base point (23, X) is included. That is, if the program restored by the restoration unit 13 after program slicing is symbolically executed, a path that does not pass through the slicing base point 3 is also extracted, and the number of paths is not sufficiently reduced. The reason is that the slicing base point (23, X) depends on the IF statement on the 22nd line. That is, in order to reach the slicing base point (23, X), the THEN branch must be fixedly selected in the IF statement on the 22nd line, but in the symbolic execution, the ELSE branch is also selected.

そこで、プログラム分析装置1は、スライシング基点3が条件分岐文に制御依存する場合、スライシング基点3に到達する分岐を固定的に選択するための情報を条件分岐文に設定する。そして、プログラム分析装置1は、復元部13によって復元されたプログラムをシンボリック実行して実行可能なパスを抽出する際に、条件分岐文に設定した情報に基づいて分岐の選択を制御する。このように、スライシング基点3を通過するパスだけを限定して抽出することによって、プログラム分析装置1は、抽出するパスの個数を減らすことができる。   Therefore, when the slicing base point 3 is dependent on the conditional branch sentence, the program analysis apparatus 1 sets information for fixedly selecting a branch that reaches the slicing base point 3 in the conditional branch sentence. Then, the program analysis apparatus 1 controls branch selection based on the information set in the conditional branch sentence when the executable path is extracted by symbolically executing the program restored by the restoration unit 13. Thus, by limiting and extracting only the paths that pass through the slicing base point 3, the program analysis apparatus 1 can reduce the number of paths to be extracted.

分岐設定部16は、スライシング基点3が条件分岐文に制御依存するか否かを制御依存関係に基づいて判定し、制御依存する場合に、スライシング基点3に到達する分岐を固定的に選択するための情報を条件分岐文に設定する。   The branch setting unit 16 determines whether or not the slicing base point 3 is control-dependent on the conditional branch sentence based on the control dependency relationship, and when it depends on the control, the branch setting unit 16 fixedly selects a branch that reaches the slicing base point 3 Is set in the conditional branch statement.

図7は、分岐設定部16の動作例を示す図である。図7において、固定選択情報は、固定選択の条件分岐文と選択される分岐の情報である。図7に示すように、分岐設定部16は、プログラム2、制御依存関係及びスライシング基点3を入力し、固定選択情報を出力する。図7では、固定選択の条件分岐文として22行目のIF文が出力され、選択される分岐としてTHEN分岐が出力されている。   FIG. 7 is a diagram illustrating an operation example of the branch setting unit 16. In FIG. 7, the fixed selection information is information on a conditional branch sentence of fixed selection and a selected branch. As shown in FIG. 7, the branch setting unit 16 inputs the program 2, the control dependency relationship, and the slicing base point 3, and outputs fixed selection information. In FIG. 7, the IF statement on the 22nd line is output as the conditional branch statement of fixed selection, and the THEN branch is output as the selected branch.

なお、分岐設定部16は、ELSEがないIF文で、THEN分岐以外の分岐が固定選択となった場合は、分岐としてELSE分岐を出力する。また、分岐設定部16は、COBOLのEVALUATE文の場合は、分岐がどのWHENであるかを特定できる情報を設定する。分岐がどのWHENであるかを特定できる情報としては、例えば、「50行目のWHEN」がある。   Note that the branch setting unit 16 outputs an ELSE branch as a branch when an IF statement with no ELSE and a branch other than the THEN branch is fixedly selected. In the case of a COBOL EVALUATE statement, the branch setting unit 16 sets information that can specify which WHEN the branch is. As information that can specify which WHEN the branch is, for example, there is “WHEN on the 50th line”.

分岐制御部17は、プログラムスライシング結果から復元されたプログラムをシンボリック実行部15がシンボリック実行して実行可能なパスを抽出する際に、固定選択情報に基づいて、分岐の選択を制御する。   The branch control unit 17 controls branch selection based on the fixed selection information when the symbolic execution unit 15 performs symbolic execution of the program restored from the program slicing result and extracts an executable path.

条件分岐の条件の真偽値が確定であり、その真偽値で選択される分岐が固定選択された分岐と同じ場合には、分岐制御部17は、固定選択された分岐を選択する。また、条件分岐の条件の真偽値が確定であり、その真偽値で選択される分岐が固定選択された分岐と異なる場合は、分岐制御部17は、シンボリック実行中のパスを棄却し、バックトラックをシンボリック実行部15に指示する。ここで、バックトラックとは、1つ前の条件分岐まで戻り、別の分岐を選択することである。また、条件分岐の条件の真偽値が不定であり、複数分岐が選択可能な場合は、分岐制御部17は、固定選択された分岐を選択する。   If the true / false value of the conditional branch condition is definite, and the branch selected by the true / false value is the same as the fixedly selected branch, the branch control unit 17 selects the fixedly selected branch. Also, if the true / false value of the conditional branch condition is definite and the branch selected by the true / false value is different from the fixedly selected branch, the branch control unit 17 rejects the symbolic execution path, Instructs the symbolic execution unit 15 to perform backtracking. Here, backtracking means returning to the previous conditional branch and selecting another branch. If the true / false value of the conditional branch condition is indefinite and a plurality of branches can be selected, the branch control unit 17 selects the fixedly selected branch.

図8は、分岐制御部17の動作例を示す図である。図8に示すように、分岐制御部17の出力は、出力#1)条件分岐文で選択する分岐、又は、出力#2)バックトラック指示であり、固定選択の分岐はTHEN分岐である。そして、シンボリック実行による22行目のIF文の条件(X>0)の判定結果が真偽値不定であり充足可能な場合には、分岐制御部17は、THEN分岐を選択する。また、シンボリック実行による22行目のIF文の条件!(X>0)の判定結果が真偽値不定であり充足可能な場合にも、分岐制御部17は、THEN分岐を選択する。したがって、この例では、バックトラック指示の場合はない。   FIG. 8 is a diagram illustrating an operation example of the branch control unit 17. As shown in FIG. 8, the output of the branch control unit 17 is output # 1) a branch selected by a conditional branch statement or output # 2) a backtrack instruction, and the fixed selection branch is a THEN branch. If the determination result of the IF statement condition (X> 0) on the 22nd line by symbolic execution is indefinite and can be satisfied, the branch control unit 17 selects the THEN branch. Also, the IF statement condition on line 22 by symbolic execution! Even when the determination result of (X> 0) is indefinite and can be satisfied, the branch control unit 17 selects the THEN branch. Therefore, in this example, there is no backtrack instruction.

次に、プログラム分析装置1による処理のフローについて説明する。図9は、プログラム分析装置1による処理のフローを示すフローチャートである。図9に示すように、プログラム分析装置1は、分析対象のプログラム2とスライシング基点3を入力する(ステップS1)。そして、プログラム分析装置1は、プログラム2に対して、スライシング基点3から、プログラムスライシング処理を実行し(ステップS2)、プログラム復元によって、プログラムスライシングの実行結果から、実行可能なプログラムを復元する(ステップS3)。   Next, the flow of processing by the program analysis apparatus 1 will be described. FIG. 9 is a flowchart showing a flow of processing by the program analysis apparatus 1. As shown in FIG. 9, the program analysis apparatus 1 inputs a program 2 to be analyzed and a slicing base point 3 (step S1). Then, the program analysis apparatus 1 executes program slicing processing on the program 2 from the slicing base point 3 (step S2), and restores an executable program from the execution result of program slicing by program restoration (step S2). S3).

そして、プログラム分析装置1は、スライシング基点3が条件分岐文に制御依存するかを判定し、制御依存すると判定した場合に、スライシング基点3を含む分岐を固定的に選択するための固定選択情報を作成する(ステップS4)。そして、プログラム分析装置1は、固定選択情報に基づいて分岐選択とバックトラックを制御しながら復元プログラムをシンボリック実行して実行可能なパスを抽出する(ステップS5)。そして、プログラム分析装置1は、抽出したパスについてロジック表4を出力する(ステップS6)。   Then, the program analysis apparatus 1 determines whether the slicing base point 3 is control-dependent on the conditional branch statement, and when it is determined that the slicing base point 3 is control-dependent, the program analysis apparatus 1 provides fixed selection information for fixedly selecting the branch including the slicing base point 3 Create (step S4). Then, the program analysis apparatus 1 extracts executable paths by executing symbolically the restoration program while controlling branch selection and backtracking based on the fixed selection information (step S5). Then, the program analysis apparatus 1 outputs the logic table 4 for the extracted path (step S6).

このように、プログラム分析装置1は、プログラムスライシングにより得られたプログラムを復元することによって、シンボリック実行を可能とすることができる。また、プログラム分析装置1は、固定選択情報を作成し、固定選択情報に基づいてシンボリック実行を制御することで、スライシング基点3を通過しないパスの抽出を防ぐことができる。   Thus, the program analysis apparatus 1 can enable symbolic execution by restoring the program obtained by program slicing. Moreover, the program analysis apparatus 1 can prevent extraction of a path that does not pass through the slicing base point 3 by creating fixed selection information and controlling symbolic execution based on the fixed selection information.

図10は、プログラムスライシング処理のフローを示すフローチャートである。なお、図10の処理は、図9に示したステップS2の処理に対応する。図10に示すように、スライシング部11は、プログラム2をパース(構文解析)し、構造木を構築する(ステップS11)。   FIG. 10 is a flowchart showing the flow of the program slicing process. Note that the processing in FIG. 10 corresponds to the processing in step S2 shown in FIG. As shown in FIG. 10, the slicing unit 11 parses (syntactically analyzes) the program 2 and constructs a structural tree (step S11).

そして、スライシング部11は、構造木の命令文の間で、制御依存関係とデータ依存関係を構築し(ステップS12)、スライシング基点3から制御依存関係とデータ依存関係を辿り、途中の命令文を収集する(ステップS13)。そして、スライシング部11は、収集した命令文を命令文リスト記憶部12に格納する(ステップS14)。   Then, the slicing unit 11 constructs a control dependency relationship and a data dependency relationship between the command statements in the structure tree (step S12), traces the control dependency relationship and the data dependency relationship from the slicing base point 3, and determines the intermediate command statement. Collect (step S13). Then, the slicing unit 11 stores the collected command statements in the command statement list storage unit 12 (step S14).

このように、スライシング部11がスライシング基点3に基づいてプログラム2をスライシングすることによって、シンボリック実行によるパス爆発を防ぐことができる。   As described above, the slicing unit 11 slicing the program 2 based on the slicing base point 3 can prevent path explosion caused by symbolic execution.

図11は、プログラムを復元する処理のフローを示すフローチャートである。なお、図11の処理は、図9に示したステップS3の処理に対応する。図11に示すように、復元部13は、命令文リスト記憶部12から順に命令文を1つ読み出し(ステップS21)、未処理の命令文があるか否かを判定する(ステップS22)。   FIG. 11 is a flowchart showing a flow of processing for restoring a program. The process of FIG. 11 corresponds to the process of step S3 shown in FIG. As illustrated in FIG. 11, the restoration unit 13 sequentially reads one command statement from the command statement list storage unit 12 (step S21), and determines whether there is an unprocessed command statement (step S22).

そして、復元部13は、未処理の命令文がある場合には、命令文が条件分岐文か否かを判定し(ステップS23)、命令文が条件分岐文でない場合には、ステップS21に戻る。一方、命令文が条件分岐文の場合には、復元部13は、条件分岐文の分岐に有効な命令文がないか否かを判定し(ステップS24)、条件分岐文の分岐に有効な命令文がある場合には、ステップS21に戻る。   If there is an unprocessed command statement, the restoration unit 13 determines whether the command statement is a conditional branch statement (step S23). If the command statement is not a conditional branch statement, the restoration unit 13 returns to step S21. . On the other hand, when the command statement is a conditional branch statement, the restoration unit 13 determines whether there is a command statement effective for branching the conditional branch statement (step S24), and the command effective for branching the conditional branch statement. If there is a sentence, the process returns to step S21.

一方、条件分岐文の分岐に有効な命令文がない場合には、復元部13は、ダミー命令文を追加リストに追加し(ステップS25)、ステップS21に戻る。また、ステップS22において、未処理の命令文がない場合には、復元部13は、命令文リストと追加リストから実行可能なプログラムを復元する(ステップS26)。   On the other hand, when there is no command statement effective for branching the conditional branch statement, the restoration unit 13 adds a dummy command statement to the addition list (step S25), and the process returns to step S21. If there is no unprocessed command statement in step S22, the restoration unit 13 restores an executable program from the command statement list and the additional list (step S26).

このように、復元部13は、条件分岐文の分岐に有効な命令文がない場合にダミー命令文を追加することによって、実行可能なプログラムを復元することができる。   As described above, the restoring unit 13 can restore an executable program by adding a dummy command statement when there is no command statement effective for branching a conditional branch statement.

図12は、分岐設定を行う処理のフローを示すフローチャートである。なお、図12の処理は、図9に示したステップS4の処理に対応する。図12に示すように、分岐設定部16は、プログラム2及びスライシング基点3を入力し、制御依存関係をスライシング部11から受け取る(ステップS31)。   FIG. 12 is a flowchart illustrating a flow of processing for performing branch setting. The process of FIG. 12 corresponds to the process of step S4 shown in FIG. As shown in FIG. 12, the branch setting unit 16 receives the program 2 and the slicing base point 3, and receives the control dependency from the slicing unit 11 (step S31).

そして、分岐設定部16は、スライシング基点3の命令文を指定命令文として、固定分岐を分析して設定する固定分岐分析処理を行い(ステップS32)、固定選択の条件分岐文と分岐の情報を分岐制御部17に渡す(ステップS33)。   Then, the branch setting unit 16 performs fixed branch analysis processing for analyzing and setting the fixed branch using the instruction sentence of the slicing base point 3 as the designated instruction sentence (step S32), and obtains the conditional branch sentence and branch information of the fixed selection. The data is transferred to the branch control unit 17 (step S33).

また、分岐設定部16は、固定分岐分析処理において、指定命令文から制御依存関係を辿り、制御依存関係において1つ前の命令文を取得する(ステップS41)。そして、分岐設定部16は、命令文があり、かつ、条件分岐文であるか否かを判定し(ステップS42)、命令文がない場合、又は、条件分岐文でない場合には、固定分岐分析処理を終了する。   Further, in the fixed branch analysis process, the branch setting unit 16 traces the control dependency relationship from the specified command statement, and acquires the previous command statement in the control dependency relationship (step S41). The branch setting unit 16 determines whether there is a command statement and a conditional branch statement (step S42). If there is no command statement, or if it is not a conditional branch statement, the fixed branch analysis is performed. The process ends.

一方、命令文があり、かつ、条件分岐文である場合には、分岐設定部16は、条件分岐文Cの分岐Bi(i=1,2,・・・,N:Nは分岐数)を取得して、i=1とする(ステップS43)。そして、分岐設定部16は、iがN以下であるか否かを判定し(ステップS44)、iがN以下でない場合には、固定分岐分析処理を終了する。 On the other hand, when there is a command statement and a conditional branch statement, the branch setting unit 16 branches the branch B i of the conditional branch statement C (i = 1, 2,..., N: N is the number of branches). And i = 1 is set (step S43). Then, the branch setting unit 16 determines whether i is equal to or less than N (step S44). If i is not equal to or less than N, the fixed branch analysis process ends.

一方、iがN以下である場合には、分岐設定部16は、指定命令文が分岐Bi内か否かを判定し(ステップS45)、指定命令文が分岐Bi内の場合には、条件分岐文Cの分岐Biを固定分岐と設定する(ステップS46)。そして、分岐設定部16は、条件分岐文Cを指定命令文として、固定分岐分析処理を行い(ステップS47)、iに1を加え(ステップS48)、ステップS44に戻る。また、ステップS45において指定命令文が分岐Bi内でない場合には、iに1を加え(ステップS48)、ステップS44に戻る。 On the other hand, if i is N or less, the branch setting unit 16 determines whether or not the designated command statement is in the branch B i (step S45), and if the designated command statement is in the branch B i , The branch B i of the conditional branch sentence C is set as a fixed branch (step S46). Then, the branch setting unit 16 performs a fixed branch analysis process using the conditional branch sentence C as the designated instruction sentence (step S47), adds 1 to i (step S48), and returns to step S44. If the specified command statement is not in the branch B i at step S45, 1 is added to i (step S48), and the process returns to step S44.

このように、分岐設定部16は、固定分岐分析処理を再帰的に呼び出すことによって、固定選択情報を作成することができる。なお、固定分岐分析処理を再帰的に呼び出す理由は、条件分岐文の入れ子構造に対応するためである。図13は、入れ子構造の条件分岐文を有するプログラム2及び制御依存関係を示す図であり、図14は、図13に示したプログラム2から作成される固定選択情報の例を示す図である。   In this way, the branch setting unit 16 can create fixed selection information by recursively calling the fixed branch analysis process. The reason why the fixed branch analysis process is called recursively is to support the nested structure of conditional branch statements. FIG. 13 is a diagram showing a program 2 having a conditional branch statement with a nested structure and a control dependency relationship, and FIG. 14 is a diagram showing an example of fixed selection information created from the program 2 shown in FIG.

図13に示すように、例えば、21行目のCOMPUTE文は20行目のIF文に制御依存し、20行目のIF文は10行目のIF文に制御依存する。このため、21行目のCOMPUTE文と変数Xをスライシング基点3とすると、図14に示すように、固定選択情報には、条件分岐文と分岐の2つの組が含まれる。具体的には、21行目のCOMPUTE文を指定命令文とした場合に20行目のIF文を条件分岐文として分岐をTHEN分岐とする組と、20行目のIF文を指定命令文とした場合に10行目のIF文を条件分岐文として分岐をELSE分岐とする組が含まれる。   As shown in FIG. 13, for example, the COMPUTE statement on the 21st line is control-dependent on the IF statement on the 20th line, and the IF statement on the 20th line is control-dependent on the IF statement on the 10th line. Therefore, if the COMPUTE statement on line 21 and the variable X are slicing base point 3, as shown in FIG. 14, the fixed selection information includes two sets of conditional branch statements and branches. Specifically, when the COMPUTE statement on the 21st line is a designated command statement, the IF statement on the 20th line is a conditional branch statement and the branch is a THEN branch, and the IF statement on the 20th line is a designated command statement. In such a case, a set including an IF statement on the 10th line as a conditional branch statement and a branch as an ELSE branch is included.

この固定選択情報を、分岐設定部16は、以下のような処理手順により作成する。まず、分岐設定部16は、図12のステップS31において、プログラム2及びスライシング基点3を入力し、制御依存関係の情報をスライシング部11から受け取る。そして、分岐設定部16は、ステップS32において、21行目のCOMPUTE文を指定命令文として固定分岐分析処理を呼び出す。   The branch setting unit 16 creates this fixed selection information by the following processing procedure. First, the branch setting unit 16 receives the program 2 and the slicing base point 3 in step S31 of FIG. In step S32, the branch setting unit 16 calls the fixed branch analysis process using the COMPUTE statement on the 21st line as a designated command statement.

そして、分岐設定部16は、ステップS41において、制御依存を辿り命令文として20行目のIF文を取得し、ステップS42において、20行目のIF文が条件分岐文であるか否かを判定する。そして、20行目のIF文が条件分岐文であるので、分岐設定部16は、ステップS43において、B1を20行目のIF文のTHEN分岐とし、B2を20行目のIF文のELSE分岐とする。 In step S41, the branch setting unit 16 traces control dependence and acquires the IF statement on the 20th line as a command statement. In step S42, the branch setting unit 16 determines whether the IF statement on the 20th line is a conditional branch statement. To do. Since the IF statement on the 20th line is a conditional branch statement, the branch setting unit 16 sets B 1 as the THEN branch of the IF statement on the 20th line and B 2 on the IF statement on the 20th line in step S43. Let ELSE branch.

そして、分岐設定部16は、ステップS45において、21行目のCOMPUTE文がB1内か否かを判定し、B1内にあるので、ステップS46において、20行目のIF文のTHEN分岐を固定分岐と設定する。そして、分岐設定部16は、ステップS47において、20行目のIF文を指定命令文として固定分岐分析処理を呼び出す。 Then, the branch setting unit 16, in step S45, COMPUTE statement in line 21 it is determined whether within B 1, since in the B 1, in step S46, the THEN branch of an IF statement in line 20 Set as fixed branch. In step S47, the branch setting unit 16 calls the fixed branch analysis process using the IF statement on the 20th line as the designated command statement.

そして、分岐設定部16は、ステップS41において、制御依存を辿り命令文として10行目のIF文を取得し、ステップS42において、10行目のIF文が条件分岐文であるか否かを判定する。そして、10行目のIF文が条件分岐文であるので、分岐設定部16は、ステップS43において、B1を10行目のIF文のTHEN分岐とし、B2を10行目のIF文のELSE分岐とする。 In step S41, the branch setting unit 16 traces the control dependence and acquires the IF statement on the 10th line as a command statement. In step S42, the branch setting unit 16 determines whether the IF statement on the 10th line is a conditional branch statement. To do. Since the IF statement on the 10th line is a conditional branch statement, the branch setting unit 16 sets B 1 as the THEN branch of the IF statement on the 10th line and B 2 on the IF statement on the 10th line in step S43. Let ELSE branch.

そして、分岐設定部16は、ステップS45において、20行目のIF文がB1内か否かを判定し、B1内ではないので、ステップS48において、iに1を加え、ステップS45において、20行目のIF文がB2内か否かを判定する。そして、分岐設定部16は、20行目のIF文はB2内にあるので、ステップS46において、10行目のIF文のELSE分岐を固定分岐と設定する。 Then, the branch setting unit 16, in step S45, IF statement in line 20 it is determined whether within B 1, since it is not in the B 1, at step S48, 1 is added to i, at step S45, iF statement of line 20 determines whether the inside B 2. Then, the branch setting unit 16, the IF statement of line 20 because it is in the B 2, in step S46, sets a fixed branch ELSE branch of an IF statement in line 10.

その後、分岐設定部16は、ステップS47の固定分岐分析処理を終了し、ステップS32の固定分岐分析処理を終了する。そして、分岐設定部16は、ステップS33において、固定選択情報を分岐制御部17に渡す。   Thereafter, the branch setting unit 16 ends the fixed branch analysis process in step S47 and ends the fixed branch analysis process in step S32. The branch setting unit 16 passes the fixed selection information to the branch control unit 17 in step S33.

図15は、分岐制御を行う処理のフローを示すフローチャートである。なお、図15の処理は、図9に示したステップS5の処理に含まれる。図15に示すように、分岐制御部17は、固定選択情報に含まれる条件分岐文に関して、シンボリック実行部15によるシンボリック実行の条件判定で複数分岐が選択可能か否かを判定する(ステップS51)。   FIG. 15 is a flowchart illustrating a flow of processing for performing branch control. The process of FIG. 15 is included in the process of step S5 shown in FIG. As shown in FIG. 15, the branch control unit 17 determines whether or not a plurality of branches can be selected by the symbolic execution condition determination by the symbolic execution unit 15 for the conditional branch sentence included in the fixed selection information (step S51). .

そして、分岐制御部17は、複数分岐が選択可能である場合には、固定選択情報の分岐を選択し(ステップS52)、複数分岐が選択可能でない場合には、選択される分岐が固定選択情報の分岐と同じか否かを判定する(ステップS53)。そして、分岐制御部17は、選択される分岐が固定選択情報の分岐と同じである場合には、当該分岐を選択し(ステップS54)、固定選択情報の分岐と同じでない場合には、シンボリック実行部15にバックトラックを指示する(ステップS55)。   Then, when a plurality of branches can be selected, the branch control unit 17 selects a branch of the fixed selection information (step S52). When a plurality of branches cannot be selected, the branch to be selected is the fixed selection information. It is determined whether the branch is the same as (2). If the selected branch is the same as the branch of the fixed selection information, the branch control unit 17 selects the branch (step S54). If the selected branch is not the same as the branch of the fixed selection information, the branch control unit 17 executes symbolic execution. The backtrack is instructed to the unit 15 (step S55).

このように、分岐制御部17は、固定選択情報に基づいてシンボリック実行の分岐を制御することによって、スライシング基点3を通過しないパスの抽出を防ぐことができる。   In this way, the branch control unit 17 can prevent extraction of a path that does not pass through the slicing base point 3 by controlling the branch of symbolic execution based on the fixed selection information.

次に、プログラム分析装置1の効果について図16〜図19を用いて説明する。図16は、図3に示したプログラム2のシンボリック実行の結果を示す図である。図16は、プログラムスライシングを行うことなくプログラム2をシンボリック実行した場合を示す。図16に示すように、プログラムスライシングを行わない場合には、9個のパスがシンボリック実行によって抽出される。   Next, the effect of the program analysis apparatus 1 will be described with reference to FIGS. FIG. 16 is a diagram showing a result of symbolic execution of the program 2 shown in FIG. FIG. 16 shows a case where the program 2 is symbolically executed without program slicing. As shown in FIG. 16, when program slicing is not performed, nine paths are extracted by symbolic execution.

図17は、図3に示したプログラム2のロジック表4を示す図である。図17(a)は、変数Xに関するロジック表4を示し、図17(b)は、変数Yに関するロジック表4を示す。すなわち、変数Xに関してプログラムスライシングが行われ、スライシング基点3が条件分岐文に依存しない場合には、図17(a)に示すロジック表4が得られる。また、変数Yに関してプログラムスライシングが行われ、スライシング基点3が条件分岐文に依存しない場合には、図17(b)に示すロジック表4が得られる。   FIG. 17 is a diagram showing the logic table 4 of the program 2 shown in FIG. 17A shows the logic table 4 related to the variable X, and FIG. 17B shows the logic table 4 related to the variable Y. That is, when program slicing is performed for the variable X and the slicing base point 3 does not depend on the conditional branch sentence, the logic table 4 shown in FIG. 17A is obtained. Further, when program slicing is performed on the variable Y and the slicing base point 3 does not depend on the conditional branch sentence, the logic table 4 shown in FIG. 17B is obtained.

図18及び図19は、プログラム分析装置1によるシンボリック実行の結果を示す図である。図18は、スライシング基点(23,X)の場合を示し、図19は、スライシング基点(25,X)の場合を示す。図18及び図19に示すように、プログラム分析装置1は、スライシング結果をシンボリック実行することができる。   FIG. 18 and FIG. 19 are diagrams showing the results of symbolic execution by the program analysis apparatus 1. FIG. 18 shows the case of the slicing base point (23, X), and FIG. 19 shows the case of the slicing base point (25, X). As shown in FIGS. 18 and 19, the program analysis apparatus 1 can symbolically execute the slicing result.

また、図18を図16と比較すると、抽出されたパスの数が9から2に減っている。また、図18を図6と比較すると、スライシング基点(23,X)を通過しないパス#3が抽出されていないことがわかる。また、図18と図19のロジック表4を合わせると、図6に示すロジック表4と同じとなり、プログラム分析装置1は、固定選択情報を用いない場合と同じロジック表4を作成することがわかる。   18 is compared with FIG. 16, the number of extracted paths is reduced from 9 to 2. 18 is compared with FIG. 6, it can be seen that the path # 3 that does not pass through the slicing base point (23, X) is not extracted. 18 and 19 are the same as the logic table 4 shown in FIG. 6, and it can be seen that the program analysis apparatus 1 creates the same logic table 4 as when no fixed selection information is used. .

上述してきたように、実施例では、スライシング部11が、スライシング基点3に基づいてプログラム2から命令文を抽出し、命令文リストを作成して命令文リスト記憶部12に格納する。そして、復元部13が、命令文リスト記憶部12から命令文リストを読み出して実行可能なプログラムを復元し、復元プログラム記憶部14に格納する。そして、シンボリック実行部15が復元プログラム記憶部14からプログラムを読み出してシンボリック実行する。したがって、プログラム分析装置1は、プログラムスライシングにより得られるプログラムをシンボリック実行することができる。   As described above, in the embodiment, the slicing unit 11 extracts a command statement from the program 2 based on the slicing base point 3, creates a command statement list, and stores it in the command statement list storage unit 12. Then, the restoring unit 13 reads the command statement list from the command statement list storage unit 12, restores an executable program, and stores it in the restored program storage unit 14. Then, the symbolic execution unit 15 reads the program from the restoration program storage unit 14 and executes it symbolically. Therefore, the program analysis apparatus 1 can symbolically execute a program obtained by program slicing.

また、実施例では、分岐設定部16が固定選択情報を作成して分岐制御部17に渡し、シンボリック実行部15がシンボリック実行を行う際に、分岐制御部17が、固有選択情報を用いてシンボリック実行の分岐を制御する。したがって、プログラム分析装置1は、スライシング基点3を通過しないパスがシンボリック実行により抽出されることを防ぐことができる。   In the embodiment, the branch setting unit 16 creates fixed selection information and passes it to the branch control unit 17. When the symbolic execution unit 15 performs symbolic execution, the branch control unit 17 uses the unique selection information to perform symbolic execution. Control execution branching. Therefore, the program analysis apparatus 1 can prevent a path that does not pass through the slicing base point 3 from being extracted by symbolic execution.

また、実施例では、分岐制御部17は、シンボリック実行において、条件分岐文の条件の真偽値が不定であり、複数分岐が選択可能な場合には、固定選択情報に含まれる分岐を選択する。また、分岐制御部17は、シンボリック実行において、条件分岐文の条件の真偽値が確定であり、真偽値に基づいて選択される分岐が固定選択情報に含まれる分岐と同じである場合には、固定選択情報に含まれる分岐を選択する。また、分岐制御部17は、シンボリック実行において、条件分岐文の条件の真偽値が確定であり、真偽値に基づいて選択される分岐が固定選択情報に含まれる分岐と異なる場合には、シンボリック実行部15にバックトラックを指示する。したがって、分岐制御部17は、スライシング基点3を通過しないパスを抽出しないように、シンボリック実行を制御することができる。   In the embodiment, the branch control unit 17 selects a branch included in the fixed selection information when the true / false value of the condition of the conditional branch statement is indefinite and a plurality of branches can be selected in symbolic execution. . In addition, the branch control unit 17 performs symbolic execution when the true / false value of the condition of the conditional branch statement is definite and the branch selected based on the true / false value is the same as the branch included in the fixed selection information. Selects a branch included in the fixed selection information. Further, the branch control unit 17, in the symbolic execution, when the truth value of the condition of the conditional branch statement is fixed, and the branch selected based on the truth value is different from the branch included in the fixed selection information, Instructs the symbolic execution unit 15 to backtrack. Therefore, the branch control unit 17 can control the symbolic execution so that a path that does not pass through the slicing base point 3 is not extracted.

また、実施例では、入れ子構造の条件分岐文の内側の条件分岐文のいずれかの分岐にスライシング基点3が含まれる場合に、分岐設定部16は、固定分岐分析処理を再帰的に呼び出して固定選択情報を作成する。したがって、プログラム分析装置1は、条件分岐文が入れ子構造を有するプログラム2に関しても、スライシング基点3を通過しないパスがシンボリック実行により抽出されることを防ぐことができる。   In the embodiment, when the slicing base point 3 is included in any branch of the conditional branch statement inside the nested conditional branch statement, the branch setting unit 16 recursively calls and fixes the fixed branch analysis process. Create selection information. Therefore, the program analysis apparatus 1 can prevent a path that does not pass the slicing base point 3 from being extracted by symbolic execution even for the program 2 in which the conditional branch statement has a nested structure.

また、実施例では、復元部13は、条件分岐文の分岐に有効な命令文があるか否かを判定し、条件分岐文の分岐に有効な命令文がない場合に、ダミー命令文を挿入するので、シンボリック実行が可能なプログラムを復元することができる。   Further, in the embodiment, the restoration unit 13 determines whether there is a command statement that is valid for the branch of the conditional branch statement, and inserts a dummy command statement when there is no command statement that is valid for the branch of the conditional branch statement Thus, a program that can be executed symbolically can be restored.

なお、実施例では、プログラム分析装置1について説明したが、プログラム分析装置1が有する構成をソフトウェアによって実現することで、同様の機能を有するプログラム分析プログラムを得ることができる。そこで、プログラム分析プログラムを実行するコンピュータについて説明する。   In addition, although the program analysis apparatus 1 was demonstrated in the Example, the program analysis program which has the same function can be obtained by implement | achieving the structure which the program analysis apparatus 1 has with software. A computer that executes the program analysis program will be described.

図20は、実施例に係るプログラム分析プログラムを実行するコンピュータのハードウェア構成を示す図である。図20に示すように、コンピュータ50は、メインメモリ51と、CPU(Central Processing Unit)52と、LAN(Local Area Network)インタフェース53と、HDD(Hard Disk Drive)54とを有する。また、コンピュータ50は、スーパーIO(Input Output)55と、DVI(Digital Visual Interface)56と、ODD(Optical Disk Drive)57とを有する。   FIG. 20 is a diagram illustrating a hardware configuration of a computer that executes the program analysis program according to the embodiment. As shown in FIG. 20, the computer 50 includes a main memory 51, a CPU (Central Processing Unit) 52, a LAN (Local Area Network) interface 53, and an HDD (Hard Disk Drive) 54. The computer 50 includes a super IO (Input Output) 55, a DVI (Digital Visual Interface) 56, and an ODD (Optical Disk Drive) 57.

メインメモリ51は、プログラムやプログラムの実行途中結果などを記憶するメモリである。CPU52は、メインメモリ51からプログラムを読み出して実行する中央処理装置である。CPU52は、メモリコントローラを有するチップセットを含む。   The main memory 51 is a memory for storing a program and a program execution result. The CPU 52 is a central processing unit that reads a program from the main memory 51 and executes it. The CPU 52 includes a chip set having a memory controller.

LANインタフェース53は、コンピュータ50をLAN経由で他のコンピュータに接続するためのインタフェースである。HDD54は、プログラムやデータを格納するディスク装置であり、スーパーIO55は、マウスやキーボードなどの入力装置を接続するためのインタフェースである。DVI56は、液晶表示装置を接続するインタフェースであり、ODD57は、DVDの読み書きを行う装置である。   The LAN interface 53 is an interface for connecting the computer 50 to another computer via a LAN. The HDD 54 is a disk device that stores programs and data, and the super IO 55 is an interface for connecting an input device such as a mouse or a keyboard. The DVI 56 is an interface for connecting a liquid crystal display device, and the ODD 57 is a device for reading / writing a DVD.

LANインタフェース53は、PCIエクスプレス(PCIe)によりCPU52に接続され、HDD54及びODD57は、SATA(Serial Advanced Technology Attachment)によりCPU52に接続される。スーパーIO55は、LPC(Low Pin Count)によりCPU52に接続される。   The LAN interface 53 is connected to the CPU 52 by PCI Express (PCIe), and the HDD 54 and ODD 57 are connected to the CPU 52 by SATA (Serial Advanced Technology Attachment). The super IO 55 is connected to the CPU 52 by LPC (Low Pin Count).

そして、コンピュータ50において実行されるプログラム分析プログラムは、DVDに記憶され、ODD57によってDVDから読み出されてコンピュータ50にインストールされる。あるいは、プログラム分析プログラムは、LANインタフェース53を介して接続された他のコンピュータシステムのデータベースなどに記憶され、これらのデータベースから読み出されてコンピュータ50にインストールされる。そして、インストールされたプログラム分析プログラムは、HDD54に記憶され、メインメモリ51に読み出されてCPU52によって実行される。   The program analysis program executed in the computer 50 is stored in the DVD, read from the DVD by the ODD 57, and installed in the computer 50. Alternatively, the program analysis program is stored in a database or the like of another computer system connected via the LAN interface 53, read from these databases, and installed in the computer 50. The installed program analysis program is stored in the HDD 54, read into the main memory 51, and executed by the CPU 52.

また、実施例では、COBOLで記述されたプログラム2を対象とする場合について説明したが、本発明はこれに限定されるものではなく、他のプログラミング言語で記述されたプログラムを対象とする場合にも同様に適用することができる。   In the embodiment, the case where the program 2 described in COBOL is targeted has been described. However, the present invention is not limited to this, and the case where the program described in another programming language is targeted. Can be applied similarly.

1 プログラム分析装置
2,91,92 プログラム
3 スライシング基点
4 ロジック表
11 スライシング部
12 命令文リスト記憶部
13 復元部
14 復元プログラム記憶部
15 シンボリック実行部
16 分岐設定部
17 分岐制御部
50 コンピュータ
51 メインメモリ
52 CPU
53 LANインタフェース
54 HDD
55 スーパーIO
56 DVI
57 ODD
93 対象プログラム
DESCRIPTION OF SYMBOLS 1 Program analyzer 2,91,92 Program 3 Slicing origin 4 Logic table 11 Slicing part 12 Command sentence list memory | storage part 13 Restoration part 14 Restoration program memory | storage part 15 Symbolic execution part 16 Branch setting part 17 Branch control part 50 Computer 51 Main memory 52 CPU
53 LAN interface 54 HDD
55 Super IO
56 DVI
57 ODD
93 Target program

Claims (7)

プログラム中の命令文と変数を指定するスライシング基点に影響する命令文を抽出して命令文リストを作成するスライシング部と、
前記スライシング部により作成された命令文リストを用いてシンボリック実行が可能なプログラムを復元する復元部と、
前記復元部により復元されたプログラムをシンボリック実行してロジック表を出力するシンボリック実行部と
を有することを特徴とするプログラム分析装置。
A slicing unit that extracts a statement that affects a slicing base point that specifies a statement and a variable in a program and creates a statement list;
A restoring unit that restores a program that can be symbolically executed using the statement list created by the slicing unit;
A program analysis apparatus comprising: a symbolic execution unit that symbolically executes the program restored by the restoration unit and outputs a logic table.
前記スライシング基点が条件分岐文のいずれかの分岐に含まれるか否かを判定し、いずれかの分岐に含まれる場合には、前記条件分岐文と前記分岐に関する情報を含む固定選択情報として作成する固定選択情報作成部と、
前記復元部により復元されたプログラムが前記シンボリック実行部により実行される際に、前記固定選択情報作成部により作成された固定選択情報に基づいて、シンボリック実行の分岐を制御する分岐制御部と
をさらに有することを特徴とする請求項1に記載のプログラム分析装置。
It is determined whether or not the slicing base point is included in any branch of a conditional branch sentence. If included in any branch, the slicing base point is created as fixed selection information including information regarding the conditional branch sentence and the branch. A fixed selection information creation unit;
A branch control unit that controls a branch of symbolic execution based on the fixed selection information created by the fixed selection information creation unit when the program restored by the restoration unit is executed by the symbolic execution unit; The program analysis apparatus according to claim 1, further comprising:
前記分岐制御部は、シンボリック実行において、前記条件分岐文の条件の真偽値が不定であり、複数分岐が選択可能な場合には、前記固定選択情報に含まれる分岐を選択し、前記条件分岐文の条件の真偽値が確定であり、該真偽値に基づいて選択される分岐が前記固定選択情報に含まれる分岐と同じである場合には、前記固定選択情報に含まれる分岐を選択し、前記条件分岐文の条件の真偽値が確定であり、該真偽値に基づいて選択される分岐が前記固定選択情報に含まれる分岐と異なる場合には、前記シンボリック実行部にバックトラックを指示することを特徴とする請求項2に記載のプログラム分析装置。   In the symbolic execution, the branch control unit selects a branch included in the fixed selection information when the truth value of the condition of the conditional branch statement is indefinite and multiple branches can be selected, and the conditional branch When the true / false value of the sentence condition is definite and the branch selected based on the true / false value is the same as the branch included in the fixed selection information, the branch included in the fixed selection information is selected. When the true / false value of the condition of the conditional branch statement is definite and the branch selected based on the true / false value is different from the branch included in the fixed selection information, the symbolic execution unit is backtracked. The program analysis apparatus according to claim 2, wherein 前記固定選択情報作成部は、前記スライシング基点で指定される命令文が、入れ子構造の条件分岐文の内側の条件分岐文のいずれかの分岐に含まれる場合には、外側と内側の条件分岐文について分岐に関する情報を含む固定選択情報を作成し、
前記分岐制御部は、外側と内側の条件分岐文について分岐に関する情報を含む固定選択情報に基づいて、シンボリック実行の分岐を複数制御することを特徴とする請求項2又は3に記載のプログラム分析装置。
The fixed selection information creation unit, when the instruction statement specified by the slicing base point is included in any branch of the conditional branch statement inside the nested conditional branch statement, the outer and inner conditional branch statements Create fixed selection information including information about branching
4. The program analysis apparatus according to claim 2, wherein the branch control unit controls a plurality of branches of symbolic execution based on fixed selection information including information related to branching for the outer and inner conditional branch statements. .
前記復元部は、条件分岐文の分岐に有効な命令文があるか否かを判定し、条件分岐文の分岐に有効な命令文がない場合に、ダミー命令文を挿入することによってシンボリック実行が可能なプログラムを復元することを特徴とする請求項1〜4のいずれか1つに記載のプログラム分析装置。   The restoration unit determines whether there is a valid command statement for the branch of the conditional branch statement, and if there is no valid command statement for the branch of the conditional branch statement, symbolic execution is performed by inserting a dummy command statement. The program analysis apparatus according to claim 1, wherein a possible program is restored. コンピュータが、
プログラム中の命令文と変数を指定するスライシング基点に影響する命令文を抽出して命令文リストを作成し、
作成した命令文リストを用いてシンボリック実行が可能なプログラムを復元し、
復元したプログラムをシンボリック実行してロジック表を出力する
処理を実行することを特徴とするプログラム分析方法。
Computer
Create a statement list by extracting statements that affect the slicing base point that specifies the statements and variables in the program,
Restore the program that can be executed symbolically using the created statement list,
A program analysis method characterized by executing a process of symbolically executing a restored program and outputting a logic table.
コンピュータに、
プログラム中の命令文と変数を指定するスライシング基点に影響する命令文を抽出して命令文リストを作成し、
作成した命令文リストを用いてシンボリック実行が可能なプログラムを復元し、
復元したプログラムをシンボリック実行してロジック表を出力する
処理を実行させることを特徴とするプログラム分析プログラム。
On the computer,
Create a statement list by extracting statements that affect the slicing base point that specifies the statements and variables in the program,
Restore the program that can be executed symbolically using the created statement list,
A program analysis program characterized by executing a process of outputting a logic table by executing symbolically the restored program.
JP2017039644A 2017-03-02 2017-03-02 Program analyzer, program analysis method and program analysis program Active JP6790921B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2017039644A JP6790921B2 (en) 2017-03-02 2017-03-02 Program analyzer, program analysis method and program analysis program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2017039644A JP6790921B2 (en) 2017-03-02 2017-03-02 Program analyzer, program analysis method and program analysis program

Publications (2)

Publication Number Publication Date
JP2018147106A true JP2018147106A (en) 2018-09-20
JP6790921B2 JP6790921B2 (en) 2020-11-25

Family

ID=63592136

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2017039644A Active JP6790921B2 (en) 2017-03-02 2017-03-02 Program analyzer, program analysis method and program analysis program

Country Status (1)

Country Link
JP (1) JP6790921B2 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2020067697A (en) * 2018-10-22 2020-04-30 富士通株式会社 Dead code analysis program, dead code analysis method, and dead code analysis device
CN111475420A (en) * 2020-05-08 2020-07-31 中国人民解放军国防科技大学 Program resource usage automatic analysis method based on numerical abstraction

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2006178835A (en) * 2004-12-24 2006-07-06 Internatl Business Mach Corp <Ibm> Program analysis device, program analysis method and program
JP2013156786A (en) * 2012-01-30 2013-08-15 Hitachi Automotive Systems Ltd Software structure visualization program and system
JP2014191652A (en) * 2013-03-27 2014-10-06 Fujitsu Ltd Test case generation method, test case generation device, and test case generation program
JP2015176230A (en) * 2014-03-13 2015-10-05 富士通株式会社 Test case generation apparatus, test case generation method, and test case generation program
US20150363305A1 (en) * 2013-10-14 2015-12-17 Xi'an Jiaotong University Method for test case reduction based on program behavior slices

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2006178835A (en) * 2004-12-24 2006-07-06 Internatl Business Mach Corp <Ibm> Program analysis device, program analysis method and program
JP2013156786A (en) * 2012-01-30 2013-08-15 Hitachi Automotive Systems Ltd Software structure visualization program and system
JP2014191652A (en) * 2013-03-27 2014-10-06 Fujitsu Ltd Test case generation method, test case generation device, and test case generation program
US20150363305A1 (en) * 2013-10-14 2015-12-17 Xi'an Jiaotong University Method for test case reduction based on program behavior slices
JP2015176230A (en) * 2014-03-13 2015-10-05 富士通株式会社 Test case generation apparatus, test case generation method, and test case generation program

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
中島 震ほか: "問題領域指向リエンジニアリング −GUIソフトウェア−", 情報処理学会研究報告, vol. 93, no. 4, JPN6020036912, 19 January 1993 (1993-01-19), JP, pages 67 - 76, ISSN: 0004356289 *
松下 圭吾ほか: "実行トレースの比較を用いたデバッグ手法の提案及び評価", 情報処理学会先進的計算基盤システムシンポジウム(SACSIS)2011[ONLINE], JPN6020036911, 18 May 2011 (2011-05-18), JP, pages 152 - 159, ISSN: 0004356290 *

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2020067697A (en) * 2018-10-22 2020-04-30 富士通株式会社 Dead code analysis program, dead code analysis method, and dead code analysis device
JP7077909B2 (en) 2018-10-22 2022-05-31 富士通株式会社 Dead code analysis program, dead code analysis method and dead code analysis device
CN111475420A (en) * 2020-05-08 2020-07-31 中国人民解放军国防科技大学 Program resource usage automatic analysis method based on numerical abstraction
CN111475420B (en) * 2020-05-08 2023-04-28 中国人民解放军国防科技大学 Automatic analysis method for program resource usage based on numerical abstraction

Also Published As

Publication number Publication date
JP6790921B2 (en) 2020-11-25

Similar Documents

Publication Publication Date Title
US10684943B2 (en) Generating executable test automation code automatically according to a test case
JP6928552B2 (en) Impact analysis
US8225288B2 (en) Model-based testing using branches, decisions, and options
US8903690B2 (en) Linking graphical user interface testing tools and human performance modeling to enable usability assessment
JP2015043198A (en) Analysis system, analysis method and analysis program
JP5450840B2 (en) Test data generation method for program execution performance evaluation
KR20160025426A (en) Source code analysis apparatus, Computer program for the same, Recording medium storing computer program for the same
JP6790921B2 (en) Program analyzer, program analysis method and program analysis program
JP7077909B2 (en) Dead code analysis program, dead code analysis method and dead code analysis device
CN112231197A (en) Page testing method and device and storage medium
JP5440287B2 (en) Symbolic execution support program, method and apparatus
US20220214963A1 (en) Analysis apparatus, analysis method and program
Oliveira pytest Quick Start Guide: Write better Python code with simple and maintainable tests
US9858113B2 (en) Creating execution flow by associating execution component information with task name
Clerissi et al. Towards the generation of end-to-end web test scripts from requirements specifications
JP2010055293A (en) Verification assisting program, verification assisting apparatus, and verification assisting method
JP7268759B2 (en) TEST DATA GENERATION DEVICE, TEST DATA GENERATION METHOD, AND PROGRAM
JP7070328B2 (en) Test data generator, test data generation method and program
CN113238967A (en) Test case generation method and device
US20150199183A1 (en) Program analysis apparatus and program analysis method
WO2020048416A1 (en) Graphic processing method and device for domain-specific language (dsl)
JP2016126700A (en) Program verification device, program verification method, and program verification program
US20140115558A1 (en) Generating and Employing Operational Abstractions of Transforms
US12001325B2 (en) Test data generation apparatus, test data generation method and program
JP2018084973A (en) Test driver generation device, test driver generation method and test driver generation program

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20191112

TRDD Decision of grant or rejection written
A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20200930

A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20201006

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20201019

R150 Certificate of patent or registration of utility model

Ref document number: 6790921

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150