JP6574151B2 - Program analysis apparatus, program analysis method, and program analysis program - Google Patents

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

Info

Publication number
JP6574151B2
JP6574151B2 JP2016161559A JP2016161559A JP6574151B2 JP 6574151 B2 JP6574151 B2 JP 6574151B2 JP 2016161559 A JP2016161559 A JP 2016161559A JP 2016161559 A JP2016161559 A JP 2016161559A JP 6574151 B2 JP6574151 B2 JP 6574151B2
Authority
JP
Japan
Prior art keywords
function
execution path
resource
loop
variable
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.)
Active
Application number
JP2016161559A
Other languages
Japanese (ja)
Other versions
JP2018028879A (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.)
Nippon Telegraph and Telephone Corp
Original Assignee
Nippon Telegraph and Telephone Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Nippon Telegraph and Telephone Corp filed Critical Nippon Telegraph and Telephone Corp
Priority to JP2016161559A priority Critical patent/JP6574151B2/en
Publication of JP2018028879A publication Critical patent/JP2018028879A/en
Application granted granted Critical
Publication of JP6574151B2 publication Critical patent/JP6574151B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Description

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

プログラム作成時に誤りを検出する技術が研究されている。そのひとつに、静的コード解析によりプログラムの誤りの可能性のある箇所を検出する技術がある。   Techniques for detecting errors when creating programs are being studied. One of them is a technique for detecting a potential error in a program by static code analysis.

静的コード解析による誤り検出技術の例として、Cプログラムを対象としたmalloc関数で確保したメモリがfree関数で解放されていない箇所を検出する技術、malloc関数で確保した未初期化メモリを参照している箇所を検出する技術などがある(例えば非特許文献1参照)。   As an example of an error detection technique based on static code analysis, refer to a technique for detecting a location where a memory secured by a malloc function for a C program is not released by a free function, and an uninitialized memory secured by a malloc function. For example, there is a technique for detecting a spot (see Non-Patent Document 1).

W. R. Bush, J. D. Pincus, and D. J. Sielaff, “A static analyzer for finding dynamic programming errors”, Software Practice and Experience, 2000年, vol. 30, No. 7, pp. 775-802W. R. Bush, J. D. Pincus, and D. J. Sielaff, “A static analyzer for finding dynamic programming errors”, Software Practice and Experience, 2000, vol. 30, No. 7, pp. 775-802

ところで、プログラム作成者は、malloc関数やfree関数などの一般的なリソース捕捉関数、リソース解放関数を使用するだけでなく、独自のリソース捕捉関数とリソース解放関数を用いてプログラムを作成することがある。   By the way, the program creator not only uses a general resource capture function and resource release function such as a malloc function and a free function, but also creates a program using an original resource capture function and resource release function. .

既存の静的コード解析ツールは、malloc関数やfree関数などの一般的な関数で捕捉したリソースの未初期化参照やリソース解放漏れを検出できる。しかし、既存の静的コード解析ツールでは、プログラム作成者が独自のリソース捕捉関数とリソース解放関数を使用してプログラムを作成した場合に、プログラム作成者独自のリソース捕捉関数を用いて捕捉されたリソースの未初期化参照やリソース解放漏れを検出することができなかった。   An existing static code analysis tool can detect an uninitialized reference to a resource captured by a general function such as a malloc function or a free function, or a resource release omission. However, with existing static code analysis tools, when a program creator creates a program using its own resource capture function and resource release function, the resources captured using the program creator's own resource capture function Failed to detect uninitialized references and missing resources release.

そこで、既存の静的コード解析ツールに、プログラム作成者独自のリソース捕捉関数やリソース解放関数を登録し、malloc関数やfree関数と同様に静的コード解析をすることも考えられる。すなわち、プログラム作成者独自のリソース捕捉関数が捕捉したリソースを、malloc関数が捕捉したメモリと同様に扱い、また、プログラム作成者独自のリソース捕捉関数が捕捉したリソースが独自の解放関数で解放されるべきという関係性を、malloc関数で捕捉されたメモリがfree関数で解放されるべきという関係性と同様に扱うことによって、捕捉されたリソースの未初期化参照やリソース解放漏れを検出できると考えられる。   Therefore, it is also conceivable to register a resource capture function and resource release function unique to the program creator in an existing static code analysis tool and perform static code analysis in the same manner as the malloc function and free function. That is, the resource captured by the program creator's own resource capture function is handled in the same manner as the memory captured by the malloc function, and the resource captured by the program creator's own resource capture function is released by the original release function. By treating the relationship that should be handled in the same way as the relationship that the memory captured by the malloc function should be released by the free function, it is considered that uninitialized references to the captured resource and resource release omissions can be detected. .

プログラム作成者独自の関数を静的コード解析ツールに登録するためには、静的コード解析ツールのユーザがリソース捕捉・解放関数を管理し登録することが必要となる。しかし、そのためには、静的コード解析を行うために、ユーザがリソース捕捉・解放関数を管理しておき、かつ、ツールに誤りなく登録する手間がかかり、利便性が悪い。   In order to register a function unique to the program creator in the static code analysis tool, it is necessary for the user of the static code analysis tool to manage and register the resource capture / release function. However, in order to perform static code analysis, it takes time and effort for the user to manage the resource capture / release function and register it without error in the tool, which is inconvenient.

そこで、プログラム作成者独自のリソース捕捉・解放関数を、プログラムから自動的に検出する技術を開発することが考えられる。本発明者はこれまでに、リソース捕捉関数とリソース解放関数とがソースコード上に対になって出現することに着目して、ソースコードを解析して自動的にリソース捕捉関数とリソース解放関数のペアを検出する技術を提案している(特願2015−028456号)。また、本発明者は、作成されたプログラムがリソース解放漏れを含む可能性があることを前提として、リソース解放漏れの誤りを含む可能性がある経路を検出する技術も提案している(特願2015−156945号)。   Therefore, it is conceivable to develop a technique for automatically detecting from the program a resource capture / release function unique to the program creator. The inventor has so far focused on the fact that the resource capture function and the resource release function appear in pairs in the source code, and analyzed the source code to automatically analyze the resource capture function and the resource release function. A technique for detecting a pair has been proposed (Japanese Patent Application No. 2015-028456). The present inventor has also proposed a technique for detecting a path that may contain a resource release omission error, assuming that the created program may contain a resource release omission (Japanese Patent Application No. 2015-156945).

開示の実施形態は、上記に鑑みてなされたものであり、分岐やループを含むソースコードからリソース捕捉関数とリソース解放関数のペアを抽出することを目的とする。   An embodiment of the disclosure has been made in view of the above, and an object thereof is to extract a pair of a resource capture function and a resource release function from a source code including a branch and a loop.

開示するプログラム解析装置、プログラム解析方法およびプログラム解析プログラムは、ソースコード中、第1の関数が呼び出された位置から処理が辿る可能性のある実行パスにループが含まれる場合に、当該ループを1回からn回(nは2以上の自然数)まで繰り返して実行した場合のそれぞれについて、処理が辿る可能性のある実行パスを生成する。そして、プログラム解析装置、プログラム解析方法およびプログラム解析プログラムは、生成した実行パスにおいて、第1の関数と、第1の関数の戻り値を格納する変数と、第1の関数とは異なり該第1の関数の戻り値を格納した変数を引数とする第2の関数と、の出現パタンが、リソース捕捉関数とリソース解放関数の出現パタンに合致する場合、第1の関数と第2の関数とをリソース捕捉関数とリソース解放関数のペアとして抽出する。   The disclosed program analysis device, program analysis method, and program analysis program, when a loop is included in an execution path that may be traced from the position where the first function is called in the source code, An execution path that can be traced by the process is generated for each of the processes executed repeatedly from n times to n times (n is a natural number of 2 or more). The program analysis apparatus, the program analysis method, and the program analysis program are different from the first function in the generated execution path, unlike the first function, the variable that stores the return value of the first function, and the first function. If the appearance pattern of the second function that uses the variable storing the return value of the function of the first argument matches the appearance pattern of the resource capture function and the resource release function, the first function and the second function are Extract as a resource capture function and resource release function pair.

開示するプログラム解析装置、プログラム解析方法およびプログラム解析プログラムは、分岐やループを含むソースコードからリソース捕捉関数とリソース解放関数のペアを抽出するという効果を奏する。   The disclosed program analysis device, program analysis method, and program analysis program have an effect of extracting a resource capture function and resource release function pair from source code including a branch and a loop.

図1は、本実施の形態におけるプログラム解析処理の概要について説明するための図である。FIG. 1 is a diagram for explaining an outline of a program analysis process in the present embodiment. 図2は、ソースコード中、関数fが複数回呼び出される場合の関数ペアの抽出手法について説明するための図である。FIG. 2 is a diagram for explaining a function pair extraction method when the function f is called a plurality of times in the source code. 図3は、本実施の形態におけるプログラム解析装置の構成の一例を示すブロック図である。FIG. 3 is a block diagram showing an example of the configuration of the program analysis apparatus according to the present embodiment. 図4は、本実施の形態におけるプログラム解析処理の流れの一例を示すフローチャートである。FIG. 4 is a flowchart showing an example of the flow of program analysis processing in the present embodiment. 図5は、ソースコード解析処理の流れの一例を示すフローチャートである。FIG. 5 is a flowchart showing an example of the flow of source code analysis processing. 図6は、プログラム解析装置の解析対象であるソースコードの一例を示す図である。FIG. 6 is a diagram illustrating an example of source code which is an analysis target of the program analysis apparatus. 図7は、図6のソースコードから作成したサブルーチン展開コードの例を示す図である。FIG. 7 is a diagram showing an example of a subroutine expansion code created from the source code of FIG. 図8は、図7のサブルーチン展開コードから抽出した関数の、全関数集合と全関数ペア集合とを示す図である。FIG. 8 is a diagram showing a full function set and a full function pair set of functions extracted from the subroutine expansion code of FIG. 図9は、ソースコードに含まれる分岐やループの構造を簡略化して示す図である。FIG. 9 is a diagram showing a simplified structure of branches and loops included in the source code. 図10は、実行パス生成処理を説明するための、非決定的実行パスのセットの一例を示す図である。FIG. 10 is a diagram illustrating an example of a set of non-deterministic execution paths for explaining the execution path generation processing. 図11は、実行パス生成処理を説明するための、ラベルパスのセットの一例を示す図である。FIG. 11 is a diagram illustrating an example of a set of label paths for explaining the execution path generation process. 図12は、実行パス生成処理においてループを1回実行して縮約実行パスを生成する場合について説明するための図である。FIG. 12 is a diagram for explaining a case where a reduced execution path is generated by executing a loop once in the execution path generation process. 図13は、実行パス生成処理においてループを2回実行して縮約実行パスを生成する場合について説明するための図である。FIG. 13 is a diagram for explaining a case where a reduced execution path is generated by executing a loop twice in the execution path generation process. 図14は、実行パス生成処理においてループを3回実行して縮約実行パスを生成する場合について説明するための図である。FIG. 14 is a diagram for explaining a case where a reduced execution path is generated by executing a loop three times in the execution path generation process. 図15は、実行パス生成処理においてループを4回実行して縮約実行パスを生成する場合について説明するための図である。FIG. 15 is a diagram for explaining a case where a reduced execution path is generated by executing a loop four times in the execution path generation process. 図16は、実行パス生成処理においてループを5回実行して縮約実行パスを生成する場合について説明するための図である。FIG. 16 is a diagram for explaining a case where a reduced execution path is generated by executing a loop five times in the execution path generation process. 図17は、実行パス生成処理においてループを6回実行して縮約実行パスを生成する場合について説明するための図である。FIG. 17 is a diagram for explaining a case where a reduced execution path is generated by executing a loop six times in the execution path generation process. 図18は、図12乃至図17に示す実行パス生成処理において生成される縮約実行パスを説明するための図である。FIG. 18 is a diagram for explaining the reduced execution path generated in the execution path generation process shown in FIGS. 12 to 17. 図19は、実施の形態に係る実行パス生成処理の流れの一例を示すフローチャートである。FIG. 19 is a flowchart illustrating an example of a flow of execution path generation processing according to the embodiment. 図20は、実施の形態に係る実行パス生成処理により生成され、実行パス記憶部に記憶される情報の構成の一例を示す図である。FIG. 20 is a diagram illustrating an example of a configuration of information generated by the execution path generation processing according to the embodiment and stored in the execution path storage unit. 図21は、実施の形態に係る関数ペア抽出処理の流れの一例を示すフローチャートである。FIG. 21 is a flowchart illustrating an exemplary flow of a function pair extraction process according to the embodiment. 図22は、開示の技術にかかるプログラム解析プログラムによる情報処理がコンピュータを用いて具体的に実現されることを示す図である。FIG. 22 is a diagram illustrating that information processing by the program analysis program according to the disclosed technique is specifically realized using a computer. 図23は、アプリケーションプログラムがリソースを管理して動的に捕捉および解放を行う場合について説明するための図である。FIG. 23 is a diagram for describing a case where the application program manages resources and dynamically captures and releases them.

以下に、開示する装置、方法およびプログラムの実施形態を図面に基づいて詳細に説明する。なお、この実施形態によりこの発明が限定されるものではない。また、各実施形態は適宜組み合わせることができる。   Hereinafter, embodiments of the disclosed apparatus, method, and program will be described in detail with reference to the drawings. In addition, this invention is not limited by this embodiment. Moreover, each embodiment can be combined suitably.

[リソースの初期化漏れの一例]
リソースを捕捉した後に解放漏れ(初期化誤り)が発生する例として、アプリケーションプログラムがリソースを管理して動的に捕捉および解放を行うような仕組みの場合が考えられる。例としては、システムと一定数のFAXボードが接続されている場合に、アプリケーションプログラムがFAXボードを操作するためにリソースを設けるような仕組みのプログラムを作成する場合が挙げられる。
[Example of missing resource initialization]
As an example in which release omission (initialization error) occurs after the resource is captured, a case where the application program manages the resource and dynamically captures and releases it can be considered. As an example, when a system and a certain number of FAX boards are connected, there is a case where an application program creates a program that provides resources for operating the FAX board.

図23は、アプリケーションプログラムがリソースを管理して動的に捕捉および解放を行う場合について説明するための図である。図23の例(1)の場合、アプリケーションプログラム(AP)が実行されると、最初に複数のリソース(M1〜M7)が生成される。そして、アプリケーションプログラムが実行される中で、最初に生成された複数のリソースの中から所定のリソースが捕捉されて使用され、使用後に解放される。たとえば、図23の例では、リソースM1からM4までが順に捕捉されて、それぞれ、値A,A,B,Aが書き込まれている。リソースM5,6,7は未使用であるため初期値となっている。   FIG. 23 is a diagram for describing a case where the application program manages resources and dynamically captures and releases them. In the case of the example (1) in FIG. 23, when the application program (AP) is executed, a plurality of resources (M1 to M7) are first generated. Then, while the application program is executed, a predetermined resource is captured and used from among a plurality of resources generated first, and released after use. For example, in the example of FIG. 23, resources M1 to M4 are captured in order, and values A, A, B, and A are written, respectively. Resources M5, 6 and 7 are initial values because they are unused.

図23の例(2)では、アプリケーションは、リソースM1からM7までを既に順番に使用し、再びリソースM1を使用しようとしている。このとき、リソースM1の1回目の使用が終了して初期化すべきところを、初期化されないままとなっていると、値Aが記憶された状態のままである。このように、リソース捕捉後にリソースの初期化を行うべきところ、初期化されないままとなっている状態をリソース初期化漏れの誤りという。かかるリソース初期化漏れの誤りが発生すると、前の処理によってリソースに書き込まれた内容がそのまま残った状態で次の処理が行われることになり、意図しない結果が生じてしまうことがある。   In the example (2) of FIG. 23, the application already uses the resources M1 to M7 in order, and tries to use the resource M1 again. At this time, if the first use of the resource M1 is completed and the place to be initialized remains uninitialized, the value A remains stored. As described above, when the resource should be initialized after the resource is captured, a state in which the resource is not initialized is referred to as a resource initialization omission error. When such an error in resource initialization omission occurs, the next process is performed with the content written in the resource by the previous process as it is, and an unintended result may occur.

以下に説明する実施形態では、このように同じ処理(リソースM1の捕捉、使用、解放)が繰り返し実行されるループを含むプログラムについて、独自に設定されたリソース捕捉関数とリソース解放関数のペアを抽出する。   In the embodiment described below, for a program including a loop in which the same process (capture, use, and release of the resource M1) is repeatedly executed, a pair of a resource capture function and a resource release function set independently is extracted. To do.

[実施形態に係るプログラム解析処理の流れ]
図1は、本実施の形態に係るプログラム解析処理の概要について説明するための図である。本実施の形態に係るプログラム解析装置は、ソースコードを解析して、ソースコードの中からリソース捕捉関数とリソース解放関数のペアを抽出する。具体的には、プログラム解析装置は、ソースコードの解析結果に基づき、所定の出現パタンに合致する関数のペアをリソース捕捉関数とリソース解放関数のペアとして抽出する。また、本実施形態に係るプログラム解析装置は、ソースコードに分岐やループが含まれることを前提として、ソースコード解析を実行した上で、リソース捕捉関数とリソース解放関数のペアを抽出する。
[Flow of Program Analysis Processing According to Embodiment]
FIG. 1 is a diagram for explaining an outline of a program analysis process according to the present embodiment. The program analysis apparatus according to the present embodiment analyzes a source code and extracts a pair of a resource capture function and a resource release function from the source code. Specifically, the program analysis device extracts a function pair that matches a predetermined appearance pattern as a resource capture function and resource release function pair based on the analysis result of the source code. Further, the program analysis apparatus according to the present embodiment extracts a resource capture function and resource release function pair after executing source code analysis on the assumption that the source code includes a branch or a loop.

図1を参照し、実施形態に係るプログラム解析処理において、プログラム解析装置は、まず、ソースコードの入力を受ける(図1の(1))。プログラム解析装置は、入力されるソースコードを解析して、ソースコード中に含まれる関数を抽出する。そして、プログラム解析装置は、ソースコードに含まれる関数全ての集合である全関数集合Fを生成する(図1の(2))。また、プログラム解析装置は、生成した全関数集合Fから、二つの関数のペアを抽出し、全関数ペア集合F×Fを生成する(図1の(3))。   Referring to FIG. 1, in the program analysis processing according to the embodiment, the program analysis apparatus first receives an input of source code ((1) in FIG. 1). The program analysis apparatus analyzes the input source code and extracts a function included in the source code. Then, the program analysis apparatus generates a total function set F that is a set of all the functions included in the source code ((2) in FIG. 1). Further, the program analysis apparatus extracts two function pairs from the generated total function set F to generate a total function pair set F × F ((3) in FIG. 1).

また、プログラム解析装置は、ソースコードを解析して、ソースコードに含まれる分岐やループ構造を抽出する(図1の(4))。プログラム解析装置は、分岐やループ構造を解析して、ソースコードを実行した場合に生じうる処理の流れを実行パスとして生成する。本実施の形態においては、ソースコード中に分岐やループが含まれるとき、当該分岐やループを実行した場合に処理がたどる可能性がある複数の実行パスの中から一つの実行パスが非決定的に実行されるものとみなす。以下、ソースコードを実行した場合に処理がたどる可能性がある複数の実行パスを非決定的実行パスと呼ぶ(図1の(5))。   Further, the program analysis apparatus analyzes the source code and extracts branches and loop structures included in the source code ((4) in FIG. 1). The program analysis device analyzes a branch or loop structure and generates a flow of processing that can occur when the source code is executed as an execution path. In the present embodiment, when a branch or loop is included in the source code, one execution path is determined nondeterministicly from a plurality of execution paths that can be processed when the branch or loop is executed. It is considered to be executed. Hereinafter, a plurality of execution paths that can be traced when the source code is executed are referred to as non-deterministic execution paths ((5) in FIG. 1).

プログラム解析装置は、(3)で生成した全関数ペア集合F×Fから1つの関数ペア(f,g)を抽出する。そして、プログラム解析装置は、非決定的実行パス中の関数ペア(f,g)の出現パタンがリソース捕捉関数とリソース解放関数について予測されるパタンに合致するか否かを判定する(図1の(6))。   The program analysis apparatus extracts one function pair (f, g) from the total function pair set F × F generated in (3). Then, the program analysis apparatus determines whether or not the appearance pattern of the function pair (f, g) in the non-deterministic execution path matches the pattern predicted for the resource capture function and the resource release function ((FIG. 1 ( 6)).

たとえば、リソース捕捉関数とリソース解放関数が使われる一般的なパタンとしては、リソース捕捉関数が呼び出されて、その結果がリソース格納変数に代入され、リソース格納変数を介してリソースが使われた後で、リソース解放関数が呼び出されるパタンがある。この場合、リソース捕捉関数が呼び出された後にリソース格納変数が参照される。リソース解放関数より後にリソース格納変数が参照されることはない。また、リソース捕捉関数が呼び出された後にリソース解放関数が呼び出されるが、リソース解放関数が2回以上呼び出されることはない。   For example, a common pattern in which resource capture and resource release functions are used is after a resource capture function is called, the result is assigned to a resource storage variable, and the resource is used through the resource storage variable. There is a pattern where the resource release function is called. In this case, the resource storage variable is referenced after the resource capture function is called. The resource storage variable is never referenced after the resource release function. Also, the resource release function is called after the resource capture function is called, but the resource release function is never called more than once.

ここで、関数ペア(f,g)が、リソース捕捉関数とリソース解放関数であると仮定する。すると、ソースコード中には、まずリソースを捕捉するために関数fの戻り値をリソース格納変数rに代入するコードが出現すると考えられる。次に、捕捉したリソースを使用するコードが出現し、最後に、関数gによってリソースを解放すると考えられる。すなわち、ソースコード中には、以下のようなコードが(1)〜(3)の順に出現すると予想される。   Here, it is assumed that the function pair (f, g) is a resource capture function and a resource release function. Then, in the source code, it is considered that a code for assigning the return value of the function f to the resource storage variable r first in order to capture the resource appears. Next, it appears that code that uses the captured resource appears and finally releases the resource by function g. That is, the following codes are expected to appear in the order of (1) to (3) in the source code.

(1)r=f()
(2)func(r)
(3)g(r)
つまり、関数ペア(f,g)がリソース捕捉関数とリソース解放関数のペアであれば、(1)のように関数fが出現すれば、その後常に(2)(3)が出現すると考えられる。なお以下、説明の便宜上、適宜(1)に対応するコードを「ALLOC」(略して「A」)、(2)に対応するコードを「USE」(略して「U」)、(3)に対応するコードを「FREE」(略して「F」)と呼ぶ。なお、以下の説明中、(2)のfunc(r)はsome_func(r)とも表記する。
(1) r = f ()
(2) func (r)
(3) g (r)
That is, if the function pair (f, g) is a pair of a resource capture function and a resource release function, if the function f appears as in (1), it is considered that (2) (3) always appears thereafter. In the following, for convenience of explanation, the code corresponding to (1) will be referred to as “ALLOC” (abbreviated as “A”), the code corresponding to (2) as “USE” (abbreviated as “U”), and (3). The corresponding code is called “FREE” (“F” for short). In the following description, func (r) in (2) is also expressed as some_func (r).

プログラム解析装置は、上の前提に基づき、生成した非決定的実行パス中に関数ペア(f,g)が、上記のパタンで出現するか否かを判定する。そして、プログラム解析装置は、関数ペア(f,g)が上記のパタンで出現する非決定的実行パスが存在する場合、関数ペア(f,g)をリソース捕捉関数とリソース解放関数のペアとして抽出する(図1の(7))。他方、いずれの非決定的実行パスにおいても関数ペア(f,g)が上記のパタンで出現しない場合、プログラム解析装置は、関数ペア(f,g)をリソース捕捉関数とリソース解放関数のペアとして抽出しない(図1の(8))。   Based on the above assumption, the program analysis apparatus determines whether or not the function pair (f, g) appears in the above pattern in the generated non-deterministic execution path. Then, when there is a non-deterministic execution path in which the function pair (f, g) appears in the above pattern, the program analysis apparatus extracts the function pair (f, g) as a pair of the resource capture function and the resource release function. ((7) in FIG. 1). On the other hand, if the function pair (f, g) does not appear in the above pattern in any non-deterministic execution path, the program analysis apparatus extracts the function pair (f, g) as a pair of the resource capture function and the resource release function. Not ((8) in FIG. 1).

プログラム解析装置は、全関数ペア集合F×Fに含まれるすべての関数ペアについて処理を繰り返すことで、ソースコードに含まれる関数ペアのうち、リソース捕捉関数とリソース解放関数のペアである可能性が高い関数ペアを抽出することができる。その後は、プログラム解析装置は、抽出した関数ペアを用いて任意の静的コード解析の手法を適用しソースコードをさらに解析することができる(図1の(9))。   The program analysis apparatus may repeat the processing for all function pairs included in the total function pair set F × F, so that the function analysis function may be a resource capture function and resource release function pair among the function pairs included in the source code. High function pairs can be extracted. Thereafter, the program analysis apparatus can further analyze the source code by applying an arbitrary static code analysis technique using the extracted function pair ((9) in FIG. 1).

なお、ソースコード中に関数fが呼び出される場合、戻り値が格納される変数は一つであるとは限らない。図2は、ソースコード中、関数fが複数回呼び出される場合の関数ペアの抽出手法について説明するための図である。図2の例では、ソースコード中、関数fは3回呼び出されている。そして、1回目に呼び出されたときには、関数fの戻り値は変数rに代入されている。また、2回目に呼び出されたときには、関数fの戻り値は変数r’に代入されている。また、3回目に呼び出されたときには、関数fの戻り値は変数r”に代入されている。この場合には、関数(f,g)がリソース捕捉関数とリソース解放関数のペアであるか否かを判断するにあたり、プログラム解析装置はまず、変数rに対応する処理について非決定的実行パスを生成する(図2の(1))。そして、プログラム解析装置は、生成した非決定的実行パスのうち、上記パタン「A−U−F」に対応する実行パスがあるか否かを判定する。図2の例では、プログラム解析装置は、パタン「A−U−F」に対応する実行パスあり(「条件に合致」)と判定する(図2の(2))。次に、プログラム解析装置は、変数r’に対応する処理について非決定的実行パスを生成する(図2の(3))。そして、プログラム解析装置は、生成した非決定的実行パスのうち、上記パタン「A−U−F」に対応する実行パスがあるか否かを判定する。図2の例では、プログラム解析装置は、パタン「A−U−F」に対応する実行パスあり(「条件に合致」)と判定する(図2の(4))。最後に、プログラム解析装置は変数r”に対応する処理について非決定的実行パスを生成する(図2の(5))。そして、プログラム解析装置は、生成した非決定的実行パスのうち、上記パタン「A−U−F」に対応する実行パスがあるか否かを判定する。図2の例では、プログラム解析装置は、パタン「A−U−F」に対応する実行パスあり(「条件に合致」)と判定する(図2の(6))。そして、プログラム解析装置は、すべての変数に対応する非決定的実行パスの中に少なくとも一つ、パタン「A−U−F」に合致する実行パスが存在する場合、関数ペア(f,g)はリソース捕捉関数とリソース解放関数のペアであると判定する(図2の(7))。このように複数の変数に対応する関数ペア(f,g)の出現パタンに基づいてリソース捕捉関数とリソース解放関数のペアであるか否かを判定することで、判定精度をさらに向上させることができる。   Note that when the function f is called in the source code, the variable for storing the return value is not necessarily one. FIG. 2 is a diagram for explaining a function pair extraction method when the function f is called a plurality of times in the source code. In the example of FIG. 2, the function f is called three times in the source code. When called for the first time, the return value of the function f is assigned to the variable r. When called for the second time, the return value of the function f is assigned to the variable r '. When called for the third time, the return value of the function f is assigned to the variable r ″. In this case, whether or not the function (f, g) is a pair of a resource capture function and a resource release function. In determining whether or not, the program analysis apparatus first generates a non-deterministic execution path for the process corresponding to the variable r ((1) in FIG. 2). Then, it is determined whether or not there is an execution path corresponding to the pattern “AUF”. In the example of FIG. 2, the program analyzing apparatus determines that there is an execution path corresponding to the pattern “AUF” (“matches the condition”) ((2) in FIG. 2). Next, the program analysis apparatus generates a nondeterministic execution path for the process corresponding to the variable r ′ ((3) in FIG. 2). Then, the program analysis apparatus determines whether there is an execution path corresponding to the pattern “AUF” among the generated non-deterministic execution paths. In the example of FIG. 2, the program analysis apparatus determines that there is an execution path corresponding to the pattern “AUF” (“matches the condition”) ((4) in FIG. 2). Finally, the program analysis apparatus generates a non-deterministic execution path for the process corresponding to the variable r ″ ((5) in FIG. 2). Then, the program analysis apparatus includes the pattern “ It is determined whether or not there is an execution path corresponding to “A-U-F”. In the example of FIG. 2, the program analysis apparatus determines that there is an execution path corresponding to the pattern “AUF” (“matches the condition”) ((6) in FIG. 2). The program analysis apparatus, when there is at least one execution path that matches the pattern “AUF” among the nondeterministic execution paths corresponding to all variables, the function pair (f, g) is It is determined that the resource capture function is a pair of the resource release function ((7) in FIG. 2). Thus, the determination accuracy can be further improved by determining whether or not the resource capture function and the resource release function are paired based on the appearance pattern of the function pair (f, g) corresponding to a plurality of variables. it can.

[プログラム解析装置の構成の一例]
図3は、本実施の形態に係るプログラム解析装置1の構成の一例を示すブロック図である。
[Example of the configuration of the program analysis device]
FIG. 3 is a block diagram showing an example of the configuration of the program analysis apparatus 1 according to the present embodiment.

図3に示すプログラム解析装置1は、入力部10と、制御部20と、記憶部30と、出力部40と、を備える。   The program analysis apparatus 1 illustrated in FIG. 3 includes an input unit 10, a control unit 20, a storage unit 30, and an output unit 40.

入力部10は、情報の入力を受け付ける処理部である。たとえば、入力部10は、プログラム解析装置1の解析対象となるソースコードの入力を受け付ける。後述する例においては、C言語のソースコードを説明する。ただし、本実施の形態のプログラム解析方法は、C言語のみに限らず他のプログラミング言語にも適用できる。   The input unit 10 is a processing unit that receives input of information. For example, the input unit 10 receives input of source code to be analyzed by the program analysis apparatus 1. In an example described later, C language source code will be described. However, the program analysis method of this embodiment can be applied not only to the C language but also to other programming languages.

制御部20は、プログラム解析装置1を制御する。制御部20はたとえば、CPU(Central Processing Unit)、MPU(Micro Processing Unit)や、ASIC(Application Specific Integrated Circuit)等で構成することができる。制御部20は、解析部21、生成部22、および抽出部23を備える。   The control unit 20 controls the program analysis device 1. The control unit 20 can be configured by, for example, a CPU (Central Processing Unit), an MPU (Micro Processing Unit), an ASIC (Application Specific Integrated Circuit), or the like. The control unit 20 includes an analysis unit 21, a generation unit 22, and an extraction unit 23.

解析部21は、入力部10が入力を受付けたソースコードを解析する。具体的には、解析部21は、ソースコード中でサブルーチン呼出し(関数呼出し)している箇所に、そのサブルーチン(関数)の定義コードを書き足してサブルーチン展開コードを作成し、サブルーチン展開コードの各行について、関数呼出しをしているか、関数の返却値を格納する変数はなにか、関数の引数はなにか、分岐しているか、分岐後の合流地点はどこか、利用されている変数はなにか、などの情報を解析する。解析部21による処理は、特願2015−156945号に記載の処理と同様である。   The analysis unit 21 analyzes the source code received by the input unit 10. Specifically, the analysis unit 21 creates a subroutine expansion code by adding the definition code of the subroutine (function) to the location where the subroutine is called (function call) in the source code, and generates each subroutine expansion code line. Is a function call, what is the variable that stores the return value of the function, what is the argument of the function, whether it is branched, where is the merge point after the branch, what variable is being used, etc. Analyze information. The processing by the analysis unit 21 is the same as the processing described in Japanese Patent Application No. 2015-156945.

解析部21はまた、ソースコードに含まれる関数を抽出して全関数集合Fおよび全関数ペア集合F×Fを作成する。   The analysis unit 21 also extracts a function included in the source code and creates a full function set F and a full function pair set F × F.

生成部22は、解析部21の解析結果を基に実行パスを生成する。実行パスは、ソースコードの処理の流れを表す。生成部22は、解析結果に基づき、ソースコード中の分岐やループを展開して、可能性がある複数の実行パス(非決定的実行パス)を生成する。たとえば、図1の(4)の例には、ループ構造と分岐を含む処理の流れが示されている。生成部22はたとえば、図1の(4)の場合、ループ内を1回実行する以下のような非決定的実行パスを生成する。
(1)1−2−3−4−11
(2)1−2−5−6−11
(3)1−2−7−8−11
(4)1−2−9−10−11
The generation unit 22 generates an execution path based on the analysis result of the analysis unit 21. The execution path represents the flow of source code processing. The generation unit 22 expands branches and loops in the source code based on the analysis result, and generates a plurality of possible execution paths (non-deterministic execution paths). For example, the example of (4) in FIG. 1 shows a flow of processing including a loop structure and a branch. For example, in the case of (4) in FIG. 1, the generation unit 22 generates the following nondeterministic execution path that is executed once in the loop.
(1) 1-2-3-4-11
(2) 1-2-5-6-11
(3) 1-2-7-8-11
(4) 1-2-9-10-11

生成部22はさらに、非決定的実行パスの処理のうち、上記「ALLOC」、「USE」、「FREE」のいずれかに合致する処理のみを抽出したラベルパスを生成する。たとえば、上の例で、「2」が「ALLOC」に合致し、「7」と「10」が「USE」に合致し、「8」が「FREE」に合致したとする。この場合、生成部22は、上の非決定的実行パスから以下のようなラベルパスを生成する。
(1)A
(2)A
(3)A−U−F
(4)A−U
The generation unit 22 further generates a label path in which only processes that match any of the above-mentioned “ALLOC”, “USE”, and “FREE” are extracted from the non-deterministic execution path processes. For example, in the above example, “2” matches “ALLOC”, “7” and “10” match “USE”, and “8” matches “FREE”. In this case, the generation unit 22 generates the following label path from the above nondeterministic execution path.
(1) A
(2) A
(3) AUF
(4) AU

生成部22はさらに、ラベルパスのうち、リソース捕捉関数とリソース解放関数のペアの判定に影響しないパタンを捨象して、縮約実行パスを生成する。縮約実行パスの生成手法については、後で詳述する。さらに、生成部22は、生成した縮約実行パスに同じパスが複数含まれている場合、重複がなくなるよう調整する。   The generation unit 22 further generates a contracted execution path by discarding patterns that do not affect the determination of the pair of the resource capture function and the resource release function in the label path. A method for generating the contracted execution path will be described in detail later. Further, the generation unit 22 adjusts so that there is no duplication when the generated contracted execution path includes a plurality of the same paths.

生成部22は、ループ内を複数回実行する場合についても同様の処理を繰り返し、ループ内をn回実行した場合に生成される縮約実行パスと、ループ内をn+1回実行した場合に生成される縮約実行パスとが同一となった時点で実行パス生成処理を終了する。   The generation unit 22 repeats the same processing for a case where the inside of the loop is executed a plurality of times, and is generated when the reduced execution path generated when the inside of the loop is executed n times and the inside of the loop is executed n + 1 times. When the contracted execution path becomes the same, the execution path generation process ends.

生成部22による非決定実行パス、ラベルパスおよび縮約実行パスの生成処理(実行パス生成処理)についてはさらに詳しく後述する。なお、本明細書で「実行パス」とは、ソースコードが含む各処理について可能性がある実行順序を示す情報である。また、「実行パス」は、「非決定的実行パス」、「ラベルパス」、「縮約実行パス」を含む概念であるとする。「非決定的実行パス」は、各処理について可能性がある実行順序を全ての処理について表示し、実際のソースコードの実行時には非決定的実行パスのうち1のパスが実行される。「ラベルパス」は、「非決定的実行パス」に含まれる各処理のうち、「A」「U」「F」に対応づけられる処理のみを表示する。同じ非決定的実行パスに基づいてラベルパスを生成する場合でも、「A」「U」「F」に対応づけられる関数ペアによって異なるラベルパスが生成される。「縮約実行パス」は、「ラベルパス」のうち、リソース捕捉関数とリソース解放関数の判定上、捨象可能な「A」「U」「F」の並び部分を削除したものである。   The non-determined execution path, label path, and contracted execution path generation process (execution path generation process) by the generation unit 22 will be described in more detail later. In this specification, “execution path” is information indicating a possible execution order for each process included in the source code. The “execution path” is a concept including “non-deterministic execution path”, “label path”, and “reduced execution path”. “Non-deterministic execution path” displays a possible execution order for each process for all processes, and one of the non-deterministic execution paths is executed when the actual source code is executed. “Label path” displays only the processes associated with “A”, “U”, and “F” among the processes included in the “non-deterministic execution path”. Even when a label path is generated based on the same non-deterministic execution path, different label paths are generated depending on the function pairs associated with “A”, “U”, and “F”. The “reduction execution path” is obtained by deleting the arrangement part of “A”, “U”, and “F” that can be discarded in the determination of the resource capture function and the resource release function in the “label path”.

抽出部23は、生成部22が生成した関数ペア(f,g)および変数rについての実行パスが、関数ペア(f,g)および変数rについてパタン「A−U−F」を含むか否かを判定する。抽出部23はまた、同じ関数ペア(f,g)と他の変数r1についての実行パスが、関数ペア(f,g)および変数r1についてパタン「A−U−F」を含むか否かを判定する。抽出部23は、呼び出された関数fの戻り値が格納されている変数が複数ある場合は、全ての変数に対応する実行パスについて同様の判定を行う。そして、抽出部23は、関数fの戻り値を格納する全ての変数について「A−U−F」を含む実行パスが一以上あれば、関数ペア(f,g)をリソース捕捉関数とリソース解放関数のペアとして抽出する。抽出部23による抽出処理についても後でさらに詳述する。   The extraction unit 23 determines whether the execution path for the function pair (f, g) and the variable r generated by the generation unit 22 includes the pattern “AUF” for the function pair (f, g) and the variable r. Determine whether. The extraction unit 23 also determines whether or not the execution paths for the same function pair (f, g) and the other variable r1 include the pattern “A-U-F” for the function pair (f, g) and the variable r1. judge. When there are a plurality of variables in which the return value of the called function f is stored, the extraction unit 23 performs the same determination for the execution paths corresponding to all the variables. Then, if there is at least one execution path including “AUF” for all variables storing the return value of the function f, the extraction unit 23 releases the function pair (f, g) as a resource capture function and a resource release. Extract as function pairs. The extraction process by the extraction unit 23 will be described in detail later.

記憶部30は、プログラム解析装置1における各部の処理に使用する情報や、各部の処理によって生成される情報を記憶する。記憶部30はたとえば、ハードディスク、光ディスク等の記憶装置でもよい。また、記憶部30は、RAM(Random Access Memory)やフラッシュメモリ等の半導体メモリであってもよい。   The storage unit 30 stores information used for processing of each unit in the program analysis device 1 and information generated by the processing of each unit. The storage unit 30 may be a storage device such as a hard disk or an optical disk. The storage unit 30 may be a semiconductor memory such as a RAM (Random Access Memory) or a flash memory.

記憶部30は、ソースコード記憶部31と、サブルーチン展開コード記憶部32と、関数記憶部33と、実行パス記憶部34と、関数ペア集合記憶部35と、を備える。   The storage unit 30 includes a source code storage unit 31, a subroutine expansion code storage unit 32, a function storage unit 33, an execution path storage unit 34, and a function pair set storage unit 35.

ソースコード記憶部31は、入力部10が入力を受付けたソースコードを記憶する。サブルーチン展開コード記憶部32は、解析部21がソースコードから作成したサブルーチン展開コードを記憶する。関数記憶部33は、解析部21がサブルーチン展開コードから抽出した全関数集合Fおよび全関数ペア集合F×Fを記憶する。実行パス記憶部34は、生成部22が生成した実行パスを記憶する。関数ペア集合記憶部35は、抽出部23による処理の結果得られる関数ペア集合すなわちリソース捕捉関数とリソース解放関数のペアと判定された関数ペアを記憶する。   The source code storage unit 31 stores the source code received by the input unit 10. The subroutine expansion code storage unit 32 stores the subroutine expansion code created by the analysis unit 21 from the source code. The function storage unit 33 stores the full function set F and the full function pair set F × F extracted by the analysis unit 21 from the subroutine expansion code. The execution path storage unit 34 stores the execution path generated by the generation unit 22. The function pair set storage unit 35 stores a function pair set obtained as a result of processing by the extraction unit 23, that is, a function pair determined as a resource capture function and resource release function pair.

なお、記憶部30の各部に記憶されるソースコード、サブルーチン展開コード、関数、実行パス、関数ペア集合の詳細については後述する。ただし、記憶部30の各部に記憶されるソースコードおよびサブルーチン展開コードは、特願2015−156945号に記載のソースコードおよびサブルーチン展開コードと同様である。また、記憶部30は、特願2015−156945号に記載の制御フローグラフや解析結果も記憶するように構成してもよい。   Details of the source code, subroutine expansion code, function, execution path, and function pair set stored in each unit of the storage unit 30 will be described later. However, the source code and subroutine expanded code stored in each part of the storage unit 30 are the same as the source code and subroutine expanded code described in Japanese Patent Application No. 2015-156945. The storage unit 30 may also be configured to store the control flow graph and analysis results described in Japanese Patent Application No. 2015-156945.

出力部40は、プログラム解析装置1による処理の結果、取得される情報を出力する。出力部40はたとえば、抽出部23が抽出する関数ペアを、視認可能な形式で出力する。出力部40は、モニタ等の表示部またはプリンタ等と接続され表示部またはプリンタ等に情報を出力するように構成してもよく、出力部40が表示部またはプリンタ等を備えるように構成してもよい。   The output unit 40 outputs information acquired as a result of processing by the program analysis apparatus 1. For example, the output unit 40 outputs the function pair extracted by the extraction unit 23 in a visually recognizable format. The output unit 40 may be configured to be connected to a display unit such as a monitor or a printer and output information to the display unit or the printer. The output unit 40 may be configured to include a display unit or a printer. Also good.

[プログラム解析処理の流れの一例]
次に、本実施の形態におけるプログラム解析装置1の動作について説明する。
[Example of program analysis processing flow]
Next, the operation of the program analysis apparatus 1 in the present embodiment will be described.

図4は、本実施の形態におけるプログラム解析処理の流れの一例を示すフローチャートである。   FIG. 4 is a flowchart showing an example of the flow of program analysis processing in the present embodiment.

入力部10は、解析対象のソースコードの入力を受け付ける(ステップS1)。   The input unit 10 receives input of the source code to be analyzed (step S1).

解析部21は、ソースコードを解析する(ソースコード解析処理、ステップS2)。ソースコードの解析処理については後述する。   The analysis unit 21 analyzes the source code (source code analysis process, step S2). The source code analysis process will be described later.

生成部22は、ソースコードの解析結果を基に、実行パスを生成する(実行パス生成処理、ステップS3)。実行パス生成処理の詳細については後述する。   The generation unit 22 generates an execution path based on the analysis result of the source code (execution path generation process, step S3). Details of the execution path generation processing will be described later.

そして、抽出部23は、生成部22による処理結果に基づき、リソース捕捉関数とリソース解放関数の出現パタンに合致する関数ペアを抽出する(関数ペア抽出処理、ステップS4)。関数ペア抽出処理の詳細については後述する。   Then, the extraction unit 23 extracts a function pair that matches the appearance pattern of the resource capture function and the resource release function based on the processing result by the generation unit 22 (function pair extraction process, step S4). Details of the function pair extraction process will be described later.

出力部40は、抽出部23が抽出した結果(関数ペア)を出力する(ステップS5)。   The output unit 40 outputs the result (function pair) extracted by the extraction unit 23 (step S5).

これでプログラム解析装置1によるプログラム解析処理が終了する。   Thus, the program analysis process by the program analysis apparatus 1 is completed.

[ソースコード解析処理の流れの一例]
次に、ソースコード解析処理(図4のステップS2に対応)について説明する。なお、以下に説明する本実施の形態におけるソースコード解析処理は、特願2015−156945号に記載の解析処理と同様である。ただし、本実施の形態では、解析部21は関数一覧(全関数集合Fと同様)に代えて、全関数集合Fおよび全関数ペア集合F×Fを作成する点が異なる。
[Example of source code analysis processing flow]
Next, source code analysis processing (corresponding to step S2 in FIG. 4) will be described. Note that the source code analysis processing in the present embodiment described below is the same as the analysis processing described in Japanese Patent Application No. 2015-156945. However, the present embodiment is different in that the analysis unit 21 creates a full function set F and a full function pair set F × F instead of the function list (similar to the full function set F).

図5は、ソースコード解析処理の流れの一例を示すフローチャートである。図6は、プログラム解析装置1の解析対象であるソースコードの一例を示す図である。以下では、図6に示すソースコードを入力した具体例とともにソースコードの解析処理を説明する。   FIG. 5 is a flowchart showing an example of the flow of source code analysis processing. FIG. 6 is a diagram illustrating an example of source code that is an analysis target of the program analysis apparatus 1. Below, the analysis process of a source code is demonstrated with the specific example which input the source code shown in FIG.

解析部21は、入力部10が入力したソースコードからサブルーチン展開コードを作成する(ステップS21)。作成されたサブルーチン展開コードは、サブルーチン展開コード記憶部32に記憶される。図7に、図6のソースコードから作成したサブルーチン展開コードの例を示す。図7の例では、解析部21は、main関数から呼び出されているfinish関数とabort_program関数のソースコードを呼び出した箇所の下に展開して追記している。解析部21は、さらにfinish関数から呼び出されているabort_program関数も展開して追記している。具体的には、符号101A,101Bで示す箇所にabort_program関数を展開し、符号102で示す箇所にfinish関数を展開した。符号101Bで示す箇所に展開したabort_program関数はfinish関数から呼び出されたものである。   The analysis unit 21 creates a subroutine development code from the source code input by the input unit 10 (step S21). The created subroutine development code is stored in the subroutine development code storage unit 32. FIG. 7 shows an example of a subroutine expansion code created from the source code of FIG. In the example of FIG. 7, the analysis unit 21 expands and appends the source code of the finish function and abort_program function called from the main function under the location where the source code is called. The analysis unit 21 also expands and adds an abort_program function called from the finish function. Specifically, the abort_program function is expanded at the locations indicated by reference numerals 101A and 101B, and the finish function is expanded at the location indicated by reference numeral 102. The abort_program function developed at the position indicated by reference numeral 101B is called from the finish function.

サブルーチン展開コードでは、関数を展開した箇所の行番号として、呼出し元の行番号に元々のソースコードの行番号を付与した行番号(以下、「コールスタック付き行番号」と称する。)を付与する。例えば、符号101Aで示した箇所のabort_program関数は、main関数の9行目で呼び出されており、abort_program関数は、図6のソースコードの25−27行目に記述されているので、9行目に展開したabort_program関数の各行に行番号9−25,9−26,9−27を付与する。別の例では、符号102で示した箇所のfinish関数はmain関数の13行目で呼び出されており、符号101Bで示した箇所のabort_program関数はfinish関数の24行目で呼び出されているので、符号101Bで示した箇所のabort_program関数の各行に行番号13−24−25,13−24−26,13−24−27を付与する。なお、サブルーチン(関数)の定義が得られない場合は定義コードは書き足さない。   In the subroutine expansion code, the line number obtained by adding the line number of the original source code to the call source line number (hereinafter referred to as “line number with call stack”) is assigned as the line number of the location where the function is expanded. . For example, the abort_program function at the position indicated by reference numeral 101A is called on the ninth line of the main function, and the abort_program function is described on the 25th to 27th lines of the source code in FIG. Line numbers 9-25, 9-26, and 9-27 are assigned to the lines of the abort_program function expanded in FIG. In another example, the finish function indicated by reference numeral 102 is called on the 13th line of the main function, and the abort_program function indicated by reference numeral 101B is called on the 24th line of the finish function. Line numbers 13-24-25, 13-24-26, and 13-24-27 are assigned to each line of the abort_program function at the location indicated by reference numeral 101B. If the definition of the subroutine (function) cannot be obtained, the definition code is not added.

続いて、解析部21は、サブルーチン展開コードから関数を抽出して全関数集合Fを作成する(ステップS22)。作成した全関数集合Fは、関数記憶部33に記憶される。図8の(A)に、図7のサブルーチン展開コードから抽出した全関数集合Fを示す。解析部21は、抽出した関数に関数ID(Identifier)を付与する。図8は、図7のサブルーチン展開コードから抽出した関数の、全関数集合と全関数ペア集合とを示す図である。図8の(A)の例に示すように、関数記憶部33は、関数IDに対応付けて各関数名を記憶する。   Subsequently, the analysis unit 21 extracts a function from the subroutine expansion code and creates a total function set F (step S22). The created all function set F is stored in the function storage unit 33. FIG. 8A shows the entire function set F extracted from the subroutine expansion code of FIG. The analysis unit 21 assigns a function ID (Identifier) to the extracted function. FIG. 8 is a diagram showing a full function set and a full function pair set of functions extracted from the subroutine expansion code of FIG. As shown in the example of FIG. 8A, the function storage unit 33 stores each function name in association with the function ID.

解析部21はまた、作成した全関数集合Fに基づき、全関数ペア集合F×Fを作成する。図8の(B)に、全関数集合Fから作成された全関数ペア集合F×Fの例を示す。図8の(B)に示すように、関数記憶部33は、各関数ペアに対して付与したペアIDに対応付けて、当該関数ペアに含まれる関数の関数IDを記憶する。   The analysis unit 21 also creates a full function pair set F × F based on the created full function set F. FIG. 8B shows an example of a total function pair set F × F created from the total function set F. As shown in FIG. 8B, the function storage unit 33 stores the function ID of the function included in the function pair in association with the pair ID assigned to each function pair.

[実行パス生成処理の一例]
次に、生成部22による実行パス生成処理(図4のステップS3に対応)について説明する。
[Example of execution path generation processing]
Next, execution path generation processing (corresponding to step S3 in FIG. 4) by the generation unit 22 will be described.

ソースコード中にループが含まれている場合、可能性がある実行パスを作成していくと無限に実行パスが作成される、という問題がある。この問題について、図9を参照して説明する。図9は、ソースコードに含まれる分岐やループの構造を簡略化して示す図である。   When a loop is included in the source code, there is a problem in that an execution path is created infinitely when a possible execution path is created. This problem will be described with reference to FIG. FIG. 9 is a diagram showing a simplified structure of branches and loops included in the source code.

[非決定的実行パスの生成]
図9に示すような分岐とループ構造を含むソースコードから非決定的実行パスを作成する場合を考える。図9の例を、ループ内を1回実行すると仮定して展開すると、以下の非決定的実行パスが得られる。
(1)1−2−3−4−11
(2)1−2−5−6−11
(3)1−2−7−8−11
(4)1−2−9−10−11
[Generate nondeterministic execution path]
Consider a case where a non-deterministic execution path is created from source code including a branch and loop structure as shown in FIG. When the example of FIG. 9 is expanded assuming that the inside of the loop is executed once, the following nondeterministic execution path is obtained.
(1) 1-2-3-4-11
(2) 1-2-5-6-11
(3) 1-2-7-8-11
(4) 1-2-9-10-11

さらにループ内を2回実行すると仮定して展開すると、たとえば以下の非決定的実行パスが得られる。
(5)1−2−3−4−2−3−4−11
(6)1−2−3−4−2−5−6−11
(7)1−2−3−4−2−7−8−11
(8)1−2−3−4−2−9−10−11
ループ内を2回実行する場合、上の(5)〜(8)に加え、分岐内の処理順序によってさらに12通りの非決定的実行パスが得られる。
Further, if it is expanded assuming that the inside of the loop is executed twice, for example, the following nondeterministic execution path is obtained.
(5) 1-2-3-4-2-3-4-11
(6) 1-2-3-4-2-5-6-11
(7) 1-2-3-4-2-7-8-11
(8) 1-2-3-4-2-9-10-11
When the inside of the loop is executed twice, in addition to the above (5) to (8), 12 further non-deterministic execution paths are obtained depending on the processing order in the branch.

さらにループ内の実行回数を3回、4回と増やしていくと、ループ内の実行回数を無限に増加させることができるため、非決定的実行パスが無限に増加する。   Furthermore, if the number of executions in the loop is increased to 3 times and 4 times, the number of executions in the loop can be increased infinitely, so the nondeterministic execution path increases infinitely.

[ラベルパスの生成]
しかし、本実施の形態に係るプログラム解析装置1では、リソース捕捉関数とリソース解放関数のペアの抽出を目的とするため、ペア抽出に関連しない情報の生成は省略することができる。たとえば、分岐とループ構造を含むソースコードから非決定的実行パスを作成した結果、図10に示す非決定的実行パスが得られたとする。図10は、実行パス生成処理を説明するための、非決定的実行パスのセットの一例を示す図である。
[Generate label path]
However, since the program analysis apparatus 1 according to the present embodiment aims to extract a resource capture function and resource release function pair, generation of information not related to pair extraction can be omitted. For example, assume that a nondeterministic execution path shown in FIG. 10 is obtained as a result of creating a nondeterministic execution path from source code including a branch and loop structure. FIG. 10 is a diagram illustrating an example of a set of non-deterministic execution paths for explaining the execution path generation processing.

そして、プログラム解析装置1が、図10の非決定的実行パスのセットに基づいて、関数fと関数gが、リソース捕捉関数とリソース解放関数のペアであるか否かを判定すると仮定する。この場合、プログラム解析装置1は、非決定的実行パスが、関数f、変数r、関数gを次の順序で含むか否かを判定する。
(1)r=f()
(2)some_func(r)
(3)g(r)
とすると、非決定的実行パスに基づきリソース捕捉関数とリソース解放関数のペアを抽出するためには、非決定的実行パスに含まれる上記(1)、(2)、(3)の情報があればよい。
Then, it is assumed that the program analysis apparatus 1 determines whether or not the function f and the function g are a pair of a resource capture function and a resource release function based on the set of nondeterministic execution paths in FIG. In this case, the program analysis apparatus 1 determines whether or not the nondeterministic execution path includes the function f, the variable r, and the function g in the following order.
(1) r = f ()
(2) some_func (r)
(3) g (r)
Then, in order to extract a pair of a resource capture function and a resource release function based on a non-deterministic execution path, the information of (1), (2), and (3) included in the non-deterministic execution path is sufficient. .

たとえば、図10の例では、上記(1)を「A」、(2)を「U」、(3)を「F」で表示する。1番目の非決定的実行パスは、「A」のみを含む。2番目の非決定的実行パスは、「A」「F」「F」を含む。このように、各非決定的実行パスから「A」「U」「F」の情報のみを抽出すると、図11に示すラベルパスを得ることができる。図11は、実行パス生成処理を説明するための、ラベルパスのセットの一例を示す図である。図10の一番目の非決定的実行パスは、「A」、「U」、「F」のうち、「A」しか含まないため、ラベルパスは「A」となる。また、図10の2番目の非決定的実行パスは「A,F,F」、3番目の非決定的実行パスは「A,F,F」、4番目の非決定的実行パスは、「A,U,F」、5番目の非決定的実行パスは「A,F,F,F」とあらわすことができる。リソース捕捉関数とリソース解放関数のペアの抽出に関係する情報のみを抽出することで、図11に示すように非決定的実行パスを短縮することができる。このように、リソース捕捉関数とリソース解放関数のペアであるか否かの判定対象となる関数(f,g)と関数f()の戻り値が代入される変数rを特定し、上記(1)〜(3)に該当する処理のみを非決定的実行パスから抽出して作成した実行パスを、ラベルパスと呼ぶ。   For example, in the example of FIG. 10, the above (1) is displayed as “A”, (2) as “U”, and (3) as “F”. The first non-deterministic execution path includes only “A”. The second non-deterministic execution path includes “A”, “F”, and “F”. Thus, by extracting only the information “A”, “U”, and “F” from each non-deterministic execution path, the label path shown in FIG. 11 can be obtained. FIG. 11 is a diagram illustrating an example of a set of label paths for explaining the execution path generation process. Since the first non-deterministic execution path in FIG. 10 includes only “A” among “A”, “U”, and “F”, the label path is “A”. Further, the second non-deterministic execution path in FIG. 10 is “A, F, F”, the third non-deterministic execution path is “A, F, F”, and the fourth non-deterministic execution path is “A, U”. , F ”and the fifth non-deterministic execution path can be expressed as“ A, F, F, F ”. By extracting only the information related to the extraction of the pair of the resource capture function and the resource release function, the non-deterministic execution path can be shortened as shown in FIG. As described above, the function (f, g) to be determined as to whether or not it is a pair of the resource capture function and the resource release function and the variable r to which the return value of the function f () is assigned are specified, and the above (1 The execution path created by extracting only the processes corresponding to (3) to (3) from the non-deterministic execution path is called a label path.

[縮約実行パスの生成]
しかし、ラベルパスを生成しただけでは、非決定的実行パスを短縮することはできるが、判定対象の実行パスが無限に増加するという問題は解消されない。そこで、生成部22は、次に、ラベルパスを所定の条件に基づき縮約すなわち短くする。本実施の形態では、以下の3つを縮約のための所定の条件、縮約ルールとする。
(1)「F」が3回以上出現する場合、2回目の「F」の出現より後のラベルパスは削除する。
(2)「A」の後に「U」が2回以上出現する場合、2回目以降の「U」は削除する。
(3)「F」の後に「U」が2回以上出現する場合、2回目以降の「U」は削除する。
[Generate reduced execution path]
However, only by generating a label path, the nondeterministic execution path can be shortened, but the problem that the execution path to be determined increases indefinitely cannot be solved. Therefore, the generation unit 22 next reduces or shortens the label path based on a predetermined condition. In the present embodiment, the following three are defined as a predetermined condition for reduction and a reduction rule.
(1) When “F” appears three times or more, the label path after the second occurrence of “F” is deleted.
(2) When “U” appears more than once after “A”, “U” after the second time is deleted.
(3) When “U” appears more than once after “F”, “U” after the second time is deleted.

まず、上記縮約ルール(1)について説明する。「F」はリソース解放関数に対応する。リソース解放は、リソースが捕捉され使用された後に1回実行すればよく、同じリソースを捕捉されていないのに何度も解放する必要はない。したがって、「A」が1回出現した後に「F」が何度も出現する場合、「F」はリソース捕捉関数ではない、と推定される。プログラム解析装置1は、実行パスが「A,U,F」のパタンに合致するか否かを判定する。たとえば、プログラム解析装置1は、「A,U,F,F」も「A,U,F,F,F」も、「A,U,F」に合致しないと判定する。したがって、プログラム解析装置1が判定対象とする情報としては、実行パス「A,U,F,F,F」は「A,U,F,F」に包含することができる。したがって、プログラム解析装置1は、ラベルパス「A,U,F,F,F」を縮約実行パス「A,U,F,F」に縮約する。このように、プログラム解析装置1は、ラベルパス中、1つの「A」の後、「F」が3回以上出現した場合、2回目の「F」より後のラベルパス(この場合は3回目の「F」)を削除する。   First, the contraction rule (1) will be described. “F” corresponds to a resource release function. Resource release only needs to be performed once after the resource is captured and used, and does not need to be released many times even though the same resource is not captured. Therefore, if “F” appears many times after “A” appears once, it is estimated that “F” is not a resource capture function. The program analysis apparatus 1 determines whether or not the execution path matches the pattern “A, U, F”. For example, the program analysis apparatus 1 determines that neither “A, U, F, F” nor “A, U, F, F, F” matches “A, U, F”. Therefore, as information to be determined by the program analysis apparatus 1, the execution path “A, U, F, F, F” can be included in “A, U, F, F”. Therefore, the program analysis apparatus 1 reduces the label path “A, U, F, F, F” to the reduced execution path “A, U, F, F”. In this way, the program analysis apparatus 1 allows the label path after the second “F” (in this case, the third “F”) when “F” appears three times or more after one “A” in the label path. F ") is deleted.

次に、縮約ルール(2)について説明する。「A」がリソース捕捉関数であるとすると、捕捉したリソースは「A」の後解放されるまで何度でも使用することができる。したがって、「A」の後の「U」の出現回数にはプログラム解析装置1による判定上意味はなく、少なくとも1度「U」が出現すればよい。そこで、「A」の後、2回以上「U」が出現した場合、2回目以降の「U」は削除する。たとえば、「A,U,U」というラベルパスが作成された場合、プログラム解析装置1は、当該ラベルパスを縮約して「A,U」という縮約実行ラベルを作成する。   Next, the contract rule (2) will be described. If “A” is a resource capture function, the captured resource can be used any number of times until it is released after “A”. Therefore, the number of occurrences of “U” after “A” has no meaning in the determination by the program analysis apparatus 1, and “U” may appear at least once. Therefore, after “A”, if “U” appears more than once, “U” for the second and subsequent times is deleted. For example, when a label path “A, U, U” is created, the program analysis apparatus 1 contracts the label path to create a reduced execution label “A, U”.

次に、縮約ルール(3)について説明する。「F」がリソース解放関数であるとすると、Fによってリソースが解放された後、当該リソースを捕捉することなく使用する、という処理はありえない。したがって、「F」の後に「U」が出現することはない。仮に「U」が出現した場合、その回数に関わらず、「F」は「A」と対をなすリソース解放関数ではない、と推定することができる。したがって、ラベルパス中「F」の後に「U」が2回以上出現した場合、2回目以降の「U」は削除する。たとえば、ラベルパス「A,U,F,U,U」が生成された場合、プログラム解析装置1は、「F」の後の2つの「U」の一つを削除して、縮約実行パス「A,U,F,U」とする。   Next, the contract rule (3) will be described. If “F” is a resource release function, after the resource is released by F, there is no process of using the resource without capturing it. Therefore, “U” does not appear after “F”. If “U” appears, it can be estimated that “F” is not a resource release function paired with “A” regardless of the number of times. Therefore, when “U” appears twice or more after “F” in the label path, “U” for the second and subsequent times is deleted. For example, when the label path “A, U, F, U, U” is generated, the program analysis apparatus 1 deletes one of the two “U” s after “F” and reduces the contract execution path “ A, U, F, U ".

[重複する縮約実行パスの削除]
以上のように、実施の形態に係るプログラム解析装置1は、非決定的実行パスからラベルパス、ラベルパスから縮約実行パスを生成する。この処理により、非決定的実行パスの冗長な部分が削除されるため、異なる非決定的実行パスから同じ縮約実行パスが生成される場合が考えられる。そこで、同じ関数(f,g)、変数rについて作成された縮約実行パス中に重複がある場合は重複する縮約実行パスを削除する。
[Delete duplicate reduction execution path]
As described above, the program analysis apparatus 1 according to the embodiment generates a label path from a non-deterministic execution path and a reduced execution path from a label path. As a result of this process, redundant portions of the non-deterministic execution path are deleted, and the same reduced execution path may be generated from different non-deterministic execution paths. Therefore, if there are duplicates in the reduced execution paths created for the same function (f, g) and variable r, the redundant reduced execution paths are deleted.

[ループの回数の制限]
次に、ループの無限展開を防止するための処理について説明する。上記のように非決定的実行パスを、リソース捕捉関数およびリソース解放関数の抽出に必要な情報に還元し、縮約した場合、所定回数ループを繰り返した後は同じ縮約実行パスしか得られなくなる。たとえば、「A,U」という縮約パスのうち、ループ部分が「U」であるとすると、何度ループを繰り返しても上記縮約ルール(2)により、2回目以降の「U」が削除されるため、「A,U」にしかならない。そこで、本実施の形態に係るプログラム解析装置1では、n回ループを繰り返して生成された縮約実行パスから重複を除去した縮約実行パスの組み合わせと、n−1回ループを繰り返して生成された縮約実行パスから重複を除去した縮約実行パスの組み合わせと、が同じになった時点で、ループの繰り返しすなわち実行パス生成処理を終了する。
[Loop limit]
Next, processing for preventing infinite expansion of the loop will be described. As described above, when the nondeterministic execution path is reduced to information necessary for extraction of the resource capturing function and the resource release function and contracted, only the same contracted execution path can be obtained after repeating the loop a predetermined number of times. For example, if the loop portion of the contracted path “A, U” is “U”, the second and subsequent “U” are deleted by the contract rule (2) no matter how many times the loop is repeated. Therefore, it becomes only “A, U”. Therefore, in the program analysis apparatus 1 according to the present embodiment, a combination of contracted execution paths obtained by removing duplicates from contracted execution paths generated by repeating a loop n times and a loop generated n-1 times are generated. When the combination of the reduced execution paths obtained by removing the duplicates from the reduced execution paths becomes the same, the loop repetition, that is, the execution path generation process is terminated.

[生成部22による実行パス生成処理の流れの一例]
次に、図12乃至図17を参照し、実行パス生成処理についてさらに具体的に説明する。図12乃至図17は各々、実行パス生成処理においてループを1回乃至6回実行して縮約実行パスを生成する場合について説明するための図である。
[Example of Flow of Execution Path Generation Processing by Generation Unit 22]
Next, the execution path generation process will be described more specifically with reference to FIGS. 12 to 17 are diagrams for explaining a case where a reduced execution path is generated by executing a loop once to six times in the execution path generation process.

[ループ1回実行時]
まず、プログラム制御装置1は、図12の(A)に示すループ構造を有するソースコードについて非決定的実行パスを生成する。処理対象とする関数ペアは(f,g)、リソース格納変数はrである。図12の(A)において、処理「1」は関数f()を呼び出して変数に格納する処理(「A」)であり、処理「3」は捕捉したリソースrを使用する処理(「U」)であり、処理「5」は捕捉したリソースrを引数とする関数g()(「F」)である。処理「1」「3」「5」以外に、「A」「U」「F」に該当する処理はないとする。
[When loop is executed once]
First, the program control apparatus 1 generates a nondeterministic execution path for the source code having the loop structure shown in FIG. The function pair to be processed is (f, g), and the resource storage variable is r. In FIG. 12A, the process “1” is a process (“A”) that calls the function f () and stores it in a variable (“A”), and the process “3” is a process that uses the captured resource r (“U”). The process “5” is a function g () (“F”) with the captured resource r as an argument. It is assumed that there are no processes corresponding to “A”, “U”, and “F” other than the processes “1”, “3”, and “5”.

まず、生成部22は、ループを1回実行した場合の非決定的実行パスを生成する(図12の(B))。
(1)1−2−3−4−7
(2)1−2−5−6−7
First, the generation unit 22 generates a nondeterministic execution path when the loop is executed once ((B) of FIG. 12).
(1) 1-2-3-4-7
(2) 1-2-5-6-7

そして、生成部22は、上記非決定的実行パスをラベルパスに変換する。すなわち、生成部22は、「1」、「3」、「5」をそれぞれ、「A」、「U」、「F」に置換し、他の処理を削除して以下のラベルパスを生成する(図12の(C))。
(1)AU
(2)AF
Then, the generation unit 22 converts the nondeterministic execution path into a label path. That is, the generation unit 22 replaces “1”, “3”, and “5” with “A”, “U”, and “F”, respectively, deletes other processes, and generates the following label paths ( (C) of FIG.
(1) AU
(2) AF

上記ラベルパスのうち、縮約ルール(1)〜(3)に合致するものはないため、縮約実行パスは、ラベルパスと同じとなる(図12の(D))。   Since none of the label paths matches the reduction rules (1) to (3), the reduction execution path is the same as the label path ((D) in FIG. 12).

さらに、重複する縮約実行パスはないため、削除される縮約実行パスはない(図12の(E))。   Furthermore, since there are no overlapping contraction execution paths, there is no contraction execution path to be deleted ((E) in FIG. 12).

[ループ2回実行時]
次に、生成部22は、ループを2回実行する。この場合、非決定的実行パスは以下のようになる。
(1)1−2−3−4−2−3−4−7
(2)1−2−3−4−2−5−6−7
(3)1−2−5−6−2−3−4−7
(4)1−2−5−6−2−5−6−7
[When loop is executed twice]
Next, the generation unit 22 executes the loop twice. In this case, the non-deterministic execution path is as follows:
(1) 1-2-3-4-2-3-4-7
(2) 1-2-3-4-2-5-6-7
(3) 1-2-5-6-2-3-4-7
(4) 1-2-5-6-2-5-6-7

実際の生成部22の処理では、ループ1回目の縮約実行パスが既に生成されているため、ループ2回目のラベルをループ1回目の縮約実行パスに追加してループ2回目のラベルパスを生成すればよい。ループ2回目のラベルパスは以下のようになる(図13の(A))。
(1)AUU
(2)AUF
(3)AFU
(4)AFF
In the actual processing of the generating unit 22, the first contracted execution path for the loop has already been generated, so the label for the second loop is added to the contracted execution path for the first loop to generate the second label path for the loop. do it. The label path for the second loop is as follows ((A) in FIG. 13).
(1) AUU
(2) AUF
(3) AFU
(4) AFF

生成されたラベルパスのうち、(1)は縮約ルール(2)に合致するため、「AU」に縮約される(図13の(B))。(1)以外には縮約ルールに合致するラベルパスはない。また、重複もないため、ループ2回の実行により生成される縮約実行パスは、以下のようになる(図13の(C))。
(1)AU
(2)AUF
(3)AFU
(4)AFF
Among the generated label paths, (1) is reduced to “AU” because it matches the reduction rule (2) ((B) of FIG. 13). Other than (1), there is no label path that matches the contract rule. Further, since there is no overlap, the contracted execution path generated by executing the loop twice is as follows ((C) of FIG. 13).
(1) AU
(2) AUF
(3) AFU
(4) AFF

ループ1回実行時の縮約実行パスと、ループ2回実行時の縮約実行パスとは相違する。このため、ループの繰り返しは終了せず、生成部22はループ3回実行時の実行パス生成処理に移る。   The contracted execution path when the loop is executed once is different from the contracted execution path when the loop is executed twice. For this reason, the repetition of the loop does not end, and the generation unit 22 proceeds to an execution path generation process at the time of executing the loop three times.

[ループ3回実行時]
次に、生成部22は、ループを3回実行した場合のラベルパスを生成する(図14の(A))。
(1)AUU
(2)AUF
(3)AUFU
(4)AUFF
(5)AFUU
(6)AFUF
(7)AFFU
(8)AFFF
[When loop is executed 3 times]
Next, the generation unit 22 generates a label path when the loop is executed three times ((A) in FIG. 14).
(1) AUU
(2) AUF
(3) AUFU
(4) AUFF
(5) AFUU
(6) AFUF
(7) AFFU
(8) AFFF

上記ラベルパスのうち、「AUU」は縮約ルール(2)に合致するため、生成部22は、「AUU」を「AU」に縮約する。また、「AFUU」は縮約ルール(3)に合致するため、生成部22は、「AFUU」を「AFU」に縮約する。また、「AFFF」は縮約ルール(1)に合致するため、生成部22は、「AFFF」を「AFF」に縮約する。この結果、縮約実行パスは以下のようになる(図14の(B))。以下ラベルパスを縮約した後の縮約実行パスを矢印右側に示す。
(1)AUU→AU
(2)AUF
(3)AUFU
(4)AUFF
(5)AFUU→AFU
(6)AFUF
(7)AFFU
(8)AFFF→AFF
Since “AUU” matches the contract rule (2) in the label path, the generation unit 22 contracts “AUU” to “AU”. Since “AFUU” matches the contract rule (3), the generation unit 22 contracts “AFUU” to “AFU”. Since “AFFF” matches the contract rule (1), the generation unit 22 contracts “AFFF” to “AFF”. As a result, the contraction execution path is as follows ((B) in FIG. 14). The contract execution path after contracting the label path is shown on the right side of the arrow.
(1) AUU → AU
(2) AUF
(3) AUFU
(4) AUFF
(5) AFUU → AFU
(6) AFUF
(7) AFFU
(8) AFFF → AFF

上記(1)〜(8)の縮約実行パスには重複はない(図14の(C))。また、ループ2回実行時の縮約実行パスとループ3回実行時の縮約実行パスとは同じではないため、プログラム解析装置1は、ループ4回実行時の実行パス生成処理に進む。   There is no overlap in the contraction execution paths (1) to (8) ((C) in FIG. 14). Further, since the contracted execution path when the loop is executed twice is not the same as the contracted execution path when the loop is executed three times, the program analysis apparatus 1 proceeds to an execution path generation process when the loop is executed four times.

[ループ4回実行時]
次に、生成部22は、ループを4回実行した場合のラベルパスを生成する(図15の(A))。
(1)AUU (2)AUF
(3)AUFU (4)AUFF
(5)AUFUU (6)AUFUF
(7)AUFFU (8)AUFFF
(9)AFUU (10)AFUF
(11)AFUFU (12)AFUFF
(13)AFFUU (14)AFFUF
(15)AFFU (16)AFFF
[When loop is executed 4 times]
Next, the generation unit 22 generates a label path when the loop is executed four times ((A) in FIG. 15).
(1) AUU (2) AUF
(3) AUFU (4) AUFF
(5) AUFUU (6) AUFUU
(7) AUFFU (8) AUFFF
(9) AFUU (10) AFUF
(11) AFUFU (12) AFUFF
(13) AFFFU (14) AFFUF
(15) AFFU (16) AFFF

このうち、「AUFFF」、「AFUFF」、「AFFUF」、「AFFF」は、「F」が3回出現し、縮約ルール(1)に合致する。また、「AUU」は縮約ルール(2)に合致する。また、「AUFUU」、「AFUU」、「AFFUU」は縮約ルール(3)に合致する。このためループ4回実行時の縮約実行パスは以下のようになる(図15の(B))。
(1)AUU→AU (2)AUF
(3)AUFU (4)AUFF
(5)AUFUU→AUFU (6)AUFUF
(7)AUFFU (8)AUFFF→AUFF
(9)AFUU→AFU (10)AFUF
(11)AFUFU (12)AFUFF→AFUF
(13)AFFUU→AFFU (14)AFFUF→AFF
(15)AFFU (16)AFFF→AFF
Among them, “AUFFF”, “AFUFF”, “AFFUF”, “AFFF”, “F” appears three times and matches the contraction rule (1). “AUU” matches the contract rule (2). In addition, “AUFUU”, “AFUUU”, and “AFUFUU” match the contraction rule (3). For this reason, the contracted execution path when the loop is executed four times is as follows ((B) of FIG. 15).
(1) AUU → AU (2) AUF
(3) AUFU (4) AUFF
(5) AUFUU → AUFU (6) AUFUF
(7) AUFFU (8) AUFFF → AUFF
(9) AFUU → AFU (10) AFUF
(11) AFUFU (12) AFUFF → AFUF
(13) AFFUU → AFFU (14) AFFFU → AFF
(15) AFFU (16) AFFF → AFF

上記縮約実行パス中、(3)と(5)、(4)と(8)、(10)と(12)、(13)と(15)、(14)と(16)、がそれぞれ重複する。そこで、生成部22は、重複がなくなるよう、(5)、(8)、(12)、(14)、(15)の計5個を削除し、残りの11個を縮約実行パスとして残す(図15の(C))。結果として、図15の(D)の縮約実行パスのセットが得られる。   (3) and (5), (4) and (8), (10) and (12), (13) and (15), and (14) and (16) overlap each other in the above reduction execution path To do. Therefore, the generation unit 22 deletes a total of five (5), (8), (12), (14), and (15) so that there is no duplication, and leaves the remaining 11 as reduced execution paths. ((C) of FIG. 15). As a result, the reduced execution path set shown in FIG. 15D is obtained.

ループ3回実行時の縮約実行パスとループ4回実行時の縮約実行パスとは同じではないため、プログラム解析装置1は、ループ5回実行時の実行パス生成処理に進む。   Since the contracted execution path when the loop is executed three times is not the same as the contracted execution path when the loop is executed four times, the program analysis apparatus 1 proceeds to an execution path generation process when the loop is executed five times.

[ループ5回実行時]
次に、生成部22は、ループを5回実行した場合のラベルパスを生成する(図16の(A))。
(1)AUU (2)AUF
(3)AUFU (4)AUFF
(5)AUFUU (6)AUFUF
(7)AUFFU (8)AUFFF
(9)AUFUFU(10)AUFUFF
(11)AUFFUU(12)AUFFUF
(13)AFUU (14)AFUF
(15)AFUFU (16)AFUFF
(17)AFUFUU(18)AFUFUF
(19)AFFUU(20)AFFUF
(21)AFFU (22)AFFF
[When loop is executed 5 times]
Next, the generation unit 22 generates a label path when the loop is executed five times ((A) in FIG. 16).
(1) AUU (2) AUF
(3) AUFU (4) AUFF
(5) AUFUU (6) AUFUU
(7) AUFFU (8) AUFFF
(9) AUFUFU (10) AUFUFF
(11) AUFFUU (12) AUFFUUF
(13) AFUU (14) AFUF
(15) AFUFU (16) AFUFF
(17) AFUFUU (18) AFUFUUF
(19) AFFFU (20) AFFUF
(21) AFFU (22) AFFF

このうち、(8)AUFFF、(10)AUFUFF、(12)AUFFUF、(16)AFUFF、(18)AFUFUF、(20)AFFUF、(22)AFFFは、縮約ルール(1)に合致する。また、(1)AUUは縮約ルール(2)に合致する。また、(5)AUFUU、(11)AUFFUU、(13)AFUU、(17)AFUFUU、(19)AFFUUは縮約ルール(3)に合致する。そこで、生成部22は、縮約ルールに合致するラベルパスをそれぞれ縮約し、以下の縮約実行パスを生成する(図16の(B))。
(1)AUU→AU (2)AUF
(3)AUFU (4)AUFF
(5)AUFUU→AUFU (6)AUFUF
(7)AUFFU (8)AUFFF→AUFF
(9)AUFUFU (10)AUFUFF→AUFUF
(11)AUFFUU→AUFFU (12)AUFFUF→AUFF
(13)AFUU→AFU (14)AFUF
(15)AFUFU (16)AFUFF→AFUF
(17)AFUFUU→AFUFU (18)AFUFUF→AFUF
(19)AFFUU→AFFU (20)AFFUF→AFF
(21)AFFU (22)AFFF→AFF
Of these, (8) AUFFF, (10) AUFUFF, (12) AUFFUF, (16) AFUFF, (18) AFUFUUF, (20) AFFUF, and (22) AFFF match the contraction rule (1). Further, (1) AUU matches the contract rule (2). Further, (5) AUFUU, (11) AUFUFUU, (13) AFUUU, (17) AFUFUU, and (19) AFUFUU match the contract rule (3). Therefore, the generation unit 22 contracts each label path that matches the contract rule, and generates the following contract execution path (FIG. 16B).
(1) AUU → AU (2) AUF
(3) AUFU (4) AUFF
(5) AUFUU → AUFU (6) AUFUF
(7) AUFFU (8) AUFFF → AUFF
(9) AUFUFU (10) AUFUFF → AUFUFU
(11) AUFFUU → AUFFU (12) AUFFUFU → AUFF
(13) AFUU → AFU (14) AFUF
(15) AFUFU (16) AFUFF → AFUF
(17) AFUFUU → AFUFU (18) AFUFUU → AFUFU
(19) AFUFU → AFFU (20) AFFFU → AFF
(21) AFFU (22) AFFF → AFF

上記縮約実行パスのうち、(3)と(5)、(7)と(11)、(6)と(10)、(19)と(21)、(4)と(8)と(12)、(15)と(17)、(14)と(16)と(18)、(20)と(22)、は、それぞれ重複する。そこで、生成部22は、(3)、(8)、(10)、(11)、(12)、(16)、(17)、(18)、(20)、(21)の計10個を削除する。この結果、ループ5回実行時の縮約実行パスは以下の12個となる(図16の(C))。
(1)AU
(2)AUF
(4)AUFF
(5)AUFU
(6)AUFUF
(7)AUFFU
(9)AUFUFU
(13)AFU
(14)AFUF
(15)AFUFU
(19)AFFU
(22)AFF
Of the above reduction execution paths, (3) and (5), (7) and (11), (6) and (10), (19) and (21), (4) and (8) and (12 ), (15) and (17), (14) and (16) and (18), and (20) and (22) overlap. Therefore, the generation unit 22 has a total of ten (3), (8), (10), (11), (12), (16), (17), (18), (20), and (21). Is deleted. As a result, the contracted execution paths when the loop is executed five times are as follows ((C) in FIG. 16).
(1) AU
(2) AUF
(4) AUFF
(5) AUFU
(6) AUFUF
(7) AUFFU
(9) AUFUFU
(13) AFU
(14) AFUF
(15) AFUFU
(19) AFFU
(22) AFF

ループ4回実行時の縮約実行パスとループ5回実行時の縮約実行パス(図16の(D))とは同じではないため、プログラム解析装置1は、ループ6回実行時の実行パス生成処理に進む。   Since the contracted execution path when the loop is executed four times and the contracted execution path when the loop is executed five times ((D) in FIG. 16) are not the same, the program analyzing apparatus 1 executes the execution path when the loop is executed six times. Proceed to the generation process.

[ループ6回実行時]
次に、生成部22は、ループを6回実行した場合のラベルパスを生成する(図17の(A))。
(1)AUU (2)AUF
(3)AUFUU (4)AUFUF
(5)AUFUFUU (6)AUFUFUF
(7)AFUU (8)AFUF
(9)AUFU (10)AUFF
(11)AUFFU (12)AUFFF
(13)AUFUFU (14)AUFUFF
(15)AUFFUU (16)AUFFUF
(17)AFUFU (18)AFUFF
(19)AFUFUU (20)AFUFUF
(21)AFFUU (22)AFFUF
(23)AFFU (24)AFFF
[When loop is executed 6 times]
Next, the generation unit 22 generates a label path when the loop is executed six times ((A) in FIG. 17).
(1) AUU (2) AUF
(3) AUFUU (4) AUFUU
(5) AUFUFUU (6) AUFUFUU
(7) AFUU (8) AFUF
(9) AUFU (10) AUFF
(11) AUFFU (12) AUFFF
(13) AUFUFU (14) AUFUFF
(15) AUFFUU (16) AUFFUUF
(17) AFUFU (18) AFUFF
(19) AFUFUU (20) AFUFUUF
(21) AFFFU (22) AFFUF
(23) AFFU (24) AFFF

上記ラベルパスのうち、(6)AUFUFUF、(12)AUFFF、(14)AUFUFF、(16)AUFFUF、(18)AFUFF、(20)AFUFUF、(22)AFFUF、(24)AFFFは、縮約ルール(1)に合致する。また、(1)AUUは縮約ルール(2)に合致する。また、(3)AUFUU、(5)AUFUFUU、(7)AFUU、(15)AUFFUU、(19)AFUFUU、(21)AFFUUは、縮約ルール(3)に合致する。そこで、生成部22は、縮約ルールに合致するラベルパスをそれぞれ縮約し、以下の縮約実行パスを生成する(図17の(B))。
(1)AUU→AU (2)AUF
(3)AUFUU→AUFU (4)AUFUF
(5)AUFUFUU→AUFUFU (6)AUFUFUF→AUFUF
(7)AFUU→AFU (8)AFUF
(9)AUFU (10)AUFF
(11)AUFFU (12)AUFFF→AUFF
(13)AUFUFU (14)AUFUFF→AUFUF
(15)AUFFUU→AUFFU (16)AUFFUF→AUFF
(17)AFUFU (18)AFUFF→AFUF
(19)AFUFUU→AFUFU (20)AFUFUF→AFUF
(21)AFFUU→AFFU (22)AFFUF→AFF
(23)AFFU (24)AFFF→AFF
Among the above label paths, (6) AUFUFUF, (12) AUFFF, (14) AUFUFF, (16) AUFFUF, (18) AFUFF, (20) AFUFUUF, (22) AFFUF, (24) AFFF are reduced rules ( It matches 1). Further, (1) AUU matches the contract rule (2). Further, (3) AUFUU, (5) AUFUFUU, (7) AFUU, (15) AUFUFUU, (19) AFUFUU, and (21) AFUFUU match the reduction rule (3). Therefore, the generation unit 22 contracts each label path that matches the contract rule, and generates the following contract execution path (FIG. 17B).
(1) AUU → AU (2) AUF
(3) AUFUU → AUFU (4) AUFUF
(5) AUFUFUU → AUFUFU (6) AUFUFUU → AUFUFU
(7) AFUU → AFU (8) AFUF
(9) AUFU (10) AUFF
(11) AUFFU (12) AUFFF → AUFF
(13) AUFUFU (14) AUFUFF → AUFUFU
(15) AUFFUU → AUFFU (16) AUFFUFU → AUFF
(17) AFUFU (18) AFUFF → AFUF
(19) AFUFUU → AFUFU (20) AFUFUU → AFUFU
(21) AFFUU → AFFU (22) AFFFU → AFF
(23) AFFU (24) AFFF → AFF

上記縮約実行パスのうち、(3)と(9)、(4)と(6)と(14)、(5)と(13)、(8)と(18)と(20)、(10)と(12)と(16)、(11)と(15)、(17)と(19)、(21)と(23)、(22)と(24)、はそれぞれ同一である。そこで生成部22は、(3)、(4)、(5)、(6)、(8)、(10)、(11)、(16)、(17)、(18)、(21)、(22)の計12個を削除する(図17の(C))。この結果、ループ6回実行時の縮約実行パスは以下の12個となる(図17の(D))。
(1)AU
(2)AUF
(7)AFU
(9)AUFU
(12)AUFF
(13)AUFUFU
(14)AUFUF
(15)AUFFU
(19)AFUFU
(20)AFUF
(23)AFFU
(24)AFF
Among the above reduction execution paths, (3) and (9), (4) and (6) and (14), (5) and (13), (8), (18), (20), (10 ) And (12) and (16), (11) and (15), (17) and (19), (21) and (23), and (22) and (24) are the same. Therefore, the generation unit 22 (3), (4), (5), (6), (8), (10), (11), (16), (17), (18), (21), A total of 12 of (22) are deleted ((C) of FIG. 17). As a result, the contracted execution paths when the loop is executed six times are as follows ((D) in FIG. 17).
(1) AU
(2) AUF
(7) AFU
(9) AUFU
(12) AUFF
(13) AUFUFU
(14) AUFUF
(15) AUFFU
(19) AFUFU
(20) AFUF
(23) AFFU
(24) AFF

ループ5回実行時の縮約実行パスとループ6回実行時の縮約実行パスとは同じである。このため、生成部22は、7回以上ループを繰り返すことなく、実行パス生成処理を終了する。   The contracted execution path when the loop is executed five times and the contracted execution path when the loop is executed six times are the same. Therefore, the generation unit 22 ends the execution path generation process without repeating the loop seven times or more.

図18は、図12乃至図17に示す実行パス生成処理において生成される縮約実行パスを説明するための図である。図18中、縮約ルールに従い削除されるラベルには二重取消線を付し、重複により削除される縮約実行パスには網掛けを付している。   FIG. 18 is a diagram for explaining the reduced execution path generated in the execution path generation process shown in FIGS. 12 to 17. In FIG. 18, labels that are deleted according to the contraction rule are marked with a double strikethrough, and contraction execution paths that are deleted due to duplication are shaded.

[実行パス生成処理の流れの一例]
図19は、実施の形態に係る実行パス生成処理の流れの一例を示すフローチャートである。生成部22は、まず、n=1の設定を受け付ける(ステップS1801)。ここで、nはループ内の実行回数を設定するための自然数である。次に、生成部22は、ループ内をn回実行して得られる非決定的実行パスを作成する(ステップS1802)。そして、生成部22は、関数記憶部33に記憶される全関数ペア集合F×Fの中から一つの関数ペア(f,g)を選択する(ステップS1803)。生成部22は、さらに、リソース捕捉変数であるrを選択する(ステップS1803)。生成部22は、選択した関数ペア(f,g)と変数rに基づき、非決定的実行パスの各処理要素のうち「A」「U」「F」のラベルに該当する処理要素を抽出し、ラベルパスを生成する(ステップS1804)。さらに、生成部22は、生成したラベルパスに対して縮約ルール(1)、(2)、(3)を適用し、縮約実行パスを生成する(ステップS1805)。そして、生成部22は、生成した縮約実行パスに重複がないか判定し、重複がある場合は重複する縮約実行パスを削除する(ステップS1806)。そして、生成部22は、ループをn回実行したときの縮約実行パスと、ループをn−1回実行したときの縮約実行パスとが一致するか否かを判定する(ステップS1807)。一致すると判定した場合(ステップS1807、Yes)、生成部22は、実行パス生成処理を終了する。他方、一致しないと判定した場合(ステップS1807、No)、生成部22は、n=n+1と設定し(S1808)、ループの実行回数を増やしてステップS1802からS1807を繰り返す。これにより関数ペア(f,g)および変数rについての実行パス生成処理が終了する。
[Example of execution path generation processing flow]
FIG. 19 is a flowchart illustrating an example of a flow of execution path generation processing according to the embodiment. First, the generation unit 22 receives a setting of n = 1 (step S1801). Here, n is a natural number for setting the number of executions in the loop. Next, the generation unit 22 creates a nondeterministic execution path obtained by executing the inside of the loop n times (step S1802). Then, the generation unit 22 selects one function pair (f, g) from the entire function pair set F × F stored in the function storage unit 33 (step S1803). The generation unit 22 further selects r, which is a resource capture variable (step S1803). Based on the selected function pair (f, g) and variable r, the generation unit 22 extracts processing elements corresponding to the labels “A”, “U”, and “F” among the processing elements of the non-deterministic execution path, A label path is generated (step S1804). Further, the generation unit 22 applies the reduction rules (1), (2), and (3) to the generated label path to generate a reduction execution path (step S1805). Then, the generation unit 22 determines whether or not the generated contracted execution path has an overlap, and if there is an overlap, deletes the overlapping contracted execution path (step S1806). Then, the generation unit 22 determines whether or not the contraction execution path when the loop is executed n times and the contraction execution path when the loop is executed n-1 times are matched (step S1807). When it determines with matching (step S1807, Yes), the production | generation part 22 complete | finishes an execution path production | generation process. On the other hand, if it is determined that they do not match (No in step S1807), the generation unit 22 sets n = n + 1 (S1808), increases the number of loop executions, and repeats steps S1802 to S1807. Thereby, the execution path generation process for the function pair (f, g) and the variable r is completed.

関数記憶部33の全関数ペア集合F×Fに含まれるすべての関数ペアについて、実行パス生成処理が繰り返される。また、リソース格納変数rは一つに限られないため、複数のリソース格納変数rと、各関数ペアについて、実行パス生成処理が繰り返される。この結果、関数ペアと変数rとの組み合わせごとに異なる縮約実行パスセットが生成される。図20は、実施の形態に係る実行パス生成処理により生成され、実行パス記憶部34に記憶される情報の構成の一例を示す図である。   The execution path generation process is repeated for all function pairs included in the all function pair set F × F in the function storage unit 33. In addition, since the resource storage variable r is not limited to one, the execution path generation process is repeated for a plurality of resource storage variables r and each function pair. As a result, a different reduced execution path set is generated for each combination of the function pair and the variable r. FIG. 20 is a diagram illustrating an example of a configuration of information generated by the execution path generation processing according to the embodiment and stored in the execution path storage unit 34.

図20に示すように、実行パス記憶部34は、「関数ペア」、「変数」、「縮約実行パス」、「フラグ」を記憶する。「関数ペア」は、縮約実行パスの生成に使用した関数ペア(f,g)を示す。また、「変数」は、縮約実行パスの生成に使用した変数rを示す。また、「縮約実行パス」は、実行パス生成処理の結果生成された縮約実行パスのセットを示す。「フラグ」は、後述する関数ペア抽出処理において、所定のパタン「A−U−F」を含むと判定された縮約実行パスに付与される標識である。   As illustrated in FIG. 20, the execution path storage unit 34 stores “function pair”, “variable”, “contracted execution path”, and “flag”. “Function pair” indicates a function pair (f, g) used to generate a reduced execution path. “Variable” indicates the variable r used to generate the reduced execution path. Further, “reduced execution path” indicates a set of reduced execution paths generated as a result of the execution path generation process. The “flag” is a mark given to a contraction execution path determined to include a predetermined pattern “AUF” in a function pair extraction process described later.

[関数ペア抽出処理の流れの一例]
次に、抽出部23による関数ペア抽出処理について説明する。図21は、実施の形態に係る関数ペア抽出処理の流れの一例を示すフローチャートである。抽出部23は、生成部22による縮約実行パスの生成が完了し、生成された縮約実行パスの情報が実行パス記憶部34に記憶されると、関数ペア抽出処理を実行する。
[Example of function pair extraction process flow]
Next, function pair extraction processing by the extraction unit 23 will be described. FIG. 21 is a flowchart illustrating an exemplary flow of a function pair extraction process according to the embodiment. The extraction unit 23 executes the function pair extraction process when the generation of the contracted execution path by the generating unit 22 is completed and the information of the generated contracted execution path is stored in the execution path storage unit 34.

抽出部23はまず、関数ペア(f,g)と変数rとを選択する(ステップS2001)。そして、抽出部23は、実行パス記憶部34に記憶された縮約実行パスのうち、選択した関数ペア(f,g)および変数rに対応付けて記憶されている縮約実行パスの一つを選択する(ステップS2002)。抽出部23は、選択した縮約実行パスが、リソース捕捉関数とリソース解放関数の出現パタン、すなわち「AUF」に合致するか否かを判定する(ステップS2003)。このとき、抽出部23は、「AUF」のみを含むか否かを判定する。すなわち、抽出部23は、「AUFU」や「AUFUF」「AUFF」等、「AUF」の出現パタンを含むが「AUF」以外のパタンを含む縮約実行パスは、「AUF」の出現パタンに合致しないと判定する。   First, the extraction unit 23 selects a function pair (f, g) and a variable r (step S2001). The extracting unit 23 then selects one of the reduced execution paths stored in association with the selected function pair (f, g) and the variable r among the reduced execution paths stored in the execution path storage unit 34. Is selected (step S2002). The extraction unit 23 determines whether or not the selected reduction execution path matches the appearance pattern of the resource capture function and the resource release function, that is, “AUF” (step S2003). At this time, the extraction unit 23 determines whether or not only “AUF” is included. In other words, the extraction unit 23 includes the appearance pattern of “AUF” such as “AUFU”, “AUFUF”, “AUFF”, etc., but the reduced execution path including the pattern other than “AUF” matches the appearance pattern of “AUF”. Judge that not.

そして、抽出部23は、「AUF」の出現パタンに合致すると判定した場合(ステップS2003、YES)、当該縮約実行パスに対応づけて実行パス記憶部34にフラグを格納する(ステップS2004)。そして、抽出部23は、関数ペア(f,g)と変数rに対応づけて記憶されている他の未選択の縮退実行パスがあるか否かを判定する(ステップS2005)。抽出部23は、「AUF」の出現パタンを含まないと判定した場合(ステップS2003、NO)、そのままステップS2005に進む。   If the extraction unit 23 determines that it matches the appearance pattern of “AUF” (step S2003, YES), the extraction unit 23 stores a flag in the execution path storage unit 34 in association with the reduced execution path (step S2004). Then, the extraction unit 23 determines whether there is another unselected degeneration execution path stored in association with the function pair (f, g) and the variable r (step S2005). If the extraction unit 23 determines that the appearance pattern of “AUF” is not included (step S2003, NO), the extraction unit 23 proceeds to step S2005 as it is.

抽出部23は、未選択の縮退実行パスがあると判定した場合(ステップS2005、YES)、次の未選択の縮約実行パスを選択する(ステップS2006)。そして、抽出部23は、選択した縮約実行パスについて、ステップS2003からS2005の処理を繰り返す。他方、抽出部23は、未選択の縮約実行パスはないと判定した場合(ステップS2005、NO)、他に関数ペア(f,g)に対応づけて実行パス記憶部34に記憶されているリソース格納変数rがあるか否かを判定する(ステップS2007)。他のリソース格納変数rがあると判定した場合(ステップS2007、YES)、抽出部23は、他のリソース格納変数rの一つを選択する(ステップS2008)。そして、抽出部23は、ステップS2002からS2007の処理を繰り返す。他方、他のリソース格納変数rはないと判定した場合(ステップS2007、NO)、抽出部23は、関数ペア(f,g)と各リソース格納変数rに対応付けて実行パス記憶部34に記憶される縮約実行パスのセット各々のうち、少なくとも一つの縮約実行パスにフラグが付与されているか否かを判定する(ステップS2009)。そして、抽出部23は、全てのセットに、フラグが付与された縮約実行パスが少なくとも一つ含まれると判定した場合(ステップS2009、YES)、関数ペア(f,g)を、リソース捕捉関数とリソース解放関数の候補ペアとして抽出する(ステップS2010)。抽出した関数ペアは、関数ペア集合記憶部35に記憶される。そして、抽出部23は、関数記憶部33に記憶される全関数ペア集合F×Fに未選択の次の関数ペアがあるか否かを判定する(ステップS2011)。そして、次の関数ペアがあると判定した場合(ステップS2011、YES)、抽出部23は、次の関数ペアと変数とを選択して(ステップS2012)、ステップS2002に戻る。他方、次の関数ペアがないと判定した場合(ステップS2011、NO)すなわち、全関数ペア集合F×Fに格納される全ての関数ペアについて関数ペア抽出処理を終了した場合、抽出部23は、関数ペア抽出処理を終了する。他方、ステップS2009において、いずれの縮約実行パスにもフラグが付与されていない縮約実行パスのセットがあると判定した場合(ステップS2009、NO)、抽出部23は、当該関数ペアは抽出せず、ステップS2011に進む。   When it is determined that there is an unselected reduction execution path (YES in step S2005), the extraction unit 23 selects the next unselected reduction execution path (step S2006). Then, the extraction unit 23 repeats the processing from step S2003 to S2005 for the selected contraction execution path. On the other hand, if the extraction unit 23 determines that there is no unselected contracted execution path (NO in step S2005), it is stored in the execution path storage unit 34 in association with another function pair (f, g). It is determined whether or not there is a resource storage variable r (step S2007). If it is determined that there is another resource storage variable r (step S2007, YES), the extraction unit 23 selects one of the other resource storage variables r (step S2008). And the extraction part 23 repeats the process of step S2002 to S2007. On the other hand, if it is determined that there is no other resource storage variable r (step S2007, NO), the extraction unit 23 stores the function pair (f, g) in association with each resource storage variable r in the execution path storage unit 34. It is determined whether or not at least one contracted execution path is flagged in each of the contracted execution path sets to be performed (step S2009). When the extraction unit 23 determines that all sets include at least one contracted execution path with a flag (YES in step S2009), the function pair (f, g) is determined as a resource capture function. And a resource release function candidate pair are extracted (step S2010). The extracted function pair is stored in the function pair set storage unit 35. Then, the extraction unit 23 determines whether or not there is a next unselected function pair in the all function pair set F × F stored in the function storage unit 33 (step S2011). If it is determined that there is a next function pair (step S2011, YES), the extraction unit 23 selects the next function pair and variable (step S2012), and returns to step S2002. On the other hand, when it is determined that there is no next function pair (step S2011, NO), that is, when the function pair extraction process is completed for all function pairs stored in the all function pair set F × F, the extraction unit 23 The function pair extraction process ends. On the other hand, when it is determined in step S2009 that there is a set of reduced execution paths to which no reduced execution path has a flag (NO in step S2009), the extraction unit 23 extracts the function pair. Instead, the process proceeds to step S2011.

[実施の形態の効果]
上記のように、本実施の形態に係るプログラム解析装置においては、ソースコード中、第1の関数(関数f)が呼び出された位置から処理が辿る可能性のある実行パスにループが含まれる場合に対処する。プログラム解析装置は、当該ループを1回からn回(nは2以上の自然数)まで繰り返して実行した場合のそれぞれについて、処理が辿る可能性のある実行パスを生成する。そして、プログラム解析装置は、生成した実行パスにおいて、第1の関数(関数f)と、第1の関数の戻り値を格納する変数(r)と、第1の関数とは異なり該第1の関数の戻り値を格納する変数を引数とする第2の関数(関数g)と、の出現パタンが、リソース捕捉関数とリソース解放関数の出現パタンに合致する場合、第1の関数と第2の関数とをリソース捕捉関数とリソース解放関数のペアとして抽出する。このため、実施形態のプログラム解析装置は、ソースコード中にループが含まれる場合に、所定回数ループを繰り返して実行した場合を考慮して、リソース捕捉関数とリソース解放関数とのペアを抽出することができる。
[Effect of the embodiment]
As described above, in the program analysis device according to the present embodiment, when a loop is included in the execution path in the source code where processing may be traced from the position where the first function (function f) is called. To deal with. The program analysis device generates an execution path that the process may follow for each case where the loop is repeatedly executed from 1 to n times (n is a natural number of 2 or more). Then, the program analysis apparatus differs from the first function in the generated execution path, unlike the first function (function f), the variable (r) for storing the return value of the first function, and the first function. When the appearance pattern of the second function (function g) having a variable for storing the return value of the function as an argument matches the appearance pattern of the resource capture function and the resource release function, the first function and the second function The function is extracted as a resource capture function and resource release function pair. For this reason, the program analysis apparatus of the embodiment extracts a pair of a resource capture function and a resource release function in consideration of a case where a loop is included in the source code and is executed a predetermined number of times. Can do.

また、本実施の形態に係るプログラム解析装置は、第1の関数の戻り値を変数に格納する第1の処理と、当該変数を引数とし、第1および第2の関数と異なる第3の関数を呼び出す第2の処理と、変数を引数とする第2の関数を呼び出す第3の処理と、の出現順序のみを示す実行パスを生成する。このため、プログラム解析装置は、リソース捕捉関数とリソース解放関数とのペアであるか否かの判定に影響を与えない要素を捨象して処理を実行することができる。このため、実施形態のプログラム解析装置は、処理効率および処理速度を向上させることができる。   In addition, the program analysis apparatus according to the present embodiment includes a first process for storing the return value of the first function in a variable, and a third function that uses the variable as an argument and is different from the first and second functions. An execution path indicating only the appearance order of the second process for calling the second process and the third process for calling the second function with the variable as an argument is generated. For this reason, the program analysis device can execute processing by discarding elements that do not affect the determination of whether or not the resource capture function and the resource release function are a pair. For this reason, the program analysis apparatus of the embodiment can improve the processing efficiency and the processing speed.

また、本実施の形態に係るプログラム解析装置は、生成した実行パスに、第1および第2の関数がリソース捕捉関数とリソース解放関数であるとした場合に、リソース捕捉関数とリソース解放関数の出現パタンに合致しない箇所がある場合、合致しない箇所を一部を残して削除することにより、実行パスを短くする。このため、実施の形態に係るプログラム解析装置は、明らかにリソース捕捉関数とリソース解放関数の出現パタンに合致しないパタンを含む実行パスについて簡易に判定をすることができる。   In addition, the program analysis apparatus according to the present embodiment causes the resource capture function and the resource release function to appear when the first and second functions are the resource capture function and the resource release function in the generated execution path. If there is a part that does not match the pattern, the execution path is shortened by deleting the part that does not match partly. Therefore, the program analysis apparatus according to the embodiment can easily determine an execution path including a pattern that clearly does not match the appearance pattern of the resource capture function and the resource release function.

また、本実施の形態に係るプログラム解析装置は、生成した実行パスが、
(1)第3の処理を3以上含む場合、2回目の第3の処理の出現より後の処理を削除し、
(2)第1の処理の後、第2の処理を2以上含む場合、2回目以降の第2の処理を削除し、
(3)第3の処理の後、第2の処理を2以上含む場合、2回目以降の第2の処理を削除する、
ことにより、実行パスを短くする。このため、実施の形態に係るプログラム解析装置は、明らかにリソース捕捉関数とリソース解放関数の出現パタンに合致しないパタンを含む実行パスについて簡易に判定をすることができる。
In addition, the program analysis apparatus according to the present embodiment has the generated execution path as follows:
(1) When three or more third processes are included, the processes after the appearance of the second third process are deleted,
(2) After including the second process after the first process, the second process after the second is deleted,
(3) After including the second process after the third process, the second process after the second time is deleted.
This shortens the execution path. Therefore, the program analysis apparatus according to the embodiment can easily determine an execution path including a pattern that clearly does not match the appearance pattern of the resource capture function and the resource release function.

また、本実施の形態に係るプログラム解析装置は、ループをn回実行した場合に得られる実行パスと、ループを(n−1)回実行した場合に得られる実行パスと、が等しくなった場合に、実行パスの生成を終了する。このため、実施の形態に係るプログラム解析装置は、ループ内を無限に繰り返すことなく、効率的にリソース捕捉関数とリソース解放関数のペアを抽出することができる。   In addition, the program analysis apparatus according to the present embodiment has a case where the execution path obtained when the loop is executed n times is equal to the execution path obtained when the loop is executed (n−1) times. Finally, the generation of the execution path is finished. Therefore, the program analysis apparatus according to the embodiment can efficiently extract a resource capture function and resource release function pair without repeating the loop infinitely.

また、本実施の形態に係るプログラム解析装置は、ソースコード中に、第1の関数を呼び出して戻り値を変数に格納する位置が複数ある場合に、各位置から辿ることができる1以上の実行パスのうち、リソース捕捉関数とリソース解放関数の出現パタンに合致する実行パスが少なくとも一つ存在することを条件として、第1の関数と第2の関数とを抽出する。このため、プログラム解析装置は、同じ関数が異なる位置で呼び出されている場合に、いずれの位置でもリソース捕捉関数とリソース解放関数の出現パタンに合致することを確認した上で、当該関数を抽出することができる。このため、プログラム解析装置は、高い精度でリソース捕捉関数とリソース解放関数を抽出することができる。   In addition, the program analysis apparatus according to the present embodiment has one or more executions that can be traced from each position when there are a plurality of positions in the source code where the first function is called and the return value is stored in the variable. The first function and the second function are extracted on condition that at least one execution path that matches the appearance pattern of the resource capture function and the resource release function exists. Therefore, when the same function is called at different positions, the program analysis apparatus extracts the function after confirming that it matches the appearance pattern of the resource capture function and the resource release function at any position. be able to. For this reason, the program analysis apparatus can extract the resource capture function and the resource release function with high accuracy.

[プログラム]
また、上記実施形態において説明したプログラム解析装置1が実行する処理をコンピュータが実行可能な言語で記述したプログラムを作成することもできる。例えば、実施形態に係るプログラム解析装置1が実行する処理をコンピュータが実行可能な言語で記述したプログラム解析プログラムを作成することもできる。この場合、コンピュータがプログラム解析プログラムを実行することにより、上記実施形態と同様の効果を得ることができる。さらに、かかるプログラム解析プログラムをコンピュータ読み取り可能な記録媒体に記録して、この記録媒体に記録されたプログラム解析プログラムをコンピュータに読み込ませて実行することにより上記実施形態と同様の処理を実現してもよい。
[program]
It is also possible to create a program in which processing executed by the program analysis device 1 described in the above embodiment is described in a language that can be executed by a computer. For example, a program analysis program in which processing executed by the program analysis apparatus 1 according to the embodiment is described in a language that can be executed by a computer can be created. In this case, when the computer executes the program analysis program, the same effects as in the above embodiment can be obtained. Further, the program analysis program may be recorded on a computer-readable recording medium, and the program analysis program recorded on the recording medium may be read and executed by the computer to execute the same processing as in the above embodiment. Good.

図22は、プログラム解析プログラムを実行するコンピュータ1000を示す図である。図22に例示するように、コンピュータ1000は、例えば、メモリ1010と、CPU1020と、ハードディスクドライブインタフェース1030と、ディスクドライブインタフェース1040と、シリアルポートインタフェース1050と、ビデオアダプタ1060と、ネットワークインタフェース1070とを有し、これらの各部はバス1080によって接続される。   FIG. 22 is a diagram illustrating a computer 1000 that executes a program analysis program. As illustrated in FIG. 22, the computer 1000 includes, for example, a memory 1010, a CPU 1020, a hard disk drive interface 1030, a disk drive interface 1040, a serial port interface 1050, a video adapter 1060, and a network interface 1070. These units are connected by a bus 1080.

メモリ1010は、図22に例示するように、ROM(Read Only Memory)1011及びRAM1012を含む。ROM1011は、例えば、BIOS(Basic Input Output System)等のブートプログラムを記憶する。ハードディスクドライブインタフェース1030は、図22に例示するように、ハードディスクドライブ1031に接続される。ディスクドライブインタフェース1040は、図22に例示するように、ディスクドライブ1041に接続される。例えば磁気ディスクや光ディスク等の着脱可能な記憶媒体が、ディスクドライブ1041に挿入される。シリアルポートインタフェース1050は、図22に例示するように、例えばマウス1051、キーボード1052に接続される。ビデオアダプタ1060は、図22に例示するように、例えばディスプレイ1061に接続される。   The memory 1010 includes a ROM (Read Only Memory) 1011 and a RAM 1012 as illustrated in FIG. The ROM 1011 stores a boot program such as BIOS (Basic Input Output System). The hard disk drive interface 1030 is connected to the hard disk drive 1031 as illustrated in FIG. The disk drive interface 1040 is connected to the disk drive 1041 as illustrated in FIG. For example, a removable storage medium such as a magnetic disk or an optical disk is inserted into the disk drive 1041. The serial port interface 1050 is connected to, for example, a mouse 1051 and a keyboard 1052 as illustrated in FIG. The video adapter 1060 is connected to a display 1061, for example, as illustrated in FIG.

ここで、図22に例示するように、ハードディスクドライブ1031は、例えば、OS1091、アプリケーションプログラム1092、プログラムモジュール1093、プログラムデータ1094を記憶する。すなわち、上記のプログラム解析プログラムは、コンピュータ1000によって実行される指令が記述されたプログラムモジュールとして、例えばハードディスクドライブ1031に記憶される。   Here, as illustrated in FIG. 22, the hard disk drive 1031 stores, for example, an OS 1091, an application program 1092, a program module 1093, and program data 1094. That is, the program analysis program is stored in, for example, the hard disk drive 1031 as a program module in which a command executed by the computer 1000 is described.

また、上記実施形態で説明した各種データは、プログラムデータとして、例えばメモリ1010やハードディスクドライブ1031に記憶される。そして、CPU1020が、メモリ1010やハードディスクドライブ1031に記憶されたプログラムモジュール1093やプログラムデータ1094を必要に応じてRAM1012に読み出し、各種処理手順を実行する。   The various data described in the above embodiment is stored as program data, for example, in the memory 1010 or the hard disk drive 1031. Then, the CPU 1020 reads the program module 1093 and the program data 1094 stored in the memory 1010 and the hard disk drive 1031 to the RAM 1012 as necessary, and executes various processing procedures.

なお、プログラム解析プログラムに係るプログラムモジュール1093やプログラムデータ1094は、ハードディスクドライブ1031に記憶される場合に限られず、例えば着脱可能な記憶媒体に記憶され、ディスクドライブ等を介してCPU1020によって読み出されてもよい。あるいは、プログラム解析プログラムに係るプログラムモジュール1093やプログラムデータ1094は、ネットワーク(LAN(Local Area Network)、WAN(Wide Area Network)等)を介して接続された他のコンピュータに記憶され、ネットワークインタフェース1070を介してCPU1020によって読み出されてもよい。   Note that the program module 1093 and the program data 1094 related to the program analysis program are not limited to being stored in the hard disk drive 1031, but are stored in, for example, a removable storage medium and read out by the CPU 1020 via the disk drive or the like. Also good. Alternatively, the program module 1093 and the program data 1094 related to the program analysis program are stored in another computer connected via a network (LAN (Local Area Network), WAN (Wide Area Network), etc.), and the network interface 1070 is stored. Via the CPU 1020.

なお、本実施形態において説明した各処理のうち、自動的におこなわれるものとして説明した処理の全部または一部を手動的に行うこともでき、あるいは、手動的におこなわれるものとして説明した処理の全部または一部を公知の方法で自動的におこなうこともできる。この他、上記文書中や図面中で示した処理手順、制御手順、具体的名称、各種のデータやパラメータを含む情報については、特記する場合を除いて任意に変更することができる。   Of the processes described in this embodiment, all or part of the processes described as being performed automatically can be performed manually, or the processes described as being performed manually can be performed. All or a part can be automatically performed by a known method. In addition, the processing procedure, control procedure, specific name, and information including various data and parameters shown in the above-described document and drawings can be arbitrarily changed unless otherwise specified.

上記の実施形態やその変形は、本願が開示する技術に含まれると同様に、特許請求の範囲に記載された発明とその均等の範囲に含まれるものである。   The above embodiments and modifications thereof are included in the invention disclosed in the claims and equivalents thereof as well as included in the technology disclosed in the present application.

1 プログラム解析装置
10 入力部
20 制御部
21 解析部
22 生成部
23 抽出部
30 記憶部
31 ソースコード記憶部
32 サブルーチン展開コード記憶部
33 関数記憶部
34 実行パス記憶部
35 関数ペア集合記憶部
40 出力部
DESCRIPTION OF SYMBOLS 1 Program analyzer 10 Input part 20 Control part 21 Analysis part 22 Generation part 23 Extraction part 30 Storage part 31 Source code storage part 32 Subroutine expansion code storage part 33 Function storage part 34 Execution path storage part 35 Function pair set storage part 40 Output Part

Claims (8)

ソースコード中、第1の関数が呼び出された位置から処理が辿る可能性のある実行パスにループが含まれる場合に、当該ループを1回からn回(nは2以上の自然数)まで繰り返して実行した場合のそれぞれについて、処理が辿る可能性のある実行パスを生成する生成部と、
生成した前記実行パスにおいて、前記第1の関数と、前記第1の関数の戻り値を格納する変数と、前記第1の関数とは異なり該第1の関数の戻り値を格納する前記変数を引数とする第2の関数と、の出現パタンが、リソース捕捉関数とリソース解放関数の出現パタンに合致する場合、前記第1の関数と前記第2の関数とをリソース捕捉関数とリソース解放関数のペアとして抽出する抽出部と、
を備え
前記生成部は、前記第1の関数の戻り値を前記変数に格納する第1の処理と、当該変数を引数とし、前記第1および第2の関数と異なる第3の関数を呼び出す第2の処理と、前記変数を引数とする前記第2の関数を呼び出す第3の処理と、の出現順序のみを示す実行パスを生成することを特徴とするプログラム解析装置。
In the source code, when a loop is included in the execution path that may be traced from the position where the first function is called, the loop is repeated from 1 to n times (n is a natural number of 2 or more). For each execution, a generation unit that generates an execution path that the process may follow,
In the generated execution path, the first function, a variable that stores the return value of the first function, and the variable that stores the return value of the first function unlike the first function When the appearance pattern of the second function as an argument matches the appearance pattern of the resource capture function and the resource release function, the first function and the second function are used as the resource capture function and the resource release function. An extractor for extracting as a pair;
Equipped with a,
The generation unit stores a return value of the first function in the variable, and a second function that calls a third function different from the first and second functions using the variable as an argument. An execution path indicating only an appearance order of a process and a third process for calling the second function having the variable as an argument is generated .
前記生成部は、生成した前記実行パスに、前記第1および第2の関数がリソース捕捉関数とリソース解放関数であるとした場合に、リソース捕捉関数とリソース解放関数の出現パタンに合致しない箇所がある場合、合致しない箇所を一部を残して削除することにより、前記実行パスを短くすることを特徴とする請求項に記載のプログラム解析装置。 In the generated execution path, when the first and second functions are a resource capture function and a resource release function, the generation unit includes a portion that does not match the appearance pattern of the resource capture function and the resource release function. in some cases, by deleting leaving some portions do not match, the program analyzing device according to claim 1, characterized in that to shorten the execution path. 前記生成部は、生成した前記実行パスが、
(1)前記第3の処理を3以上含む場合、2回目の前記第3の処理の出現より後の処理を削除し、
(2)前記第1の処理の後、前記第2の処理を2以上含む場合、2回目以降の前記第2の処理を削除し、
(3)前記第3の処理の後、前記第2の処理を2以上含む場合、2回目以降の前記第2の処理を削除する、
ことにより、前記実行パスを短くすることを特徴とする請求項に記載のプログラム解析装置。
The generation unit generates the generated execution path as follows:
(1) When three or more of the third processes are included, a process after the appearance of the third process for the second time is deleted,
(2) After the first process, when the second process includes two or more, delete the second process after the second time,
(3) After the third process, when the second process includes two or more, the second process after the second is deleted.
The program analysis apparatus according to claim 2 , wherein the execution path is shortened.
ソースコード中、第1の関数が呼び出された位置から処理が辿る可能性のある実行パスにループが含まれる場合に、当該ループを1回からn回(nは2以上の自然数)まで繰り返して実行した場合のそれぞれについて、処理が辿る可能性のある実行パスを生成する生成部と、
生成した前記実行パスにおいて、前記第1の関数と、前記第1の関数の戻り値を格納する変数と、前記第1の関数とは異なり該第1の関数の戻り値を格納する前記変数を引数とする第2の関数と、の出現パタンが、リソース捕捉関数とリソース解放関数の出現パタンに合致する場合、前記第1の関数と前記第2の関数とをリソース捕捉関数とリソース解放関数のペアとして抽出する抽出部と、
を備え、
前記生成部は、前記ループをn回実行した場合に得られる実行パスと、前記ループを(n−1)回実行した場合に得られる実行パスと、が等しくなった場合に、前記実行パスの生成を終了することを特徴とするプログラム解析装置。
In the source code, when a loop is included in the execution path that may be traced from the position where the first function is called, the loop is repeated from 1 to n times (n is a natural number of 2 or more). For each execution, a generation unit that generates an execution path that the process may follow,
In the generated execution path, the first function, a variable that stores the return value of the first function, and the variable that stores the return value of the first function unlike the first function When the appearance pattern of the second function as an argument matches the appearance pattern of the resource capture function and the resource release function, the first function and the second function are used as the resource capture function and the resource release function. An extractor for extracting as a pair;
With
When the execution path obtained when the loop is executed n times is equal to the execution path obtained when the loop is executed (n-1) times, the generation unit features and to Help program analyzer to terminate the generation.
前記抽出部は、前記ソースコード中に、前記第1の関数を呼び出して戻り値を変数に格納する位置が複数ある場合に、各位置から辿ることができる1以上の実行パスのうち、前記出現パタンに合致する実行パスが少なくとも一つ存在することを条件として、前記第1の関数と前記第2の関数とを抽出することを特徴とする請求項1からのいずれか1項に記載のプログラム解析装置。 In the case where there are a plurality of positions in the source code where the first function is called and a return value is stored in a variable, the extraction unit includes the appearance among one or more execution paths that can be traced from each position. on the condition that the execution path that matches the pattern is at least one presence, according to any one of claims 1 4, characterized in that to extract said first function and said second function Program analysis device. ソースコード中、第1の関数が呼び出された位置から処理が辿る可能性のある実行パスにループが含まれる場合に、当該ループを1回からn回(nは2以上の自然数)まで繰り返して実行した場合のそれぞれについて、処理が辿る可能性のある実行パスを生成する生成工程と、
生成した前記実行パスにおいて、前記第1の関数と、前記第1の関数の戻り値を格納する変数と、前記第1の関数とは異なり前記変数を引数とする第2の関数と、の出現パタンが、リソース捕捉関数とリソース解放関数の出現パタンに合致する場合、前記第1の関数と前記第2の関数とをリソース捕捉関数とリソース解放関数のペアとして抽出する抽出工程と、
をコンピュータが実行し、
前記生成工程は、前記第1の関数の戻り値を前記変数に格納する第1の処理と、当該変数を引数とし、前記第1および第2の関数と異なる第3の関数を呼び出す第2の処理と、前記変数を引数とする前記第2の関数を呼び出す第3の処理と、の出現順序のみを示す実行パスを生成することを特徴とするプログラム解析方法。
In the source code, when a loop is included in the execution path that may be traced from the position where the first function is called, the loop is repeated from 1 to n times (n is a natural number of 2 or more). For each execution, a generation process that generates an execution path that the process may follow,
Appearance of the first function, a variable for storing a return value of the first function, and a second function having the variable as an argument unlike the first function in the generated execution path An extraction step of extracting the first function and the second function as a pair of a resource capture function and a resource release function when the pattern matches an appearance pattern of a resource capture function and a resource release function;
The computer runs ,
The generating step includes a first process for storing a return value of the first function in the variable, and a second function for calling a third function different from the first and second functions using the variable as an argument. An execution path indicating only an appearance order of the process and a third process for calling the second function having the variable as an argument is generated .
ソースコード中、第1の関数が呼び出された位置から処理が辿る可能性のある実行パスにループが含まれる場合に、当該ループを1回からn回(nは2以上の自然数)まで繰り返して実行した場合のそれぞれについて、処理が辿る可能性のある実行パスを生成する生成工程と、  In the source code, when a loop is included in the execution path that may be traced from the position where the first function is called, the loop is repeated from 1 to n times (n is a natural number of 2 or more). For each execution, a generation process that generates an execution path that the process may follow,
生成した前記実行パスにおいて、前記第1の関数と、前記第1の関数の戻り値を格納する変数と、前記第1の関数とは異なり前記変数を引数とする第2の関数と、の出現パタンが、リソース捕捉関数とリソース解放関数の出現パタンに合致する場合、前記第1の関数と前記第2の関数とをリソース捕捉関数とリソース解放関数のペアとして抽出する抽出工程と、  Appearance of the first function, a variable for storing a return value of the first function, and a second function having the variable as an argument unlike the first function in the generated execution path An extraction step of extracting the first function and the second function as a pair of a resource capture function and a resource release function when the pattern matches an appearance pattern of a resource capture function and a resource release function;
をコンピュータが実行し、  The computer runs,
前記生成工程は、前記ループをn回実行した場合に得られる実行パスと、前記ループを(n−1)回実行した場合に得られる実行パスと、が等しくなった場合に、前記実行パスの生成を終了することを特徴とするプログラム解析方法。  In the generation step, the execution path obtained when the loop is executed n times is equal to the execution path obtained when the loop is executed (n−1) times. A program analysis method characterized by terminating generation.
コンピュータを請求項1〜のいずれか1項に記載のプログラム解析装置として機能させるためのプログラム解析プログラム。 The program analysis program for functioning a computer as a program analysis apparatus of any one of Claims 1-5 .
JP2016161559A 2016-08-19 2016-08-19 Program analysis apparatus, program analysis method, and program analysis program Active JP6574151B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2016161559A JP6574151B2 (en) 2016-08-19 2016-08-19 Program analysis apparatus, program analysis method, and program analysis program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2016161559A JP6574151B2 (en) 2016-08-19 2016-08-19 Program analysis apparatus, program analysis method, and program analysis program

Publications (2)

Publication Number Publication Date
JP2018028879A JP2018028879A (en) 2018-02-22
JP6574151B2 true JP6574151B2 (en) 2019-09-11

Family

ID=61248499

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2016161559A Active JP6574151B2 (en) 2016-08-19 2016-08-19 Program analysis apparatus, program analysis method, and program analysis program

Country Status (1)

Country Link
JP (1) JP6574151B2 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10996906B2 (en) 2018-02-21 2021-05-04 Canon Kabushiki Kaisha Image processing apparatus that is connectable with information processing apparatus providing service to image processing apparatus, control method therefor, and storage medium storing control program therefor

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS62121553A (en) * 1985-11-22 1987-06-02 Fujitsu Ltd Path analysis processing system
JPH0926897A (en) * 1995-05-08 1997-01-28 Toshiba Corp Program analyzer and program analyzing method
JP3418544B2 (en) * 1998-03-24 2003-06-23 日立ソフトウエアエンジニアリング株式会社 Automatic test data generator for programs
JP4257096B2 (en) * 2002-10-21 2009-04-22 株式会社日立製作所 Static analysis device for source program
JP2006127496A (en) * 2004-10-01 2006-05-18 Matsushita Electric Ind Co Ltd Device and method for api specification verification, program for executing the same, and storage medium for storing the same
JP5440287B2 (en) * 2010-03-15 2014-03-12 富士通株式会社 Symbolic execution support program, method and apparatus
WO2012127482A1 (en) * 2011-03-23 2012-09-27 Infosys Technologies Limited Method and system for detecting memory leaks in a program
JP2013065258A (en) * 2011-09-20 2013-04-11 Nec Corp Information processor, information processing method and information processing program

Also Published As

Publication number Publication date
JP2018028879A (en) 2018-02-22

Similar Documents

Publication Publication Date Title
US8291399B2 (en) Off-line program analysis and run-time instrumentation
JPWO2006038394A1 (en) Source code tester, method, program, and storage medium
JP5450840B2 (en) Test data generation method for program execution performance evaluation
JP2016115175A (en) Software test apparatus and software test program
US8752007B2 (en) Automatic generation of run-time instrumenter
JP6574151B2 (en) Program analysis apparatus, program analysis method, and program analysis program
Lebeuf et al. Understanding, debugging, and optimizing distributed software builds: A design study
US20150220733A1 (en) Apparatus and method for detecting a malicious code based on collecting event information
Yang et al. Memoise: a tool for memoized symbolic execution
JP7211228B2 (en) Analysis device, analysis method, and program
JP5207314B2 (en) Test pattern compression method and test pattern compression system
JP6301851B2 (en) Program analysis device, error detection device, program analysis method, error detection method, program analysis program, and error detection program
JP7380851B2 (en) Test script generation device, test script generation method and program
Akimoto et al. Test case selection technique for regression testing using differential control flow graphs
JP5163172B2 (en) Software test item editing support apparatus and software test item editing support method
Dhatchayani et al. Test Case Generation and Reusing Test Cases for GUI Designed with HTML.
JP2011100420A (en) Test program creation device
JP5578625B2 (en) Program analysis apparatus, program analysis method, and program
JP6437396B2 (en) Trace information management system, method, and program
Fekete et al. Creating a GPGPU-accelerated framework for pattern matching using a case study
US8930759B2 (en) Stream generation
JP2016042317A (en) Software design support device, and method
Shabaan et al. Effects of FSM minimization techniques on number of test paths in mobile applications MBT
JP2017037387A (en) Program analysis device, program analysis method and program analysis program
JP7244756B2 (en) Analysis program, program analysis method and program analysis device

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20180830

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20190530

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20190611

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20190726

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

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20190815

R150 Certificate of patent or registration of utility model

Ref document number: 6574151

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150