JP5761056B2 - Generating device, generating program, and generating method - Google Patents

Generating device, generating program, and generating method Download PDF

Info

Publication number
JP5761056B2
JP5761056B2 JP2012019285A JP2012019285A JP5761056B2 JP 5761056 B2 JP5761056 B2 JP 5761056B2 JP 2012019285 A JP2012019285 A JP 2012019285A JP 2012019285 A JP2012019285 A JP 2012019285A JP 5761056 B2 JP5761056 B2 JP 5761056B2
Authority
JP
Japan
Prior art keywords
node
branch
execution
executed
program
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.)
Expired - Fee Related
Application number
JP2012019285A
Other languages
Japanese (ja)
Other versions
JP2013156961A (en
Inventor
晋 徳本
晋 徳本
忠弘 上原
忠弘 上原
一樹 宗像
一樹 宗像
前田 芳晴
芳晴 前田
翔一朗 藤原
翔一朗 藤原
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 JP2012019285A priority Critical patent/JP5761056B2/en
Publication of JP2013156961A publication Critical patent/JP2013156961A/en
Application granted granted Critical
Publication of JP5761056B2 publication Critical patent/JP5761056B2/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

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

Description

本発明は、生成装置、生成プログラム、および生成方法に関する。   The present invention relates to a generation device, a generation program, and a generation method.

従来、テストデータをプログラムに与えた場合に、プログラムの実行経路を示す2分木をトレースして到達する葉ノードを特定し、2分木の葉ノードの中で特定された葉ノードの割合を、プログラムに対するテストデータの網羅性として算出する技術がある(例えば、下記特許文献1参照)。   Conventionally, when test data is given to a program, a leaf tree that traces a binary tree indicating the execution path of the program is traced and a leaf node that is reached is identified. There is a technique for calculating the completeness of test data for (see, for example, Patent Document 1 below).

特開平3−296148号公報JP-A-3-296148

しかしながら、上述した従来技術では、2分木の生成過程において、プログラムの分岐命令ごとに2分木の末端ノードが枝分かれするため、ノードの個数が増大していく。また、プログラムの実行経路を示す2分木のトレースによりプログラムに対するテストデータの網羅性が算出されるため、2分木を記憶装置に保持し続けると、記憶領域を圧迫するといった問題がある。また、記憶領域が圧迫されるとプログラムの実行効率が低下し、テストデータの網羅性の算出が長期化することになる。また、記憶領域に2分木を保持しきれなくなった場合、プログラムの実行が中断される。これにより、2分木が完成せず、テストデータの網羅性の算出ができない場合がある。   However, in the above-described conventional technique, the end node of the binary tree branches for each branch instruction of the program in the generation process of the binary tree, so the number of nodes increases. Further, since the completeness of the test data for the program is calculated by tracing the binary tree indicating the execution path of the program, there is a problem that if the binary tree is kept in the storage device, the storage area is compressed. In addition, if the storage area is compressed, the execution efficiency of the program is reduced, and the calculation of the completeness of the test data is prolonged. When the binary tree cannot be held in the storage area, the program execution is interrupted. As a result, the binary tree may not be completed, and the completeness of test data may not be calculated.

本発明は、上述した従来技術による問題点を解消するため、記憶領域の使用量増加を抑制することができる生成装置、生成プログラム、および生成方法を提供することを目的とする。   An object of the present invention is to provide a generation device, a generation program, and a generation method that can suppress an increase in the amount of use of a storage area in order to solve the above-described problems caused by the conventional technology.

上述した課題を解決し、目的を達成するため、本発明の一側面によれば、プログラムの実行中に到達した分岐命令において未実行の分岐条件が実行された場合、分岐命令と、実行された分岐条件と、プログラムの実行開始から分岐命令の分岐元の分岐命令までに実行された一連の分岐条件と、を関連付けたノードを生成し、生成されたノードを記憶装置に格納し、プログラムの実行が終了した場合、プログラムが終了するまでの実行経路上の末尾ノードが示す一連の分岐条件に基づいて、プログラムが終了するまでに実行された一連の分岐条件を生成し、生成された一連の分岐条件を記憶装置に格納し、プログラムの実行が終了した場合、プログラムが終了するまでの実行経路を当該実行経路上の末尾ノードから前記実行経路の逆順に探索して未実行の分岐条件が最初に出現するノードを、記憶装置の中から特定し、特定されたノードが示す分岐命令からプログラムが再開され、未実行の分岐条件が実行された場合、当該分岐条件を特定されたノードが示す分岐命令に関連付けることにより、特定されたノードを記憶装置内において更新し、未実行の分岐条件がなくなったノードを記憶装置から削除する生成装置、生成プログラム、および生成方法が提案される。   In order to solve the above-described problems and achieve the object, according to one aspect of the present invention, when an unexecuted branch condition is executed in a branch instruction reached during program execution, the branch instruction is executed. Generates a node that associates the branch condition with a series of branch conditions executed from the start of program execution to the branch instruction that is the branch source of the branch instruction, stores the generated node in the storage device, and executes the program When is completed, a series of branch conditions executed until the program ends is generated based on a series of branch conditions indicated by the end node on the execution path until the program ends, and the generated series of branches When the condition is stored in the storage device and the execution of the program ends, the execution path until the program ends is searched from the last node on the execution path in the reverse order of the execution path. The node in which the unexecuted branch condition first appears is identified from the storage device, and when the program is restarted from the branch instruction indicated by the identified node and the unexecuted branch condition is executed, the branch condition is A generation device, a generation program, and a generation method for updating a specified node in a storage device by associating it with a branch instruction indicated by the specified node and deleting a node that has no unexecuted branch condition from the storage device Proposed.

本発明の一側面によれば、記憶領域の使用量増加を抑制することができるという効果を奏する。   According to one aspect of the present invention, there is an effect that an increase in the usage amount of a storage area can be suppressed.

図1は、生成装置によるパス条件の生成の内容を示す説明図である。FIG. 1 is an explanatory diagram showing details of generation of a path condition by the generation device. 図2は、実施の形態にかかる生成装置100のハードウェア構成例を示すブロック図である。FIG. 2 is a block diagram illustrating a hardware configuration example of the generation apparatus 100 according to the embodiment. 図3は、生成装置100の機能的構成例を示すブロック図である。FIG. 3 is a block diagram illustrating a functional configuration example of the generation apparatus 100. 図4は、対象プログラムTPの一例を示す説明図である。FIG. 4 is an explanatory diagram showing an example of the target program TP. 図5は、パス条件を生成する具体例を示す説明図(その1)である。FIG. 5 is an explanatory diagram (part 1) illustrating a specific example of generating a path condition. 図6は、パス条件を生成する具体例を示す説明図(その2)である。FIG. 6 is an explanatory diagram (part 2) illustrating a specific example of generating a path condition. 図7は、パス条件を生成する具体例を示す説明図(その3)である。FIG. 7 is an explanatory diagram (part 3) illustrating a specific example of generating a path condition. 図8は、パス条件を生成する具体例を示す説明図(その4)である。FIG. 8 is an explanatory diagram (part 4) of the specific example for generating the path condition. 図9は、パス条件を生成する具体例を示す説明図(その5)である。FIG. 9 is an explanatory diagram (part 5) illustrating a specific example of generating a path condition. 図10は、パス条件を生成する具体例を示す説明図(その6)である。FIG. 10 is an explanatory diagram (part 6) of a specific example for generating a path condition. 図11は、パス条件を生成する具体例を示す説明図(その7)である。FIG. 11 is an explanatory diagram (part 7) illustrating a specific example of generating a path condition. 図12は、実行回数が閾値以上になったことを検出する具体例を示す説明図である。FIG. 12 is an explanatory diagram illustrating a specific example of detecting that the number of executions is equal to or greater than a threshold value. 図13は、パス条件生成処理の詳細な処理手順を示すフローチャート(その1)である。FIG. 13 is a flowchart (part 1) showing a detailed processing procedure of the path condition generation processing. 図14は、パス条件生成処理の詳細な処理手順を示すフローチャート(その2)である。FIG. 14 is a flowchart (part 2) illustrating the detailed processing procedure of the path condition generation processing.

以下に添付図面を参照して、この発明にかかる生成装置、生成プログラム、および生成方法の実施の形態を詳細に説明する。   Exemplary embodiments of a generating device, a generating program, and a generating method according to the present invention will be explained below in detail with reference to the accompanying drawings.

(生成装置によるパス条件の生成の内容)
図1は、生成装置によるパス条件の生成の内容を示す説明図である。図1において、生成装置100は、パス条件の生成対象になる対象プログラムTPをシンボリック実行するコンピュータである。パス条件とは、或る実行経路で対象プログラムTPを実行する場合に対象プログラムTPの入力になるデータが満たすべき条件であり、対象プログラムTPの実行が終了するまでの実行経路上において実行された一連の分岐条件である。
(Contents of path condition generation by the generator)
FIG. 1 is an explanatory diagram showing details of generation of a path condition by the generation device. In FIG. 1, the generation device 100 is a computer that executes symbolically the target program TP that is a target for generating a path condition. The path condition is a condition that must be satisfied by data to be input to the target program TP when the target program TP is executed in a certain execution path, and is executed on the execution path until the execution of the target program TP is completed. A series of branch conditions.

シンボリック実行とは、対象プログラムTPの変数に具体的な値を入力する代わりに、シンボル値(記号値)を入力し、シンボル値のまま対象プログラムTPを模擬的に実行することである。以降、シンボル値が入力される変数を「シンボル変数」と称す。生成装置100は、対象プログラムTPのシンボリック実行中において、シンボル変数に関する分岐命令を実行するごとに、当該分岐命令に対応するノードNを生成する。   Symbolic execution is to input a symbol value (symbol value) instead of inputting a specific value to a variable of the target program TP, and execute the target program TP in a simulated manner with the symbol value. Hereinafter, a variable to which a symbol value is input is referred to as a “symbol variable”. The generation apparatus 100 generates a node N corresponding to a branch instruction each time a branch instruction related to a symbol variable is executed during symbolic execution of the target program TP.

(A)は、生成されたノードNのデータ構造を示す。分岐命令に対応するノードNには、例えば、分岐命令に応じたプログラムカウンタ、および分岐命令までの実行経路上において実行された一連の分岐条件、実行された分岐条件が含まれる。プログラムカウンタとは、命令の番地(アドレス)である。   (A) shows the data structure of the generated node N. The node N corresponding to the branch instruction includes, for example, a program counter corresponding to the branch instruction, a series of branch conditions executed on the execution path to the branch instruction, and an executed branch condition. The program counter is an instruction address (address).

ここで、一般的なシンボリック実行の場合とは異なり、ノードNには、実行された分岐条件が含まれる。これにより、生成装置100は、ノードNが示す分岐命令に、未実行の分岐条件があるか否かを判別できる。また、一般的なシンボリック実行の場合とは異なり、ノードNには、分岐命令までの実行経路上において実行された一連の分岐条件が含まれる。これにより、生成装置100は、ノードNが示す一連の分岐条件を引き継ぐことにより、ノードNが示す分岐命令から対象プログラムTPの実行を再開して、未実行の実行経路を途中から実行することができる。   Here, unlike the case of general symbolic execution, the executed branch condition is included in the node N. Thereby, the generation device 100 can determine whether or not the branch instruction indicated by the node N has an unexecuted branch condition. Also, unlike the case of general symbolic execution, the node N includes a series of branch conditions executed on the execution path up to the branch instruction. As a result, the generation apparatus 100 can resume execution of the target program TP from the branch instruction indicated by the node N by executing a series of branch conditions indicated by the node N, and execute an unexecuted execution path from the middle. it can.

また、生成装置100は、対象プログラムTPの実行を終了した場合、対象プログラムTPの実行の終了に対応するノードNを生成する。この場合、対象プログラムTPの実行の終了に対応するノードNには、例えば、対象プログラムTPの実行の終了に応じたプログラムカウンタ、および対象プログラムTPの実行の終了までの実行経路上において実行された一連の分岐条件が含まれる。   Further, when the execution of the target program TP is ended, the generation apparatus 100 generates a node N corresponding to the end of execution of the target program TP. In this case, the node N corresponding to the end of the execution of the target program TP is executed, for example, on the program counter according to the end of the execution of the target program TP and the execution path until the end of the execution of the target program TP. A series of branch conditions is included.

また、各ノードNは、実行経路上の親ノードNへのリンクとして、親ノードのアドレスを含んでもよい。また、各ノードNは、実行経路上の子ノードNへのリンクとして、子ノードのアドレスを含んでもよい。ノードNの子ノードとは、当該ノードNから分岐したノードである。ノードNの親ノードとは、当該ノードNの直前の分岐元のノードNである。   Each node N may include the address of the parent node as a link to the parent node N on the execution path. Each node N may include the address of the child node as a link to the child node N on the execution path. The child node of the node N is a node branched from the node N. The parent node of the node N is the branching node N immediately before the node N.

(B)は、対象プログラムTPの記述内容の一例を示す。対象プログラムTPは、シンボル変数「a」に関する分岐命令を3番地に含み、シンボル変数「b」に関する分岐命令を4番地に含む。(C)〜(E)は、生成されたノード群により構成される木構造データの一例を示している。以下、(B)〜(E)を参照して、生成装置100による対象プログラムTPのパス条件の生成の内容について説明する。   (B) shows an example of the description content of the target program TP. The target program TP includes a branch instruction related to the symbol variable “a” at the third address, and includes a branch instruction related to the symbol variable “b” at the fourth address. (C)-(E) have shown an example of the tree structure data comprised by the produced | generated node group. Hereinafter, with reference to (B) to (E), the contents of the generation of the path condition of the target program TP by the generation apparatus 100 will be described.

(B)において、(1)まず、生成装置100は、対象プログラムTPの1番地からシンボリック実行を開始し、対象プログラムTPの3番地に到達する。そして、(C)において、(2)生成装置100は、対象プログラムTPの3番地において、シンボル変数「a」に関する分岐命令「if(a>0)」が真になる分岐条件「a>0」を実行すると、当該分岐命令に対応するノードN1を生成する。   In (B), (1) First, the generation apparatus 100 starts symbolic execution from the first address of the target program TP and reaches the third address of the target program TP. In (C), (2) the generation apparatus 100 determines that the branch condition “a> 0” in which the branch instruction “if (a> 0)” regarding the symbol variable “a” is true at the third address of the target program TP. Is executed, a node N1 corresponding to the branch instruction is generated.

ノードN1は、例えば、当該分岐命令の番地を示すプログラムカウンタ「3」と、3番地までに実行された一連の分岐条件と、当該分岐命令が真になる分岐条件を実行したことを示す「真」と、を含む。ここで、3番地までに実行された分岐条件がないため、ノードN1は、3番地までに実行された分岐条件がないことを示す情報「True」を含む。   The node N1, for example, indicates that the program counter “3” indicating the address of the branch instruction, a series of branch conditions executed up to the third address, and “true” indicating execution of the branch condition that makes the branch instruction true. ”. Here, since there is no branch condition executed up to the third address, the node N1 includes information “True” indicating that there is no branch condition executed up to the third address.

次に、(B)において、(3)生成装置100は、対象プログラムTPを3番地から再開し、対象プログラムTPの4番地に到達する。そして、(C)において、(4)生成装置100は、対象プログラムTPの4番地において、シンボル変数「b」に関する分岐命令「if(b>0)」が真になる分岐条件「b>0」を実行すると、当該分岐命令に対応するノードN2を生成する。   Next, in (B), (3) the generation apparatus 100 resumes the target program TP from address 3, and reaches address 4 of the target program TP. In (C), (4) the generation apparatus 100 determines that the branch condition “b> 0” in which the branch instruction “if (b> 0)” regarding the symbol variable “b” is true at the address 4 of the target program TP. Is executed, a node N2 corresponding to the branch instruction is generated.

ノードN2は、例えば、当該分岐命令の番地を示すプログラムカウンタ「4」と、4番地までに実行された一連の分岐条件「a>0」と、当該分岐命令が真になる分岐条件を実行したことを示す「真」と、を含む。4番地までに実行された一連の分岐条件「a>0」は、ノードN1が示す一連の分岐条件「True」と、3番地において実行された分岐条件「a>0」を参照して生成される。   For example, the node N2 executes a program counter “4” indicating the address of the branch instruction, a series of branch conditions “a> 0” executed up to the fourth address, and a branch condition that makes the branch instruction true. "True" indicating that. A series of branch conditions “a> 0” executed up to the fourth address are generated with reference to a series of branch conditions “True” indicated by the node N1 and a branch condition “a> 0” executed at the third address. The

次に、(B)において、(5)生成装置100は、対象プログラムTPを4番地から再開し、対象プログラムTPの8番地まで到達する。そして、(C)において、(6)生成装置100は、対象プログラムTPの8番地で、対象プログラムTPの実行の終了を検出すると、対象プログラムTPの実行の終了に対応するノードN3を生成する。   Next, in (B), (5) the generation apparatus 100 restarts the target program TP from the address 4 and reaches the address 8 of the target program TP. In (C), (6) when the generation apparatus 100 detects the end of execution of the target program TP at the address 8 of the target program TP, the generation apparatus 100 generates a node N3 corresponding to the end of execution of the target program TP.

ノードN3は、例えば、対象プログラムTPが終了した番地を示すプログラムカウンタ「8」と、8番地までに実行された一連の分岐条件「(a>0)&&(b>0)」と、を含む。8番地までに実行された一連の分岐条件「(a>0)&&(b>0)」は、ノードN2が示す一連の分岐条件「a>0」と、4番地において実行された分岐条件「b>0」を参照して生成される。「&&」は論理積を示す。ここで、生成装置100は、生成したノードN3が示す一連の分岐条件「a>0&&b>0」をパス条件PC1として記憶装置に保持しておく。   The node N3 includes, for example, a program counter “8” indicating the address at which the target program TP has ended, and a series of branch conditions “(a> 0) && (b> 0)” executed up to the address 8. . A series of branch conditions “(a> 0) && (b> 0)” executed up to the 8th address are a series of branch conditions “a> 0” indicated by the node N2, and a branch condition “ b> 0 ”. “&&” indicates a logical product. Here, the generation device 100 holds a series of branch conditions “a> 0 && b> 0” indicated by the generated node N3 as a path condition PC1 in the storage device.

また、(B)において、(7)生成装置100は、対象プログラムTPの実行の終了を検出すると、ノードN3の親になるノードN2が示す分岐命令の番地「4」まで戻る。そして、(D)において、(8)生成装置100は、ノードN2が示す分岐命令の番地「4」に戻ると、他のパス条件の生成に用いない不要なノードN3を削除する。これにより、生成装置100は、記憶領域の使用量増加を抑制することができる。(9)そして、生成装置100は、番地「4」の分岐命令に、未実行の分岐条件があるか否かを判定する。   In (B), (7) when the generation apparatus 100 detects the end of execution of the target program TP, it returns to the branch instruction address “4” indicated by the node N2 that is the parent of the node N3. In (D), (8) when the generation apparatus 100 returns to the branch instruction address “4” indicated by the node N2, the generation apparatus 100 deletes an unnecessary node N3 that is not used for generation of another path condition. Thereby, the production | generation apparatus 100 can suppress the increase in the usage-amount of a storage area. (9) Then, the generation device 100 determines whether or not the branch instruction at the address “4” has an unexecuted branch condition.

次に、(B)において、(10)生成装置100は、ノードN2に分岐命令が偽になる分岐条件を実行したことを示す「偽」が含まれていないため、未実行の分岐条件があると判断する。   Next, in (B), (10) since the generation apparatus 100 does not include “false” indicating that the branch condition in which the branch instruction becomes false is included in the node N2, there is an unexecuted branch condition. Judge.

そのため、生成装置100は、4番地の分岐命令「if(b>0)」が偽になる未実行の分岐条件「!b>0」を実行し、対象プログラムTPを4番地から再開し、対象プログラムTPの8番地まで到達する。「!」は否定を示す。ここで、生成装置100は、分岐命令が偽になる分岐条件を実行したことを示す「偽」を、ノードN2に追加する。(11)そして、生成装置100は、対象プログラムTPの8番地において、対象プログラムTPの実行の終了を検出すると、対象プログラムTPの実行の終了に対応するノードN4を生成する。   Therefore, the generation apparatus 100 executes the unexecuted branch condition “! B> 0” in which the branch instruction “if (b> 0)” at the address 4 is false, restarts the target program TP from the address 4, and the target Reach up to address 8 of program TP. “!” Indicates denial. Here, the generation apparatus 100 adds “false” indicating that the branch condition for which the branch instruction is false is executed to the node N2. (11) When the generation apparatus 100 detects the end of execution of the target program TP at the address 8 of the target program TP, the generation apparatus 100 generates a node N4 corresponding to the end of execution of the target program TP.

ノードN4は、例えば、対象プログラムTPの実行の終了の番地を示すプログラムカウンタ「8」と、8番地までに実行された一連の分岐条件「a>0&&!b>0」と、を含む。8番地までに実行された一連の分岐条件「a>0&&!b>0」は、ノードN2が示す一連の分岐条件「a>0」と、4番地において実行された分岐条件「b≦0」を参照して生成される。ここで、生成装置100は、生成したノードN4が示す一連の分岐条件「a>0&&!b>0」をパス条件PC2として保持しておく。   The node N4 includes, for example, a program counter “8” indicating an end address of execution of the target program TP and a series of branch conditions “a> 0 &&! B> 0” executed up to the eighth address. A series of branch conditions “a> 0 &&! B> 0” executed up to the 8th address are a series of branch conditions “a> 0” indicated by the node N2 and a branch condition “b ≦ 0” executed at the 4th address. Generated with reference to Here, the generation device 100 holds a series of branch conditions “a> 0 &&! B> 0” indicated by the generated node N4 as the path condition PC2.

また、(B)において、(12)生成装置100は、対象プログラムTPが終了すると、ノードN4の親になるノードN2が示す分岐命令の番地「4」まで戻る。そして、(E)において、(13)生成装置100は、ノードN2が示す分岐命令の番地「4」に戻ると、ノードN4を削除する。(14)そして、生成装置100は、番地「4」の分岐命令に、未実行の分岐条件があるか否かを判定する。   In (B), (12) when the target program TP ends, the generating apparatus 100 returns to the branch instruction address “4” indicated by the node N2 that is the parent of the node N4. In (E), (13) when the generation apparatus 100 returns to the branch instruction address “4” indicated by the node N2, the node N4 is deleted. (14) Then, the generation device 100 determines whether or not the branch instruction at the address “4” has an unexecuted branch condition.

次に、(B)において、(15)ノードN2に「真」と「偽」が含まれているため、生成装置100は、未実行の分岐条件がないと判断する。そのため、生成装置100は、さらに、ノードN2の親になるノードN1が示す分岐命令の番地「3」まで戻る。そして、(E)において、(16)生成装置100は、ノードN1が示す分岐命令の番地「3」に戻ると、未実行の分岐条件がないノードN2を、他のパス条件の生成に用いない不要なノードNとして削除する。これにより、生成装置100は、記憶領域の使用量増加を抑制することができる。(17)そして、生成装置100は、番地「3」の分岐命令に、未実行の分岐条件があるか否かを判定する。   Next, in (B), (15) since the node N2 includes “true” and “false”, the generating apparatus 100 determines that there is no unexecuted branch condition. Therefore, the generating apparatus 100 further returns to the branch instruction address “3” indicated by the node N1 that is the parent of the node N2. In (E), (16) when the generator 100 returns to the branch instruction address “3” indicated by the node N1, the node N2 having no unexecuted branch condition is not used for generating other path conditions. Delete as unnecessary node N. Thereby, the production | generation apparatus 100 can suppress the increase in the usage-amount of a storage area. (17) Then, the generation device 100 determines whether or not the branch instruction at the address “3” has an unexecuted branch condition.

次に、(B)において、(18)ノードN1に分岐命令が偽になる分岐条件を実行したことを示す「偽」が含まれていないため、生成装置100は、未実行の分岐条件があると判断する。そのため、生成装置100は、3番地の分岐命令「if(a>0)」が「偽」になる未実行の分岐条件「!a>0」を実行し、対象プログラムTPを3番地から再開し、対象プログラムTPの8番地まで到達する。   Next, in (B), (18) because the node N1 does not include “false” indicating that the branch condition that makes the branch instruction false is included, the generation apparatus 100 has an unexecuted branch condition. Judge. Therefore, the generation apparatus 100 executes the unexecuted branch condition “! A> 0” in which the branch instruction “if (a> 0)” at address 3 is “false”, and resumes the target program TP from address 3. , Reach the address 8 of the target program TP.

そして、(E)において、(19)生成装置100は、対象プログラムTPの8番地で、対象プログラムTPの実行の終了を検出すると、対象プログラムTPの実行の終了に対応するノードN5を生成する。ノードN5は、対象プログラムTPの実行の終了の番地を示すプログラムカウンタ「8」と、1番地から8番地までに実行された分岐条件「!a>0」と、を含む。8番地までに実行された一連の分岐条件「!a>0」は、ノードN1が示す一連の分岐条件「True」と、3番地において実行された分岐条件「!a>0」を参照して生成される。ここで、生成装置100は、生成したノードN5が示す分岐条件「!a>0」をパス条件PC3として保持しておく。   In (E), (19) when the generation apparatus 100 detects the end of execution of the target program TP at the address 8 of the target program TP, the generation apparatus 100 generates a node N5 corresponding to the end of execution of the target program TP. The node N5 includes a program counter “8” indicating an end address of execution of the target program TP and a branch condition “! A> 0” executed from the first address to the eighth address. A series of branch conditions “! A> 0” executed up to address 8 is referred to a series of branch conditions “True” indicated by node N1 and branch condition “! A> 0” executed at address 3 Generated. Here, the generation apparatus 100 holds the branch condition “! A> 0” indicated by the generated node N5 as the path condition PC3.

これにより、生成装置100は、対象プログラムTPの各々の実行経路に対応するパス条件PC1〜PC3を生成することができる。この際、生成装置100は、パス条件の生成に伴って、パス条件の生成を終えた実行経路上のノードNを、パス条件の生成に用いない不要なノードNとして削除していくことにより、記憶領域の使用量増加を抑制することができる。   Thereby, the generating apparatus 100 can generate the path conditions PC1 to PC3 corresponding to the execution paths of the target program TP. At this time, the generation apparatus 100 deletes the node N on the execution path for which the generation of the path condition has been completed as an unnecessary node N that is not used for the generation of the path condition, along with the generation of the path condition. An increase in the usage amount of the storage area can be suppressed.

このように、生成装置100は、記憶領域に保持されるノードNの個数増加を抑制し、ノードNの保持によるワークエリアになる記憶領域の圧迫を抑制する。そして、生成装置100は、ワークエリアの圧迫によるプログラムの実行効率の低下を抑制することができる。生成装置100は、例えば、テストデータの対象プログラムTPに対する網羅性の算出効率の低下を抑制することができる。また、生成装置100は、記憶領域にノードNが保持しきれずに、ワークエリアとして使用可能な領域がなくなることを防止することができる。そして、生成装置100は、ワークエリアとして使用可能な領域がなくなり、パス条件の生成が中断することを防止することができる。   In this way, the generation apparatus 100 suppresses an increase in the number of nodes N held in the storage area, and suppresses compression of the storage area that becomes a work area due to the holding of the node N. And the production | generation apparatus 100 can suppress the fall of the execution efficiency of the program by the pressure of a work area. For example, the generation apparatus 100 can suppress a decrease in the calculation efficiency of the completeness of the test data for the target program TP. Further, the generation apparatus 100 can prevent the area that can be used as a work area from being lost because the node N cannot be held in the storage area. Then, the generation apparatus 100 can prevent the generation of the path condition from being interrupted because there is no area that can be used as a work area.

また、生成装置100は、生成したパス条件PC1〜PC3から、対象プログラムTPの動作確認に用いられるテストデータが、各々の実行経路をどの程度網羅しているかを示す網羅性を算出することができる。ここで、テストデータは、例えば、生成装置100の利用者によって生成される。例えば、テストデータが「(a,b)=(1,1),(1,−1)」であれば、上述した3つのパス条件PC1〜PC3のうち、2つのパス条件PC1,PC2を満たすため、当該テストデータの網羅性は「66%」である。   Further, the generation apparatus 100 can calculate the completeness indicating how much the test data used for the operation check of the target program TP covers each execution path from the generated path conditions PC1 to PC3. . Here, the test data is generated by a user of the generation apparatus 100, for example. For example, if the test data is “(a, b) = (1, 1), (1, −1)”, the two path conditions PC1 and PC2 are satisfied among the three path conditions PC1 to PC3 described above. Therefore, the completeness of the test data is “66%”.

これにより、生成装置100の利用者は、テストデータの対象プログラムTPに対する網羅性が100%に満たない場合、対象プログラムTPの実行経路の各々を100%網羅して動作確認ができるように、テストデータを追加することができる。生成装置100の利用者は、例えば、上記テストデータ「(a,b)=(1,1),(1,−1)」に、パス条件PC3を満たす「(a,b)=(−1,−1)」を追加して、網羅性を100%にする。   As a result, when the user of the generation apparatus 100 has less than 100% coverage of the test program with respect to the target program TP, the test can be performed so that each of the execution paths of the target program TP can be checked with 100% coverage. Data can be added. For example, the user of the generation apparatus 100 satisfies “(a, b) = (− 1) that satisfies the path condition PC3 in the test data“ (a, b) = (1, 1), (1, −1) ”. , -1) "to make the coverage 100%.

また、生成装置100の利用者は、テストデータの対象プログラムTPに対する網羅性が100%である場合、テストデータから不要なデータを削除し、対象プログラムTPの動作確認の効率化を図ってもよい。生成装置100の利用者は、例えば、テストデータ「(a,b)=(1,1),(2,1),(−1,−1),(1,−1)」から、「(a,b)=(2,1)」を削除しても網羅性が100%のままであるため、「(a,b)=(2,1)」を削除する。   In addition, when the coverage of the test data with respect to the target program TP is 100%, the user of the generation apparatus 100 may delete unnecessary data from the test data to improve the efficiency of the operation check of the target program TP. . For example, the user of the generation apparatus 100 can obtain from the test data “(a, b) = (1, 1), (2, 1), (−1, −1), (1, −1)” using “( Even if “a, b) = (2, 1)” is deleted, the completeness remains 100%, so “(a, b) = (2, 1)” is deleted.

また、生成装置100は、生成したパス条件の各々を満たすテストデータを生成してもよい。生成装置100は、例えば、パス条件「(a>0)&&(b>0)」を満たすテストデータとして、「(a,b)=(1,1)」を生成する。   Further, the generation apparatus 100 may generate test data that satisfies each of the generated path conditions. For example, the generation device 100 generates “(a, b) = (1, 1)” as test data that satisfies the path condition “(a> 0) && (b> 0)”.

(生成装置100のハードウェア構成例)
図2は、実施の形態にかかる生成装置100のハードウェア構成例を示すブロック図である。図2において、生成装置100は、CPU(Central Processing Unit)201と、ROM(Read‐Only Memory)202と、RAM(Random Access Memory)203と、磁気ディスクドライブ204と、磁気ディスク205と、光ディスクドライブ206と、光ディスク207と、ディスプレイ208と、I/F(Interface)209と、キーボード210と、マウス211と、スキャナ212と、プリンタ213と、を備えている。また、各構成部はバス220によってそれぞれ接続されている。
(Hardware configuration example of generation device 100)
FIG. 2 is a block diagram illustrating a hardware configuration example of the generation apparatus 100 according to the embodiment. In FIG. 2, a generation apparatus 100 includes a CPU (Central Processing Unit) 201, a ROM (Read-Only Memory) 202, a RAM (Random Access Memory) 203, a magnetic disk drive 204, a magnetic disk 205, and an optical disk drive. 206, an optical disk 207, a display 208, an I / F (Interface) 209, a keyboard 210, a mouse 211, a scanner 212, and a printer 213. Each component is connected by a bus 220.

ここで、CPU201は、生成装置100の全体の制御を司る。ROM202は、ブートプログラムなどのプログラムを記憶している。RAM203は、CPU201のワークエリアとして使用される。磁気ディスクドライブ204は、CPU201の制御にしたがって磁気ディスク205に対するデータのリード/ライトを制御する。磁気ディスク205は、磁気ディスクドライブ204の制御で書き込まれたデータを記憶する。   Here, the CPU 201 governs overall control of the generation apparatus 100. The ROM 202 stores a program such as a boot program. The RAM 203 is used as a work area for the CPU 201. The magnetic disk drive 204 controls reading / writing of data with respect to the magnetic disk 205 according to the control of the CPU 201. The magnetic disk 205 stores data written under the control of the magnetic disk drive 204.

光ディスクドライブ206は、CPU201の制御にしたがって光ディスク207に対するデータのリード/ライトを制御する。光ディスク207は、光ディスクドライブ206の制御で書き込まれたデータを記憶したり、光ディスク207に記憶されたデータをコンピュータに読み取らせたりする。   The optical disk drive 206 controls reading / writing of data with respect to the optical disk 207 according to the control of the CPU 201. The optical disk 207 stores data written under the control of the optical disk drive 206, or causes the computer to read data stored on the optical disk 207.

ディスプレイ208は、カーソル、アイコンあるいはツールボックスをはじめ、文書、画像、機能情報などのデータを表示する。このディスプレイ208は、例えば、液晶ディスプレイ、プラズマディスプレイなどを採用することができる。   The display 208 displays data such as a document, an image, and function information as well as a cursor, an icon, or a tool box. As this display 208, for example, a liquid crystal display, a plasma display, or the like can be adopted.

インターフェース(以下、「I/F」と略する。)209は、通信回線を通じてLAN(Local Area Network)、WAN(Wide Area Network)、インターネットなどのネットワーク214に接続され、このネットワーク214を介して他の装置に接続される。そして、I/F209は、ネットワーク214と内部のインターフェースを司り、外部装置からのデータの入出力を制御する。I/F209には、例えばモデムやLANアダプタなどを採用することができる。   An interface (hereinafter abbreviated as “I / F”) 209 is connected to a network 214 such as a LAN (Local Area Network), a WAN (Wide Area Network), and the Internet through a communication line. Connected to other devices. The I / F 209 controls an internal interface with the network 214 and controls data input / output from an external device. For example, a modem or a LAN adapter may be employed as the I / F 209.

キーボード210は、文字、数字、各種指示などの入力のためのキーを備え、データの入力をおこなう。また、タッチパネル式の入力パッドやテンキーなどであってもよい。マウス211は、カーソルの移動や範囲選択、あるいはウィンドウの移動やサイズの変更などをおこなう。ポインティングデバイスとして同様に機能を有するものであれば、トラックボールやジョイスティックなどであってもよい。   The keyboard 210 includes keys for inputting characters, numbers, various instructions, and the like, and inputs data. Moreover, a touch panel type input pad or a numeric keypad may be used. The mouse 211 performs cursor movement, range selection, window movement, size change, and the like. A trackball or a joystick may be used as long as they have the same function as a pointing device.

スキャナ212は、画像を光学的に読み取り、生成装置100内に画像データを取り込む。なお、スキャナ212は、OCR(Optical Character Reader)機能を持たせてもよい。また、プリンタ213は、画像データや文書データを印刷する。プリンタ213には、例えば、レーザプリンタやインクジェットプリンタを採用することができる。   The scanner 212 optically reads an image and takes in the image data into the generation apparatus 100. The scanner 212 may have an OCR (Optical Character Reader) function. The printer 213 prints image data and document data. As the printer 213, for example, a laser printer or an ink jet printer can be adopted.

(生成装置100の機能的構成例)
図3は、生成装置100の機能的構成例を示すブロック図である。生成装置100は、入力部301と、実行部302と、第1の生成部303と、第1の格納部304と、第2の生成部305と、第2の格納部306と、特定部307と、更新部308と、削除部309と、追加部310と、判定部311と、出力部312と、判断部313と、算出部314と、を含む構成である。
(Functional configuration example of the generation device 100)
FIG. 3 is a block diagram illustrating a functional configuration example of the generation apparatus 100. The generation apparatus 100 includes an input unit 301, an execution unit 302, a first generation unit 303, a first storage unit 304, a second generation unit 305, a second storage unit 306, and a specification unit 307. The update unit 308, the deletion unit 309, the addition unit 310, the determination unit 311, the output unit 312, the determination unit 313, and the calculation unit 314.

入力部301、実行部302、第1の生成部303、第1の格納部304、第2の生成部305、第2の格納部306、特定部307、更新部308、削除部309、追加部310、判定部311、出力部312、判断部313、および、算出部314は、具体的には、例えば、図2に示したROM202、RAM203、磁気ディスク205、光ディスク207などの記憶装置300に記憶されたプログラムをCPU201に実行させることにより、または、I/F209により、その機能を実現する。   Input unit 301, execution unit 302, first generation unit 303, first storage unit 304, second generation unit 305, second storage unit 306, identification unit 307, update unit 308, deletion unit 309, addition unit 310, the determination unit 311, the output unit 312, the determination unit 313, and the calculation unit 314 are specifically stored in the storage device 300 such as the ROM 202, the RAM 203, the magnetic disk 205, and the optical disk 207 illustrated in FIG. The function is realized by causing the CPU 201 to execute the recorded program or by the I / F 209.

ここで、生成装置100は、対象プログラムTPについて実行可能な各々の実行経路に対応するパス条件を生成する機能を有する。ここで、実行経路とは、対象プログラムTPの実行に伴って生成されたノードNの集合における先頭ノードNから末尾ノードNまでの経路である。また、生成装置100は、或る分岐命令の実行回数が閾値以上になったことを検出する機能を有する。また、生成装置100は、生成したパス条件の集合から、テストデータの網羅性を算出する機能を有する。   Here, the generation device 100 has a function of generating a path condition corresponding to each execution path executable for the target program TP. Here, the execution path is a path from the start node N to the end node N in the set of nodes N generated along with the execution of the target program TP. The generation apparatus 100 also has a function of detecting that the number of executions of a certain branch instruction has exceeded a threshold value. In addition, the generation apparatus 100 has a function of calculating the completeness of the test data from the generated set of path conditions.

まず、パス条件を生成する機能について説明する。パス条件を生成する機能は、入力部301〜削除部309によって実現される。パス条件を生成する具体例については、図5〜図11を用いて後述する。   First, a function for generating a path condition will be described. The function of generating the path condition is realized by the input unit 301 to the deletion unit 309. A specific example of generating the path condition will be described later with reference to FIGS.

入力部301は、プログラムの入力を受け付ける。ここで、プログラムとは、パス条件の生成対象になるプログラムであり、例えば、上述した対象プログラムTPである。これにより、入力部301は、対象プログラムTPのシンボリック実行を実行部302に開始させるトリガを発生することができる。ここで、図4を用いて、入力部301によって入力される対象プログラムTPについて説明する。   The input unit 301 receives a program input. Here, the program is a program that is a generation target of the path condition, and is, for example, the above-described target program TP. Thereby, the input unit 301 can generate a trigger for causing the execution unit 302 to start symbolic execution of the target program TP. Here, the target program TP input by the input unit 301 will be described with reference to FIG.

図4は、対象プログラムTPの一例を示す説明図である。図4に示すように、対象プログラムTPは、3番地に、変数「a」にシンボル値を入力する命令「klee_make_symbolic(&a);」を含む。また、対象プログラムTPは、4番地に、変数「b」にシンボル値を入力する命令「klee_make_symbolic(&b);」を含む。ここで、シンボル値を入力された変数を、シンボル変数という。   FIG. 4 is an explanatory diagram showing an example of the target program TP. As shown in FIG. 4, the target program TP includes an instruction “klee_make_symbolic (&a);” for inputting a symbol value to the variable “a” at the third address. The target program TP includes an instruction “klee_make_symbolic (&b);” for inputting a symbol value to the variable “b” at the fourth address. Here, a variable to which a symbol value is input is referred to as a symbol variable.

また、対象プログラムTPは、17番地に、シンボル変数に関する分岐命令であるif文「if(b<10) n++;」を含む。if文「if(b<10) n++;」は、シンボル変数「b」が10より小さいか否かにより分岐する。また、対象プログラムTPは、22番地に、シンボル変数に関する分岐命令になるif文「if(x<0) return −x;」を含む。if文「if(x<0) return −x;」は、変数「x」の引数になるシンボル変数「a」が0より小さいか否かにより分岐する。   Further, the target program TP includes an if statement “if (b <10) n ++;” which is a branch instruction related to the symbol variable at the 17th address. The if statement “if (b <10) n ++;” branches depending on whether the symbol variable “b” is smaller than 10. Further, the target program TP includes an if statement “if (x <0) return -x;” that becomes a branch instruction related to a symbol variable at the 22nd address. The if statement “if (x <0) return -x;” branches depending on whether or not the symbol variable “a” that is an argument of the variable “x” is smaller than zero.

図3に戻り、実行部302は、入力部301によって入力されたプログラムをシンボリック実行する。ここで、シンボリック実行とは、上述したように、対象プログラムTPの変数に具体的な値を入力する代わりに、シンボル値(記号値)を入力し、シンボル値のまま対象プログラムTPを模擬的に実行することである。実行部302は、具体的には、例えば、プログラムカウンタが示す対象プログラムTPの番地から命令を読み出し、読み出した命令を実行する。   Returning to FIG. 3, the execution unit 302 symbolically executes the program input by the input unit 301. Here, symbolic execution means that, as described above, instead of inputting a specific value to a variable of the target program TP, a symbol value (symbol value) is input, and the target program TP is simulated using the symbol value. Is to do. Specifically, for example, the execution unit 302 reads an instruction from the address of the target program TP indicated by the program counter, and executes the read instruction.

また、実行部302は、シンボル変数に関する分岐命令を読み出した場合、未実行の分岐条件を実行し、第1の生成部303に未実行の分岐命令を実行したことを通知する。実行部302は、具体的には、例えば、図4の17番地のif文「if(b<10) n++;」を読み出した場合、当該if文が真になる未実行である分岐条件「b<10」を実行する。これにより、実行部302は、第1の生成部303にノードNの生成を開始させることができる。   Further, when the execution unit 302 reads a branch instruction related to a symbol variable, the execution unit 302 executes an unexecuted branch condition and notifies the first generation unit 303 that the unexecuted branch instruction has been executed. Specifically, for example, when the execution unit 302 reads the if statement “if (b <10) n ++;” at address 17 in FIG. 4, the branch condition “b” that is not executed becomes true. <10> is executed. Thereby, the execution unit 302 can cause the first generation unit 303 to start generating the node N.

また、実行部302は、具体的には、例えば、図4の17番地のif文「if(b<10) n++;」を読み出した場合、分岐条件「b<10」を実行済みであれば、当該if文が偽になる未実行である分岐条件「b≧10」を実行してもよい。これにより、実行部302は、第1の生成部303にノードNの生成を開始させることができる。   Further, for example, when the execution unit 302 reads the if statement “if (b <10) n ++;” at address 17 in FIG. 4, if the branch condition “b <10” is already executed, The branch condition “b ≧ 10”, which is an unexecuted state in which the if statement becomes false, may be executed. Thereby, the execution unit 302 can cause the first generation unit 303 to start generating the node N.

また、実行部302は、プログラムの終了命令を読み出した場合、第2の生成部305にプログラムの終了を通知する。ここで、プログラムの終了命令とは、例えば、関数「main()」の終了を示す、図4の8番地の閉じ括弧である。これにより、実行部302は、第2の生成部305にパス条件の生成を開始させることができる。   Further, when the execution unit 302 reads the program end instruction, the execution unit 302 notifies the second generation unit 305 of the end of the program. Here, the program end instruction is, for example, the closing parenthesis at address 8 in FIG. 4 indicating the end of the function “main ()”. Accordingly, the execution unit 302 can cause the second generation unit 305 to start generating path conditions.

第1の生成部303は、プログラムの実行中に到達した分岐命令において未実行の分岐条件が実行された場合、分岐命令と、実行された分岐条件と、プログラムの実行開始から分岐命令の分岐元の分岐命令までに実行された一連の分岐条件と、を関連付けたノードNを生成する。   When an unexecuted branch condition is executed in a branch instruction reached during program execution, the first generation unit 303 executes the branch instruction, the executed branch condition, and the branch instruction branch source from the start of program execution. A node N that associates a series of branch conditions executed up to the branch instruction is generated.

ここで、実行部302によって図4の22番地のif文が真になる分岐条件「a<0」が実行された場合を例に挙げる。この場合、第1の生成部303は、具体的には、例えば、実行された分岐命令を示す番地「22」と、実行された分岐条件「a<0」と、22番地までに実行された一連の分岐条件「True」と、を関連付けたノードNを生成する。ここで、一連の分岐条件「True」とは、22番地までに実行された分岐条件がないことを示す情報である。   Here, a case will be described as an example in which the execution unit 302 executes a branch condition “a <0” that makes the if statement at address 22 in FIG. 4 true. In this case, specifically, the first generation unit 303 is executed by, for example, the address “22” indicating the executed branch instruction, the executed branch condition “a <0”, and the 22nd address. A node N that associates a series of branch conditions “True” is generated. Here, the series of branch conditions “True” is information indicating that there is no branch condition executed up to the 22nd address.

また、実行部302によって図4の22番地のif文の分岐条件「x<0」が実行された後に、17番地のif文の分岐条件「b<10」が実行された場合を例に挙げる。この場合、第1の生成部303は、具体的には、例えば、実行された分岐命令を示す番地「17」と、実行された分岐条件「b<10」と、17番地までに実行された一連の分岐条件「a<0」と、を関連付けたノードNを生成する。17番地までに実行された一連の分岐条件「a<0」は、22番地の分岐命令に対応する親ノードNが示す一連の分岐条件「True」と実行された分岐条件「a<0」から生成される。   In addition, a case where the branch condition “b <10” of the if statement at the address 17 is executed after the execution unit 302 executes the branch condition “x <0” of the if statement at the address 22 in FIG. 4 will be described as an example. . In this case, specifically, the first generation unit 303 is executed by, for example, the address “17” indicating the executed branch instruction, the executed branch condition “b <10”, and the 17th address. A node N that associates a series of branch conditions “a <0” is generated. A series of branch conditions “a <0” executed up to the 17th address is based on a series of branch conditions “True” indicated by the parent node N corresponding to the branch instruction at the 22nd address and the executed branch conditions “a <0”. Generated.

また、ノードNは、親ノードNへのリンクになる記憶装置300における親ノードNのアドレスを含んでもよい。また、親ノードNは、ノードNへのリンクになる記憶装置300におけるノードNのアドレスを含んでもよい。また、第1の生成部303は、ノードNに、「a<0」の代わりに、分岐命令が真になる分岐条件が実行されたことを示す「真」を関連付けてもよい。また、第1の生成部303は、ノードNに、分岐命令に到達した場合の変数の値を関連付けてもよい。   Further, the node N may include the address of the parent node N in the storage device 300 that becomes a link to the parent node N. Further, the parent node N may include the address of the node N in the storage device 300 that is a link to the node N. Further, the first generation unit 303 may associate “true” indicating that a branch condition for which the branch instruction is true is executed instead of “a <0” with the node N. The first generation unit 303 may associate the value of the variable when the branch instruction is reached with the node N.

これにより、特定部307は、第1の生成部303により生成されたノードNが示す実行済みの分岐条件を参照して、ノードNが示す分岐命令に未実行の分岐条件があるか否かを判別することができる。また、実行部302は、第1の生成部303により生成されたノードNが示す一連の分岐条件と変数の値とを参照して、対象プログラムTPの実行を再開することができる。   Thereby, the specifying unit 307 refers to the executed branch condition indicated by the node N generated by the first generation unit 303, and determines whether or not the branch instruction indicated by the node N has an unexecuted branch condition. Can be determined. Further, the execution unit 302 can resume execution of the target program TP with reference to a series of branch conditions and variable values indicated by the node N generated by the first generation unit 303.

第1の格納部304は、第1の生成部303によって生成されたノードNを記憶装置300に格納する。ここで、記憶装置300は、図2に示したRAM203、磁気ディスク205、光ディスク207などである。これにより、特定部307は、第1の格納部304により格納されたノードNが示す実行済みの分岐条件を、記憶装置300から取得することができる。また、実行部302は、第1の格納部304により格納されたノードNが示す一連の分岐条件と変数の値とを、記憶装置300から取得することができる。   The first storage unit 304 stores the node N generated by the first generation unit 303 in the storage device 300. Here, the storage device 300 is the RAM 203, the magnetic disk 205, the optical disk 207, or the like shown in FIG. Thereby, the specifying unit 307 can acquire the executed branch condition indicated by the node N stored by the first storage unit 304 from the storage device 300. In addition, the execution unit 302 can acquire a series of branch conditions and variable values indicated by the node N stored by the first storage unit 304 from the storage device 300.

第2の生成部305は、プログラムの実行が終了した場合、プログラムが終了するまでの実行経路上の末尾ノードNが示す一連の分岐条件に基づいて、プログラムが終了するまでに実行された一連の分岐条件を生成する。プログラムが終了するまでに実行された一連の分岐条件をパス条件という。パス条件は、当該実行経路(パス)でプログラムを実行する場合に各シンボル変数が満たすべき条件である。   When the execution of the program ends, the second generation unit 305, based on a series of branch conditions indicated by the end node N on the execution path until the program ends, a series of steps executed until the program ends. Generate a branch condition. A series of branch conditions executed until the program ends is called a path condition. The path condition is a condition that each symbol variable should satisfy when the program is executed on the execution path (path).

ここで、分岐命令を示す番地「17」と、実行された分岐条件「b<10」と、17番地までに実行された一連の分岐条件「a<0」と、を関連付けたノードNが末尾ノードNである場合を例に挙げる。この場合、第2の生成部305は、具体的には、例えば、プログラムが終了するまでに実行された一連の分岐条件として、末尾ノードNが示す17番地において実行された分岐条件「b<10」と、17番地までに実行された一連の分岐条件「a<0」と、の論理積「(b<10)&&(a<0)」を生成する。これにより、算出部314は、第2の生成部305により生成されたパス条件を参照して、対象プログラムTPの動作確認に用いられるテストデータの網羅性を算出することができる。   Here, the node N that associates the address “17” indicating the branch instruction, the executed branch condition “b <10”, and the series of branch conditions “a <0” executed up to the address 17 ends. Take the case of node N as an example. In this case, the second generation unit 305 specifically, for example, sets the branch condition “b <10” executed at the address 17 indicated by the end node N as a series of branch conditions executed until the program ends. And a series of branch conditions “a <0” executed up to the 17th address, and “(b <10) && (a <0)” are generated. Thereby, the calculation unit 314 can calculate the completeness of the test data used for checking the operation of the target program TP with reference to the path condition generated by the second generation unit 305.

第2の格納部306は、第2の生成部305によって生成された一連の分岐条件を記憶装置300に格納する。ここで、記憶装置300は、図2に示したRAM203、磁気ディスク205、光ディスク207などである。これにより、削除部309は、第2の格納部306により記憶装置300に格納済みのパス条件に対応する実行経路上のノードNを、パス条件の生成に用いない不要なノードNとして削除することができる。また、算出部314は、第2の格納部306により格納されたパス条件を、記憶装置300から取得することができる。   The second storage unit 306 stores the series of branch conditions generated by the second generation unit 305 in the storage device 300. Here, the storage device 300 is the RAM 203, the magnetic disk 205, the optical disk 207, or the like shown in FIG. Accordingly, the deletion unit 309 deletes the node N on the execution path corresponding to the path condition already stored in the storage device 300 by the second storage unit 306 as an unnecessary node N that is not used for generation of the path condition. Can do. In addition, the calculation unit 314 can acquire the path condition stored by the second storage unit 306 from the storage device 300.

特定部307は、プログラムの実行が終了した場合、プログラムが終了するまでの実行経路を当該実行経路上の末尾ノードNから実行経路の逆順に探索して、未実行の分岐条件が最初に存在するノードNを記憶装置300の中から特定する。ここで、逆順とは、ノードNの生成された順序の逆の順序であり、実行経路上の各ノードNが示す分岐命令が実行された順序の逆の順序である。実行経路を当該実行経路上の末尾ノードNから実行経路の逆順に探索することを、バックトラックという。   When the execution of the program ends, the specifying unit 307 searches for the execution path until the program ends in the reverse order of the execution path from the end node N on the execution path, and the unexecuted branch condition exists first. The node N is specified from the storage device 300. Here, the reverse order is an order reverse to the order in which the nodes N are generated, and is an order reverse to the order in which the branch instructions indicated by the nodes N on the execution path are executed. Searching the execution path from the end node N on the execution path in the reverse order of the execution path is called backtracking.

特定部307は、具体的には、例えば、末尾ノードNを始点にし、プログラムが終了するまでの実行経路上の各々のノードNが示す親のノードNのアドレスを参照して、親のノードNに戻る。特定部307は、親のノードNに戻ると、さらに、その親のノードに戻る。このようにして、特定部307は、プログラムが終了するまでの実行経路をその逆順に探索していくことになる。次に、特定部307は、プログラムが終了するまでの実行経路を探索する過程において、当該実行経路内のノードNが示す実行済み分岐条件を取得する。そして、特定部307は、取得された分岐条件が1つ以下である場合に、未実行の分岐条件が存在すると判定し、分岐条件を取得したノードNを、未実行の分岐条件が存在するノードNとして特定する。   Specifically, for example, the specifying unit 307 refers to the address of the parent node N indicated by each node N on the execution path from the end node N as the starting point until the program ends. Return to. When returning to the parent node N, the specifying unit 307 further returns to the parent node. In this way, the specifying unit 307 searches for an execution path until the program ends in the reverse order. Next, in the process of searching for an execution path until the program ends, the specifying unit 307 acquires the executed branch condition indicated by the node N in the execution path. Then, the identifying unit 307 determines that there is an unexecuted branch condition when the acquired branch condition is one or less, and determines the node N that has acquired the branch condition as the node where the unexecuted branch condition exists. Specify as N.

特定部307は、より具体的には、図4の17番地の分岐命令に応じた末尾ノードNから、実行された分岐条件「b<10」を取得する。特定部307は、分岐条件「b<10」が1つ以下であり、未実行の分岐条件「b≧10」が存在すると判定する。そして、特定部307は、17番地の分岐命令に応じた末尾ノードNを、未実行の分岐条件が存在するノードNとして特定する。   More specifically, the specifying unit 307 acquires the executed branch condition “b <10” from the tail node N corresponding to the branch instruction at address 17 in FIG. The identifying unit 307 determines that the branch condition “b <10” is one or less and there is an unexecuted branch condition “b ≧ 10”. Then, the specifying unit 307 specifies the end node N corresponding to the branch instruction at address 17 as the node N where an unexecuted branch condition exists.

これにより、実行部302は、特定部307により特定されたノードNが示す分岐命令を起点にして、対象プログラムTPの実行を再開することができる。また、実行部302は、対象プログラムTPの実行を再開し、分岐命令が真になる分岐条件と、偽になる分岐条件と、を実行することができる。   Thereby, the execution unit 302 can resume the execution of the target program TP using the branch instruction indicated by the node N specified by the specifying unit 307 as a starting point. Further, the execution unit 302 can resume execution of the target program TP and execute a branch condition that makes the branch instruction true and a branch condition that makes the branch instruction false.

この場合、実行部302は、特定されたノードNが示す変数の値を各変数に設定し、特定されたノードNが示す番地から対象プログラムTPを実行する。これにより、実行部302は、対象プログラムTPを最初から実行しなくても、途中から再開することができ、未実行の実行経路の実行を開始することができる。そのため、実行部302は、対象プログラムTPの実行可能な実行経路の各々を、効率的に実行していくことができる。   In this case, the execution unit 302 sets the value of the variable indicated by the identified node N to each variable, and executes the target program TP from the address indicated by the identified node N. As a result, the execution unit 302 can resume from the middle without executing the target program TP from the beginning, and can start executing an unexecuted execution path. Therefore, the execution unit 302 can efficiently execute each of the execution paths that can execute the target program TP.

また、実行部302は、対象プログラムTPの実行を再開し、分岐命令が真になる分岐条件と、偽になる分岐条件と、を実行することができる。そのため、削除部309は、実行部302により実行され、未実行の分岐条件がなくなったノードNを、パス条件の生成に用いないノードNとして削除することができる。   Further, the execution unit 302 can resume execution of the target program TP and execute a branch condition that makes the branch instruction true and a branch condition that makes the branch instruction false. Therefore, the deletion unit 309 can delete a node N that is executed by the execution unit 302 and has no unexecuted branch condition as a node N that is not used for generation of a path condition.

更新部308は、特定部307によって特定されたノードNが示す分岐命令からプログラムが再開され、未実行の分岐条件が実行された場合、当該分岐条件を特定されたノードNが示す分岐命令に関連付けることにより、特定されたノードNを記憶装置300内において更新する。   When the program is restarted from the branch instruction indicated by the node N specified by the specifying unit 307 and an unexecuted branch condition is executed, the update unit 308 associates the branch condition with the branch instruction indicated by the specified node N. As a result, the identified node N is updated in the storage device 300.

更新部308は、具体的には、例えば、実行部302により17番地の分岐命令が偽になる分岐条件「b≧10」が実行され、対象プログラムTPが再開された場合、17番地の分岐命令に応じた末尾ノードNに、さらに「b≧10」を関連付けて更新する。また、更新部308は、末尾ノードNに、「b≧10」の代わりに、分岐命令が偽になる分岐条件が実行されたことを示す「偽」を関連付けて更新してもよい。これにより、削除部309は、更新部308により更新された実行された分岐条件を参照して、未実行の分岐条件がなくなったノードNを特定することができる。   Specifically, for example, when the execution unit 302 executes the branch condition “b ≧ 10” in which the branch instruction at the 17th address is false and the target program TP is resumed, the update unit 308 executes the branch instruction at the 17th address. Further, “b ≧ 10” is further associated with the tail node N corresponding to the update. Further, the updating unit 308 may update the tail node N by associating “false” indicating that a branch condition in which the branch instruction becomes false is executed instead of “b ≧ 10”. As a result, the deletion unit 309 can identify the node N in which the unexecuted branch condition disappears with reference to the executed branch condition updated by the update unit 308.

削除部309は、未実行の分岐条件がなくなったノードNを記憶装置300から削除する。削除部309は、具体的には、例えば、実行された分岐条件として2つの分岐条件が関連付けられたノードNを、パス条件の生成に用いない不要なノードNと判断して削除する。これにより、削除部309は、メモリ使用量の増加を抑制することができる。   The deletion unit 309 deletes from the storage device 300 the node N that has no unexecuted branch conditions. Specifically, for example, the deletion unit 309 determines that a node N associated with two branch conditions as an executed branch condition is an unnecessary node N that is not used for generation of a path condition and deletes the node N. Thereby, the deletion unit 309 can suppress an increase in memory usage.

次に、分岐命令の実行回数が閾値以上になったことを検出する機能について説明する。分岐命令の実行回数が閾値以上になったことを検出する機能は、追加部310〜出力部312によって実現される。分岐命令の実行回数が閾値以上になったことを検出する具体例については、図12を用いて後述する。   Next, a function for detecting that the number of executions of the branch instruction has exceeded the threshold will be described. The function of detecting that the number of executions of the branch instruction has exceeded the threshold value is realized by the adding unit 310 to the output unit 312. A specific example of detecting that the number of executions of the branch instruction has exceeded the threshold will be described later with reference to FIG.

追加部310は、生成されたノードNに、生成されたノードNが示す分岐命令を呼び出した関数の履歴を追加する。関数の履歴とは、対象プログラムTPの実行により呼び出された一連の関数と当該関数の呼び出し順序とを示す情報である。関数の履歴は、例えば、LIFO(Last In First Out)の記憶方式であり、呼び出された関数の履歴が、当該関数の終了に伴って消去されるコールスタックの内容である。また、関数の履歴は、呼び出された関数の履歴が、当該関数の終了に伴って消去されない履歴であってもよい。   The adding unit 310 adds to the generated node N the history of the function that called the branch instruction indicated by the generated node N. The function history is information indicating a series of functions called by executing the target program TP and the calling order of the functions. The function history is, for example, a LIFO (Last In First Out) storage method, and the history of the called function is the content of the call stack that is erased when the function ends. The function history may be a history in which the called function history is not deleted when the function ends.

追加部310は、具体的には、例えば、図4の22番地に応じたノードNに、22番地の分岐命令におけるコールスタックを関連付ける。22番地の分岐命令におけるコールスタックは、関数「int abs(int x)」と関数「int funcA(int a)」と関数「int main()」とを含む。これにより、判定部311は、追加部310により追加されたノードNと同一の実行経路において、追加されたノードNと、同一の関数の履歴を示し、かつ、同一の分岐命令を示すノードNが何個あるかを特定することができる。   Specifically, the adding unit 310 associates, for example, the call stack in the branch instruction at the address 22 with the node N corresponding to the address 22 in FIG. The call stack in the branch instruction at address 22 includes a function “int abs (int x)”, a function “int funcA (int a)”, and a function “int main ()”. As a result, the determination unit 311 displays the same function history as that of the added node N in the same execution path as that of the node N added by the adding unit 310, and the node N indicating the same branch instruction is displayed. You can specify how many.

判定部311は、追加部310によって関数の履歴が追加された追加後のノード列を当該ノード列の末尾ノードから追加後のノード列の逆順に探索することにより、追加後のノード列の末尾ノードNと同一内容の関数の履歴を示すノードNが閾値以上連続して出現するか否かを判定する。ここで、追加後のノード列とは、各々のノードが示す分岐命令が実行された場合のコールスタックの内容を含むノードNの集合であり、コールスタックが追加された最新のノードNまでの実行経路である。追加後のノード列の末尾ノードNとは、コールスタックが追加された最新のノードNである。   The determination unit 311 searches the node sequence after the addition of the function history by the adding unit 310 in the reverse order of the node sequence after the addition from the node at the end of the node sequence, thereby determining the end node of the node sequence after the addition It is determined whether or not a node N indicating a function history having the same content as N appears continuously for a threshold value or more. Here, the node sequence after addition is a set of nodes N including the contents of the call stack when the branch instruction indicated by each node is executed, and execution up to the latest node N to which the call stack is added It is a route. The end node N in the node sequence after addition is the latest node N to which the call stack has been added.

判定部311は、具体的には、例えば、追加後のノード列の末尾ノードNを始点にし、追加後のノード列の各々のノードNが示す親のノードNのアドレスを参照して、親のノードNに戻る。判定部311は、親のノードNに戻ると、さらに、その親のノードに戻る。このようにして、判定部311は、追加後のノード列をその逆順に探索していくことになる。次に、判定部311は、追加後のノード列を探索する過程において、追加後のノード列の末尾ノードNを始点にして、同一の分岐命令を示し、かつ、同一のコールスタックの内容を示すノードNが何個あるかを計数する。   Specifically, for example, the determination unit 311 refers to the address of the parent node N indicated by each node N in the node sequence after the addition, starting from the end node N of the node sequence after the addition, Return to node N. When the determination unit 311 returns to the parent node N, the determination unit 311 further returns to the parent node. In this way, the determination unit 311 searches for the added node sequence in the reverse order. Next, the determination unit 311 indicates the same branch instruction and the contents of the same call stack starting from the end node N of the node sequence after the addition in the process of searching the node sequence after the addition. Count how many nodes N are present.

そして、判定部311は、計数結果が閾値以上であるか否かを判定する。判定結果は、例えば、RAM203、磁気ディスク205、光ディスク207などの記憶装置300に記憶される。これにより、判定部311は、同一の実行経路上における実行回数が閾値以上である分岐命令を特定することができる。   And the determination part 311 determines whether a count result is more than a threshold value. The determination result is stored in the storage device 300 such as the RAM 203, the magnetic disk 205, and the optical disk 207, for example. Thereby, the determination unit 311 can specify a branch instruction whose number of executions on the same execution path is equal to or greater than a threshold value.

出力部312は、判定部311によって出現すると判定された場合、追加後のノード列の末尾ノードNが示す分岐命令が閾値以上連続して実行された旨を示す情報を出力する。出力部312は、具体的には、例えば、追加後のノード列の末尾ノードNが示すコールスタックの内容から分岐命令を呼び出した関数と分岐命令の番地とを特定し、特定した関数と番地とを出力する。   When it is determined by the determination unit 311 that the output unit 311 appears, the output unit 312 outputs information indicating that the branch instruction indicated by the end node N of the node sequence after the addition is continuously executed for the threshold value or more. Specifically, for example, the output unit 312 identifies the function that called the branch instruction and the address of the branch instruction from the contents of the call stack indicated by the end node N of the node sequence after the addition, and the identified function and address Is output.

出力形式としては、例えば、ディスプレイ208への表示、プリンタ213への印刷出力、I/F209による外部装置への送信がある。また、RAM203、磁気ディスク205、光ディスク207などの記憶領域に記憶することとしてもよい。これにより、出力部312は、生成装置100の利用者に、閾値以上連続して実行された分岐命令の対象プログラムTPにおける番地を通知することができる。   Examples of the output format include display on the display 208, print output to the printer 213, and transmission to an external device by the I / F 209. Alternatively, the data may be stored in a storage area such as the RAM 203, the magnetic disk 205, and the optical disk 207. As a result, the output unit 312 can notify the user of the generation apparatus 100 of the address in the target program TP of the branch instruction that has been continuously executed for the threshold value or more.

そのため、生成装置100の利用者は、通知された番地を参照して、閾値以上連続して実行された分岐命令を特定することができる。そして、生成装置100の利用者は、通知された番地の分岐命令をシンボル変数ではない通常の変数に関する分岐命令に変更したり、シンボル変数の取り得る値の範囲を狭めたりすることができる。ここで、生成装置100の利用者は、番地が通知されているため、当該分岐命令を対象プログラムTPの中から特定する手間を省くことができる。これにより、生成装置100の利用者は、対象プログラムTPのパス条件に不要なパス条件が入らないように対象プログラムTPに変更を加え、対象プログラムTPのパス条件の生成の効率化を図ることができる。   Therefore, the user of the generation apparatus 100 can specify branch instructions that have been executed continuously for a threshold or more with reference to the notified address. The user of the generation device 100 can change the branch instruction at the notified address to a branch instruction related to a normal variable that is not a symbol variable, or can narrow the range of values that the symbol variable can take. Here, since the user is notified of the address, the user of the generating apparatus 100 can save the trouble of specifying the branch instruction from the target program TP. Accordingly, the user of the generation apparatus 100 can change the target program TP so that unnecessary path conditions are not included in the path conditions of the target program TP, thereby improving the efficiency of generation of the path conditions of the target program TP. it can.

また、判定部311によって出現すると判定された場合、第2の格納部306は、追加後のノード列の末尾ノードNが示す一連の分岐条件を記憶装置300に格納してもよい。これにより、算出部314は、記憶装置300を参照して、第2の格納部306により格納された対象プログラムTPのパス条件の各々を取得することができる。   Further, when it is determined by the determination unit 311 to appear, the second storage unit 306 may store a series of branch conditions indicated by the end node N of the node sequence after addition in the storage device 300. Thereby, the calculation unit 314 can acquire each of the path conditions of the target program TP stored by the second storage unit 306 with reference to the storage device 300.

また、判定部311によって出現すると判定された場合、特定部307は、追加後のノード列を追加後のノード列の末尾ノードNから探索して未実行の分岐条件が最初に出現するノードNを記憶装置300の中から特定してもよい。この場合、特定部307は、具体的には、例えば、追加後のノード列の末尾ノードNを始点にし、当該ノード列の各々のノードNが示す親のノードNのアドレスを参照することにより、追加後のノード列を探索していく。次に、特定部307は、追加後のノード列を探索する過程において、追加後のノード列内のノードNが示す実行済み分岐条件を取得する。そして、特定部307は、取得された分岐条件が1つ以下である場合に、未実行の分岐条件が存在すると判定し、分岐条件を取得したノードNを、未実行の分岐条件が存在するノードNとして特定することになる。   If the determination unit 311 determines that the node sequence appears, the specifying unit 307 searches for the node sequence after the addition from the end node N of the node sequence after the addition, and determines the node N where the unexecuted branch condition first appears. The storage device 300 may be specified. In this case, specifically, for example, the specifying unit 307 refers to the address of the parent node N indicated by each node N in the node sequence, starting from the end node N of the node sequence after the addition, The node sequence after the addition is searched. Next, the identifying unit 307 acquires the executed branch condition indicated by the node N in the node string after addition in the process of searching for the node string after addition. Then, the identifying unit 307 determines that there is an unexecuted branch condition when the acquired branch condition is one or less, and determines the node N that has acquired the branch condition as the node where the unexecuted branch condition exists. N will be specified.

これにより、実行部302は、特定部307により、特定されたノードNが示す分岐命令から、対象プログラムTPの実行を再開することができ、分岐命令の実行回数が閾値以上になった実行経路以外の実行経路を実行することができる。そのため、実行部302は、分岐命令の実行回数が閾値以上になった実行経路の実行を停止し、対象プログラムTPのシンボリック実行にかかる処理量を低減することができる。   As a result, the execution unit 302 can restart the execution of the target program TP from the branch instruction indicated by the identified node N by the specifying unit 307, and the execution path other than the execution path in which the execution count of the branch instruction is equal to or greater than the threshold value. Execution paths can be executed. Therefore, the execution unit 302 can stop the execution of the execution path in which the number of executions of the branch instruction is equal to or greater than the threshold, and can reduce the processing amount required for symbolic execution of the target program TP.

また、判定部311によって出現すると判定された場合、実行部302は、対象プログラムTPの実行を停止してもよい。これにより、実行部302は、分岐命令の実行回数が閾値以上になった対象プログラムTPの実行を停止し、対象プログラムTPのシンボリック実行にかかる処理量を低減することができる。   Further, when it is determined by the determination unit 311 to appear, the execution unit 302 may stop the execution of the target program TP. As a result, the execution unit 302 can stop the execution of the target program TP in which the number of executions of the branch instruction is equal to or greater than the threshold, and can reduce the processing amount required for symbolic execution of the target program TP.

次に、テストデータの網羅性を算出する機能について説明する。テストデータの網羅性を算出する機能は、入力部301と、判断部313と、算出部314と、出力部312と、によって実現される。   Next, a function for calculating the completeness of the test data will be described. The function of calculating the completeness of the test data is realized by the input unit 301, the determination unit 313, the calculation unit 314, and the output unit 312.

入力部301は、対象プログラムTPの入力になるデータを受け付ける。対象プログラムTPの入力になるデータとは、プログラムの動作確認のために入力されるテストデータである。これにより、入力部301は、算出部314にテストデータの対象プログラムTPに対する網羅性を算出させることができる。   The input unit 301 receives data to be input to the target program TP. The data to be input to the target program TP is test data that is input to check the operation of the program. Accordingly, the input unit 301 can cause the calculation unit 314 to calculate the completeness of the test data with respect to the target program TP.

判断部313は、対象プログラムTPの入力になるデータが、第2の格納部306によって記憶装置300に格納された一連の分岐条件に該当するか否かを判断する。判断結果は、例えば、RAM203、磁気ディスク205、光ディスク207などの記憶領域に記憶される。これにより、判断部313は、テストデータがパス条件の集合のうち、いくつのパス条件を満たしているかを判断することができる。   The determination unit 313 determines whether the data that is input to the target program TP corresponds to a series of branch conditions stored in the storage device 300 by the second storage unit 306. The determination result is stored in a storage area such as the RAM 203, the magnetic disk 205, and the optical disk 207, for example. Thereby, the determination unit 313 can determine how many path conditions the test data satisfies in the set of path conditions.

算出部314は、記憶装置300に記憶された一連の分岐条件の集合において、判断部313によって該当すると判断される一連の分岐条件が占める割合を算出する。算出部314は、パス条件の集合のうちで、テストデータがパス条件を満たしている割合を、テストデータの対象プログラムTPに対する網羅性として算出する。算出結果は、例えば、RAM203、磁気ディスク205、光ディスク207などの記憶領域に記憶される。これにより、出力部312は、算出部314により算出されたテストデータの網羅性を出力することができる。   The calculation unit 314 calculates the ratio of the series of branch conditions determined to be applicable by the determination unit 313 in the set of series of branch conditions stored in the storage device 300. The calculation unit 314 calculates the ratio of the test data that satisfies the path condition in the set of path conditions as the coverage of the test data with respect to the target program TP. The calculation result is stored in a storage area such as the RAM 203, the magnetic disk 205, and the optical disk 207, for example. Accordingly, the output unit 312 can output the completeness of the test data calculated by the calculation unit 314.

出力部312は、算出部314による算出結果を出力する。出力形式としては、例えば、ディスプレイ208への表示、プリンタ213への印刷出力、I/F209による外部装置への送信がある。また、RAM203、磁気ディスク205、光ディスク207などの記憶領域に記憶することとしてもよい。これにより、出力部312は、生成装置100の利用者に、テストデータの対象プログラムTPに対する網羅性を通知することができる。そして、生成装置100の利用者は、テストデータの対象プログラムTPに対する網羅性から、テストデータを調整することができる。   The output unit 312 outputs the calculation result by the calculation unit 314. Examples of the output format include display on the display 208, print output to the printer 213, and transmission to an external device by the I / F 209. Alternatively, the data may be stored in a storage area such as the RAM 203, the magnetic disk 205, and the optical disk 207. As a result, the output unit 312 can notify the user of the generation apparatus 100 of the completeness of the test data to the target program TP. And the user of the production | generation apparatus 100 can adjust test data from the comprehensiveness with respect to the object program TP of test data.

生成装置100の利用者は、例えば、テストデータの対象プログラムTPに対する網羅性が100%に満たない場合、対象プログラムTPの実行経路の各々を100%網羅して動作確認ができるように、テストデータを追加することができる。また、生成装置100の利用者は、テストデータの対象プログラムTPに対する網羅性が100%である場合、テストデータから不要なデータを削除し、対象プログラムTPの動作確認の効率化を図ってもよい。   For example, when the coverage of the target program TP of the test data is less than 100%, the user of the generation apparatus 100 can test the test data so that each of the execution paths of the target program TP can be checked 100%. Can be added. In addition, when the coverage of the test data with respect to the target program TP is 100%, the user of the generation apparatus 100 may delete unnecessary data from the test data to improve the efficiency of the operation check of the target program TP. .

(パス条件を生成する具体例)
次に、図5〜図11を用いて、図4に示した対象プログラムTPを例に挙げて、パス条件を生成する具体例について説明する。
(Specific example of generating a path condition)
Next, a specific example of generating a path condition will be described using FIGS. 5 to 11 and taking the target program TP shown in FIG. 4 as an example.

図5〜図11は、パス条件を生成する具体例を示す説明図である。図5に示す生成装置100は、対象プログラムTPの実行中において、シンボル変数に関する分岐命令を実行するごとに、当該分岐命令に対応するノードNを生成する。ノードNには、例えば、分岐命令に応じたプログラムカウンタ、分岐命令に到達した場合のコールスタック、分岐命令に到達した場合の変数の値、分岐命令までの実行経路上において実行された一連の分岐条件、分岐命令において実行された分岐条件、および実行カウンタが含まれる。実行カウンタは、同一の分岐命令が、同一の関数から連続して呼び出された回数を、分岐命令の実行回数として保持する。   5 to 11 are explanatory diagrams illustrating specific examples of generating the path condition. The generation apparatus 100 illustrated in FIG. 5 generates a node N corresponding to a branch instruction each time a branch instruction related to a symbol variable is executed during execution of the target program TP. The node N includes, for example, a program counter corresponding to the branch instruction, a call stack when the branch instruction is reached, a variable value when the branch instruction is reached, and a series of branches executed on the execution path to the branch instruction. The condition, the branch condition executed in the branch instruction, and the execution counter are included. The execution counter holds the number of times that the same branch instruction is continuously called from the same function as the execution count of the branch instruction.

実行カウンタには、ノードN22とノードN22の親になるノードN21とが示すスタックとプログラムカウンタが一致する場合、ノードN21が示す回数に1を加算した加算後の回数が採用される。また、実行カウンタには、ノードN22とノードN22の親になるノードN21とが示すスタックまたはプログラムカウンタのいずれかが一致しない場合、1が採用される。   When the stack indicated by the node N22 and the node N21 that is the parent of the node N22 matches the program counter, the number of times after addition obtained by adding 1 to the number indicated by the node N21 is adopted as the execution counter. The execution counter is 1 when either the stack or the program counter indicated by the node N22 and the node N21 that is the parent of the node N22 does not match.

そして、生成装置100は、実行カウンタが閾値以上になった場合、分岐命令の実行回数が閾値以上であると判断し、分岐命令の実行回数が閾値以上である旨を示す情報を出力する。これにより、生成装置100は、生成装置100の利用者に、閾値以上連続して実行された分岐命令の対象プログラムTPにおける番地を通知することができる。   Then, when the execution counter reaches or exceeds the threshold, the generation apparatus 100 determines that the execution count of the branch instruction is equal to or greater than the threshold, and outputs information indicating that the execution count of the branch instruction is equal to or greater than the threshold. Thereby, the generation device 100 can notify the user of the generation device 100 of the address in the target program TP of the branch instruction that has been continuously executed for the threshold value or more.

図5において、(21)まず、生成装置100は、対象プログラムTPの1番地〜8番地が示す関数「int main()」の実行を開始する。ここで、生成装置100は、コールスタックに、実行された関数「int main()」を格納する。そのため、コールスタックは、関数「int main()」が格納された状態になる。   In FIG. 5, (21) First, the generating apparatus 100 starts executing the function “int main ()” indicated by addresses 1 to 8 of the target program TP. Here, the generation device 100 stores the executed function “int main ()” in the call stack. Therefore, the call stack is in a state where the function “int main ()” is stored.

そして、生成装置100は、関数「int main()」を1番地から実行し、5番地に到達する。生成装置100は、5番地において、9番地〜14番地が示す関数「int funcA(int a)」を呼び出す。ここで、生成装置100は、コールスタックに、呼び出した関数「int funcA(int a)」を格納する。コールスタックへの格納方法は、「後入れ先出し」である。そのため、コールスタックは、先頭から順に、関数「int funcA(int a)」、関数「int main()」が格納された状態になる。   Then, the generation apparatus 100 executes the function “int main ()” from the first address and reaches the fifth address. The generation apparatus 100 calls the function “int funcA (int a)” indicated by the addresses 9 to 14 at the address 5. Here, the generation device 100 stores the called function “int funcA (int a)” in the call stack. The storage method in the call stack is “last-in first-out”. For this reason, the function “int funcA (int a)” and the function “int main ()” are stored in order from the top of the call stack.

(22)次に、生成装置100は、呼び出された関数「int funcA(int a)」の9番地から実行を開始し、11番地に到達する。生成装置100は、11番地において、21番地〜24番地が示す関数「int abs(int x)」を呼び出す。ここで、生成装置100は、コールスタックに、呼び出した関数「int abs(int x)」を格納する。そのため、コールスタックは、先頭から順に、関数「int abs(int x)」、関数「int funcA(int a)」、および関数「int main()」が格納された状態になる。   (22) Next, the generation device 100 starts execution from the address 9 of the called function “int funcA (int a)” and reaches the address 11. The generation apparatus 100 calls the function “int abs (int x)” indicated by the addresses 21 to 24 at the address 11. Here, the generation device 100 stores the called function “int abs (int x)” in the call stack. Therefore, the function “int abs (int x)”, the function “int funcA (int a)”, and the function “int main ()” are stored in the call stack in order from the top.

(23)そして、生成装置100は、呼び出された関数「int abs(int x)」の21番地から実行を開始し、22番地に到達する。(24)生成装置100は、22番地において、シンボル変数「a」に関する分岐命令「if(x<0)」が真になる未実行の分岐条件「x<0」を実行すると、当該分岐命令に対応するノードN11を生成する。   (23) Then, the generation device 100 starts execution from the address 21 of the called function “int abs (int x)” and reaches the address 22. (24) When the generation apparatus 100 executes the unexecuted branch condition “x <0” in which the branch instruction “if (x <0)” regarding the symbol variable “a” is true at the address 22, the branch instruction is A corresponding node N11 is generated.

ノードN11は、当該分岐命令の番地を示すプログラムカウンタ「22」、当該分岐命令に到達した場合の変数の値「x=*」、22番地までに実行された一連の分岐条件「True」、および、当該分岐命令が真になる分岐条件を実行したことを示す「真」を含む。また、ノードN11は、当該分岐命令の実行回数を示す実行カウンタ「1」、および、当該分岐命令に到達するまでに呼び出された関数の履歴を示すスタック(stack)1を含む。   The node N11 includes a program counter “22” indicating the address of the branch instruction, a variable value “x = *” when the branch instruction is reached, a series of branch conditions “True” executed up to the address 22, and , Including “true” indicating that the branch condition for which the branch instruction is true is executed. The node N11 includes an execution counter “1” indicating the number of executions of the branch instruction, and a stack 1 indicating a history of functions called up to the branch instruction.

スタック1は、当該分岐命令に到達した場合のコールスタックの内容である。スタック1は、例えば、関数「int abs(int x)」と、関数「int funcA(int a)」と、関数「int main()」と、を含む。   Stack 1 is the contents of the call stack when the branch instruction is reached. The stack 1 includes, for example, a function “int abs (int x)”, a function “int funcA (int a)”, and a function “int main ()”.

(25)次に、生成装置100は、対象プログラムTPを23番地から再開し、24番地に到達する。生成装置100は、24番地において、関数「int abs(int x)」が終了したことを検出する。そして、生成装置100は、関数「int abs(int x)」が終了すると、呼び出し元の関数「int funcA(int a)」に戻る。ここで、生成装置100は、コールスタックの先頭に格納された関数「int abs(int x)」を削除する。そのため、コールスタックは、先頭から順に、関数「int funcA(int a)」、関数「int main()」が格納された状態になる。   (25) Next, the generating apparatus 100 restarts the target program TP from address 23 and reaches address 24. The generation apparatus 100 detects that the function “int abs (int x)” is completed at the 24th address. Then, when the function “int abs (int x)” ends, the generation apparatus 100 returns to the caller function “int func (int a)”. Here, the generation device 100 deletes the function “int abs (int x)” stored at the top of the call stack. For this reason, the function “int funcA (int a)” and the function “int main ()” are stored in order from the top of the call stack.

(26)次に、生成装置100は、呼び出し元の関数「int funcA(int a)」に戻ると、11番地から実行を開始し、14番地に到達する。生成装置100は、14番地において、関数「int funcA(int a)」が終了したことを検出する。そして、生成装置100は、関数「int funcA(int a)」が終了すると、呼び出し元の関数「int main()」に戻る。ここで、生成装置100は、コールスタックの先頭に格納された関数「int funcA(int a)」を削除する。そのため、コールスタックは、関数「int main()」が格納された状態になる。   (26) Next, when the generating apparatus 100 returns to the caller function “int funcA (int a)”, the generation apparatus 100 starts execution from the 11th address and reaches the 14th address. The generation apparatus 100 detects that the function “int funcA (int a)” has ended at the 14th address. When the function “int funcA (int a)” ends, the generation apparatus 100 returns to the caller function “int main ()”. Here, the generation device 100 deletes the function “int funcA (int a)” stored at the top of the call stack. Therefore, the call stack is in a state where the function “int main ()” is stored.

(27)次に、生成装置100は、呼び出し元の関数「int main()」に戻ると、6番地から実行を開始する。生成装置100は、6番地において、15番地〜20番地が示す関数「int funcB(int b)」を呼び出す。ここで、生成装置100は、コールスタックに、呼び出した関数「int funcB(int b)」を格納する。そのため、コールスタックは、先頭から順に、関数「int funcB(int b)」、および関数「int main()」が格納された状態になる。   (27) Next, when the generating apparatus 100 returns to the caller function “int main ()”, the generating apparatus 100 starts execution from address 6. The generation apparatus 100 calls the function “int funcB (int b)” indicated by the addresses 15 to 20 at the address 6. Here, the generation device 100 stores the called function “int funcB (int b)” in the call stack. Therefore, the function “int funcB (int b)” and the function “int main ()” are stored in order from the top of the call stack.

(28)そして、生成装置100は、呼び出された関数「int funcB(int b)」の15番地から実行を開始し、17番地に到達する。(29)生成装置100は、17番地において、シンボル変数「b」に関する分岐命令「if(b<10)」が真になる未実行の分岐条件「b<10」を実行すると、当該分岐命令に対応するノードN12を生成する。   (28) Then, the generation apparatus 100 starts execution from the 15th address of the called function “int funcB (int b)” and reaches 17th address. (29) When the generation apparatus 100 executes the unexecuted branch condition “b <10” in which the branch instruction “if (b <10)” regarding the symbol variable “b” is true at the address 17, the branch instruction is A corresponding node N12 is generated.

ノードN12は、当該分岐命令の番地を示すプログラムカウンタ「17」、当該分岐命令に到達した場合の変数の値「b=*,n=*」、17番地までに実行された一連の分岐条件「a<0」、および、当該分岐命令が真になる分岐条件を実行したことを示す「真」を含む。また、ノードN12は、実行カウンタ「1」、および、当該分岐命令に到達するまでに呼び出された関数の履歴を示すスタック2を含む。   The node N12 has a program counter “17” indicating the address of the branch instruction, variable values “b = *, n = *” when the branch instruction is reached, and a series of branch conditions “ a <0 ”and“ true ”indicating that the branch condition that makes the branch instruction true is executed. Further, the node N12 includes an execution counter “1” and a stack 2 indicating a history of functions called up to the branch instruction.

17番地までに実行された一連の分岐条件「a<0」は、ノードN11が示す一連の分岐条件「True」と、実行された分岐条件が「真」であることと、を参照して生成される。スタック2は、当該分岐命令に到達した場合のコールスタックの内容である。スタック2は、例えば、関数「int funcB(int b)」と、関数「int main()」と、を含む。次に、生成装置100は、図6の(30)に移行する。   A series of branch conditions “a <0” executed up to address 17 are generated with reference to a series of branch conditions “True” indicated by node N11 and the executed branch condition is “true”. Is done. The stack 2 is the contents of the call stack when the branch instruction is reached. The stack 2 includes, for example, a function “int funcB (int b)” and a function “int main ()”. Next, the generating apparatus 100 proceeds to (30) in FIG.

図6において、(30)生成装置100は、対象プログラムTPを18番地から再開し、20番地に到達する。生成装置100は、20番地において、関数「int funcB(int b)」が終了したことを検出する。そして、生成装置100は、関数「int funcB(int b)」が終了すると、呼び出し元の関数「int main()」に戻る。ここで、生成装置100は、コールスタックの先頭に格納された関数「int funcB(int b)」を削除する。そのため、コールスタックは、関数「int main()」が格納された状態になる。   In FIG. 6, (30) the generation apparatus 100 restarts the target program TP from the 18th address and reaches the 20th address. The generation apparatus 100 detects that the function “int funcB (int b)” has ended at the 20th address. When the function “int funcB (int b)” ends, the generating apparatus 100 returns to the caller function “int main ()”. Here, the generation device 100 deletes the function “int funcB (int b)” stored at the top of the call stack. Therefore, the call stack is in a state where the function “int main ()” is stored.

(31)次に、生成装置100は、呼び出し元の関数「int main()」に戻ると、7番地から実行を開始し、8番地に到達する。(32)そして、生成装置100は、対象プログラムTPの8番地において、対象プログラムTPの実行の終了を検出すると、対象プログラムTPの実行の終了に対応するノードN13を生成する。   (31) Next, when the generation apparatus 100 returns to the caller function “int main ()”, the generation apparatus 100 starts execution from the 7th address and reaches the 8th address. (32) When the generation apparatus 100 detects the end of execution of the target program TP at the address 8 of the target program TP, the generation apparatus 100 generates a node N13 corresponding to the end of execution of the target program TP.

ノードN13は、対象プログラムTPが終了した番地を示すプログラムカウンタ「8」、当該分岐命令に到達した場合の変数の値「a=*,b=*,n=1」、8番地までに実行された一連の分岐条件「(a<0)&&(b<10)」を含む。また、ノードN13は、実行カウンタ「1」、および、当該分岐命令に到達するまでに呼び出された関数の履歴を示すスタック3を含む。   The node N13 is executed by the program counter “8” indicating the address at which the target program TP ends, the variable values “a = *, b = *, n = 1” when the branch instruction is reached, and the eighth address. A series of branch conditions “(a <0) && (b <10)” are included. The node N13 includes an execution counter “1” and a stack 3 indicating a history of functions called up to the branch instruction.

8番地までに実行された一連の分岐条件「(a<0)&&(b<10)」は、ノードN12が示す一連の分岐条件「a<0」と、実行された分岐条件が「真」であることと、を参照して生成される。スタック3は、対象プログラムTPが終了した場合のコールスタックの内容である。スタック3は、例えば、関数「int main()」を含む。ここで、生成装置100は、生成したノードN13が示す一連の分岐条件「(a<0)&&(b<10)」をパス条件PC11として保持しておく。次に、生成装置100は、図7の(33)に移行する。   A series of branch conditions “(a <0) && (b <10)” executed up to the 8th address are a series of branch conditions “a <0” indicated by the node N12, and the executed branch condition is “true”. It is generated with reference to. The stack 3 is the contents of the call stack when the target program TP ends. The stack 3 includes, for example, a function “int main ()”. Here, the generation apparatus 100 holds a series of branch conditions “(a <0) && (b <10)” indicated by the generated node N13 as the path condition PC11. Next, the generating apparatus 100 proceeds to (33) in FIG.

図7において、(33)生成装置100は、対象プログラムTPが終了すると、ノードN13の親になるノードN12が示す分岐命令の番地「17」まで戻る。(34)生成装置100は、ノードN12が示す分岐命令の番地「17」に戻ると、他のパス条件の生成に用いない不要なノードN13を削除する。   In FIG. 7, (33) when the target program TP ends, the generating apparatus 100 returns to the branch instruction address “17” indicated by the node N12 that is the parent of the node N13. (34) When the generating apparatus 100 returns to the branch instruction address “17” indicated by the node N12, the generating apparatus 100 deletes the unnecessary node N13 that is not used for generating another path condition.

(35)次に、生成装置100は、番地「17」の分岐命令に、未実行の分岐条件があるか否かを判定する。(36)ここで、生成装置100は、ノードN12に分岐命令が偽になる分岐条件を実行したことを示す「偽」が含まれていないため、未実行の分岐条件があると判断する。そのため、生成装置100は、シンボル変数「b」に関する分岐命令「if(b<10)」が偽になる未実行の分岐条件「b≧10」を実行して、対象プログラムTPを18番地から再開する。ここで、生成装置100は、分岐命令が偽になる分岐条件を実行したことを示す「偽」を、ノードN12に追加する。   (35) Next, the generating apparatus 100 determines whether or not the branch instruction at the address “17” has an unexecuted branch condition. (36) Here, the generation apparatus 100 determines that there is an unexecuted branch condition because the node N12 does not include “false” indicating that the branch condition for which the branch instruction is false is executed. Therefore, the generation apparatus 100 executes the unexecuted branch condition “b ≧ 10” in which the branch instruction “if (b <10)” regarding the symbol variable “b” is false, and resumes the target program TP from the 18th address. To do. Here, the generation apparatus 100 adds “false” to the node N12 indicating that the branch condition that makes the branch instruction false is executed.

次に、生成装置100は、20番地まで到達する。生成装置100は、20番地において、関数「int funcB(int b)」が終了したことを検出する。そして、生成装置100は、関数「int funcB(int b)」が終了すると、呼び出し元の関数「int main()」に戻る。ここで、生成装置100は、コールスタックの先頭に格納された関数「int funcB(int b)」を削除する。そのため、コールスタックは、関数「int main()」が格納された状態になる。   Next, the generating apparatus 100 reaches 20 addresses. The generation apparatus 100 detects that the function “int funcB (int b)” has ended at the 20th address. When the function “int funcB (int b)” ends, the generating apparatus 100 returns to the caller function “int main ()”. Here, the generation device 100 deletes the function “int funcB (int b)” stored at the top of the call stack. Therefore, the call stack is in a state where the function “int main ()” is stored.

(37)次に、生成装置100は、呼び出し元の関数「int main()」に戻ると、7番地から実行を開始し、8番地に到達する。(38)そして、生成装置100は、対象プログラムTPの8番地において、対象プログラムTPの実行の終了を検出すると、対象プログラムTPの実行の終了に対応するノードN14を生成する。   (37) Next, when the generation apparatus 100 returns to the caller function “int main ()”, the generation apparatus 100 starts execution from the 7th address and reaches the 8th address. (38) When the generation apparatus 100 detects the end of execution of the target program TP at the address 8 of the target program TP, the generation apparatus 100 generates a node N14 corresponding to the end of execution of the target program TP.

ノードN14は、対象プログラムTPが終了した番地を示すプログラムカウンタ「8」、当該分岐命令に到達した場合の変数の値「a=*,b=*,n=0」、8番地までに実行された一連の分岐条件「(a<0)&&!(b<10)」を含む。また、ノードN14は、実行カウンタ「1」、および、当該分岐命令に到達するまでに呼び出された関数の履歴を示すスタック3を含む。   The node N14 is executed by the program counter “8” indicating the address at which the target program TP ends, the variable values “a = *, b = *, n = 0” when the branch instruction is reached, and the eight addresses. A series of branch conditions “(a <0) &&! (B <10)” are included. The node N14 includes an execution counter “1” and a stack 3 indicating a history of functions called up to the branch instruction.

8番地までに実行された一連の分岐条件「(a<0)&&(b<10)」は、ノードN12が示す一連の分岐条件「a<0」と、実行された分岐条件が「偽」であることと、を参照して生成される。ここで、生成装置100は、生成したノードN14が示す一連の分岐条件「(a<0)&&!(b<10)」をパス条件PC12として保持しておく。次に、生成装置100は、図8の(39)に移行する。   A series of branch conditions “(a <0) && (b <10)” executed up to the 8th address is a series of branch conditions “a <0” indicated by the node N12, and the executed branch condition is “false”. It is generated with reference to. Here, the generation apparatus 100 holds a series of branch conditions “(a <0) &&! (B <10)” indicated by the generated node N14 as the path condition PC12. Next, the generating apparatus 100 proceeds to (39) of FIG.

図8において、(39)生成装置100は、対象プログラムTPが終了すると、ノードN14の親になるノードN12が示す分岐命令の番地「17」まで戻る。(40)生成装置100は、ノードN12が示す分岐命令の番地「17」に戻ると、他のパス条件の生成に用いない不要なノードN14を削除する。   8, (39) when the target program TP ends, the generating apparatus 100 returns to the branch instruction address “17” indicated by the node N12 that is the parent of the node N14. (40) When the generating apparatus 100 returns to the branch instruction address “17” indicated by the node N12, the generating apparatus 100 deletes the unnecessary node N14 that is not used for generating another path condition.

(41)そして、生成装置100は、番地「17」の分岐命令に、未実行の分岐条件があるか否かを判定する。(42)ここで、生成装置100は、ノードN12に「真」と「偽」が含まれているため、未実行の分岐条件がないと判断する。そのため、生成装置100は、さらに、ノードN12の親になるノードN11が示す分岐命令の番地「22」まで戻る。(43)生成装置100は、ノードN11が示す分岐命令の番地「22」に戻ると、他のパス条件の生成に用いない不要なノードN12を削除する。次に、生成装置100は、図9の(44)に移行する。   (41) Then, the generation apparatus 100 determines whether or not the branch instruction at the address “17” has an unexecuted branch condition. (42) Here, the generation device 100 determines that there is no unexecuted branch condition because the node N12 includes “true” and “false”. Therefore, the generation apparatus 100 further returns to the branch instruction address “22” indicated by the node N11 that is the parent of the node N12. (43) When returning to the branch instruction address “22” indicated by the node N11, the generating apparatus 100 deletes the unnecessary node N12 that is not used for generating another path condition. Next, the generating apparatus 100 proceeds to (44) of FIG.

図9において、(44)生成装置100は、番地「22」の分岐命令に、未実行の分岐条件があるか否かを判定する。(45)ここで、生成装置100は、ノードN11に分岐命令が偽になる分岐条件を実行したことを示す「偽」が含まれていないため、未実行の分岐条件があると判断する。そのため、生成装置100は、シンボル変数「a」に関する分岐命令「if(x<0)」が偽になる未実行の分岐条件「x≧0」を実行して、対象プログラムTPを23番地から再開する。   In FIG. 9, (44) the generation apparatus 100 determines whether or not the branch instruction at the address “22” has an unexecuted branch condition. (45) Here, the generation apparatus 100 determines that there is an unexecuted branch condition because the node N11 does not include “false” indicating that the branch condition for which the branch instruction is false is executed. Therefore, the generation apparatus 100 executes the unexecuted branch condition “x ≧ 0” in which the branch instruction “if (x <0)” regarding the symbol variable “a” is false, and resumes the target program TP from the 23rd address. To do.

生成装置100は、24番地に到達する。生成装置100は、24番地において、関数「int abs(int x)」が終了したことを検出する。そして、生成装置100は、関数「int abs(int x)」が終了すると、呼び出し元の関数「int funcA(int a)」に戻る。ここで、生成装置100は、コールスタックの先頭に格納された関数「int abs(int x)」を削除する。そのため、コールスタックは、先頭から順に、関数「int funcA(int a)」、関数「int main()」が格納された状態になる。   The generation apparatus 100 reaches address 24. The generation apparatus 100 detects that the function “int abs (int x)” is completed at the 24th address. Then, when the function “int abs (int x)” ends, the generation apparatus 100 returns to the caller function “int func (int a)”. Here, the generation device 100 deletes the function “int abs (int x)” stored at the top of the call stack. For this reason, the function “int funcA (int a)” and the function “int main ()” are stored in order from the top of the call stack.

(46)次に、生成装置100は、呼び出し元の関数「int funcA(int a)」に戻ると、11番地から実行を開始し、14番地に到達する。生成装置100は、14番地において、関数「int funcA(int a)」が終了したことを検出する。そして、生成装置100は、関数「int funcA(int a)」が終了すると、呼び出し元の関数「int main()」に戻る。ここで、生成装置100は、コールスタックの先頭に格納された関数「int funcA(int a)」を削除する。そのため、コールスタックは、関数「int main()」が格納された状態になる。   (46) Next, when returning to the caller function “int funcA (int a)”, the generation device 100 starts execution from the 11th address and reaches the 14th address. The generation apparatus 100 detects that the function “int funcA (int a)” has ended at the 14th address. When the function “int funcA (int a)” ends, the generation apparatus 100 returns to the caller function “int main ()”. Here, the generation device 100 deletes the function “int funcA (int a)” stored at the top of the call stack. Therefore, the call stack is in a state where the function “int main ()” is stored.

(47)次に、生成装置100は、呼び出し元の関数「int main()」に戻ると、6番地から実行を開始する。生成装置100は、6番地において、15番地〜20番地が示す関数「int funcB(int b)」を呼び出す。ここで、生成装置100は、コールスタックに、呼び出した関数「int funcB(int b)」を格納する。そのため、コールスタックは、先頭から順に、関数「int funcB(int b)」、および関数「int main()」が格納された状態になる。   (47) Next, when returning to the caller function “int main ()”, the generating apparatus 100 starts execution from the sixth address. The generation apparatus 100 calls the function “int funcB (int b)” indicated by the addresses 15 to 20 at the address 6. Here, the generation device 100 stores the called function “int funcB (int b)” in the call stack. Therefore, the function “int funcB (int b)” and the function “int main ()” are stored in order from the top of the call stack.

(48)そして、生成装置100は、呼び出された関数「int funcB(int b)」の15番地から実行を開始し、17番地に到達する。(49)生成装置100は、17番地において、シンボル変数「b」に関する分岐命令「if(b<10)」が真になる未実行の分岐条件「b<10」を実行すると、当該分岐命令に対応するノードN15を生成する。   (48) Then, the generation apparatus 100 starts execution from the 15th address of the called function “int funcB (int b)” and reaches 17th address. (49) The generation apparatus 100 executes an unexecuted branch condition “b <10” in which the branch instruction “if (b <10)” regarding the symbol variable “b” is true at the address 17, and the branch instruction is A corresponding node N15 is generated.

ノードN15は、当該分岐命令の番地を示すプログラムカウンタ「17」、当該分岐命令に到達した場合の変数の値「b=*,n=0」、17番地までに実行された一連の分岐条件「!(a<0)」、および、当該分岐命令が真になる分岐条件を実行したことを示す「真」を含む。また、ノードN15は、実行カウンタ「1」、および、当該分岐命令に到達するまでに呼び出された関数の履歴を示すスタック2を含む。   The node N15 has a program counter “17” indicating the address of the branch instruction, variable values “b = *, n = 0” when the branch instruction is reached, and a series of branch conditions “ (A <0) ”and“ true ”indicating that the branch condition for which the branch instruction is true has been executed. Further, the node N15 includes an execution counter “1” and a stack 2 indicating a history of functions called up to the branch instruction.

17番地までに実行された一連の分岐条件「!(a<0)&&(b<10)」は、ノードN11が示す一連の分岐条件「True」と、実行された分岐条件が「偽」であることと、を参照して生成される。スタック2は、当該分岐命令に到達した場合のコールスタックの内容である。スタック2は、例えば、関数「int funcB(int b)」と、関数「int main()」と、を含む。次に、生成装置100は、図10の(50)に移行する。   A series of branch conditions “! (A <0) && (b <10)” executed up to the 17th address are a series of branch conditions “True” indicated by the node N11 and the executed branch condition is “false”. It is generated with reference to what. The stack 2 is the contents of the call stack when the branch instruction is reached. The stack 2 includes, for example, a function “int funcB (int b)” and a function “int main ()”. Next, the generating apparatus 100 proceeds to (50) of FIG.

図10において、(50)生成装置100は、対象プログラムTPを18番地から再開し、20番地に到達する。生成装置100は、20番地において、関数「int funcB(int b)」が終了したことを検出する。そして、生成装置100は、関数「int funcB(int b)」が終了すると、呼び出し元の関数「int main()」に戻る。ここで、生成装置100は、コールスタックの先頭に格納された関数「int funcB(int b)」を削除する。そのため、コールスタックは、関数「int main()」が格納された状態になる。   In FIG. 10, (50) the generation apparatus 100 restarts the target program TP from the 18th address and reaches the 20th address. The generation apparatus 100 detects that the function “int funcB (int b)” has ended at the 20th address. When the function “int funcB (int b)” ends, the generating apparatus 100 returns to the caller function “int main ()”. Here, the generation device 100 deletes the function “int funcB (int b)” stored at the top of the call stack. Therefore, the call stack is in a state where the function “int main ()” is stored.

(51)次に、生成装置100は、呼び出し元の関数「int main()」に戻ると、7番地から実行を開始し、8番地に到達する。(52)そして、生成装置100は、対象プログラムTPの8番地において、対象プログラムTPの実行の終了を検出すると、対象プログラムTPの実行の終了に対応するノードN16を生成する。   (51) Next, when returning to the caller function “int main ()”, the generation apparatus 100 starts execution from the 7th address and reaches the 8th address. (52) When the generation apparatus 100 detects the end of execution of the target program TP at the address 8 of the target program TP, the generation apparatus 100 generates a node N16 corresponding to the end of execution of the target program TP.

ノードN16は、対象プログラムTPが終了した番地を示すプログラムカウンタ「8」、当該分岐命令に到達した場合の変数の値「a=*,b=*,n=1」、8番地までに実行された一連の分岐条件「!(a<0)&&(b<10)」、および、当該分岐命令が真になる分岐条件を実行したことを示す「真」を含む。また、ノードN16は、実行カウンタ「1」、および、当該分岐命令に到達するまでに呼び出された関数の履歴を示すスタック3を含む。   The node N16 is executed by the program counter “8” indicating the address at which the target program TP ends, the variable values “a = *, b = *, n = 1” when the branch instruction is reached, and the eighth address. And a series of branch conditions “! (A <0) && (b <10)” and “true” indicating that the branch condition for which the branch instruction is true has been executed. The node N16 includes an execution counter “1” and a stack 3 indicating a history of functions called up to the branch instruction.

8番地までに実行された一連の分岐条件「!(a<0)&&(b<10)」は、ノードN15が示す一連の分岐条件「!(a<0)」と、実行された分岐条件が「真」であることと、を参照して生成される。スタック3は、対象プログラムTPが終了した場合のコールスタックの内容である。スタック3は、例えば、関数「int main()」を含む。ここで、生成装置100は、生成したノードN16が示す一連の分岐条件「!(a<0)&&(b<10)」をパス条件PC13として保持しておく。次に、生成装置100は、図11の(53)に移行する。   A series of branch conditions “! (A <0) && (b <10)” executed up to address 8 are a series of branch conditions “! (A <0)” indicated by the node N15 and executed branch conditions. Is generated with reference to “true”. The stack 3 is the contents of the call stack when the target program TP ends. The stack 3 includes, for example, a function “int main ()”. Here, the generation device 100 holds a series of branch conditions “! (A <0) && (b <10)” indicated by the generated node N16 as the path condition PC13. Next, the generating apparatus 100 proceeds to (53) in FIG.

図11において、(53)生成装置100は、対象プログラムTPが終了すると、ノードN16の親になるノードN15が示す分岐命令の番地「17」まで戻る。(54)生成装置100は、ノードN15が示す分岐命令の番地「17」に戻ると、他のパス条件の生成に用いない不要なノードN16を削除する。   In FIG. 11, (53) when the target program TP ends, the generating apparatus 100 returns to the branch instruction address “17” indicated by the node N15 that is the parent of the node N16. (54) When the generating apparatus 100 returns to the branch instruction address “17” indicated by the node N15, the generating apparatus 100 deletes the unnecessary node N16 that is not used for generating another path condition.

(55)次に、生成装置100は、番地「17」の分岐命令に、未実行の分岐条件があるか否かを判定する。(56)ここで、生成装置100は、ノードN15に分岐命令が偽になる分岐条件を実行したことを示す「偽」が含まれていないため、未実行の分岐条件があると判断する。そのため、生成装置100は、シンボル変数「b」に関する分岐命令「if(b<10)」が偽になる未実行の分岐条件「b≧10」を実行して、対象プログラムTPを18番地から再開する。ここで、生成装置100は、分岐命令が偽になる分岐条件を実行したことを示す「偽」を、ノードN15に追加する。   (55) Next, the generation device 100 determines whether or not the branch instruction at the address “17” has an unexecuted branch condition. (56) Here, the generation apparatus 100 determines that there is an unexecuted branch condition because the node N15 does not include “false” indicating that the branch condition for which the branch instruction is false is executed. Therefore, the generation apparatus 100 executes the unexecuted branch condition “b ≧ 10” in which the branch instruction “if (b <10)” regarding the symbol variable “b” is false, and resumes the target program TP from the 18th address. To do. Here, the generation apparatus 100 adds “false” to the node N15 indicating that the branch condition for which the branch instruction is false is executed.

次に、生成装置100は、20番地まで到達する。生成装置100は、20番地において、関数「int funcB(int b)」が終了したことを検出する。そして、生成装置100は、関数「int funcB(int b)」が終了すると、呼び出し元の関数「int main()」に戻る。ここで、生成装置100は、コールスタックの先頭に格納された関数「int funcB(int b)」を削除する。そのため、コールスタックは、関数「int main()」が格納された状態になる。   Next, the generating apparatus 100 reaches 20 addresses. The generation apparatus 100 detects that the function “int funcB (int b)” has ended at the 20th address. When the function “int funcB (int b)” ends, the generating apparatus 100 returns to the caller function “int main ()”. Here, the generation device 100 deletes the function “int funcB (int b)” stored at the top of the call stack. Therefore, the call stack is in a state where the function “int main ()” is stored.

(57)次に、生成装置100は、呼び出し元の関数「int main()」に戻ると、7番地から実行を開始し、8番地に到達する。(58)そして、生成装置100は、対象プログラムTPの8番地において、対象プログラムTPの実行の終了を検出すると、対象プログラムTPの実行の終了に対応するノードN17を生成する。   (57) Next, when returning to the caller function “int main ()”, the generation apparatus 100 starts execution from the 7th address and reaches the 8th address. (58) When the generation apparatus 100 detects the end of execution of the target program TP at the address 8 of the target program TP, the generation apparatus 100 generates a node N17 corresponding to the end of execution of the target program TP.

ノードN17は、対象プログラムTPが終了した番地を示すプログラムカウンタ「8」、当該分岐命令に到達した場合の変数の値「a=*,b=*,n=0」、8番地までに実行された一連の分岐条件「!(a<0)&&!(b<10)」、および、当該分岐命令が真になる分岐条件を実行したことを示す「真」を含む。また、ノードN17は、実行カウンタ「1」、および、当該分岐命令に到達するまでに呼び出された関数の履歴を示すスタック3を含む。   The node N17 is executed by the program counter “8” indicating the address at which the target program TP ends, the variable values “a = *, b = *, n = 0” when the branch instruction is reached, and the eighth address. And a series of branch conditions “! (A <0) &&! (B <10)” and “true” indicating that a branch condition for which the branch instruction is true has been executed. The node N17 includes an execution counter “1” and a stack 3 indicating a history of functions called up to the branch instruction.

8番地までに実行された一連の分岐条件「!(a<0)&&!(b<10)」は、ノードN15が示す一連の分岐条件「!(a<0)」と、実行された分岐条件が「偽」であることと、を参照して生成される。ここで、生成装置100は、生成したノードN17が示す分岐条件「!(a<0)&&!(b<10)」をパス条件PC14として保持しておく。   A series of branch conditions “! (A <0) &&! (B <10)” executed up to address 8 are a series of branch conditions “! (A <0)” indicated by the node N15 and executed branches. The condition is generated with reference to “false”. Here, the generation apparatus 100 holds the branch condition “! (A <0) &&! (B <10)” indicated by the generated node N17 as the path condition PC14.

これにより、生成装置100は、記憶領域の使用量増加を抑制した上で、対象プログラムTPの各々の実行経路に対応するパス条件PC11〜PC14を生成することができる。例えば、2分木のノードNのすべてを保持する場合の記憶領域の使用量に比べて、記憶領域の使用量をn/(2^n−1)に減少させることができる。nは2分木の分岐の数を示す。^は累乗を示す。   Thereby, the generation apparatus 100 can generate the path conditions PC11 to PC14 corresponding to the execution paths of the target program TP while suppressing an increase in the usage amount of the storage area. For example, the usage amount of the storage area can be reduced to n / (2 ^ n-1) as compared to the usage amount of the storage area when all the nodes N of the binary tree are held. n indicates the number of branches of the binary tree. ^ Indicates a power.

また、生成装置100は、生成されたパス条件PC11〜PC14から、対象プログラムTPの動作確認のためのテストデータの対象プログラムTPに対する網羅性を算出し、算出結果を出力してもよい。網羅性とは、テストデータが、対象プログラムTPについて実行可能な実行経路をどの程度網羅しているかを示す割合である。   The generation apparatus 100 may calculate the completeness of the test data for confirming the operation of the target program TP with respect to the target program TP from the generated path conditions PC11 to PC14, and output the calculation result. The completeness is a ratio indicating how much the test data covers the execution paths executable for the target program TP.

これにより、生成装置100の利用者は、テストデータの対象プログラムTPに対する網羅性が100%に満たない場合、対象プログラムTPの実行経路の各々を100%網羅して動作確認ができるように、テストデータを追加することができる。また、生成装置100の利用者は、テストデータの対象プログラムTPに対する網羅性が100%である場合、テストデータから不要なデータを削除し、対象プログラムTPの動作確認の効率化を図ってもよい。   As a result, when the user of the generation apparatus 100 has less than 100% coverage of the test program with respect to the target program TP, the test can be performed so that each of the execution paths of the target program TP can be checked with 100% coverage. Data can be added. In addition, when the coverage of the test data with respect to the target program TP is 100%, the user of the generation apparatus 100 may delete unnecessary data from the test data to improve the efficiency of the operation check of the target program TP. .

(実行回数が閾値以上になったことを検出する具体例)
次に、図12を用いて、実行回数が閾値以上になったことを検出する具体例について説明する。
(Specific example of detecting that the number of executions has exceeded the threshold)
Next, a specific example of detecting that the number of executions is equal to or greater than a threshold will be described with reference to FIG.

図12は、実行回数が閾値以上になったことを検出する具体例を示す説明図である。閾値は、例えば、予め、生成装置100の利用者によって設定されている。図12の例では、閾値は「8」とする。図12において、(61)まず、生成装置100は、対象プログラムTPの1番地〜8番地が示す関数「int main()」の実行を開始する。ここで、生成装置100は、コールスタックに、実行された関数「int main()」を格納する。そのため、コールスタックは、関数「int main()」が格納された状態になる。   FIG. 12 is an explanatory diagram illustrating a specific example of detecting that the number of executions is equal to or greater than a threshold value. The threshold is set in advance by the user of the generation apparatus 100, for example. In the example of FIG. 12, the threshold value is “8”. In FIG. 12, (61) First, the generation apparatus 100 starts executing the function “int main ()” indicated by addresses 1 to 8 of the target program TP. Here, the generation device 100 stores the executed function “int main ()” in the call stack. Therefore, the call stack is in a state where the function “int main ()” is stored.

そして、生成装置100は、関数「int main()」を1番地から実行し、4番地に到達する。生成装置100は、4番地において、6番地〜13番地が示す関数「int CountBit(x)」を呼び出す。ここで、生成装置100は、コールスタックに、呼び出した関数「int CountBit(x)」を格納する。そのため、コールスタックは、先頭から順に、関数「int CountBit(x)」、関数「int main()」が格納された状態になる。   Then, the generation apparatus 100 executes the function “int main ()” from the first address and reaches the fourth address. The generation apparatus 100 calls the function “int CountBit (x)” indicated by the addresses 6 to 13 at the address 4. Here, the generation device 100 stores the called function “int CountBit (x)” in the call stack. Therefore, the function “int CountBit (x)” and the function “int main ()” are stored in the call stack in order from the top.

(62)次に、生成装置100は、呼び出された関数「int CountBit(x)」の6番地から実行を開始し、8番地においてfor文のループの条件が真であるため、for文の中の命令を実行し、9番地に到達する。   (62) Next, the generation apparatus 100 starts execution from the 6th address of the called function “int CountBit (x)”, and the for statement loop condition is true at the 8th address. Is executed, and address 9 is reached.

(63)生成装置100は、9番地において、シンボル変数「x」に関する分岐命令「if(((x>>1)&1)!=0)」が真になる分岐条件「(x>>1)&1)!=0」を実行すると、当該分岐命令に対応するノードN21を生成する。ノードN21は、当該分岐命令の番地を示すプログラムカウンタ「9」、当該分岐命令に到達した場合の変数の値「x=*」、9番地までに実行された一連の分岐条件「True」、当該分岐命令が真になる分岐条件を実行したことを示す「真」を含む。また、ノードN21は、当該分岐命令に到達するまでに呼び出された関数の履歴を示すスタック1、当該分岐命令が呼び出された回数を示す実行カウンタ「1」を含む。スタック1は、呼び出された関数の履歴であり、関数「int CountBit(x)」と、関数「int main()」と、を含む。   (63) The generation device 100 sets the branch condition “(x >> 1) at which the branch instruction“ if (((x >> 1) & 1)! = 0) ”regarding the symbol variable“ x ”becomes true at the address 9. & 1)! = 0 ”generates a node N21 corresponding to the branch instruction. The node N21 includes a program counter “9” indicating the address of the branch instruction, a variable value “x = *” when the branch instruction is reached, a series of branch conditions “True” executed up to the address 9, It includes “true” indicating that the branch condition for which the branch instruction is true is executed. The node N21 includes a stack 1 indicating a history of functions called up to the branch instruction and an execution counter “1” indicating the number of times the branch instruction is called. The stack 1 is a history of called functions, and includes a function “int CountBit (x)” and a function “int main ()”.

(64)次に、生成装置100は、対象プログラムTPを10番地から再開し、11番地に到達する。生成装置100は、11番地において、for文が終了したため、8番地に戻る。(65)次に、生成装置100は、8番地においてfor文のループの条件が真であるため、for文の中の命令を実行し、9番地に到達する。(66)生成装置100は、9番地において、シンボル変数「x」に関する分岐命令「if(((x>>2)&1)!=0)」が真になる分岐条件「((x>>2)&1)!=0)」を実行すると、当該分岐命令に対応するノードN22を生成する。   (64) Next, the generating apparatus 100 resumes the target program TP from the 10th address and reaches the 11th address. The generation apparatus 100 returns to the 8th address because the for sentence is completed at the 11th address. (65) Next, since the for statement loop condition is true at address 8, the generation apparatus 100 executes the instruction in the for statement and reaches address 9. (66) The generation device 100 generates a branch condition “((x >> 2) at which the branch instruction“ if (((x >> 2) & 1)! = 0) ”related to the symbol variable“ x ”becomes true at address 9. ) & 1)! = 0) ”, a node N22 corresponding to the branch instruction is generated.

ノードN22は、当該分岐命令の番地を示すプログラムカウンタ「9」、当該分岐命令に到達した場合の変数の値「x=*」、9番地までに実行された一連の分岐条件「(x>>1)&1)!=0」、当該分岐命令が真になる分岐条件を実行したことを示す「真」を含む。また、ノードN22は、当該分岐命令に到達するまでに呼び出された関数の履歴を示すスタック1、当該分岐命令が呼び出された回数を示す実行カウンタ「2」を含む。9番地までに実行された一連の分岐条件「(x>>1)&1)!=0」は、ノードN21が示す一連の分岐条件「True」と、実行された分岐条件が「真」であることと、を参照して生成される。   The node N22 has a program counter “9” indicating the address of the branch instruction, a variable value “x = *” when the branch instruction is reached, and a series of branch conditions “(x >>) executed up to the ninth address. 1) & 1)! = 0 ”, including“ true ”indicating that the branch condition for which the branch instruction is true has been executed. The node N22 includes a stack 1 indicating a history of functions called up to the branch instruction, and an execution counter “2” indicating the number of times the branch instruction is called. A series of branch conditions “(x >> 1) & 1)! = 0” executed up to address 9 is a series of branch conditions “True” indicated by the node N21 and the executed branch condition is “true”. It is generated with reference to that.

実行カウンタには、ノードN22とノードN22の親になるノードN21とが示すスタックとプログラムカウンタが一致する場合、ノードN21が示す回数に1を加算した加算後の回数が採用される。また、実行カウンタには、ノードN22とノードN22の親になるノードN21とが示すスタックまたはプログラムカウンタのいずれかが一致しない場合、1が採用される。そのため、ノードN22が示す実行カウンタは、ノードN21が示す実行カウンタに1を加算した加算後の回数「2」になっている。   When the stack indicated by the node N22 and the node N21 that is the parent of the node N22 matches the program counter, the number of times after addition obtained by adding 1 to the number indicated by the node N21 is adopted as the execution counter. The execution counter is 1 when either the stack or the program counter indicated by the node N22 and the node N21 that is the parent of the node N22 does not match. Therefore, the execution counter indicated by the node N22 is “2” after the addition of adding 1 to the execution counter indicated by the node N21.

以降において、生成装置100は、(64)〜(66)と同様にして、9番地の分岐命令を実行するごとに、ノードNを生成する。ここで、生成装置100は、7回目の分岐命令を実行し、ノードNを生成したとする。   Thereafter, the generation apparatus 100 generates a node N every time the branch instruction at address 9 is executed in the same manner as (64) to (66). Here, it is assumed that the generation apparatus 100 executes the seventh branch instruction and generates a node N.

(67)生成装置100は、対象プログラムTPを10番地から再開し、11番地に到達する。生成装置100は、11番地において、for文が終了したため、8番地に戻る。(68)次に、生成装置100は、8番地においてfor文のループの条件が真であるため、for文の中の命令を実行し、9番地に到達する。(69)生成装置100は、9番地において、シンボル変数「x」に関する分岐命令「if(((x>>8)&1)!=0)」が真になる分岐条件「((x>>8)&1)!=0)」を実行すると、当該分岐命令に対応するノードN28を生成する。   (67) The generation device 100 resumes the target program TP from the 10th address and reaches the 11th address. The generation apparatus 100 returns to the 8th address because the for sentence is completed at the 11th address. (68) Next, the generating apparatus 100 executes the instruction in the for statement because the for statement loop condition is true at the 8th address, and reaches the 9th address. (69) The generation device 100 generates a branch condition “((x >> 8) where the branch instruction“ if (((x >> 8) & 1)! = 0) ”” regarding the symbol variable “x” is true at address 9. ) & 1)! = 0) ”, the node N28 corresponding to the branch instruction is generated.

ノードN28は、当該分岐命令の番地を示すプログラムカウンタ「9」、当該分岐命令に到達した場合の変数の値「x=*」、9番地までに実行された一連の分岐条件「((x>>1)&1)!=0)&&((x>>2)&1)!=0)&&・・・&&((x>>7)&1)!=0)」、当該分岐命令が真になる分岐条件を実行したことを示す「真」を含む。また、ノードN28は、当該分岐命令に到達するまでに呼び出された関数の履歴を示すスタック1と、実行カウンタ「8」を含む。   The node N28 has a program counter “9” indicating the address of the branch instruction, a variable value “x = *” when the branch instruction is reached, and a series of branch conditions “((x> > 1) & 1)! = 0) && ((x >> 2) & 1)! = 0) && ... && ((x >> 7) & 1)! = 0) ", the branch instruction becomes true Contains "true" indicating that the branch condition has been executed. Further, the node N28 includes a stack 1 indicating a history of functions called up to the branch instruction and an execution counter “8”.

9番地までに実行された一連の分岐条件「((x>>1)&1)!=0)&&((x>>2)&1)!=0)&&・・・&&((x>>7)&1)!=0)」は、ノード28の親になるノードN27(不図示)が示す一連の分岐条件と、実行された分岐条件が真であることと、を参照して生成される。また、ノードN28が示す実行カウンタは、ノードN27(不図示)が示す実行カウンタに1を加算した加算後の回数「8」になっている。   A series of branch conditions executed up to address 9 "((x >> 1) & 1)! = 0) && ((x >> 2) & 1)! = 0) && ... && ((x >> 7 ) & 1)! = 0) ”is generated with reference to a series of branch conditions indicated by the node N27 (not shown) that is the parent of the node 28 and that the executed branch condition is true. Further, the execution counter indicated by the node N28 is “8” after the addition of adding 1 to the execution counter indicated by the node N27 (not shown).

(70)ここで、生成装置100は、実行カウンタ「8」が閾値以上であるため、9番地の分岐命令の実行回数が閾値以上になったと判断する。そして、生成装置100は、9番地の分岐命令の実行回数が閾値以上である旨を示す情報を出力する。   (70) Here, since the execution counter “8” is equal to or greater than the threshold, the generation apparatus 100 determines that the number of executions of the branch instruction at address 9 is equal to or greater than the threshold. Then, the generation apparatus 100 outputs information indicating that the number of executions of the branch instruction at address 9 is equal to or greater than a threshold value.

これにより、生成装置100は、生成装置100の利用者に、閾値以上連続して実行された分岐命令の対象プログラムTPにおける番地を通知することができる。生成装置100の利用者は、対象プログラムTPに、シンボル変数に関する分岐命令が連続して実行されている部分があると判断できる。例えば、分岐命令が連続して実行されている部分とは、for文の中に分岐命令が含まれる場合である。   Thereby, the generation device 100 can notify the user of the generation device 100 of the address in the target program TP of the branch instruction that has been continuously executed for the threshold value or more. The user of the generation apparatus 100 can determine that the target program TP includes a portion in which branch instructions related to symbol variables are continuously executed. For example, the part where the branch instructions are continuously executed is a case where the branch instruction is included in the for statement.

そして、生成装置100の利用者は、通知された番地の分岐命令をシンボル変数ではない通常の変数に関する分岐命令に変更したり、シンボル変数の取り得る値の範囲を狭めたりすることができる。ここで、生成装置100の利用者は、番地が通知されているため、当該分岐命令を対象プログラムTPの中から特定する手間を省くことができる。これにより、生成装置100の利用者は、対象プログラムTPのパス条件に不要なパス条件が入らないように対象プログラムTPに変更を加え、対象プログラムTPのパス条件の生成の効率化を図ることができる。   The user of the generation device 100 can change the branch instruction at the notified address to a branch instruction related to a normal variable that is not a symbol variable, or can narrow the range of values that the symbol variable can take. Here, since the user is notified of the address, the user of the generating apparatus 100 can save the trouble of specifying the branch instruction from the target program TP. Accordingly, the user of the generation apparatus 100 can change the target program TP so that unnecessary path conditions are not included in the path conditions of the target program TP, thereby improving the efficiency of generation of the path conditions of the target program TP. it can.

また、生成装置100は、9番地の分岐命令の実行回数が閾値以上である旨を示す情報を出力済みであることを示す警告済み判定フラグを保持していてもよい。そして、生成装置100は、実行カウンタが「8」の場合に実行回数が閾値以上である旨を示す情報を出力した後、警告済み判定フラグを真に設定する。   The generation apparatus 100 may also hold a warning determination flag indicating that information indicating that the number of executions of the branch instruction at address 9 is equal to or greater than a threshold has been output. Then, when the execution counter is “8”, the generation apparatus 100 outputs information indicating that the number of executions is equal to or greater than the threshold, and then sets the warning determination flag to true.

その後、生成装置100は、9番地の分岐命令に関する実行カウンタが「9」の場合でも、警告済み判定フラグが真のため、実行回数が閾値以上である旨を示す情報を出力しない。また、生成装置100は、別の実行経路において、9番地の分岐命令に関する実行カウンタが閾値以上の場合でも、警告済み判定フラグが真のため、実行回数が閾値以上である旨を示す情報を出力しない。   Thereafter, even when the execution counter for the branch instruction at address 9 is “9”, the generation apparatus 100 does not output information indicating that the number of executions is equal to or greater than the threshold because the warning determination flag is true. Further, the generation apparatus 100 outputs information indicating that the number of executions is equal to or greater than the threshold because the warning determination flag is true even when the execution counter for the branch instruction at address 9 is equal to or greater than the threshold in another execution path. do not do.

そのため、生成装置100は、同一の分岐命令について、実行回数が閾値以上である旨を示す情報を1回出力した後、2回目以降は出力しない。これにより、生成装置100の利用者は、出力された数から、直感的に何ヶ所の分岐命令の実行回数が閾値以上であるかを把握することができる。   Therefore, after generating information indicating that the number of executions is equal to or greater than the threshold value for the same branch instruction once, the generation apparatus 100 does not output the second and subsequent times. Thereby, the user of the generation apparatus 100 can intuitively know how many branch instructions are executed more than the threshold from the output number.

(パス条件生成処理)
図13および図14は、パス条件生成処理の詳細な処理手順を示すフローチャートである。まず、生成装置100は、対象プログラムTPと、分岐命令の実行回数の上限を規定する閾値と、の入力があったか否かを判定する(ステップS1301)。ここで、入力がない場合(ステップS1301:No)、生成装置100は、ステップS1301に戻り、入力を待つ。
(Path condition generation process)
13 and 14 are flowcharts showing the detailed processing procedure of the path condition generation processing. First, the generating apparatus 100 determines whether or not there is an input of the target program TP and a threshold value that defines the upper limit of the number of executions of branch instructions (step S1301). Here, when there is no input (step S1301: No), the production | generation apparatus 100 returns to step S1301, and waits for an input.

一方、入力があった場合(ステップS1301:Yes)、生成装置100は、入力された対象プログラムTPから1命令を読み出す(ステップS1302)。次に、生成装置100は、読み出した命令がシンボル変数に関する命令か否かを判定する(ステップS1303)。ここで、シンボル変数に関する命令である場合(ステップS1303:Yes)、生成装置100は、図14のステップS1401に移行する。   On the other hand, when there is an input (step S1301: Yes), the generation device 100 reads one command from the input target program TP (step S1302). Next, the generating apparatus 100 determines whether or not the read instruction is an instruction related to a symbol variable (step S1303). Here, when the command is a symbol variable instruction (step S1303: Yes), the generating apparatus 100 proceeds to step S1401 in FIG.

一方、シンボル変数に関する命令ではない場合(ステップS1303:No)、生成装置100は、対象プログラムTPの次の命令を読み出し対象に設定する(ステップS1304)。次に、生成装置100は、対象プログラムTPが終了したか否かを判定する(ステップS1305)。ここで、終了していない場合(ステップS1305:No)、生成装置100は、ステップS1302に戻る。   On the other hand, if the instruction is not related to a symbol variable (step S1303: No), the generating apparatus 100 sets the next instruction of the target program TP as a read target (step S1304). Next, the generating apparatus 100 determines whether or not the target program TP has ended (step S1305). Here, when not complete | finishing (step S1305: No), the production | generation apparatus 100 returns to step S1302.

一方、対象プログラムTPが終了した場合(ステップS1305:Yes)、生成装置100は、パス条件を記憶する(ステップS1306)。次に、生成装置100は、親のノードNが存在するか否かを判定する(ステップS1307)。ここで、親のノードNが存在しない場合(ステップS1307:No)、生成装置100は、パス条件生成処理を終了する。   On the other hand, when the target program TP ends (step S1305: Yes), the generation device 100 stores the path condition (step S1306). Next, the generating apparatus 100 determines whether or not a parent node N exists (step S1307). If the parent node N does not exist (step S1307: No), the generation device 100 ends the path condition generation process.

一方、親のノードNが存在する場合(ステップS1307:Yes)、生成装置100は、親のノードNまで戻る(ステップS1308)。次に、生成装置100は、偽のパスが実行済みか否かを判定する(ステップS1309)。ここで、偽の実行条件が実行済みである場合(ステップS1309:Yes)、生成装置100は、ステップS1307に戻る。一方、偽の実行条件が実行済みではない場合(ステップS1309:No)、生成装置100は、偽の実行条件を実行し、対象プログラムTPの実行を再開する(ステップS1310)。次に、生成装置100は、ステップS1305に戻る。   On the other hand, when the parent node N exists (step S1307: Yes), the generating apparatus 100 returns to the parent node N (step S1308). Next, the generating apparatus 100 determines whether or not a false pass has been executed (step S1309). Here, when the false execution condition has been executed (step S1309: Yes), the generating apparatus 100 returns to step S1307. On the other hand, if the false execution condition has not been executed (step S1309: No), the generation apparatus 100 executes the false execution condition and resumes execution of the target program TP (step S1310). Next, the generating apparatus 100 returns to Step S1305.

図14において、生成装置100は、親のノードNのコールスタックと一致するか否かを判定する(ステップS1401)。一致しない場合(ステップS1401:No)、生成装置100は、ステップS1403に移行する。一方、一致する場合(ステップS1401:Yes)、生成装置100は、実行カウンタを「0」に設定する(ステップS1402)。次に、生成装置100は、ステップS1403に移行する。   In FIG. 14, the generating apparatus 100 determines whether or not the call stack matches that of the parent node N (step S1401). If they do not match (step S1401: No), the generating apparatus 100 proceeds to step S1403. On the other hand, if they match (step S1401: Yes), the generation device 100 sets the execution counter to “0” (step S1402). Next, the generating apparatus 100 proceeds to step S1403.

そして、生成装置100は、ノードNにおける実行カウンタをインクリメントする(ステップS1403)。次に、生成装置100は、実行カウンタが閾値以上であるか否かを判定する(ステップS1404)。ここで、実行カウンタが閾値以上ではない場合(ステップS1404:No)、生成装置100は、ステップS1408に移行する。   Then, the generation device 100 increments the execution counter in the node N (Step S1403). Next, the generating apparatus 100 determines whether or not the execution counter is greater than or equal to a threshold (step S1404). Here, when the execution counter is not greater than or equal to the threshold (step S1404: No), the generating apparatus 100 proceeds to step S1408.

一方、実行カウンタが閾値以上である場合(ステップS1404:Yes)、生成装置100は、警告済み判定フラグが偽か否かを判定する(ステップS1405)。ここで、警告済み判定フラグが偽ではない場合(ステップS1405:No)、生成装置100は、ステップS1408に移行する。   On the other hand, when the execution counter is greater than or equal to the threshold (step S1404: Yes), the generating apparatus 100 determines whether the warning determination flag is false (step S1405). Here, when the warning completion determination flag is not false (step S1405: No), the generating apparatus 100 proceeds to step S1408.

一方、警告済み判定フラグが偽である場合(ステップS1405:Yes)、生成装置100は、ノードNが示す分岐命令の実行回数が閾値以上である旨を示す警告を出力する(ステップS1406)。次に、生成装置100は、警告済み判定フラグを真にする(ステップS1407)。   On the other hand, if the warning completion determination flag is false (step S1405: Yes), the generation device 100 outputs a warning indicating that the number of executions of the branch instruction indicated by the node N is greater than or equal to the threshold (step S1406). Next, the generation device 100 sets the warning determination flag to true (step S1407).

そして、生成装置100は、親のノードNの実行カウンタを、各々の子のノードNの実行カウンタに複製する(ステップS1408)。次に、生成装置100は、子のノードNに、コールスタックと、パス条件と、親のノードNへのリンクを記憶する(ステップS1409)。   The generation apparatus 100 copies the execution counter of the parent node N to the execution counter of each child node N (step S1408). Next, the generating apparatus 100 stores the call stack, the path condition, and the link to the parent node N in the child node N (step S1409).

そして、生成装置100は、真の実行条件を実行し、対象プログラムTPの実行を再開する(ステップS1410)。次に、生成装置100は、図13のステップS1305に移行する。これにより、生成装置100は、記憶領域の使用量増加を抑制しつつ、対象プログラムTPの各々の実行経路に対応するパス条件を生成することができる。   Then, the generation device 100 executes the true execution condition and resumes execution of the target program TP (step S1410). Next, the generating apparatus 100 proceeds to Step S1305 in FIG. Thereby, the generation device 100 can generate a path condition corresponding to each execution path of the target program TP while suppressing an increase in the usage amount of the storage area.

以上説明したように、生成装置100は、対象プログラムTPの実行経路上の分岐命令ごとに、分岐命令において実行された分岐条件と、分岐命令までに実行された一連の分岐条件と、を関連付けたノードNを生成していく。次に、生成装置100は、実行経路上の末尾ノードNから、当該実行経路で対象プログラムTPを実行する場合に、対象プログラムTPの入力になるデータが満たすべきパス条件を生成する。そして、生成装置100は、実行経路上の未実行の分岐条件が存在する分岐命令から対象プログラムTPの実行を再開し、他の実行経路についても同様にパス条件を生成する。また、生成装置100は、パス条件の生成に伴って、未実行の分岐条件がなくなったノードNがあれば、当該ノードNを削除する。   As described above, the generating apparatus 100 associates, for each branch instruction on the execution path of the target program TP, the branch condition executed in the branch instruction and the series of branch conditions executed up to the branch instruction. Node N is generated. Next, when the target program TP is executed on the execution path from the end node N on the execution path, the generation apparatus 100 generates a path condition that the data to be input to the target program TP should satisfy. Then, the generation apparatus 100 resumes the execution of the target program TP from a branch instruction in which an unexecuted branch condition exists on the execution path, and similarly generates a path condition for other execution paths. In addition, the generation apparatus 100 deletes the node N if there is a node N that has no unexecuted branch condition accompanying generation of the path condition.

これにより、生成装置100は、記憶領域の使用量増加を抑制した上で、対象プログラムTPの各々の実行経路に対応するパス条件を生成することができる。例えば、2分木のノードNのすべてを保持する場合の記憶領域の使用量に比べて、記憶領域の使用量をn/(2^n−1)に減少させることができる。   Thereby, the generation apparatus 100 can generate a path condition corresponding to each execution path of the target program TP, while suppressing an increase in the usage amount of the storage area. For example, the usage amount of the storage area can be reduced to n / (2 ^ n-1) as compared to the usage amount of the storage area when all the nodes N of the binary tree are held.

このように、生成装置100は、記憶領域に保持されるノードNの個数増加を抑制し、ワークエリアになる記憶領域の圧迫を抑制する。したがって、生成装置100は、ワークエリアの圧迫によるプログラムの実行効率の低下を抑制することができる。これにより、生成装置100は、例えば、テストデータの対象プログラムTPに対する網羅性の算出効率の低下を抑制することができる。また、生成装置100は、記憶領域にノードNが保持しきれずに、ワークエリアとして使用可能な領域がなくなることを防止することができ、パス条件の生成が中断することを防止することができる。したがって、利用者は、2分木のメモリ使用量を気にせずにシンボリック実行をおこなうことができる。   As described above, the generation device 100 suppresses an increase in the number of nodes N held in the storage area, and suppresses compression of the storage area serving as a work area. Therefore, the generation apparatus 100 can suppress a decrease in the execution efficiency of the program due to work area compression. Thereby, the production | generation apparatus 100 can suppress the fall of the calculation efficiency of the completeness with respect to the object program TP of test data, for example. In addition, the generation apparatus 100 can prevent the storage of the node N from being held in the storage area, thereby preventing the area that can be used as a work area from being lost, and can prevent the generation of the path condition from being interrupted. Therefore, the user can perform symbolic execution without worrying about the memory usage of the binary tree.

また、生成装置100は、分岐命令を実行した場合のコールスタックの内容を、ノードNに関連付けておく。次に、生成装置100は、生成したノードNを始点にして、生成したノードNと同一の実行経路上に、生成したノードNと同一の分岐命令を示し、かつ、同一のコールスタックの内容を示すノードNが閾値以上連続して出現するか否かを判断する。そして、生成装置100は、閾値以上連続して出現する場合、生成したノードNが示す分岐命令が閾値以上連続して実行された旨を示す情報と、当該分岐命令の番地と、を出力する。   The generation apparatus 100 associates the contents of the call stack when the branch instruction is executed with the node N. Next, the generation device 100 indicates the same branch instruction as that of the generated node N on the same execution path as that of the generated node N with the generated node N as a starting point, and also displays the contents of the same call stack. It is determined whether or not the indicated node N appears continuously for a threshold value or more. When the generation device 100 continuously appears for a threshold value or more, the generation device 100 outputs information indicating that the branch instruction indicated by the generated node N has been continuously executed for the threshold value or more and the address of the branch instruction.

これにより、生成装置100は、生成装置100の利用者に、同一の実行経路上、かつ、同一のコールスタックの状態において、閾値以上連続して実行された分岐命令の対象プログラムTPにおける番地を通知することができる。生成装置100の利用者は、対象プログラムTPに、シンボル変数に関する分岐命令が連続して実行されている部分があると判断できる。例えば、分岐命令が連続して実行されている部分とは、for文の中に分岐命令が含まれる場合である。   As a result, the generation device 100 notifies the user of the generation device 100 of the address in the target program TP of the branch instruction that has been executed continuously over the threshold in the same execution path and in the same call stack state. can do. The user of the generation apparatus 100 can determine that the target program TP includes a portion in which branch instructions related to symbol variables are continuously executed. For example, the part where the branch instructions are continuously executed is a case where the branch instruction is included in the for statement.

そして、生成装置100の利用者は、通知された番地の分岐命令をシンボル変数ではない通常の変数に関する分岐命令に変更したり、シンボル変数の取り得る値の範囲を狭めたりすることができる。ここで、生成装置100の利用者は、番地が通知されているため、当該分岐命令を対象プログラムTPの中から特定する手間を省くことができる。これにより、生成装置100の利用者は、対象プログラムTPのパス条件に不要なパス条件が入らないように対象プログラムTPに変更を加え、対象プログラムTPのパス条件の生成の効率化を図ることができる。   The user of the generation device 100 can change the branch instruction at the notified address to a branch instruction related to a normal variable that is not a symbol variable, or can narrow the range of values that the symbol variable can take. Here, since the user is notified of the address, the user of the generating apparatus 100 can save the trouble of specifying the branch instruction from the target program TP. Accordingly, the user of the generation apparatus 100 can change the target program TP so that unnecessary path conditions are not included in the path conditions of the target program TP, thereby improving the efficiency of generation of the path conditions of the target program TP. it can.

また、これにより、生成装置100は、生成装置100の利用者に、複数の実行経路における同一の分岐命令の実行回数の和が閾値以上になっても、分岐命令が閾値以上連続して実行されたと誤って通知することがない。また、生成装置100は、対象プログラムTPの複数箇所から或る関数が呼び出され、当該関数内の分岐命令の実行回数が閾値以上になっても、分岐命令が閾値以上連続して実行されたと誤って通知することがない。   Accordingly, the generation apparatus 100 allows the user of the generation apparatus 100 to continuously execute the branch instructions over the threshold even if the sum of the number of executions of the same branch instruction in the plurality of execution paths is over the threshold. You will not be notified by mistake. In addition, the generation apparatus 100 erroneously determines that a branch instruction is continuously executed for a threshold value or more even when a certain function is called from a plurality of locations of the target program TP and the number of executions of the branch instruction in the function exceeds the threshold value. Will not be notified.

また、生成装置100は、生成されたパス条件の集合から、対象プログラムTPの動作確認のためのテストデータの対象プログラムTPに対する網羅性を算出し、算出結果を出力する。これにより、生成装置100の利用者は、テストデータの対象プログラムTPに対する網羅性が100%に満たない場合、対象プログラムTPの実行経路の各々を100%網羅して動作確認ができるように、テストデータを追加することができる。また、生成装置100の利用者は、テストデータの対象プログラムTPに対する網羅性が100%である場合、テストデータから不要なデータを削除し、対象プログラムTPの動作確認の効率化を図ってもよい。   Further, the generation device 100 calculates the completeness of the test data for confirming the operation of the target program TP with respect to the target program TP from the set of generated path conditions, and outputs the calculation result. As a result, when the user of the generation apparatus 100 has less than 100% coverage of the test program with respect to the target program TP, the test can be performed so that each of the execution paths of the target program TP can be checked with 100% coverage. Data can be added. In addition, when the coverage of the test data with respect to the target program TP is 100%, the user of the generation apparatus 100 may delete unnecessary data from the test data to improve the efficiency of the operation check of the target program TP. .

なお、本実施の形態で説明した生成方法は、予め用意されたプログラムをパーソナル・コンピュータやワークステーション等のコンピュータで実行することにより実現することができる。本生成プログラムは、ハードディスク、フレキシブルディスク、CD−ROM、MO、DVD等のコンピュータで読み取り可能な記録媒体に記録され、コンピュータによって記録媒体から読み出されることによって実行される。また本生成プログラムは、インターネット等のネットワークを介して配布してもよい。   Note that the generation method described in this embodiment can be realized by executing a program prepared in advance on a computer such as a personal computer or a workstation. The generation program is recorded on a computer-readable recording medium such as a hard disk, a flexible disk, a CD-ROM, an MO, and a DVD, and is executed by being read from the recording medium by the computer. The generation program may be distributed via a network such as the Internet.

また、本実施の形態で説明した生成装置100は、スタンダードセルやストラクチャードASIC(Application Specific Integrated Circuit)などの特定用途向けIC(以下、単に「ASIC」と称す。)やFPGAなどのPLD(Programmable Logic Device)によっても実現することができる。具体的には、例えば、上述した生成装置100の機能(入力部301〜算出部314)をHDL記述によって機能定義し、そのHDL記述を論理合成してASICやPLDに与えることにより、生成装置100を製造することができる。   In addition, the generation apparatus 100 described in the present embodiment includes a specific cell IC (hereinafter simply referred to as “ASIC”) such as a standard cell or a structured ASIC (Application Specific Integrated Circuit), or a PLD (Programmable Logic) such as an FPGA. It can also be realized by Device). Specifically, for example, the function (input unit 301 to calculation unit 314) of the generation device 100 described above is defined by the HDL description, and the HDL description is logically synthesized and given to the ASIC or PLD to generate the generation device 100. Can be manufactured.

上述した実施の形態に関し、さらに以下の付記を開示する。   The following additional notes are disclosed with respect to the embodiment described above.

(付記1)プログラムの実行中に到達した分岐命令において未実行の分岐条件が実行された場合、前記分岐命令と、実行された分岐条件と、前記プログラムの実行開始から前記分岐命令の分岐元の分岐命令までに実行された一連の分岐条件と、を関連付けたノードを生成する第1の生成部と、
前記第1の生成部によって生成されたノードを記憶装置に格納する第1の格納部と、
前記プログラムの実行が終了した場合、前記プログラムが終了するまでの実行経路上の末尾ノードが示す一連の分岐条件に基づいて、前記プログラムが終了するまでに実行された一連の分岐条件を生成する第2の生成部と、
前記第2の生成部によって生成された一連の分岐条件を前記記憶装置に格納する第2の格納部と、
前記プログラムの実行が終了した場合、前記プログラムが終了するまでの実行経路を当該実行経路上の末尾ノードから前記実行経路の逆順に探索して未実行の分岐条件が最初に出現するノードを、前記記憶装置の中から特定する特定部と、
前記特定部によって特定されたノードが示す分岐命令から前記プログラムが再開され、未実行の分岐条件が実行された場合、当該分岐条件を前記特定されたノードが示す分岐命令に関連付けることにより、前記特定されたノードを前記記憶装置内において更新する更新部と、
未実行の分岐条件がなくなったノードを前記記憶装置から削除する削除部と、
を有することを特徴とする生成装置。
(Supplementary Note 1) When an unexecuted branch condition is executed in a branch instruction reached during program execution, the branch instruction, the executed branch condition, and the branch source of the branch instruction from the start of execution of the program A first generation unit that generates a node that associates a series of branch conditions executed up to the branch instruction;
A first storage unit that stores the node generated by the first generation unit in a storage device;
When the execution of the program ends, a series of branch conditions that are executed until the program ends are generated based on a series of branch conditions indicated by the end node on the execution path until the program ends. Two generators;
A second storage unit that stores a series of branch conditions generated by the second generation unit in the storage device;
When the execution of the program ends, the execution path until the program ends is searched from the end node on the execution path in the reverse order of the execution path, and the node where the unexecuted branch condition first appears is A specific unit that identifies the storage device;
When the program is restarted from the branch instruction indicated by the node specified by the specifying unit and an unexecuted branch condition is executed, the specification is performed by associating the branch condition with the branch instruction indicated by the specified node. An updating unit for updating the generated node in the storage device;
A deletion unit that deletes a node that has no unexecuted branch condition from the storage device; and
A generation apparatus comprising:

(付記2)前記生成されたノードに、前記生成されたノードが示す分岐命令を呼び出した関数の履歴を追加する追加部と、
前記追加部によって関数の履歴が追加された追加後のノード列を当該追加後のノード列の末尾ノードから前記追加後のノード列の逆順に探索することにより、前記追加後のノード列の末尾ノードと同一の分岐命令を示し、かつ、同一内容の関数の履歴を示すノードが閾値以上連続して出現するか否かを判定する判定部と、
前記判定部によって出現すると判定された場合、前記追加後のノード列の末尾ノードが示す分岐命令が閾値以上連続して実行された旨を示す情報を出力する出力部と、
を有することを特徴とする付記1に記載の生成装置。
(Additional remark 2) The addition part which adds the log | history of the function which called the branch instruction which the said produced | generated node shows to the said produced | generated node,
By searching the node sequence after the addition of which the function history has been added by the adding unit in the reverse order of the node sequence after the addition from the end node of the node sequence after the addition, the end node of the node sequence after the addition A determination unit that determines whether or not a node indicating the same branch instruction and a history of a function history having the same content appears continuously over a threshold value;
An output unit that outputs information indicating that the branch instruction indicated by the end node of the node sequence after the addition is continuously executed for a threshold value or more when determined to appear by the determination unit;
The generating apparatus according to appendix 1, wherein:

(付記3)前記第2の格納部は、
前記判定部によって出現すると判定された場合、前記追加後のノード列の末尾ノードが示す一連の分岐条件を前記記憶装置に格納し、
前記特定部は、
前記判定部によって出現すると判定された場合、前記追加後のノード列を前記追加後のノード列の末尾ノードから前記追加後のノード列の逆順に探索して未実行の分岐条件が最初に出現するノードを、前記記憶装置の中から特定することを特徴とする付記2に記載の生成装置。
(Appendix 3) The second storage unit is
If it is determined by the determination unit to appear, a series of branch conditions indicated by the end node of the node sequence after the addition is stored in the storage device,
The specific part is:
When it is determined by the determination unit that the node sequence after the addition is added, the node sequence after the addition is searched in the reverse order of the node sequence after the addition from the end node of the node sequence after the addition, and the unexecuted branch condition appears first. The generation apparatus according to attachment 2, wherein a node is specified from the storage device.

(付記4)前記判定部によって出現すると判定された場合、前記プログラムの実行を停止する停止部を有することを特徴とする付記2に記載の生成装置。 (Additional remark 4) When it determines with appearing by the said determination part, it has a stop part which stops execution of the said program, The production | generation apparatus of Additional remark 2 characterized by the above-mentioned.

(付記5)前記プログラムの入力になるデータが、前記第2の格納部によって前記記憶装置に格納された一連の分岐条件に該当するか否かを判断する判断部と、
前記記憶装置に記憶された一連の分岐条件の集合において、前記判断部によって該当すると判断される一連の分岐条件が占める割合を算出する算出部と、
を有することを特徴とする付記1乃至4のいずれか一つに記載の生成装置。
(Additional remark 5) The judgment part which judges whether the data used as the input of the said program correspond to a series of branch conditions stored in the said memory | storage device by the said 2nd storage part,
A calculation unit that calculates a ratio of a series of branch conditions determined to be applicable by the determination unit in the set of branch conditions stored in the storage device;
The generating apparatus according to any one of appendices 1 to 4, wherein the generating apparatus includes:

(付記6)コンピュータに、
プログラムの実行中に到達した分岐命令において未実行の分岐条件が実行された場合、前記分岐命令と、実行された分岐条件と、前記プログラムの実行開始から前記分岐命令の分岐元の分岐命令までに実行された一連の分岐条件と、を関連付けたノードを生成し、
生成されたノードを記憶装置に格納し、
前記プログラムの実行が終了した場合、前記プログラムが終了するまでの実行経路上の末尾ノードが示す一連の分岐条件に基づいて、前記プログラムが終了するまでに実行された一連の分岐条件を生成し、
生成された一連の分岐条件を前記記憶装置に格納し、
前記プログラムの実行が終了した場合、前記プログラムが終了するまでの実行経路を当該実行経路上の末尾ノードから前記実行経路の逆順に探索して未実行の分岐条件が最初に出現するノードを、前記記憶装置の中から特定し、
特定されたノードが示す分岐命令から前記プログラムが再開され、未実行の分岐条件が実行された場合、当該分岐条件を前記特定されたノードが示す分岐命令に関連付けることにより、前記特定されたノードを前記記憶装置内において更新し、
未実行の分岐条件がなくなったノードを前記記憶装置から削除する、
処理を実行させることを特徴とする生成プログラム。
(Appendix 6)
When an unexecuted branch condition is executed in a branch instruction that is reached during execution of the program, the branch instruction, the executed branch condition, and from the start of execution of the program to the branch instruction that is the branch source of the branch instruction Generate a node that associates a series of executed branch conditions with
Store the generated node in the storage device,
When the execution of the program ends, based on a series of branch conditions indicated by the end node on the execution path until the program ends, a series of branch conditions executed until the program ends,
Storing the generated series of branch conditions in the storage device;
When the execution of the program ends, the execution path until the program ends is searched from the end node on the execution path in the reverse order of the execution path, and the node where the unexecuted branch condition first appears is Identify the storage device,
When the program is resumed from the branch instruction indicated by the identified node and an unexecuted branch condition is executed, the identified node is associated with the branch instruction indicated by the identified node. Updating in the storage device;
Deleting a node that has no unexecuted branch condition from the storage device;
A generation program characterized by causing processing to be executed.

(付記7)コンピュータが、
プログラムの実行中に到達した分岐命令において未実行の分岐条件が実行された場合、前記分岐命令と、実行された分岐条件と、前記プログラムの実行開始から前記分岐命令の分岐元の分岐命令までに実行された一連の分岐条件と、を関連付けたノードを生成し、
生成されたノードを記憶装置に格納し、
前記プログラムの実行が終了した場合、前記プログラムが終了するまでの実行経路上の末尾ノードが示す一連の分岐条件に基づいて、前記プログラムが終了するまでに実行された一連の分岐条件を生成し、
生成された一連の分岐条件を前記記憶装置に格納し、
前記プログラムの実行が終了した場合、前記プログラムが終了するまでの実行経路を当該実行経路上の末尾ノードから前記実行経路の逆順に探索して未実行の分岐条件が最初に出現するノードを、前記記憶装置の中から特定し、
特定されたノードが示す分岐命令から前記プログラムが再開され、未実行の分岐条件が実行された場合、当該分岐条件を前記特定されたノードが示す分岐命令に関連付けることにより、前記特定されたノードを前記記憶装置内において更新し、
未実行の分岐条件がなくなったノードを前記記憶装置から削除する、
処理を実行することを特徴とする生成方法。
(Appendix 7) The computer
When an unexecuted branch condition is executed in a branch instruction that is reached during execution of the program, the branch instruction, the executed branch condition, and from the start of execution of the program to the branch instruction that is the branch source of the branch instruction Generate a node that associates a series of executed branch conditions with
Store the generated node in the storage device,
When the execution of the program ends, based on a series of branch conditions indicated by the end node on the execution path until the program ends, a series of branch conditions executed until the program ends,
Storing the generated series of branch conditions in the storage device;
When the execution of the program ends, the execution path until the program ends is searched from the end node on the execution path in the reverse order of the execution path, and the node where the unexecuted branch condition first appears is Identify the storage device,
When the program is resumed from the branch instruction indicated by the identified node and an unexecuted branch condition is executed, the identified node is associated with the branch instruction indicated by the identified node. Updating in the storage device;
Deleting a node that has no unexecuted branch condition from the storage device;
A generation method characterized by executing processing.

100 生成装置
TP 対象プログラム
N,N1〜N5,N11〜N17,N21,N22,N28 ノード
301 入力部
302 実行部
303 第1の生成部
304 第1の格納部
305 第2の生成部
306 第2の格納部
307 特定部
308 更新部
309 削除部
310 追加部
311 判定部
312 出力部
313 判断部
314 算出部
100 generator TP target program N, N1 to N5, N11 to N17, N21, N22, N28 Node 301 input unit 302 execution unit 303 first generation unit 304 first storage unit 305 second generation unit 306 second Storage unit 307 Identification unit 308 Update unit 309 Deletion unit 310 Addition unit 311 Determination unit 312 Output unit 313 Determination unit 314 Calculation unit

Claims (6)

プログラムの実行中に到達した分岐命令において未実行の分岐条件が実行された場合、前記分岐命令と、実行された分岐条件と、前記プログラムの実行開始から前記分岐命令の分岐元の分岐命令までに実行された一連の分岐条件と、を関連付けたノードを生成する第1の生成部と、
前記第1の生成部によって生成されたノードを記憶装置に格納する第1の格納部と、
前記プログラムの実行が終了した場合、前記プログラムが終了するまでの実行経路上の末尾ノードが示す一連の分岐条件に基づいて、前記プログラムが終了するまでに実行された一連の分岐条件を生成する第2の生成部と、
前記第2の生成部によって生成された一連の分岐条件を前記記憶装置に格納する第2の格納部と、
前記プログラムの実行が終了した場合、前記プログラムが終了するまでの実行経路を当該実行経路上の末尾ノードから前記実行経路の逆順に探索して未実行の分岐条件が最初に出現するノードを、前記記憶装置の中から特定する特定部と、
前記特定部によって特定されたノードが示す分岐命令から前記プログラムが再開され、未実行の分岐条件が実行された場合、当該分岐条件を前記特定されたノードが示す分岐命令に関連付けることにより、前記特定されたノードを前記記憶装置内において更新する更新部と、
未実行の分岐条件がなくなったノードを前記記憶装置から削除する削除部と、
を有することを特徴とする生成装置。
When an unexecuted branch condition is executed in a branch instruction that is reached during execution of the program, the branch instruction, the executed branch condition, and from the start of execution of the program to the branch instruction that is the branch source of the branch instruction A first generation unit that generates a node that associates a series of executed branch conditions with each other;
A first storage unit that stores the node generated by the first generation unit in a storage device;
When the execution of the program ends, a series of branch conditions that are executed until the program ends are generated based on a series of branch conditions indicated by the end node on the execution path until the program ends. Two generators;
A second storage unit that stores a series of branch conditions generated by the second generation unit in the storage device;
When the execution of the program ends, the execution path until the program ends is searched from the end node on the execution path in the reverse order of the execution path, and the node where the unexecuted branch condition first appears is A specific unit that identifies the storage device;
When the program is restarted from the branch instruction indicated by the node specified by the specifying unit and an unexecuted branch condition is executed, the specification is performed by associating the branch condition with the branch instruction indicated by the specified node. An updating unit for updating the generated node in the storage device;
A deletion unit that deletes a node that has no unexecuted branch condition from the storage device; and
A generation apparatus comprising:
前記生成されたノードに、前記生成されたノードが示す分岐命令を呼び出した関数の履歴を追加する追加部と、
前記追加部によって関数の履歴が追加された追加後のノード列を当該追加後のノード列の末尾ノードから前記追加後のノード列の逆順に探索することにより、前記追加後のノード列の末尾ノードと同一の分岐命令を示し、かつ、同一内容の関数の履歴を示すノードが閾値以上連続して出現するか否かを判定する判定部と、
前記判定部によって出現すると判定された場合、前記追加後のノード列の末尾ノードが示す分岐命令が閾値以上連続して実行された旨を示す情報を出力する出力部と、
を有することを特徴とする請求項1に記載の生成装置。
An adding unit that adds a history of a function that called a branch instruction indicated by the generated node to the generated node;
By searching the node sequence after the addition of which the function history has been added by the adding unit in the reverse order of the node sequence after the addition from the end node of the node sequence after the addition, the end node of the node sequence after the addition A determination unit that determines whether or not a node indicating the same branch instruction and a history of a function history having the same content appears continuously over a threshold value;
An output unit that outputs information indicating that the branch instruction indicated by the end node of the node sequence after the addition is continuously executed for a threshold value or more when determined to appear by the determination unit;
The generating apparatus according to claim 1, wherein:
前記第2の格納部は、
前記判定部によって出現すると判定された場合、前記追加後のノード列の末尾ノードが示す一連の分岐条件を前記記憶装置に格納し、
前記特定部は、
前記判定部によって出現すると判定された場合、前記追加後のノード列を前記追加後のノード列の末尾ノードから前記追加後のノード列の逆順に探索して未実行の分岐条件が最初に出現するノードを、前記記憶装置の中から特定することを特徴とする請求項2に記載の生成装置。
The second storage unit
If it is determined by the determination unit to appear, a series of branch conditions indicated by the end node of the node sequence after the addition is stored in the storage device,
The specific part is:
When it is determined by the determination unit that the node sequence after the addition is added, the node sequence after the addition is searched in the reverse order of the node sequence after the addition from the end node of the node sequence after the addition, and the unexecuted branch condition appears first. The generation apparatus according to claim 2, wherein a node is specified from the storage device.
前記プログラムの入力になるデータが、前記第2の格納部によって前記記憶装置に格納された一連の分岐条件に該当するか否かを判断する判断部と、
前記記憶装置に記憶された一連の分岐条件の集合において、前記判断部によって該当すると判断される一連の分岐条件が占める割合を算出する算出部と、
を有することを特徴とする請求項1乃至3のいずれか一項に記載の生成装置。
A determination unit that determines whether data to be input to the program satisfies a series of branch conditions stored in the storage device by the second storage unit;
A calculation unit that calculates a ratio of a series of branch conditions determined to be applicable by the determination unit in the set of branch conditions stored in the storage device;
The generating apparatus according to claim 1, wherein the generating apparatus includes:
コンピュータに、
プログラムの実行中に到達した分岐命令において未実行の分岐条件が実行された場合、前記分岐命令と、実行された分岐条件と、前記プログラムの実行開始から前記分岐命令の分岐元の分岐命令までに実行された一連の分岐条件と、を関連付けたノードを生成し、
生成されたノードを記憶装置に格納し、
前記プログラムの実行が終了した場合、前記プログラムが終了するまでの実行経路上の末尾ノードが示す一連の分岐条件に基づいて、前記プログラムが終了するまでに実行された一連の分岐条件を生成し、
生成された一連の分岐条件を前記記憶装置に格納し、
前記プログラムの実行が終了した場合、前記プログラムが終了するまでの実行経路を当該実行経路上の末尾ノードから前記実行経路の逆順に探索して未実行の分岐条件が最初に出現するノードを、前記記憶装置の中から特定し、
特定されたノードが示す分岐命令から前記プログラムが再開され、未実行の分岐条件が実行された場合、当該分岐条件を前記特定されたノードが示す分岐命令に関連付けることにより、前記特定されたノードを前記記憶装置内において更新し、
未実行の分岐条件がなくなったノードを前記記憶装置から削除する、
処理を実行させることを特徴とする生成プログラム。
On the computer,
When an unexecuted branch condition is executed in a branch instruction that is reached during execution of the program, the branch instruction, the executed branch condition, and from the start of execution of the program to the branch instruction that is the branch source of the branch instruction Generate a node that associates a series of executed branch conditions with
Store the generated node in the storage device,
When the execution of the program ends, based on a series of branch conditions indicated by the end node on the execution path until the program ends, a series of branch conditions executed until the program ends,
Storing the generated series of branch conditions in the storage device;
When the execution of the program ends, the execution path until the program ends is searched from the end node on the execution path in the reverse order of the execution path, and the node where the unexecuted branch condition first appears is Identify the storage device,
When the program is resumed from the branch instruction indicated by the identified node and an unexecuted branch condition is executed, the identified node is associated with the branch instruction indicated by the identified node. Updating in the storage device;
Deleting a node that has no unexecuted branch condition from the storage device;
A generation program characterized by causing processing to be executed.
コンピュータが、
プログラムの実行中に到達した分岐命令において未実行の分岐条件が実行された場合、前記分岐命令と、実行された分岐条件と、前記プログラムの実行開始から前記分岐命令の分岐元の分岐命令までに実行された一連の分岐条件と、を関連付けたノードを生成し、
生成されたノードを記憶装置に格納し、
前記プログラムの実行が終了した場合、前記プログラムが終了するまでの実行経路上の末尾ノードが示す一連の分岐条件に基づいて、前記プログラムが終了するまでに実行された一連の分岐条件を生成し、
生成された一連の分岐条件を前記記憶装置に格納し、
前記プログラムの実行が終了した場合、前記プログラムが終了するまでの実行経路を当該実行経路上の末尾ノードから前記実行経路の逆順に探索して未実行の分岐条件が最初に出現するノードを、前記記憶装置の中から特定し、
特定されたノードが示す分岐命令から前記プログラムが再開され、未実行の分岐条件が実行された場合、当該分岐条件を前記特定されたノードが示す分岐命令に関連付けることにより、前記特定されたノードを前記記憶装置内において更新し、
未実行の分岐条件がなくなったノードを前記記憶装置から削除する、
処理を実行することを特徴とする生成方法。
Computer
When an unexecuted branch condition is executed in a branch instruction that is reached during execution of the program, the branch instruction, the executed branch condition, and from the start of execution of the program to the branch instruction that is the branch source of the branch instruction Generate a node that associates a series of executed branch conditions with
Store the generated node in the storage device,
When the execution of the program ends, based on a series of branch conditions indicated by the end node on the execution path until the program ends, a series of branch conditions executed until the program ends,
Storing the generated series of branch conditions in the storage device;
When the execution of the program ends, the execution path until the program ends is searched from the end node on the execution path in the reverse order of the execution path, and the node where the unexecuted branch condition first appears is Identify the storage device,
When the program is resumed from the branch instruction indicated by the identified node and an unexecuted branch condition is executed, the identified node is associated with the branch instruction indicated by the identified node. Updating in the storage device;
Deleting a node that has no unexecuted branch condition from the storage device;
A generation method characterized by executing processing.
JP2012019285A 2012-01-31 2012-01-31 Generating device, generating program, and generating method Expired - Fee Related JP5761056B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2012019285A JP5761056B2 (en) 2012-01-31 2012-01-31 Generating device, generating program, and generating method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2012019285A JP5761056B2 (en) 2012-01-31 2012-01-31 Generating device, generating program, and generating method

Publications (2)

Publication Number Publication Date
JP2013156961A JP2013156961A (en) 2013-08-15
JP5761056B2 true JP5761056B2 (en) 2015-08-12

Family

ID=49052045

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2012019285A Expired - Fee Related JP5761056B2 (en) 2012-01-31 2012-01-31 Generating device, generating program, and generating method

Country Status (1)

Country Link
JP (1) JP5761056B2 (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP6201567B2 (en) * 2013-09-24 2017-09-27 富士通株式会社 Symbolic execution method, symbolic execution device, and symbolic execution program
JP6882892B2 (en) * 2013-12-18 2021-06-02 アビニシオ テクノロジー エルエルシー Data generation
US20150331786A1 (en) * 2014-05-15 2015-11-19 Fujitsu Limited Path execution reduction in software program verification
JP6331756B2 (en) * 2014-06-25 2018-05-30 富士通株式会社 Test case generation program, test case generation method, and test case generation apparatus
JP6559600B2 (en) * 2016-03-17 2019-08-14 株式会社東芝 Information processing apparatus, information processing program, and inspection system

Also Published As

Publication number Publication date
JP2013156961A (en) 2013-08-15

Similar Documents

Publication Publication Date Title
JP5761056B2 (en) Generating device, generating program, and generating method
US8375007B2 (en) Status tool to expose metadata read and write queues
US8719797B2 (en) System and method for debugging dynamically generated code of an application
JP6122448B2 (en) Extension activation for related documents
US20130080720A1 (en) Information processing apparatus and method
JP6003699B2 (en) Test data generation program, method and apparatus
USRE44722E1 (en) Efficient use of exceptions in text segmentation
CN111143205B (en) Android platform-oriented test case automatic generation method and generation system
CN111460235A (en) Atlas data processing method, device, equipment and storage medium
KR101683448B1 (en) Method for undoing multiple command
US8458110B2 (en) Verification support apparatus, verification support method, and computer product
CN114356299A (en) Event arrangement method and device in page building process
CN108304367A (en) Segmenting method and device
JP2018147106A (en) Program analyzer, program analysis method and program analysis program
CN102411534A (en) Breakpoint debugging method and debugger
JP4893811B2 (en) Verification support program and verification support device
JP6260234B2 (en) Document analysis apparatus, document analysis method, and document analysis program
JP6556091B2 (en) System specification verification support apparatus and system specification verification support method
US9910647B2 (en) Field size calculation and color coding display options usable in an emulated integrated development environment (IDE)
KR101550652B1 (en) Method and apparatus for providing program development environment
JP2014067109A (en) Data transition trace device, data transition trace method, and data transition trace program
JP2012160101A (en) Information processing unit, software testing method and software testing program
US20230385314A1 (en) Method and apparatus for searching contents
JP2009042951A (en) Data extraction method and device from program
JP6960270B2 (en) Design document learning device and design document learning method

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20141007

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20150422

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

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20150525

R150 Certificate of patent or registration of utility model

Ref document number: 5761056

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150

LAPS Cancellation because of no payment of annual fees