JP2010191598A - Information processor, information processing method, and program - Google Patents

Information processor, information processing method, and program Download PDF

Info

Publication number
JP2010191598A
JP2010191598A JP2009034105A JP2009034105A JP2010191598A JP 2010191598 A JP2010191598 A JP 2010191598A JP 2009034105 A JP2009034105 A JP 2009034105A JP 2009034105 A JP2009034105 A JP 2009034105A JP 2010191598 A JP2010191598 A JP 2010191598A
Authority
JP
Japan
Prior art keywords
variable
analysis
argument
code
program code
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
JP2009034105A
Other languages
Japanese (ja)
Other versions
JP5409039B2 (en
Inventor
Junya Ujiie
純也 氏家
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Mitsubishi Electric Corp
Original Assignee
Mitsubishi Electric Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Mitsubishi Electric Corp filed Critical Mitsubishi Electric Corp
Priority to JP2009034105A priority Critical patent/JP5409039B2/en
Publication of JP2010191598A publication Critical patent/JP2010191598A/en
Application granted granted Critical
Publication of JP5409039B2 publication Critical patent/JP5409039B2/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Devices For Executing Special Programs (AREA)
  • Stored Programmes (AREA)

Abstract

<P>PROBLEM TO BE SOLVED: To provide a detailed analytic result about reference and substitution to a global variables included in a source code. <P>SOLUTION: A source code analyzing device 1 extracts and analyzes the substitution of the addresses of global variables included in a source code 21 into local variables, the substitution of the arguments of functions in which any address is stored into the local variables, the substitution of the local variables in which the address of the global variables are stored into the other local variables, and the substitution of the local variables in which the arguments of the functions in which any address is stored are stored into the other local variables. Thus, it is possible to achieve more detailed analysis about reference and substitution with respect to the global variables than analysis based on only the names of the global variables. <P>COPYRIGHT: (C)2010,JPO&INPIT

Description

本発明は、プログラムコードを解析する技術に関する。   The present invention relates to a technique for analyzing a program code.

コンピュータシステムでは、高速化、高性能化の要求が強まっている。この要求に対して、プロセッサ単体の高性能化の他に、複数のプロセッサを用いてプログラムを並列動作させることで、処理時間の短縮、すなわち高速化を実現するといった取り組みがなされている。   In computer systems, there is an increasing demand for higher speed and higher performance. In response to this demand, in addition to improving the performance of a single processor, efforts are being made to reduce processing time, that is, increase the speed by operating programs in parallel using a plurality of processors.

プログラムを並列動作させるにあたり、プログラム内の複数箇所で同じデータにアクセスすると、そのアクセス順序によってはプログラムが想定外の動作となるといった問題がある。   When a program is operated in parallel, there is a problem that if the same data is accessed at a plurality of locations in the program, the program becomes an unexpected operation depending on the access order.

この点、特許文献1では、割り込み禁止命令を用いた大域変数へのアクセス順序制御を行う場合に、プログラムのソースコードを解析し、割り込み禁止命令が適切に記述されているか検査することにより、大域変数の干渉を判断し、人手によるチェックの工数削減を実現している。   In this regard, in Patent Document 1, when the access order control to the global variable using the interrupt prohibition instruction is performed, the global code is analyzed by analyzing the source code of the program and checking whether the interrupt prohibition instruction is appropriately described. By judging the interference of variables, the number of man-hours for checking manually is reduced.

また、プログラムの並列化を自動的に行うといった取り組みも多数なされている。
特許文献2では、プログラムの並列化を2パスで行い、ソースコード中の関数呼び出しを検出した際に、第1のパスにおいて生成された各関数内で使用される大域変数の情報を参照することにより、大域変数への参照や代入の順序関係から関数呼び出しの並列実行の可否を判定し、関数呼び出しの前後のプログラム部分及び呼び出された関数同志の並列化の解析を行っている。
さらに、特許文献3では、オブジェクト指向言語を対象として、クラスメンバの情報を考慮することにより、効率の良い並列化を行っている。
Many efforts have been made to automatically parallelize programs.
In Patent Document 2, when parallelizing a program in two passes and detecting a function call in the source code, reference is made to information on global variables used in each function generated in the first pass. Thus, it is determined whether or not the function call can be executed in parallel based on the reference relation to the global variable and the order relation of the assignment, and the parallelization of the program part before and after the function call and the called functions is analyzed.
Furthermore, in Patent Document 3, efficient parallelization is performed by considering class member information for an object-oriented language.

特開2003−241997号公報Japanese Patent Laid-Open No. 2003-241997 特開平5−143357号公報JP-A-5-143357 特開2004−13184号公報JP 2004-13184 A

しかしながら、上述した従来技術では、大域変数名、もしくはクラスのメンバ変数名に基づいた割り込み禁止命令のチェック、もしくは並列化を行っているため、大域変数のアドレスを格納した変数を経由して行われる大域変数の参照(読み込み)、もしくは大域変数への代入(書き込み)を解析できない。
比較的規模の大きなプログラムでは、機能の共通化等を目的として、大域変数名等を関数定義の中に直接記述せず、引数で与えられたアドレスに対する参照や代入を行う場合がある。
このような記述をしているソースコードの場合、上述した従来技術では、アドレスが代入された引数を対象とした解析ができないため、割り込み禁止の検査については検出漏れが発生し、自動並列化については該当箇所が並列化対象から外れてしまい並列度が上がらないなど、結果としてそれぞれの目的を達成できないという課題がある。
However, in the above-described prior art, since the interrupt disable instruction is checked or parallelized based on the global variable name or the member variable name of the class, it is performed via the variable storing the address of the global variable. Cannot analyze global variable reference (reading) or assignment to global variable (writing).
In a relatively large program, there is a case where a global variable name or the like is not described directly in a function definition for the purpose of sharing functions, but an address given by an argument is referenced or assigned.
In the case of source code with such a description, the above-mentioned conventional technology cannot analyze the argument with the assigned address. There is a problem that each target cannot be achieved as a result, for example, the corresponding part is excluded from the parallelization target and the degree of parallelism does not increase.

本発明は、上記に鑑みてなされたものであり、大域変数のアドレスを格納する処理を検出し、格納された変数を用いた大域変数の参照、代入を解析対象とすることで、大域変数の名前のみに基づく解析よりも、大域変数に対する参照、代入について、詳細な解析結果を提供することを主な目的とする。
また、本発明は、上述の解析結果を用いて、大域変数とそのアドレスが格納された変数との関係を視覚的に表示することを主な目的とする。
The present invention has been made in view of the above, and detects a process of storing the address of a global variable, and makes the analysis and analysis of the reference and assignment of the global variable using the stored variable. The main purpose is to provide detailed analysis results for references and assignments to global variables rather than analysis based only on names.
Another object of the present invention is to visually display the relationship between a global variable and a variable in which the address is stored, using the above analysis result.

本発明に係る情報処理装置は、
大域変数及び局所変数が含まれるプログラムコードを解析対象プログラムコードとして指定するからコード指定部と、
前記コード指定部により指定された解析対象プログラムコードに対する解析を行い、大域変数のアドレスの局所変数への代入と、いずれかのアドレスを格納する引数の局所変数への代入と、大域変数のアドレスを格納する局所変数の他の局所変数への代入と、いずれかのアドレスを格納する引数を格納する局所変数の他の局所変数への代入の少なくともいずれかを前記解析対象プログラムコードから抽出するコード解析抽出部と、
前記コード解析抽出部の抽出結果を記憶する抽出結果記憶部とを有することを特徴とする。
An information processing apparatus according to the present invention includes:
Since a program code including a global variable and a local variable is specified as a program code to be analyzed, a code specifying part,
Analyzes the analysis target program code specified by the code specification unit, assigns the address of the global variable to a local variable, assigns an argument that stores one of the addresses to the local variable, and sets the address of the global variable Code analysis for extracting from the analysis target program code at least one of assignment of a local variable to be stored to another local variable and assignment of a local variable to store an argument for storing any address to another local variable An extractor;
And an extraction result storage unit for storing the extraction result of the code analysis extraction unit.

本発明によれば、大域変数のアドレスを格納する処理を検出し、格納された変数を用いた大域変数の参照、代入を解析対象とすることで、大域変数の名前のみに基づく解析よりも、大域変数に対する参照、代入について、詳細な解析結果を提供することができる。   According to the present invention, by detecting the process of storing the address of the global variable and making the analysis target the reference and assignment of the global variable using the stored variable, rather than the analysis based only on the name of the global variable, Detailed analysis results for references and assignments to global variables can be provided.

実施の形態1におけるソースコード解析装置1を備える解析システムの機能ブロック図。FIG. 2 is a functional block diagram of an analysis system including a source code analysis device 1 according to the first embodiment. 構文木160を構成するノード1600の構造の一例を示す図。The figure which shows an example of the structure of the node 1600 which comprises the syntax tree 160. FIG. 記号表161の構造の一例を示す図。The figure which shows an example of the structure of the symbol table 161. 引数関連情報162の構造の一例を示す図。The figure which shows an example of the structure of the argument relevant information 162. 関数定義ファイルリスト20の構造の一例を示す図。The figure which shows an example of the structure of the function definition file list. ソースコード21a、ソースコード21b、ソースコード21cを示す図。The figure which shows the source code 21a, the source code 21b, and the source code 21c. 解析結果22の構造の一例を示す図。The figure which shows an example of the structure of the analysis result 22. FIG. 入力部10の動作を示すフローチャート。7 is a flowchart showing the operation of the input unit 10 ソースファイル特定部11の動作を示すフローチャート。7 is a flowchart showing the operation of the source file specifying unit 11. 実施の形態1おけるソースコード展開部12の動作を示すフローチャート。6 is a flowchart showing the operation of the source code development unit 12 in the first embodiment. 引数関連情報設定部13の動作を示すフローチャート。14 is a flowchart showing the operation of the argument related information setting unit 13. 解析部14の動作を示すフローチャート。7 is a flowchart showing the operation of the analysis unit 14. 解析部14による宣言の解析動作を示すフローチャート。9 is a flowchart showing a declaration analysis operation by the analysis unit 14; 解析部14による代入文の解析動作を示すフローチャート。10 is a flowchart showing an assignment statement analysis operation by the analysis unit 14; 解析部14による関数呼び出しの解析動作を示すフローチャート。7 is a flowchart showing an analysis operation of a function call by the analysis unit 14. 表示部15の動作を示すフローチャート。10 is a flowchart showing the operation of the display unit 15. 解析結果22を木構造状に示した図。The figure which showed the analysis result 22 in the shape of a tree structure. 解析結果22を木構造状に示し、特定の関数の内部動作を表示した図。The figure which showed the analysis result 22 in the tree structure form, and displayed the internal operation | movement of the specific function. 解析結果22を用いて、縦軸に着目する変数を1つ選択し、横軸に解析開始関数から呼び出される関数を並べて、アドレスの代入、着目変数への代入を実行順序に従い表示した図。The figure which selected one variable to focus on a vertical axis | shaft using the analysis result 22, arranged the function called from an analysis start function on a horizontal axis, and displayed the substitution of an address and substitution to a focused variable according to the execution order. 実施の形態2におけるソースコード解析装置1を備える解析システムの機能ブロック図。FIG. 4 is a functional block diagram of an analysis system including a source code analysis device 1 according to a second embodiment. 実施の形態2で用いる関数定義ファイルリスト20の構造の一例を示す図。FIG. 10 is a diagram illustrating an example of a structure of a function definition file list 20 used in the second embodiment. 実施の形態2におけるソースコード展開部12による展開済データ23作成の動作を示すフローチャート。9 is a flowchart showing an operation of creating decompressed data 23 by the source code decompressing unit 12 according to the second embodiment. 実施の形態2におけるソースコード展開部12による展開済データ23読み込みの動作を示すフローチャート。10 is a flowchart showing an operation of reading expanded data 23 by the source code expanding unit 12 according to the second embodiment. ソースコードの例を示す図。The figure which shows the example of a source code. ソースコード解析装置のハードウェア構成例を示す図。The figure which shows the hardware structural example of a source code analysis apparatus.

実施の形態1.
この実施の形態では、大域変数の参照、代入について、詳細な情報の提供を可能としたソースコード解析装置について説明する。
Embodiment 1 FIG.
In this embodiment, a source code analysis apparatus capable of providing detailed information regarding global variable reference and substitution will be described.

まず、本実施の形態に係るソースコード解析装置の動作の概要を説明した後に、本実施の形態に係るソースコード解析装置の構成例及び動作の詳細を説明する。   First, after describing the outline of the operation of the source code analysis device according to the present embodiment, a configuration example and details of the operation of the source code analysis device according to the present embodiment will be described.

ソースコード解析装置は、プログラミング言語で記述されたソースコード(プログラムコード)を解析して、ソースコードに含まれる以下の<A>〜<I>の各要素を抽出する。
<A>大域変数の参照
<B>大域変数への代入
<C>いずれかのアドレスを格納した引数の参照
<D>局所変数への
(1)大域変数のアドレスの代入
(2)いずれかのアドレスを格納した関数の引数の代入
(3)大域変数のアドレスが格納されている局所変数の代入
(4)いずれかのアドレスを格納した関数の引数が格納されている局所変数の代入
<E>
(1)大域変数のアドレスが格納されている局所変数の参照
(2)いずれかのアドレスを格納する引数が格納されている局所変数の参照
<F>上記<D>の局所変数を介した、大域変数もしくは局所変数の参照
<G>上記<D>の局所変数を介した、大域変数もしくは局所変数への代入
<H>いずれかのアドレスを格納する関数の引数を介した、大域変数もしくは局所変数の参照
<I>いずれかのアドレスを格納する関数の引数を介した、大域変数もしくは局所変数への代入
The source code analysis device analyzes a source code (program code) described in a programming language, and extracts the following elements <A> to <I> included in the source code.
<A> Reference to global variable <B> Assignment to global variable <C> Reference to argument storing any address <D> Local variable (1) Assignment of global variable address (2) Any Assignment of argument of function storing address (3) Assignment of local variable storing address of global variable (4) Assignment of local variable storing argument of function storing any address <E>
(1) Reference of local variable storing address of global variable (2) Reference of local variable storing argument storing any address <F> Via local variable of <D> above, Reference of global variable or local variable <G> Substitution to global variable or local variable via local variable of <D> above <H> Global variable or local via argument of function storing any address Variable reference <I> Assignment to a global or local variable via an argument of a function that stores any address

例えば、本実施の形態に係るソースコード解析装置が、図24に例示するソースコードを解析対象とした場合には、gを大域変数としてソースコードを解析し、図24のコメントに示しているように上記の<A>〜<I>が抽出される。
なお、図24のソースコード例は、C言語で記述されたものである。
本実施の形態では、ソースコード解析装置は、ソースコードの構文木と記号表を生成し、構文木と記号表を用いてソースコードを解析して上記の<A>〜<I>を抽出し、抽出結果を記憶する。
なお、構文木と記号表の生成は必須ではなく、構文木と記号表を用いずにソースコードを解析するようにしてもよい。
For example, when the source code analysis apparatus according to the present embodiment analyzes the source code illustrated in FIG. 24, the source code is analyzed using g as a global variable, as shown in the comments of FIG. The above <A> to <I> are extracted.
Note that the source code example in FIG. 24 is written in C language.
In the present embodiment, the source code analysis device generates a syntax tree and a symbol table of the source code, analyzes the source code using the syntax tree and the symbol table, and extracts the above <A> to <I>. , Memorize the extraction result.
The generation of the syntax tree and the symbol table is not essential, and the source code may be analyzed without using the syntax tree and the symbol table.

また、解析対象のソースコードに関数呼び出しが含まれている場合は、ソースコード解析装置は、関数呼び出しに関連する仮引数と実引数を抽出し、抽出した抽出仮引数と抽出実引数とを対応付け、呼び出し対象の関数のソースコードを解析し、抽出仮引数の参照と、抽出仮引数への代入と、抽出仮引数の値を代入した局所変数の参照と、抽出仮引数の値を代入した局所変数の他の局所変数への代入の少なくともといずれかを抽出し、抽出結果を、抽出仮引数と抽出実引数に対応付ける。
また、ソースコード解析装置は、呼び出し対象の関数が含まれているソースコードを識別し、当該ソースコードを新たな解析対象ソースコードとして指定するとともに、それまで解析を行っていた解析対象ソースコードに対する解析を中断し、新たな解析対象ソースコードに対する解析を開始し、新たな解析対象ソースコードに対する解析が終了した際に、新たな解析対象ソースコードの前に解析を行っていた解析対象ソースコードに対する解析を再開する。
If the source code to be analyzed contains a function call, the source code analyzer extracts the dummy argument and actual argument related to the function call, and associates the extracted extracted dummy argument with the extracted actual argument. The source code of the function to be called is analyzed and the extracted dummy argument is referenced, assigned to the extracted dummy argument, the reference of the local variable that is assigned the value of the extracted dummy argument, and the value of the extracted dummy argument is assigned. Extract at least one of the substitutions of local variables to other local variables, and associate the extraction results with extracted formal arguments and extracted actual arguments.
In addition, the source code analysis device identifies a source code including a function to be called, designates the source code as a new analysis target source code, and performs analysis on the analysis target source code that has been analyzed so far. When the analysis is interrupted, the analysis for the new analysis target source code is started, and the analysis for the new analysis target source code is completed, the analysis is performed on the analysis target source code that was analyzed before the new analysis target source code. Resume analysis.

また、ソースコード解析装置は、ソースコードの解析において、大域変数と、アドレスを格納する実引数に記述されている変数と、アドレスを格納する実引数に対応する仮引数に記述されている変数と、宣言文に含まれている変数が出現した場合には、これら変数を検査リストに入れる。このように検査リストに入れた変数を検査対象変数と呼ぶ。
そして、検査対象変数の参照と、検査対象変数への代入(代入文において検査対象変数が左辺)と、検査対象要素を介した他の変数への代入(代入文において他の変数が左辺)と、他の変数への検査対象変数の代入(代入文において他の変数が左辺、検査対象変数が右辺)の少なくともといずれかが解析対象ソースコードに含まれているか否かを検査して抽出処理を行う。
また、ソースコード解析装置は、他の変数へ検査対象変数が代入されている場合(代入文において他の変数が左辺、検査対象変数が右辺)に、当該他の変数がアドレスを格納する変数であるかを判断し、当該他の変数がアドレスを格納する変数である場合に当該他の変数を検査リストに入れて検査対象変数とする。
Further, the source code analysis device, in the analysis of the source code, the global variable, the variable described in the actual argument storing the address, and the variable described in the dummy argument corresponding to the actual argument storing the address When variables included in the declaration statement appear, these variables are put in the check list. A variable placed in the inspection list in this way is called an inspection target variable.
And the reference of the inspection target variable, the assignment to the inspection target variable (the inspection target variable is the left side in the assignment statement), the assignment to the other variable via the inspection target element (the other variable is the left side in the assignment statement), , Check whether at least one of the assignment of the variable to be examined to another variable (in the assignment statement, the other variable is on the left side and the variable to be examined is on the right side) is included in the analysis source code. I do.
The source code analysis device is a variable that stores an address when the variable to be checked is assigned to another variable (in the assignment statement, the other variable is the left side and the variable to be checked is the right side). If the other variable is a variable for storing an address, the other variable is put in the inspection list and is set as the inspection target variable.

そして、ソースコード解析装置は、抽出した<A>〜<I>の各々に対して、変数名、抽出元のソースファイル名、行番号、呼出階層、操作種別(参照/代入の別)、設定値をリスト化して、ソースコード解析装置のユーザに提示する。   Then, the source code analysis apparatus, for each of the extracted <A> to <I>, variable name, source file name of the extraction source, line number, call hierarchy, operation type (separate reference / substitution), setting List the values and present them to the user of the source code analyzer.

次に、本実施の形態に係るソースコード解析装置1を備える解析システムの機能ブロックを図1に示す。   Next, FIG. 1 shows functional blocks of an analysis system including the source code analysis device 1 according to the present embodiment.

解析システムは、ソースコード解析装置1(情報処理装置)及び記憶装置2を備える。
ソースコード解析装置1は、大域変数の参照・代入について、詳細な解析結果を提供することを可能とした装置であり、動作の詳細については後述する。
記憶装置2は、例えばHDD(Hard Disk Drive)等の不揮発性記憶装置である。
記憶装置2は、ソースコード解析装置1への入力となるデータ、およびソースコード解析装置1からの出力を蓄積する。
The analysis system includes a source code analysis device 1 (information processing device) and a storage device 2.
The source code analysis device 1 is a device that can provide a detailed analysis result for reference / substitution of a global variable, and details of the operation will be described later.
The storage device 2 is a non-volatile storage device such as an HDD (Hard Disk Drive).
The storage device 2 stores data to be input to the source code analysis device 1 and an output from the source code analysis device 1.

ソースコード解析装置1は、入力部10、ソースファイル特定部11、ソースコード展開部12、引数関連情報設定部13、解析部14、表示部15、一時記憶部16を備える。   The source code analysis device 1 includes an input unit 10, a source file identification unit 11, a source code development unit 12, an argument related information setting unit 13, an analysis unit 14, a display unit 15, and a temporary storage unit 16.

入力部10は、解析システムの使用者からの入力を受け付ける機能であり、この入力に基づき、ソースコード解析装置1を用いて解析する関数を決定したり、解析結果の表示形式を決定したりする。   The input unit 10 is a function that receives an input from a user of the analysis system. Based on the input, the input unit 10 determines a function to be analyzed using the source code analysis device 1 and determines a display format of the analysis result. .

ソースファイル特定部11は、入力部10、もしくは解析部14から渡される解析対象関数、および関数定義ファイルリスト20に基づき、解析に用いるソースコード21を決定する。
ソースファイル特定部11は、コード指定部の例である。また、ソースファイル特定部11により行われる処理がコード指定ステップとなる。
The source file specifying unit 11 determines a source code 21 to be used for analysis based on the analysis target function passed from the input unit 10 or the analysis unit 14 and the function definition file list 20.
The source file specifying unit 11 is an example of a code specifying unit. The process performed by the source file specifying unit 11 is a code specifying step.

ソースコード展開部12は、ソースファイル特定部11が決定したソースコード21から構文木160、および記号表161を作成し、一時記憶部16に格納する。
引数関連情報設定部13は、ソースコード展開部12が一時記憶部16に格納した構文木160、および記号表161に基づき、解析対象関数の仮引数と実引数との対応関係を引数関連情報162として一時記憶部16に格納する。
解析部14は、ソースコード展開部12が一時記憶部16に格納した構文木160、および記号表161に基づき、大域変数と、大域変数のアドレスが格納されている局所変数と、関数の引数を用いた大域変数、に対する参照、代入を解析結果22に出力し、引数関連情報162にある仮引数を用いた大域変数に対する参照、代入等の動作を、引数関連情報162に記録する。また、関数呼び出しの記述がある場合は、記述された関数に対する解析を先に実行し、解析結果22に出力する。
これらソースコード展開部12、引数関連情報設定部13及び解析部14は、コード解析抽出部の例である。また、ソースコード展開部12、引数関連情報設定部13及び解析部14は、コード解析抽出部により行われる処理がコード解析抽出ステップとなる。
The source code development unit 12 creates a syntax tree 160 and a symbol table 161 from the source code 21 determined by the source file specifying unit 11 and stores the syntax tree 160 and the symbol table 161 in the temporary storage unit 16.
Based on the syntax tree 160 stored in the temporary storage unit 16 by the source code development unit 12 and the symbol table 161, the argument related information setting unit 13 indicates the correspondence between the formal argument and the actual argument of the function to be analyzed, and the argument related information 162. Is stored in the temporary storage unit 16.
Based on the syntax tree 160 and the symbol table 161 stored in the temporary storage unit 16 by the source code development unit 12, the analysis unit 14 receives a global variable, a local variable in which the address of the global variable is stored, and a function argument. References and substitutions for the used global variables are output to the analysis result 22, and operations such as references and substitutions for global variables using the dummy arguments in the argument related information 162 are recorded in the argument related information 162. If there is a description of a function call, the analysis for the described function is executed first and output to the analysis result 22.
The source code development unit 12, the argument related information setting unit 13, and the analysis unit 14 are examples of a code analysis extraction unit. In the source code development unit 12, the argument related information setting unit 13, and the analysis unit 14, the processing performed by the code analysis extraction unit is the code analysis extraction step.

表示部15は、解析結果22を入力部10にて指定された形式で表示する。
一時記憶部16は、例えばRAM(Random Access Memory)等の揮発性記憶装置であり、構文木160、記号表161、引数関連情報162、階層値163、解析結果164を一時的に格納する。
解析結果164は、ソースコード解析装置1がソースコードを解析中の中間段階の解析結果である。
解析部14は、解析結果22に反映させる上記の<A>〜<I>を抽出する度に、逐次解析結果164に抽出結果を蓄積し、解析結果164を記憶装置2に移して解析結果22とするが、説明が煩雑になるのを避けるため、以下では、解析部14は解析結果22に抽出結果を蓄積するものとして説明する。
一時記憶部16は、抽出結果記憶部の例である。また、一時記憶部16による解析結果164の記憶処理が抽出結果記憶ステップとなる。
The display unit 15 displays the analysis result 22 in the format specified by the input unit 10.
The temporary storage unit 16 is a volatile storage device such as a RAM (Random Access Memory), for example, and temporarily stores the syntax tree 160, the symbol table 161, the argument related information 162, the hierarchy value 163, and the analysis result 164.
The analysis result 164 is an analysis result at an intermediate stage in which the source code analysis device 1 is analyzing the source code.
Each time the analysis unit 14 extracts the above-described <A> to <I> to be reflected in the analysis result 22, the analysis result is sequentially accumulated in the analysis result 164, and the analysis result 164 is transferred to the storage device 2 and the analysis result 22. However, in order to avoid complicated description, the analysis unit 14 will be described below as storing the extraction result in the analysis result 22.
The temporary storage unit 16 is an example of an extraction result storage unit. The storage process of the analysis result 164 by the temporary storage unit 16 is an extraction result storage step.

なお、上記の説明ではソースコード解析装置1と記憶装置2を個々の分かれた装置としたが、これらが1つの装置として構成されていてもよい。
また、上記の説明では、表示部15をソースコード解析装置1の中に含むとしているが、ソースコード解析装置1とは別の装置(例えば「表示装置」)であっても構わない。
In the above description, the source code analysis device 1 and the storage device 2 are separate devices, but they may be configured as one device.
In the above description, the display unit 15 is included in the source code analysis device 1, but may be a device different from the source code analysis device 1 (for example, “display device”).

次に、構文木160について説明する。
図2は構文木160を構成するノード1600の構造を示す図である。
ノード1600はノード種別1601、構文規則番号1602、行番号1603、値種別1604、ノード値1605を備える。
ノード種別1601は、構文規則を構成する終端記号(ソースコード上に出現する識別子、演算子、特殊記号等)もしくは非終端記号(ソースコードには出現せず、特定の終端記号の集合を表すもの)を識別するための情報である。
構文規則番号1602は、非終端記号に関する構文規則を一意に特定するための番号である。例えば、ある非終端記号が親ノードとなる木構造に対応する構文規則が2つあるとした場合、構文規則番号1602に0、1のどちらかを入れることで、該当する構文規則を特定できる。
行番号1603はそれぞれの終端記号について、ソースコード上の出現位置を意味する番号である。
値種別1604は、ノード値1605の種類を識別するための情報である。
ノード値1605は、ノード種別1601が非終端記号に属する場合、子ノードの個数と子ノードへの接続情報である。また、ノード種別1601が記号表161に格納される識別子の場合、ノード値1605は、記号表の該当する情報への接続情報である。また、ノード種別1601が識別子以外の終端記号の場合、ノード値1605は、ソースコードに出現する予約語、特殊文字等の文字列である。
Next, the syntax tree 160 will be described.
FIG. 2 is a diagram showing the structure of the node 1600 that constitutes the syntax tree 160.
The node 1600 includes a node type 1601, a syntax rule number 1602, a line number 1603, a value type 1604, and a node value 1605.
The node type 1601 is a terminal symbol (identifier, operator, special symbol, etc. appearing in the source code) or non-terminal symbol (which does not appear in the source code and represents a set of specific terminal symbols) constituting the syntax rule. It is information for identifying.
The syntax rule number 1602 is a number for uniquely specifying a syntax rule regarding a non-terminal symbol. For example, when there are two syntax rules corresponding to a tree structure in which a certain non-terminal symbol is a parent node, the corresponding syntax rule can be specified by putting either 0 or 1 in the syntax rule number 1602.
A line number 1603 is a number indicating an appearance position on the source code for each terminal symbol.
The value type 1604 is information for identifying the type of the node value 1605.
The node value 1605 is the number of child nodes and connection information to the child nodes when the node type 1601 belongs to a non-terminal symbol. When the node type 1601 is an identifier stored in the symbol table 161, the node value 1605 is connection information to corresponding information in the symbol table. When the node type 1601 is a terminal symbol other than an identifier, the node value 1605 is a character string such as a reserved word or special character that appears in the source code.

記号表161について説明する。
図3は記号表161の構造を示す図である。
記号表161には、識別子の数だけ識別子名1610、識別子種別1611、型指定子情報1612、宣言子情報1613、初期化子情報1614が存在する。すなわち、記号表161は、1つ以上の識別子名1610、識別子種別1611、型指定子情報1612、宣言子情報1613、初期化子情報1614から構成される組を備える。
識別子名1610は、ソースコードに出現した識別子の名前である。
識別子種別1611は、識別子の種類を表す情報である。識別子種別1611に格納する値は、例えば、大域変数、静的変数、引数、局所変数等を意味する値である。
型指定子情報1612は、識別子名1610の型指定子に関する情報である。具体的には、型指定子という名前の非終端記号に対応するノードをルートとする構文木160の部分木に出現する終端記号、すなわち型名等の記述となる。
宣言子情報1613は、識別子名1610の宣言子に関する情報である。具体的には、宣言子という名前の非終端記号に対応するノードをルートとする構文木160の部分木に出現する終端記号、すなわち変数宣言の場合は変数名、関数宣言の場合は関数名と引数リスト、等の記述となる。
初期化子情報1614は、識別子名1610の初期化子に関する情報である。具体的には、初期化子という名前の非終端記号に対応するノードをルートとする構文木160の部分木に出現する終端記号、すなわち代入する値の記述となる。図3では、大域変数gValのみに対して「20」と記述されており、大域変数gValが宣言と同時に20という値で初期化されることを意味する。
なお、説明のため、図3では記号表161の型指定子情報1612、宣言子情報1613、初期化子情報1614の欄に型名、もしくは初期化値等を直接記述したが、構文木160の該当するノード1600への接続情報を格納してもよい。
The symbol table 161 will be described.
FIG. 3 is a diagram showing the structure of the symbol table 161.
The symbol table 161 includes as many identifier names 1610, identifier types 1611, type specifier information 1612, declarator information 1613, and initializer information 1614 as the number of identifiers. That is, the symbol table 161 includes a set including one or more identifier names 1610, identifier types 1611, type specifier information 1612, declarator information 1613, and initializer information 1614.
The identifier name 1610 is a name of an identifier that appears in the source code.
The identifier type 1611 is information indicating the type of identifier. The values stored in the identifier type 1611 are values that mean, for example, global variables, static variables, arguments, local variables, and the like.
The type specifier information 1612 is information related to the type specifier of the identifier name 1610. Specifically, it is a description of a terminal symbol that appears in a subtree of the syntax tree 160 whose root is a node corresponding to a nonterminal symbol named type specifier, that is, a type name.
The declarator information 1613 is information related to the declarator of the identifier name 1610. Specifically, a terminal symbol that appears in a subtree of the syntax tree 160 rooted at a node corresponding to a nonterminal symbol named declarator, that is, a variable name in the case of a variable declaration, a function name and an argument in the case of a function declaration A description such as a list.
The initializer information 1614 is information regarding the initializer of the identifier name 1610. Specifically, it is a description of a terminal symbol that appears in a subtree of the syntax tree 160 whose root is a node corresponding to a nonterminal symbol named initializer, that is, a value to be substituted. In FIG. 3, “20” is described only for the global variable gVal, which means that the global variable gVal is initialized with a value of 20 at the same time as the declaration.
For the sake of explanation, in FIG. 3, the type name or initialization value is directly described in the type specifier information 1612, declarator information 1613, and initializer information 1614 fields of the symbol table 161. Connection information to the corresponding node 1600 may be stored.

引数関連情報162について説明する。
図4は引数関連情報162の構造を示す図である。
引数関連情報162には、引数の数だけ実引数1620、仮引数1621、初期設定1622、操作種別1623が存在する。
すなわち、引数関連情報162は、0個以上の実引数1620、仮引数1621、初期設定1622、操作種別1623から構成される組を備える。なお、引数のない関数の呼び出しの場合は、実引数1620、仮引数1621、初期設定1622、操作種別1623から構成される組の個数が0個となる。
実引数1620は、ソースコード21に記述された関数呼び出しにある引数である。
仮引数1621は、ソースコード21に記述された関数定義、もしくは関数プロトタイプ宣言に記述されている引数である。
初期設定1622は、実引数1620に代入されている値である。図4では、gValという名前の変数のアドレスを格納しているため、初期設定1622には「&gVal」と先頭に「&」をつけている。
操作種別1623は仮引数1621を用いた処理の種類を表す情報である。
The argument related information 162 will be described.
FIG. 4 is a diagram showing the structure of the argument related information 162.
The argument related information 162 includes as many actual arguments 1620, temporary arguments 1621, initial settings 1622, and operation types 1623 as the number of arguments.
That is, the argument related information 162 includes a set including zero or more actual arguments 1620, temporary arguments 1621, initial settings 1622, and operation types 1623. In the case of calling a function without an argument, the number of sets composed of an actual argument 1620, a dummy argument 1621, an initial setting 1622, and an operation type 1623 is zero.
The actual argument 1620 is an argument in the function call described in the source code 21.
The formal argument 1621 is an argument described in a function definition or function prototype declaration described in the source code 21.
The initial setting 1622 is a value assigned to the actual argument 1620. In FIG. 4, since the address of a variable named gVal is stored, “& gVal” and “&” are added to the initial setting 1622.
The operation type 1623 is information indicating the type of processing using the dummy argument 1621.

階層値163について説明する。
階層値163は、ソースコード解析装置1による解析における、解析を開始する関数から、現在解析している関数に到達するまでの関数呼び出しの回数を示す値である。
The hierarchy value 163 will be described.
The layer value 163 is a value indicating the number of function calls from the function that starts the analysis until the function currently being analyzed is reached in the analysis by the source code analysis device 1.

関数定義ファイルリスト20について説明する。
図5は関数定義ファイルリスト20の構造を示す図である。関数定義ファイルリスト20には、ソースコード解析装置1による解析に用いる1つ以上のソースコード21で定義されている関数の数だけ、関数名200、ソースファイル名201が存在する。
すなわち、関数定義ファイルリスト20は、1つ以上の関数名200、ソースファイル名201から構成される組を備える。
関数名200は、ソースコード21に記述された関数定義における関数の名前である。
ソースファイル名201は、関数名200の関数定義が記述されているファイルの名前である。
The function definition file list 20 will be described.
FIG. 5 shows the structure of the function definition file list 20. In the function definition file list 20, there are as many function names 200 and source file names 201 as there are functions defined in one or more source codes 21 used for analysis by the source code analysis device 1.
That is, the function definition file list 20 includes a set composed of one or more function names 200 and source file names 201.
The function name 200 is a function name in the function definition described in the source code 21.
The source file name 201 is the name of a file in which the function definition of the function name 200 is described.

ソースコード21について説明する。
図6はこの実施の形態の説明に用いるソースコード21を示す図である。
ソースコード21はC言語で記述されたプログラムである。
図6には、3つのソースコード21a、ソースコード21b、ソースコード21cが示されており、ファイル名はそれぞれ、/src/funcA.c、/src/funcB.c、/src/funcC.cである。
ソースコード21aには大域変数gValの宣言と関数f1の定義が記述されている。
ソースコード21bには関数f2の定義が記述されている。
ソースコード21cには関数f3の定義が記述されている。
なお、図6には示していないが、関数f1における関数f2の呼び出し、および、関数f2における関数f3の呼び出しが可能なように、各ソースコードには関数プロトタイプ宣言が記述されているものとする。
なお、この実施の形態ではC言語で記述されたソースコードを例として説明するが、他の言語を対象とすることも可能である。
The source code 21 will be described.
FIG. 6 is a diagram showing the source code 21 used for explaining this embodiment.
The source code 21 is a program written in C language.
FIG. 6 shows three source codes 21a, 21b, and 21c, and the file names are / src / funcA. c, / src / funcB. c, / src / func C.I. c.
The source code 21a describes the declaration of the global variable gVal and the definition of the function f1.
The source code 21b describes the definition of the function f2.
The source code 21c describes the definition of the function f3.
Although not shown in FIG. 6, it is assumed that a function prototype declaration is described in each source code so that the function f2 can be called in the function f1 and the function f3 can be called in the function f2. .
In this embodiment, source code written in C language will be described as an example, but other languages can also be targeted.

解析結果22について説明する。
図7は解析結果22の構造を示す図である。
解析結果22には、解析対象となる変数に対する操作の回数だけ、変数名220、ソースファイル名221、行番号222、呼出階層223、操作種別224、設定値225が存在する。すなわち、解析結果22は、1つ以上の変数名220、ソースファイル名221、行番号222、呼出階層223、操作種別224、設定値225から構成される組を備える。
変数名220は操作された変数の名前である。
ソースファイル名221は、変数名220により特定される変数への操作が記述されたファイルの名前である。
行番号222は、ソースファイル名221のファイルにおける、変数名220により特定される変数への操作の記述位置を示す情報である。
呼出階層223は、関数呼び出しの深さを示す情報である。
操作種別224は、変数名220により特定される変数への操作の種類を示す情報であり、格納する情報の種類は操作種別1623と同じである。なお、図7の操作種別224では「Set」「Read」「Write」が各欄に1つずつ格納されているが、同時に複数の情報を保持することもできる。
設定値225は、変数名220により特定される変数そのもの、もしくは前記変数がアドレスを保持している場合はそのアドレスが指す変数、に対して設定された値である。前記変数に対する値の設定が発生しない操作の場合、設定値225は空である。
The analysis result 22 will be described.
FIG. 7 is a diagram showing the structure of the analysis result 22.
The analysis result 22 includes the variable name 220, the source file name 221, the line number 222, the call hierarchy 223, the operation type 224, and the setting value 225 as many times as the number of operations on the variable to be analyzed. That is, the analysis result 22 includes a set including one or more variable names 220, source file names 221, line numbers 222, a call hierarchy 223, operation types 224, and setting values 225.
The variable name 220 is the name of the manipulated variable.
The source file name 221 is a name of a file in which an operation on the variable specified by the variable name 220 is described.
The line number 222 is information indicating the description position of the operation for the variable specified by the variable name 220 in the file of the source file name 221.
The call hierarchy 223 is information indicating the depth of function calls.
The operation type 224 is information indicating the type of operation for the variable specified by the variable name 220, and the type of information to be stored is the same as the operation type 1623. In the operation type 224 of FIG. 7, “Set”, “Read”, and “Write” are stored one by one in each column, but a plurality of pieces of information can be held simultaneously.
The set value 225 is a value set for the variable itself specified by the variable name 220, or when the variable has an address, the variable indicated by the address. For an operation that does not set a value for the variable, the set value 225 is empty.

以上で説明した図1から図7までと、以下の図8から図19までに基づき、この実施の形態におけるソースコード解析装置1の動作を詳細に説明する。   The operation of the source code analyzing apparatus 1 in this embodiment will be described in detail based on FIGS. 1 to 7 described above and FIGS. 8 to 19 below.

まず、この実施の形態における、入力部10の動作である初期化処理について、図1、図4、図8に基づき説明する。
図8は、この実施の形態における、解析システムの使用者から入力を受けた入力部10の動作を示すフローチャートである。
First, an initialization process that is an operation of the input unit 10 in this embodiment will be described with reference to FIGS. 1, 4, and 8.
FIG. 8 is a flowchart showing the operation of the input unit 10 that receives an input from the user of the analysis system in this embodiment.

(S100):入力部10は、解析システムの使用者から解析を開始する関数を渡されると、初期化処理を開始する。
(S101):入力部10は、階層値163に0を設定する。この動作は階層値163の初期化に相当する。
(S102):入力部10は、解析結果22を開く。
(S103):入力部10は、S100にて取得した関数名と、空の引数関連情報をソースファイル特定部11に渡す。空の引数関連情報とは、実引数1620、仮引数1621、初期設定1622、操作種別1623の組を1つも持たないこと引数関連情報162であることを意味する。
(S104):入力部10は、初期化処理を完了する。
(S100): The input unit 10 starts an initialization process when a function for starting analysis is passed from the user of the analysis system.
(S101): The input unit 10 sets 0 to the layer value 163. This operation corresponds to initialization of the hierarchy value 163.
(S102): The input unit 10 opens the analysis result 22.
(S103): The input unit 10 passes the function name acquired in S100 and empty argument-related information to the source file specifying unit 11. The empty argument related information means that the argument related information 162 does not have any combination of the actual argument 1620, the dummy argument 1621, the initial setting 1622, and the operation type 1623.
(S104): The input unit 10 completes the initialization process.

次に、ソースファイル特定部11の動作について、図1、図5、図9に基づき説明する。
図9は、この実施の形態における、ソースファイル特定部11の動作を示すフローチャートである。
Next, the operation of the source file specifying unit 11 will be described with reference to FIG. 1, FIG. 5, and FIG.
FIG. 9 is a flowchart showing the operation of the source file specifying unit 11 in this embodiment.

(S110):ソースファイル特定部11は、入力部10もしくは解析部14から関数名と引数関連情報162を渡されると、処理を開始する。
(S111):ソースファイル特定部11は、関数定義ファイルリスト20を読み込む。この実施の形態では、関数定義ファイルリスト20は解析システムによる解析の実行前に予め準備されており、図5に示す内容が記録されているとする。
(S112):ソースファイル特定部11は、関数定義ファイルリスト20の関数名200に、入力部10もしくは解析部14から渡された関数名が存在するか判定する。存在すると判定した場合(S112でYes)は、S113に進む。一方、存在しないと判定した場合(S112でNo)は、S114に進む。
(S113):ソースファイル特定部11は、関数定義ファイルリストから該当する関数名200、およびソースファイル名201を取り出し、ソースコード展開部12に渡す。
(S114):ソースファイル特定部11は、処理を完了する。
(S110): When the function name and the argument related information 162 are passed from the input unit 10 or the analysis unit 14, the source file specifying unit 11 starts processing.
(S111): The source file specifying unit 11 reads the function definition file list 20. In this embodiment, it is assumed that the function definition file list 20 is prepared in advance before execution of analysis by the analysis system, and the contents shown in FIG. 5 are recorded.
(S112): The source file specifying unit 11 determines whether the function name passed from the input unit 10 or the analysis unit 14 exists in the function name 200 of the function definition file list 20. If it is determined that it exists (Yes in S112), the process proceeds to S113. On the other hand, if it is determined that it does not exist (No in S112), the process proceeds to S114.
(S113): The source file specifying unit 11 takes out the corresponding function name 200 and source file name 201 from the function definition file list and passes them to the source code development unit 12.
(S114): The source file specifying unit 11 completes the process.

次に、ソースコード展開部12の動作について、図1、図2、図3、図5、図10に基づき説明する。
図10は、この実施の形態における、ソースコード展開部12の動作を示すフローチャートである。
なお、以降はソースファイル名201に対応するソースコード21は記憶装置2に存在するものとして説明する。
Next, the operation of the source code development unit 12 will be described with reference to FIGS. 1, 2, 3, 5, and 10.
FIG. 10 is a flowchart showing the operation of the source code development unit 12 in this embodiment.
In the following description, it is assumed that the source code 21 corresponding to the source file name 201 exists in the storage device 2.

(S120):ソースコード展開部12は、ソースファイル特定部から解析対象となる関数名200、およびソースファイル名201を渡されると、処理を開始する。
(S121):ソースコード展開部12は、ソースコード21を読み込み、構文木160を作成する。構文木160の作成方法について、詳細には述べず、概要のみ述べる。まず、ソースコード21に対して字句解析を行い終端記号として取り出し、ノード1600を作成し、スタックに蓄積する。次に、ノードの並びが構文規則と一致した場合、前記一致した1つ以上のノードをスタックから取り出し、さらに、それらを子ノードとする非終端記号を表すノードを作成し、前記作成したノードをスタックに蓄積する。この処理をソースコード21の終端まで繰り返すことで、構文木160が作成される。
(S122):ソースコード展開部12は、ソースコード21を読み込み、記号表161を作成する。記号表161の作成方法について、詳細には述べず、概要のみ述べる。ソースコード21から変数宣言、関数定義等を読み取り、構文規則に基づき、識別子名1610から初期化子情報1614までの5つの情報を取り出し、記号表161に格納する。変数宣言に対する識別子種別1611の判定は、変数宣言が行われているソースコード21内の位置、具体的には関数定義の外側(大域変数)、関数定義の引数リスト(引数)、関数定義の内側(局所変数)、に基づき行う。
(S123):ソースコード展開部12は、処理を完了する。
(S120): The source code development unit 12 starts processing upon receiving the function name 200 and the source file name 201 to be analyzed from the source file specifying unit.
(S121): The source code development unit 12 reads the source code 21 and creates a syntax tree 160. The method of creating the syntax tree 160 will not be described in detail, but only an overview will be described. First, lexical analysis is performed on the source code 21 to extract it as a terminal symbol, and a node 1600 is created and accumulated in the stack. Next, when the sequence of nodes matches the syntax rule, one or more matched nodes are taken out of the stack, and a node representing a non-terminal symbol having them as child nodes is created, and the created node is stacked. To accumulate. By repeating this process until the end of the source code 21, a syntax tree 160 is created.
(S122): The source code development unit 12 reads the source code 21 and creates the symbol table 161. The method of creating the symbol table 161 will not be described in detail, but only an overview will be described. A variable declaration, function definition, and the like are read from the source code 21, and five pieces of information from the identifier name 1610 to the initializer information 1614 are extracted based on the syntax rules and stored in the symbol table 161. The identifier type 1611 for the variable declaration is determined by the position in the source code 21 where the variable declaration is made, specifically, outside the function definition (global variable), argument list (argument) of the function definition, inside the function definition. (Local variable).
(S123): The source code development unit 12 completes the process.

次に、引数関連情報設定部13の動作について、図1、図3、図4、図5、図7、図11に基づき説明する。
図11は、この実施の形態における、引数関連情報設定部13の動作を示すフローチャートである。
Next, the operation of the argument related information setting unit 13 will be described with reference to FIGS. 1, 3, 4, 5, 7, and 11.
FIG. 11 is a flowchart showing the operation of the argument related information setting unit 13 in this embodiment.

(S130):引数関連情報設定部13は、ソースコード展開部12による構文木160、および記号表161の作成が完了すると、処理を開始する。
(S131):引数関連情報設定部13は、ソースファイル特定部11に渡された引数関連情報162に格納された、実引数1620、仮引数1621、初期設定1622、操作種別1623から構成される組の数を判定する。0個より多い場合(S131でYes)は、S132に進む。一方、0個の場合(S131でNo)はS136に進む。
(S132):引数関連情報設定部13は、記号表161から仮引数1621に対応する識別子名1610を探索し、前記識別子名1610の型を、型指定子情報1612、および宣言子情報1613を取り出す。前記型指定子情報1612、および宣言子情報1613から、仮引数1621がアドレスを格納すると判定した場合(S132でYes)は、S133に進む。一方、仮引数1621がアドレスを格納しないと判定した場合(S132でNo)は、S134に進む。
(S133):引数関連情報設定部13は、記号表161から仮引数1621に対応する宣言子情報1613を探す。続いて、変数名220に仮引数1621、ソースファイル名221にソースコード展開部12に渡されたソースファイル名201、行番号222に前記宣言子情報1613に対応する構文木160のノード1600の行番号1603、呼出階層223に階層値163、操作種別224にアドレス設定を意味する値(図7では「Set」と記載)、設定値225に実引数1620を格納する組を、解析結果22に記録する。
(S134):引数関連情報設定部13は、引数関連情報162における、S132の実行対象を次に進める。
(S135):引数関連情報設定部13は、引数関連情報162全体に対して、S132が実行されたか判定する(補足:図4において、表の上から順番に検査して、一番下に到達したか、ということを判定している)。実行されたと判定した場合(S135でYes)は、S136に進む。一方、実行されていないと判定した場合(S135でNo)は、S132に進む。
(S136):引数関連情報設定部13は、処理を完了する。
(S130): The argument-related information setting unit 13 starts processing when the source code development unit 12 completes the creation of the syntax tree 160 and the symbol table 161.
(S131): The argument related information setting unit 13 is a set including an actual argument 1620, a temporary argument 1621, an initial setting 1622, and an operation type 1623 stored in the argument related information 162 passed to the source file specifying unit 11. Determine the number of If there are more than zero (Yes in S131), the process proceeds to S132. On the other hand, if the number is zero (No in S131), the process proceeds to S136.
(S132): The argument related information setting unit 13 searches the symbol table 161 for the identifier name 1610 corresponding to the dummy argument 1621, and extracts the type of the identifier name 1610, the type specifier information 1612, and the declarator information 1613. . If it is determined from the type specifier information 1612 and the declarator information 1613 that the dummy argument 1621 stores an address (Yes in S132), the process proceeds to S133. On the other hand, if it is determined that the dummy argument 1621 does not store an address (No in S132), the process proceeds to S134.
(S133): The argument-related information setting unit 13 searches the declarator information 1613 corresponding to the dummy argument 1621 from the symbol table 161. Subsequently, the variable name 220 is the formal argument 1621, the source file name 221 is the source file name 201 passed to the source code development unit 12, and the line number 222 is the line of the node 1600 of the syntax tree 160 corresponding to the declarator information 1613. Recorded in the analysis result 22 is a set storing the number 1603, the hierarchy value 163 in the call hierarchy 223, the value indicating address setting (described as “Set” in FIG. 7) in the operation type 224, and the actual argument 1620 in the setting value 225. To do.
(S134): The argument related information setting unit 13 advances the execution target of S132 next in the argument related information 162.
(S135): The argument-related information setting unit 13 determines whether S132 has been executed for the entire argument-related information 162 (supplement: in FIG. Is determined). When it is determined that the process has been executed (Yes in S135), the process proceeds to S136. On the other hand, when it determines with not having performed (No in S135), it progresses to S132.
(S136): The argument related information setting unit 13 completes the process.

次に、解析部14の動作について、図1、図2、図4、図12に基づき説明する。
図12は、この実施の形態における、解析部14の動作を示すフローチャートである。
Next, operation | movement of the analysis part 14 is demonstrated based on FIG.1, FIG.2, FIG.4 and FIG.
FIG. 12 is a flowchart showing the operation of the analysis unit 14 in this embodiment.

(S140):解析部14は、引数関連情報設定部13による引数関連情報162を用いた解析結果22への記録が完了すると、処理を開始する。
(S141):解析部14は、記号表の特定の識別子に対するリンク情報で構成される検査リストを作成する(検査リストは図示しない)。検査リストに格納する変数は、ソースコード21のすべての大域変数と、引数関連情報設定部13にて解析結果22に記録された引数関連情報162の仮引数1621である。この実施の形態では、静的大域変数、すなわち、スコープがソースファイル内部に限定される変数は検査リストに格納しない。
(S142):解析部14は、構文木160にて、解析対象の関数の関数定義に対応するノードに移動する。以降は、前記ノードの子ノードを用いて解析を行う。
(S143)〜(S147):解析部14は、関数定義内部の宣言、もしくは代入文を単位とした解析を行う。まず、前記単位に相当する構文木160の部分木を、ノード種別1601、構文規則番号1602、値種別1604、およびノード値1605を用いて決定し、前記決定された部分木が宣言に相当するか、代入文に相当するかを判定する(S143)。宣言と判定した場合(S143で宣言)はS144に進み、宣言に対する解析を行う(S144)。一方、代入文と判定した場合(S143で代入文)はS145に進み、文の解析を行う(S145)。S144およびS145の詳細な動作は後述する。宣言もしくは代入文の解析が完了すると、次の宣言もしくは代入文に進む。このとき、有効範囲(スコープ)から外れた局所変数について、検査リストから削除する(S146)。続いて、関数定義の末尾に到達しているか判定する(S147)。到達していると判定した場合(S147でYes)は、S148に進む。一方、まだ到達していない場合(S147でNo)は、S143に進む。なお、S143およびS146では、宣言もしくは代入文のいずれでもない部分は読み飛ばす。
(S148):解析部14は、検査リストを破棄する。また、構文木160と記号表161も破棄する。
(S149):解析部14は、処理を完了する。
(S140): The analysis unit 14 starts processing when the recording of the analysis result 22 using the argument related information 162 by the argument related information setting unit 13 is completed.
(S141): The analysis unit 14 creates a test list including link information for a specific identifier in the symbol table (the test list is not shown). The variables stored in the inspection list are all the global variables of the source code 21 and the temporary argument 1621 of the argument related information 162 recorded in the analysis result 22 by the argument related information setting unit 13. In this embodiment, static global variables, that is, variables whose scope is limited within the source file are not stored in the inspection list.
(S142): The analysis unit 14 moves to the node corresponding to the function definition of the function to be analyzed in the syntax tree 160. Thereafter, analysis is performed using child nodes of the node.
(S143) to (S147): The analysis unit 14 performs analysis in units of declarations within function definitions or assignment statements. First, a subtree of the syntax tree 160 corresponding to the unit is determined using a node type 1601, a syntax rule number 1602, a value type 1604, and a node value 1605, and whether the determined subtree corresponds to a declaration. It is determined whether it corresponds to an assignment statement (S143). If it is determined to be a declaration (declared in S143), the process proceeds to S144, and the declaration is analyzed (S144). On the other hand, if it is determined that the statement is an assignment statement (assignment statement in S143), the process proceeds to S145 to analyze the statement (S145). Detailed operations of S144 and S145 will be described later. When the analysis of the declaration or assignment statement is completed, the process proceeds to the next declaration or assignment statement. At this time, local variables that are out of the effective range (scope) are deleted from the examination list (S146). Subsequently, it is determined whether the end of the function definition has been reached (S147). If it is determined that it has arrived (Yes in S147), the process proceeds to S148. On the other hand, when it has not reached yet (No in S147), the process proceeds to S143. In S143 and S146, parts that are neither declarations nor assignment statements are skipped.
(S148): The analysis unit 14 discards the inspection list. Also, the syntax tree 160 and the symbol table 161 are discarded.
(S149): The analysis unit 14 completes the process.

次に、解析部14における宣言に対する解析について、図1、図2、図3、図7、図13に基づき説明する。
図13は、解析部14における宣言に対する解析の動作(図12のS144)を示すフローチャートである。
Next, analysis of the declaration in the analysis unit 14 will be described with reference to FIGS. 1, 2, 3, 7, and 13.
FIG. 13 is a flowchart showing the analysis operation (S144 in FIG. 12) for the declaration in the analysis unit 14.

(S150):解析部14は、宣言に対する解析を行うと判断すると、処理を開始する。
(S151):解析部14は、解析部14は、宣言に対応する構文木160の部分木を用いて、宣言された変数が初期化されているか判定する。初期化されていると判定した場合(S151でYes)は、初期化式に対する代入文解析を実行し(S152)、その後S153に進む。一方、初期化されていないと判定した場合(S151でNo)は、S157に進む。
(S152):解析部14は、初期化式に対して代入文解析を実行する。S152の詳細な動作は後述する。
(S153):解析部14は、宣言に対応する構文木160の部分木を用いて、宣言された変数の型を特定し、アドレスを格納する型か判定する。アドレスを格納する型であると判定した場合(S153でYes)は、S154に進む。一方、アドレスを格納する型でないと判定した場合(S153でNo)は、S157に進む。
(S154):解析部14は、宣言に対応する構文木160の部分木を用いて、S152で解析した初期化式に、検査リストに格納された変数が出現しているか判定する。出現していると判定した場合(S154でYes)は、S155に進む。一方、出現していないと判定した場合(S154でNo)は、S157に進む。
(S155):解析部14は、宣言された変数を検査リストに追加する。
(S156):解析部14は、記号表161から宣言された変数に対応する宣言子情報1613を探す。続いて、変数名220に宣言された変数の名前、ソースファイル名221にソースコード展開部12に渡されたソースファイル名201、行番号222に前記宣言子情報1613に対応する構文木160のノード1600の行番号1603、呼出階層223に階層値163、操作種別224にアドレス設定を意味する値(図7では「Set」と記載)、設定値225に初期化に用いた式全体を格納する組を、解析結果22に記録する。
(S157):解析部14は、宣言に対する解析を終了する。
(S150): When the analysis unit 14 determines to analyze the declaration, it starts processing.
(S151): The analysis unit 14 determines whether the declared variable is initialized using the subtree of the syntax tree 160 corresponding to the declaration. If it is determined that it has been initialized (Yes in S151), an assignment statement analysis for the initialization expression is executed (S152), and then the process proceeds to S153. On the other hand, if it is determined that it has not been initialized (No in S151), the process proceeds to S157.
(S152): The analysis unit 14 performs an assignment statement analysis on the initialization expression. The detailed operation of S152 will be described later.
(S153): The analysis unit 14 specifies the type of the declared variable using the subtree of the syntax tree 160 corresponding to the declaration, and determines whether the type is for storing an address. If it is determined that the address is stored (Yes in S153), the process proceeds to S154. On the other hand, if it is determined that the address is not stored (No in S153), the process proceeds to S157.
(S154): The analysis unit 14 determines whether the variable stored in the check list appears in the initialization expression analyzed in S152, using the subtree of the syntax tree 160 corresponding to the declaration. When it determines with having appeared (it is Yes at S154), it progresses to S155. On the other hand, when it determines with not having appeared (it is No at S154), it progresses to S157.
(S155): The analysis unit 14 adds the declared variable to the inspection list.
(S156): The analysis unit 14 searches for declarator information 1613 corresponding to the variable declared from the symbol table 161. Subsequently, the name of the variable declared in the variable name 220, the source file name 201 passed to the source code development unit 12 in the source file name 221, and the node of the syntax tree 160 corresponding to the declarator information 1613 in the line number 222 1600 is a line number 1603, a hierarchy value 163 in the call hierarchy 223, a value meaning address setting in the operation type 224 (indicated as “Set” in FIG. 7), and a set value 225 for storing the entire expression used for initialization Is recorded in the analysis result 22.
(S157): The analysis unit 14 ends the analysis on the declaration.

次に、解析部14における代入文に対する解析について、図1、図2、図4、図5、図7、図14に基づき説明する。
図14は、解析部14における代入文に対する解析の動作(図12のS145、および図13のS152)を示すフローチャートである。
Next, analysis of the assignment statement in the analysis unit 14 will be described with reference to FIGS. 1, 2, 4, 5, 7, and 14.
FIG. 14 is a flowchart showing the analysis operation (S145 in FIG. 12 and S152 in FIG. 13) for the assignment statement in the analysis unit 14.

(S160):解析部14は、代入文に対する解析を行うと判断すると、処理を開始する。
(S161):解析部14は、代入文に対応する構文木160の部分木を用いて、関数呼び出しがあるか判定する。関数呼び出しがあると判定した場合(S161でYes)は、S180に進む。一方、関数呼び出しがないと判定した場合(S161でNo)は、S162に進む。
(S162):解析部14は、代入文に対応する構文木160の部分木、および検査リストを用いて、代入文で検査リストに格納された変数を参照しているか判定する。ただし、S161で参照した関数呼び出しに対応する部分は判定に用いない。代入文で検査リストに格納された変数を参照していると判定した場合(S162でYes)は、S167に進む。一方、代入文で検査リストに格納された変数を参照していないと判定した場合(S162でNo)は、S163に進む。
(S163):解析部14は、代入文に対応する構文木160の部分木、および検査リストを用いて、代入文で検査リストに格納された変数を介した他の変数への代入が行われているか判定する。代入文で検査リストに格納された変数を介した他の変数への代入が行われていると判定した場合(S163でYes)は、S168に進む。一方、代入文で検査リストに格納された変数を介した他の変数への代入が行われていないと判定した場合(S163でNo)は、S164に進む。
(S164):解析部14は、代入文に対応する構文木160の部分木、および検査リストを用いて、代入文で検査リストに格納された変数に対する代入(代入文において検査リストに格納された変数が左辺)が行われているか判定する。代入文で検査リストに格納された変数に対する代入が行われていると判定した場合(S164でYes)は、S168に進む。一方、代入文で検査リストに格納された変数に対する代入が行われていないと判定した場合(S164でNo)は、S165に進む。
(S165):解析部14は、代入文に対応する構文木160の部分木、および検査リストを用いて、代入文で検査リストに格納された変数を代入(代入文において検査リストに格納された変数が右辺)しているか判定する。代入文で検査リストに格納された変数を代入していると判定した場合(S165でYes)は、S170に進む。一方、代入文で検査リストに格納された変数を代入していないと判定した場合(S165でNo)は、S174に進む。
(S160): When the analysis unit 14 determines to analyze the assignment statement, the analysis unit 14 starts processing.
(S161): The analysis unit 14 determines whether there is a function call using the subtree of the syntax tree 160 corresponding to the assignment statement. If it is determined that there is a function call (Yes in S161), the process proceeds to S180. On the other hand, when it is determined that there is no function call (No in S161), the process proceeds to S162.
(S162): Using the subtree of the syntax tree 160 corresponding to the assignment statement and the check list, the analysis unit 14 determines whether the assignment statement refers to a variable stored in the check list. However, the part corresponding to the function call referred to in S161 is not used for the determination. If it is determined that the assignment statement refers to a variable stored in the examination list (Yes in S162), the process proceeds to S167. On the other hand, if it is determined that the assignment statement does not refer to a variable stored in the examination list (No in S162), the process proceeds to S163.
(S163): The analysis unit 14 uses the subtree of the syntax tree 160 corresponding to the assignment statement and the check list to perform assignment to another variable via the variable stored in the check list using the assignment statement. Judgment is made. If it is determined by the assignment statement that assignment to another variable has been performed via a variable stored in the check list (Yes in S163), the process proceeds to S168. On the other hand, if it is determined that the assignment statement is not assigned to another variable via the variable stored in the check list (No in S163), the process proceeds to S164.
(S164): The analysis unit 14 uses the subtree of the syntax tree 160 corresponding to the assignment statement and the check list to assign to the variable stored in the check list in the assignment statement (stored in the check list in the assignment statement). Determine whether the variable is on the left side. If it is determined by the assignment statement that assignment to the variable stored in the check list has been performed (Yes in S164), the process proceeds to S168. On the other hand, if it is determined that the assignment statement is not assigned to the variable stored in the examination list (No in S164), the process proceeds to S165.
(S165): Using the subtree of the syntax tree 160 corresponding to the assignment statement and the check list, the analysis unit 14 assigns the variables stored in the check list by the assignment statement (stored in the check list in the assignment statement). Determine whether the variable is on the right side. If it is determined that the variable stored in the examination list is substituted by the assignment statement (Yes in S165), the process proceeds to S170. On the other hand, if it is determined that the variable stored in the examination list is not substituted by the assignment statement (No in S165), the process proceeds to S174.

(S180):解析部14は関数呼出解析に移行する。関数呼出解析の詳細は、図15を用いて後に説明する。
(S166):解析部14は、代入文に対応する構文木160の部分木を用いて、次の関数呼び出しを探索する。
(S180): The analysis unit 14 proceeds to function call analysis. Details of the function call analysis will be described later with reference to FIG.
(S166): The analysis unit 14 searches for the next function call using the subtree of the syntax tree 160 corresponding to the assignment statement.

(S167):解析部14は、変数名220に参照されている変数の名前、ソースファイル名221にソースコード展開部12に渡されたソースファイル名201、行番号222に代入文を表す構文木160の部分木における参照されている変数を表すノード1600の行番号1603、呼出階層223に階層値163、操作種別224に参照を意味する値(図7では「Read」と記載)、設定値225には設定値なしを意味する値、を格納する組を、解析結果22に記録する。また、変数名220が引数関連情報162の仮引数1621に格納されている変数、もしくは引数関連情報162の仮引数1621に格納されている変数が代入されている変数の場合は、追加で、該当する組の操作種別1623に参照を意味する値を記録する。   (S167): The analysis unit 14 uses the name of the variable referenced by the variable name 220, the source file name 221 passed to the source code development unit 12 as the source file name 221, and the syntax tree representing the assignment statement at the line number 222. A row number 1603 of a node 1600 representing a variable referred to in a subtree of 160, a hierarchy value 163 in the call hierarchy 223, a value meaning reference to the operation type 224 (indicated as “Read” in FIG. 7), a set value 225 Is stored in the analysis result 22 as a set for storing a value indicating no set value. In addition, if the variable name 220 is a variable stored in the dummy argument 1621 of the argument related information 162 or a variable to which the variable stored in the dummy argument 1621 of the argument related information 162 is assigned, A value meaning reference is recorded in the operation type 1623 of the set.

(S168):解析部14は、代入文の左辺に対応する構文木160の部分木および記号表161を用いて、左辺の型を特定する。
(S169):解析部14は、変数名220に代入された変数の名前、ソースファイル名221にソースコード展開部12に渡されたソースファイル名201、行番号222に代入文を表す構文木160の部分木における代入された変数を表すノード1600の行番号1603、呼出階層223に階層値163、操作種別224にアドレス設定を意味する値もしくは代入を意味する値(図7では「Set」もしくは「Write」と記載)、設定値225に代入された式全体、を格納する組を、解析結果22に記録する。このとき、解析部14は、S168で特定した左辺の型を参照して、アドレスを格納する型の場合は操作種別224にアドレス設定を意味する値を格納し、アドレスを格納する型ではない場合は代入を意味する値を格納する。また、変数名220が引数関連情報162の仮引数1621に格納されている変数、もしくは引数関連情報162の仮引数1621に格納されている変数が代入されている変数の場合は、追加で、該当する組の操作種別1623にアドレス設定もしくは代入を意味する値を記録する。
(S168): The analysis unit 14 specifies the type of the left side using the subtree of the syntax tree 160 corresponding to the left side of the assignment statement and the symbol table 161.
(S169): The analysis unit 14 uses the name of the variable assigned to the variable name 220, the source file name 201 passed to the source code development unit 12 as the source file name 221, and the syntax tree 160 representing the assignment statement at the line number 222. The row number 1603 of the node 1600 representing the substituted variable in the sub-tree of, the hierarchy value 163 in the call hierarchy 223, the value meaning address setting in the operation type 224 or the value meaning substitution (in FIG. 7, “Set” or “ The group storing the entire expression substituted for the set value 225 is recorded in the analysis result 22. At this time, the analysis unit 14 refers to the type of the left side specified in S168, and in the case of the type storing the address, the value indicating the address setting is stored in the operation type 224 and is not the type storing the address. Stores a value that means substitution. In addition, if the variable name 220 is a variable stored in the dummy argument 1621 of the argument related information 162 or a variable to which the variable stored in the dummy argument 1621 of the argument related information 162 is substituted, A value meaning address setting or substitution is recorded in the operation type 1623 of the set.

(S170):解析部14は、代入文の左辺に対応する構文木160の部分木および記号表161を用いて、左辺の型がアドレスを格納する型であるかを判定する。左辺の型がアドレスを格納する型であると判定した場合(S170でYes)は、S171に進む。一方、左辺の型がアドレスを格納する型でないと判定した場合(S170でNo)は、S174に進む。
(S171):解析部14は、代入文に対応する構文木160の部分木、および検査リストを用いて、代入された変数(代入文の左辺の変数)が検査リストに格納されているか判定する。代入された変数が検査リストに格納されていると判定した場合(S171でYes)は、S172に進む。一方、代入された変数が検査リストに格納されていないと判定した場合(S171でNo)は、S173に進む。
(S172):解析部14は、代入文に対応する構文木160の部分木、および検査リストを用いて、代入された変数を検査リストに追加する。
(S173):解析部14は、変数名220に代入された変数の名前、ソースファイル名221にソースコード展開部12に渡されたソースファイル名201、行番号222に代入文を表す構文木160の部分木における代入された変数を表すノード1600の行番号1603、呼出階層223に階層値163、操作種別224にアドレス設定を意味する値(図7では「Set」と記載)、設定値225に代入された式全体、を格納する組を、解析結果22に記録する。また、変数名220が引数関連情報162の仮引数1621に格納されている変数、もしくは引数関連情報162の仮引数1621に格納されている変数が代入されている変数の場合は、追加で、該当する組の操作種別1623に参照を意味する値を記録する。
(S174):解析部14は、代入文に対する解析を終了する。
(S170): The analysis unit 14 determines whether the type of the left side is a type for storing an address, using the subtree of the syntax tree 160 corresponding to the left side of the assignment statement and the symbol table 161. If it is determined that the type on the left side is a type for storing an address (Yes in S170), the process proceeds to S171. On the other hand, if it is determined that the type on the left side is not a type for storing an address (No in S170), the process proceeds to S174.
(S171): Using the subtree of the syntax tree 160 corresponding to the assignment statement and the check list, the analysis unit 14 determines whether the assigned variable (the variable on the left side of the assignment statement) is stored in the check list. . If it is determined that the substituted variable is stored in the examination list (Yes in S171), the process proceeds to S172. On the other hand, when it is determined that the assigned variable is not stored in the examination list (No in S171), the process proceeds to S173.
(S172): The analysis unit 14 adds the substituted variable to the check list using the subtree of the syntax tree 160 corresponding to the assignment statement and the check list.
(S173): The analysis unit 14 uses the name of the variable assigned to the variable name 220, the source file name 221 passed to the source code development unit 12 as the source file name 221, and the syntax tree 160 representing the assignment statement at the line number 222. The row number 1603 of the node 1600 representing the substituted variable in the sub-tree of, the hierarchy value 163 in the call hierarchy 223, the value meaning address setting in the operation type 224 (indicated as “Set” in FIG. 7), and the setting value 225 A set storing the entire assigned expression is recorded in the analysis result 22. In addition, if the variable name 220 is a variable stored in the dummy argument 1621 of the argument related information 162 or a variable to which the variable stored in the dummy argument 1621 of the argument related information 162 is substituted, A value meaning reference is recorded in the operation type 1623 of the set.
(S174): The analysis unit 14 ends the analysis for the assignment statement.

次に、解析部14における関数呼び出しに対する解析(図13および図14におけるS180:関数呼出解析)について、図1、図2、図4、図5、図7、図15に基づき説明する。
図15は、解析部14における関数呼び出しに対する解析の動作を示すフローチャートである。
Next, the analysis of the function call in the analysis unit 14 (S180 in FIG. 13 and FIG. 14: function call analysis) will be described based on FIG. 1, FIG. 2, FIG. 4, FIG.
FIG. 15 is a flowchart showing an analysis operation for a function call in the analysis unit 14.

(S181):解析部14は、関数呼び出しに対する解析を行うと判断すると、処理を開始する。
(S182):解析部14は、関数呼び出しに対応する構文木160の部分木を用いて、引数の個数を数える。
(S183):解析部14は、S182で数え上げた引数の個数分、引数関連情報162に情報を追加したか判定する。引数の個数分、引数関連情報162に情報を追加したと判定した場合(S183でYes)は、S190に進む。一方、引数の個数分、引数関連情報162に情報を追加していないと判定した場合(S183でNo)は、S184に進む。
(S184):解析部14は、関数呼び出しに対応する構文木160の部分木を用いて、引数が関数呼び出しか判定する。引数が関数呼び出しであると判定した場合(S184でYes)は、S185に進む。一方、引数が関数呼び出しでないと判定した場合(S184でNo)は、S186に進む。
(S185):解析部14は、引数にある関数を対象に、関数呼出解析を実行する。すなわち、S180を再帰的に実行する。
(S186):解析部14は、検査リスト、および関数呼び出しに対応する構文木160の部分木を用いて、(ア)実引数の型がアドレスを格納する型である、(イ)実引数が検査リストに格納されている、の2条件を判定する。(ア)が真であり、かつ(イ)が偽の場合(S186でYes)は、S187に進む。一方、(ア)が真であり、かつ(イ)が偽を満たさない場合(S186でNo)は、S188に進む。
(S187):解析部14は、引数に記述されている変数を検査リストに追加する。
(S188):解析部14は、解析結果22を用いて、まず実引数に代入されている値を特定する。ただし、実引数が複数の変数で表現されている場合、特定は行わない。次に、解析部14は、実引数1620に関数呼び出しに記述されている式、仮引数1621に呼び出されている関数のプロトタイプ宣言もしくは定義に記述されている仮引数、初期設定1622に前記動作により特定された実引数1620に代入されている値(特定していない場合は何も設定しない)、操作種別1623には無設定を意味する値、を格納する引数関連情報162Newを作成する(ソースファイル特定部に渡される引数関連情報と区別するため162Newとする)。なお、引数が複数ある場合は、先頭の引数の処理にて作成し、残りの引数については追記となる。
(S189):解析部14は、次の引数に対する処理に移る。
(S181): When the analysis unit 14 determines to analyze the function call, the analysis unit 14 starts processing.
(S182): The analysis unit 14 counts the number of arguments using the subtree of the syntax tree 160 corresponding to the function call.
(S183): The analysis unit 14 determines whether information has been added to the argument related information 162 by the number of arguments counted in S182. If it is determined that information is added to the argument related information 162 by the number of arguments (Yes in S183), the process proceeds to S190. On the other hand, if it is determined that information is not added to the argument related information 162 for the number of arguments (No in S183), the process proceeds to S184.
(S184): The analysis unit 14 determines whether the argument is a function call using the subtree of the syntax tree 160 corresponding to the function call. If it is determined that the argument is a function call (Yes in S184), the process proceeds to S185. On the other hand, if it is determined that the argument is not a function call (No in S184), the process proceeds to S186.
(S185): The analysis unit 14 performs a function call analysis for the function in the argument. That is, S180 is recursively executed.
(S186): The analysis unit 14 uses the check list and the subtree of the syntax tree 160 corresponding to the function call, and (a) the type of the actual argument is a type for storing an address. Two conditions stored in the examination list are determined. When (a) is true and (b) is false (Yes in S186), the process proceeds to S187. On the other hand, if (a) is true and (b) does not satisfy false (No in S186), the process proceeds to S188.
(S187): The analysis unit 14 adds the variable described in the argument to the inspection list.
(S188): Using the analysis result 22, the analysis unit 14 first identifies the value assigned to the actual argument. However, if the actual argument is expressed by multiple variables, it is not specified. Next, the analysis unit 14 performs the expression described in the function call in the actual argument 1620, the dummy argument described in the prototype declaration or definition of the function called in the dummy argument 1621, and the initial setting 1622 by the above operation. Argument related information 162New is stored that stores the value assigned to the specified actual argument 1620 (if nothing is specified, nothing is set) and the operation type 1623 indicates a value that means no setting (source file) (In order to distinguish it from the argument related information passed to the specific part, it is set to 162 New). If there are multiple arguments, they are created by processing the first argument, and the remaining arguments are added.
(S189): The analysis unit 14 proceeds to processing for the next argument.

(S190):解析部14は、階層値163を1増加させる。
(S191):解析部14は、ソースファイル特定部11を実行する。このとき、関数名は関数呼び出しに記述されている関数の名前であり、引数関連情報162NewはS184からS189までの処理にて作成したもの、もしくは空である。
(S192):解析部14は、階層値163を1減少させる。
(S193):解析部14は、引数関連情報162Newがある場合、すなわち引数の個数が1個以上の場合は引数関連情報162Newを参照し、操作種別1623に参照もしくは代入を意味する値が格納されている場合は、変数名220に実引数1620、ソースファイル名221にソースコード展開部12に渡されたソースファイル名201、行番号222に代入文を表す構文木160の部分木における代入された変数を表すノード1600の行番号1603、呼出階層223に階層値163、操作種別224に操作種別1623に格納されている値(参照もしくは代入の一方)、設定値225に設定値なしを意味する値、を格納する組を、解析結果22に記録する。また、引数関連情報162Newに格納されている実引数が、引数関連情報162の仮引数1621に格納されている変数である、もしくは、引数関連情報162の仮引数1621に格納されている変数が代入されている変数の場合は、該当する引数関連情報162の操作種別1623も更新する。なお、引数関連情報162Newの操作種別1623に参照と代入の両方が発生したことを意味する値が格納されている場合は、解析結果にそれぞれを分けて記録する。一方、解析部14は、引数関連情報162Newがない場合、何もしない。
(S194):解析部14は、引数関連情報162Newがある場合、S184からS189までで作成した引数関連情報162Newを破棄する。一方、解析部14は、引数関連情報162Newがない場合、何もしない。
(S195):解析部14は、関数呼出解析を完了する。
(S190): The analysis unit 14 increases the layer value 163 by one.
(S191): The analysis unit 14 executes the source file specifying unit 11. At this time, the function name is the name of the function described in the function call, and the argument related information 162New is created by the processing from S184 to S189, or is empty.
(S192): The analysis unit 14 decreases the hierarchy value 163 by one.
(S193): When there is argument-related information 162New, that is, when the number of arguments is 1 or more, the analysis unit 14 refers to the argument-related information 162New, and a value indicating reference or substitution is stored in the operation type 1623 If it is, the actual argument 1620 is assigned to the variable name 220, the source file name 201 is passed to the source code development unit 12 as the source file name 221, and the subtree of the syntax tree 160 representing the assignment statement is assigned to the line number 222. The line number 1603 of the node 1600 representing the variable, the hierarchy value 163 in the call hierarchy 223, the value stored in the operation type 1623 (either reference or substitution), and the value that means no set value in the set value 225 , Are stored in the analysis result 22. Further, the actual argument stored in the argument related information 162New is a variable stored in the dummy argument 1621 of the argument related information 162, or the variable stored in the temporary argument 1621 of the argument related information 162 is substituted. In the case of a variable, the operation type 1623 of the corresponding argument related information 162 is also updated. When a value indicating that both reference and substitution have occurred is stored in the operation type 1623 of the argument related information 162New, each is separately recorded in the analysis result. On the other hand, the analysis unit 14 does nothing if there is no argument related information 162New.
(S194): When there is the argument related information 162New, the analysis unit 14 discards the argument related information 162New created in S184 to S189. On the other hand, the analysis unit 14 does nothing if there is no argument related information 162New.
(S195): The analysis unit 14 completes the function call analysis.

最後に、入力部10に渡された関数について、解析部14による解析が完了すると、解析部14は解析結果22を閉じる(図示せず)。   Finally, when the analysis by the analysis unit 14 is completed for the function passed to the input unit 10, the analysis unit 14 closes the analysis result 22 (not shown).

この実施の形態における、関数f1に対する解析の流れについて、図1、図4、図5、図7、図8、図9、図10、図11、図12、図13、図14、図15に基づき説明する。   The flow of analysis for the function f1 in this embodiment is shown in FIGS. 1, 4, 5, 7, 8, 9, 10, 10, 11, 12, 13, 14, and 15. This will be explained based on this.

(入力部10):関数名「f1」と、空の引数関連情報162aをソースファイル特定部11に渡す(S103)。
(ソースファイル特定部11[f1]):関数定義ファイルリスト120を読み込み(S111)、関数f1の存在を判定し(S112)、関数名200すなわち「f1」、およびソースファイル名(/src/funcA.c)をソースコード展開部12に渡す(S113)。
(ソースコード展開部12[f1]):/src/funcA.cを読み込み、構文木160aおよび記号表161aを作成する(S121、S122)。
(引数関連情報設定部13[f1]):引数関連情報162aは空であるため、S131にて分岐し、S136に到達する。
(Input unit 10): The function name “f1” and empty argument related information 162a are passed to the source file specifying unit 11 (S103).
(Source file specifying unit 11 [f1]): The function definition file list 120 is read (S111), the existence of the function f1 is determined (S112), the function name 200, that is, “f1”, and the source file name (/ src / funcA) .C) is passed to the source code development unit 12 (S113).
(Source code development unit 12 [f1]): / src / funcA. c is read and a syntax tree 160a and a symbol table 161a are created (S121, S122).
(Argument-related information setting unit 13 [f1]): Since the argument-related information 162a is empty, the process branches in S131 and reaches S136.

(解析部14[f1]):検査リストを作成し、大域変数gValを検査リストに格納する(S141)。
(解析部14[f1:行番号5]):「int y = gVal」に対する宣言解析を実行する(S144)。この宣言は、初期化を行っているため(S151でYes)、初期化式、すなわちgValに対する代入文解析を実行する(S152)。gValに対する代入文解析の流れは、S161でNo、S162でYes、S163でNo、S164でNo、S165でNo、であり、gValの参照を解析結果22に記録し(S167)、代入文解析を終了する(S174)。続いて、局所変数yはアドレスを格納する型ではないため(S153でNo)、宣言解析を終了する(S157)。
(解析部14[f1:行番号7]):「gVal = 0」に対する代入文解析を実行する(S145)。gValは検査リストに格納されているため、代入文解析の流れは、S161でNo、S162でNo、S163でNo、S164でYes、S165でNo、であり、左辺の型がアドレスを格納する型ではないため、gValに対する値の代入をを解析結果22に記録し(S168、S169)、代入文解析を終了する(S174)。
(解析部14[f1:行番号8]):「x = &gVal;」に対する代入文解析を実行する(S145)。代入文解析の流れは、まず、S161でNoとなる。次に、gValが検査リストに格納されているため、S162はYesとなり、gValの参照を解析結果22に記録する(S167)。xは検査リストに格納されていないため、S163、S164はNoとなる。右辺にgValがあるため、S165はYesとなる、xはアドレスを格納する型であるため、S170はYesとなる。xは検査リストに格納されていないため、S171はNoとなり、xを検査リストに追加し(S172)、xに対するアドレス設定を解析結果22に記録する(S173)。その後、代入文解析を終了する(S174)。
(解析部14[f1:行番号9]):「y = f2(x)」に対する代入文解析を実行する。代入文解析の流れは、まず、S161でYesとなり、関数呼び出しを実行する(S180)。引数関連情報162bをを作成し(S184〜S189)、関数名f2と引数関連情報162bをソースファイル特定部11に渡す(S191)。
(Analysis unit 14 [f1]): A test list is created, and the global variable gVal is stored in the test list (S141).
(Analysis unit 14 [f1: line number 5]): Declaration analysis for “int y = gVal” is executed (S144). Since this declaration has been initialized (Yes in S151), an initialization expression, that is, an assignment statement analysis for gVal is executed (S152). The flow of assignment statement analysis for gVal is No in S161, Yes in S162, No in S163, No in S164, No in S165, and the reference of gVal is recorded in the analysis result 22 (S167). The process ends (S174). Subsequently, since the local variable y is not a type for storing an address (No in S153), the declaration analysis is terminated (S157).
(Analysis unit 14 [f1: line number 7]): An assignment statement analysis for “gVal = 0” is executed (S145). Since gVal is stored in the examination list, the assignment statement analysis flow is No in S161, No in S162, No in S163, Yes in S164, No in S165, and the type on the left side stores the address. Therefore, the value assignment for gVal is recorded in the analysis result 22 (S168, S169), and the assignment statement analysis is terminated (S174).
(Analysis unit 14 [f1: line number 8]): An assignment statement analysis for “x = &gVal;” is executed (S145). The flow of assignment statement analysis is first No in S161. Next, since gVal is stored in the examination list, S162 becomes Yes, and the reference of gVal is recorded in the analysis result 22 (S167). Since x is not stored in the examination list, S163 and S164 are No. Since there is gVal on the right side, S165 is Yes, and since x is a type for storing an address, S170 is Yes. Since x is not stored in the inspection list, S171 is No, x is added to the inspection list (S172), and the address setting for x is recorded in the analysis result 22 (S173). Thereafter, the assignment statement analysis is terminated (S174).
(Analyzer 14 [f1: Line number 9]): Performs an assignment statement analysis for “y = f2 (x)”. The flow of assignment statement analysis first becomes Yes in S161, and executes a function call (S180). The argument related information 162b is created (S184 to S189), and the function name f2 and the argument related information 162b are passed to the source file specifying unit 11 (S191).

(ソースファイル特定部11[f2]):関数定義ファイルリスト120を読み込み(S111)、関数f2の存在を判定し(S112)、関数名200、すなわち「f2」、およびソースファイル名201(/src/funcB.c)をソースコード展開部12に渡す(S113)。
(ソースコード展開部12[f2]):/src/funcB.cを読み込み、構文木160bおよび記号表161bを作成する(S121、S122)。
(引数関連情報設定部13[f2]):引数関連情報162bは空でなく(S131でYes)、仮引数pはアドレスを格納する型であるため(S132でYes)、pに対するアドレス設定を解析結果22に記録する(S133)。
(Source file specifying unit 11 [f2]): The function definition file list 120 is read (S111), the existence of the function f2 is determined (S112), the function name 200, that is, “f2”, and the source file name 201 (/ src) /FuncB.c) is passed to the source code development unit 12 (S113).
(Source code development unit 12 [f2]): / src / funcB. c is read and a syntax tree 160b and a symbol table 161b are created (S121, S122).
(Argument-related information setting unit 13 [f2]): Since the argument-related information 162b is not empty (Yes in S131) and the dummy argument p is a type for storing an address (Yes in S132), the address setting for p is analyzed. Record in the result 22 (S133).

(解析部14[f2]):検査リストを作成する(S141)。/src/funcB.cには大域変数がないため、空の検査リストとなる。
(解析部14[f2:行番号3]):「int *q = p」に対する宣言解析を実行する(S144)。この宣言は、初期化を行っているため(S151でYes)、初期化式、すなわちpに対する代入文解析を実行する(S152)。pに対する代入文解析の流れは、S161でNo、S162でYes、S163でNo、S164でNo、S165でNo、であるため、pの参照を解析結果22に記録し(S167)、代入文解析を終了する(S174)。続いて、局所変数qはアドレスを格納する型であり(S153でYes)、かつ右辺のpが検査リストに格納されているため(S154でYes)、qを検査リストに格納し(S155)、qに対するアドレス設定を解析結果22に記録する(S156)。その後、宣言解析を終了する(S157)。
(解析部14[f2:行番号4]):「int *r = q」に対する宣言解析を実行する(S144)。この宣言は、初期化を行っているため(S151でYes)、初期化式、すなわちqに対する代入文解析を実行する(S152)。qに対する代入文解析の流れは、S161でNo、S162でYes、S163でNo、S164でNo、S165でNo、であるため、qの参照を解析結果22に記録し(S167)、代入文解析を終了する(S174)。続いて、局所変数rはアドレスを格納する型であり(S153でYes)、かつ右辺のqが検査リストに格納されているため(S154でYes)、rを検査リストに格納し(S155)、rに対するアドレス設定を解析結果22に記録する(S156)。その後、宣言解析を終了する(S157)。
(解析部14[f2:行番号5]):「int *s = r」に対する宣言解析を実行する(S144)。この宣言は、初期化を行っているため(S151でYes)、初期化式、すなわちrに対する代入文解析を実行する(S152)。rに対する代入文解析の流れは、S161でNo、S162でYes、S163でNo、S164でNo、S165でYes、であるため、rの参照を解析結果22に記録し(S167)、代入文解析を終了する(S174)。続いて、局所変数sはアドレスを格納する型であり(S153でYes)、かつ右辺のrが検査リストに格納されているため(S154でYes)、sを検査リストに格納し(S155)、sに対するアドレス設定を解析結果22に記録する(S156)。その後、宣言解析を終了する(S157)。
(解析部14[f2:行番号6]):「int b = *r」に対する宣言解析を実行する(S144)。この宣言は、初期化を行っているため(S151でYes)、初期化式、すなわち*rに対する代入文解析を実行する(S152)。*rに対する代入文解析の流れは、S161でNo、S162でYes、S163でNo、S164でNo、S165でNo、であるため、rに対する参照を解析結果22に記録し(S167)、代入文解析を終了する(S174)。続いて、局所変数sはアドレスを格納する型ではないため(S153でNo)、宣言解析を終了する(S157)。
(解析部14[f2:行番号8]):「*s =0」に対する代入文解析を実行する。代入文解析の流れは、S161でNo、S162でNo、S163でYes、であり、左辺の型がアドレスを格納する型ではないため、sに対する値の代入を解析結果22に記録する(S168,S169)。続いて、S165でNoとなるため、代入文解析を終了する(S174)。
(解析部14[f2:行番号9]):「b = f3(q)」に対する代入文解析を実行する。代入文解析の流れは、まず、S161でYesとなり、関数呼び出しを実行する(S180)。引数関連情報162cをを作成し(S184〜S189)、関数名f3と引数関連情報162cをソースファイル特定部11に渡す(S191)。
(Analyzing unit 14 [f2]): An inspection list is created (S141). / Src / funcB. Since c has no global variables, it is an empty checklist.
(Analyzing unit 14 [f2: line number 3]): Declaration analysis for “int * q = p” is executed (S144). Since this declaration is initialized (Yes in S151), an initialization expression, that is, an assignment statement analysis for p is executed (S152). The flow of assignment statement analysis for p is No in S161, Yes in S162, No in S163, No in S164, No in S165, so p reference is recorded in the analysis result 22 (S167), and assignment statement analysis is performed. Is finished (S174). Subsequently, since the local variable q is a type for storing an address (Yes in S153) and p on the right side is stored in the inspection list (Yes in S154), q is stored in the inspection list (S155). The address setting for q is recorded in the analysis result 22 (S156). Thereafter, the declaration analysis ends (S157).
(Analysis unit 14 [f2: line number 4]): Declaration analysis for “int * r = q” is executed (S144). Since this declaration is initialized (Yes in S151), an initialization expression, that is, an assignment statement analysis for q is executed (S152). The flow of assignment statement analysis for q is No in S161, Yes in S162, No in S163, No in S164, No in S165, so the reference to q is recorded in the analysis result 22 (S167), and the assignment statement analysis is performed. Is finished (S174). Subsequently, since the local variable r is a type for storing an address (Yes in S153) and q on the right side is stored in the inspection list (Yes in S154), r is stored in the inspection list (S155), The address setting for r is recorded in the analysis result 22 (S156). Thereafter, the declaration analysis ends (S157).
(Analysis unit 14 [f2: line number 5]): Declaration analysis is performed for “int * s = r” (S144). Since this declaration is initialized (Yes in S151), an initialization expression, that is, an assignment statement analysis for r is executed (S152). Since the flow of assignment statement analysis for r is No in S161, Yes in S162, No in S163, No in S164, Yes in S165, the reference of r is recorded in the analysis result 22 (S167), and the assignment statement analysis Is finished (S174). Subsequently, since the local variable s is a type for storing an address (Yes in S153) and r on the right side is stored in the inspection list (Yes in S154), s is stored in the inspection list (S155). The address setting for s is recorded in the analysis result 22 (S156). Thereafter, the declaration analysis ends (S157).
(Analysis unit 14 [f2: line number 6]): Declaration analysis for “int b = * r” is executed (S144). Since this declaration has been initialized (Yes in S151), an initialization expression, that is, an assignment statement analysis for * r is executed (S152). * Since the assignment statement analysis flow for r is No in S161, Yes in S162, No in S163, No in S164, No in S165, a reference to r is recorded in the analysis result 22 (S167). The analysis is terminated (S174). Subsequently, since the local variable s is not a type for storing an address (No in S153), the declaration analysis is terminated (S157).
(Analyzing unit 14 [f2: line number 8]): The assignment statement analysis for “* s = 0” is executed. The flow of assignment statement analysis is No in S161, No in S162, Yes in S163, and since the type on the left side is not a type for storing an address, assignment of a value for s is recorded in the analysis result 22 (S168, S168). S169). Subsequently, since the answer is No in S165, the assignment statement analysis is terminated (S174).
(Analysis unit 14 [f2: line number 9]): The assignment statement analysis for “b = f3 (q)” is executed. The flow of assignment statement analysis first becomes Yes in S161, and executes a function call (S180). The argument related information 162c is created (S184 to S189), and the function name f3 and the argument related information 162c are passed to the source file specifying unit 11 (S191).

(ソースファイル特定部11[f3]):関数定義ファイルリスト120を読み込み(S111)、関数f3の存在を判定し(S112)、関数名200、すなわち「f3」、およびソースファイル名201(/src/funcC.c)をソースコード展開部12に渡す(S113)。
(ソースコード展開部12[f3]):/src/funcC.cを読み込み、構文木160cおよび記号表161cを作成する(S121、S122)。
(引数関連情報設定部13[f3]):引数関連情報162cは空でなく(S131でYes)、仮引数tはアドレスを格納する型であるため(S132でYes)、tに対するアドレス設定を解析結果22に記録する(S133)。
(Source file specifying unit 11 [f3]): The function definition file list 120 is read (S111), the existence of the function f3 is determined (S112), the function name 200, that is, “f3”, and the source file name 201 (/ src) /FuncC.c) is passed to the source code development unit 12 (S113).
(Source code development unit 12 [f3]): / src / funcC. c is read and a syntax tree 160c and a symbol table 161c are created (S121, S122).
(Argument-related information setting unit 13 [f3]): Since the argument-related information 162c is not empty (Yes in S131) and the dummy argument t is a type for storing an address (Yes in S132), the address setting for t is analyzed. The result 22 is recorded (S133).

(解析部14[f3]):検査リストを作成する(S141)。/src/funcC.cには大域変数がないため、空の検査リストとなる。
(解析部14[f3:行番号3]):「int z = *t」に対する宣言解析を実行する(S144)。この宣言は、初期化を行っているため(S151でYes)、初期化式、すなわち*tに対する代入文解析を実行する(S152)。*tに対する代入文解析の流れは、S161でNo、S162でYes、S163でNo、S164でNo、S165でNo、であるため、tに対する参照を解析結果22に記録し(S167)、代入文解析を終了する(S174)。続いて、局所変数zはアドレスを格納する型ではないため(S153でNo)、宣言解析を終了する(S157)。
(解析部14[f3:行番号4]):「*t = 100」に対する代入文解析を実行する。代入文解析の流れは、S161でNo、S162でNo、S163でYes、であり、左辺の型がアドレスを格納する型ではないため、tに対する値の代入を解析結果22に記録する(S168、S169)。その後、S165でNoとなるため、代入文解析を終了する(S174)。
(解析部14[f3:行番号5]「z」に対する代入文解析を実行する。代入文解析の流れは、S161でNo、S162でNo、S163でNo、S164でNo、S165でNo、であるため、代入文解析を終了する(S174)。
(解析部14[f3]):関数f3の末尾まで解析すると(S147でYes)、解析部14の処理が完了し(S149)、関数f2の解析に戻る。
(Analyzing unit 14 [f3]): An inspection list is created (S141). / Src / funcC. Since c has no global variables, it is an empty checklist.
(Analysis unit 14 [f3: line number 3]): Declaration analysis for “int z = * t” is executed (S144). Since this declaration has been initialized (Yes in S151), an initialization expression, that is, an assignment statement analysis for * t is executed (S152). Since the assignment statement analysis flow for t is No in S161, Yes in S162, No in S163, No in S164, No in S165, a reference to t is recorded in the analysis result 22 (S167), The analysis is terminated (S174). Subsequently, since the local variable z is not a type for storing an address (No in S153), the declaration analysis is terminated (S157).
(Analysis unit 14 [f3: line number 4]): Performs an assignment statement analysis for “* t = 100”. The flow of assignment statement analysis is No in S161, No in S162, Yes in S163, and since the type on the left side is not a type for storing an address, the value assignment for t is recorded in the analysis result 22 (S168, S169). Then, since it becomes No at S165, the assignment statement analysis is terminated (S174).
(Analysis section 14 [f3: line number 5] executes an assignment sentence analysis for “z”. The flow of assignment sentence analysis is No in S161, No in S162, No in S163, No in S164, No in S165. Therefore, the assignment statement analysis is terminated (S174).
(Analysis unit 14 [f3]): When the analysis is performed up to the end of the function f3 (Yes in S147), the processing of the analysis unit 14 is completed (S149), and the process returns to the analysis of the function f2.

(解析部14[f2:行番号9]):S193で引数関連情報162cに記録された操作種別を用いて、引数qに対する参照と代入を解析結果22に記録する(S193)。関数解析が完了すると(S195)、図14のS162に戻る。S162以降の代入文解析の流れは、S162でNo、S163でNo、S164でNo、S165でNo、であるため、代入文解析を終了する(S174)。 (解析部14[f2:行番号10]):「b」に対する代入文解析を実行する。代入文解析の流れは、S161でNo、S162でNo、S163でNo、S164でNo、S165でNo、であるため、代入文解析を終了する(S174)。
(解析部14[f2]):関数f2の末尾まで解析すると(S147でYes)、解析部14の処理が完了し(S149)、関数f1の解析に戻る。
(Analysis unit 14 [f2: line number 9]): Using the operation type recorded in the argument related information 162c in S193, the reference and substitution for the argument q are recorded in the analysis result 22 (S193). When the function analysis is completed (S195), the process returns to S162 in FIG. Since the flow of assignment statement analysis after S162 is No in S162, No in S163, No in S164, No in S165, the assignment statement analysis ends (S174). (Analysis unit 14 [f2: line number 10]): Performs an assignment statement analysis for “b”. Since the flow of assignment statement analysis is No in S161, No in S162, No in S163, No in S164, No in S165, the assignment statement analysis is terminated (S174).
(Analysis unit 14 [f2]): When the analysis is performed up to the end of the function f2 (Yes in S147), the processing of the analysis unit 14 is completed (S149), and the process returns to the analysis of the function f1.

(解析部14[f1:行番号9]):S193で引数関連情報162bに記録された操作種別を用いて、引数xに対する参照と代入を解析結果22に記録する(S193)。関数解析が完了すると(S195)、図14のS162に戻る。S162以降の代入文解析の流れは、S162でNo、S163でNo、S164でNo、S165でNo、であるため、代入文解析を終了する(S174)。
(解析部14[f1:行番号10]):「y」に対する代入文解析を実行する。代入文解析の流れは、S161でNo、S162でNo、S163でNo、S164でNo、S165でNo、であるため、代入文解析を終了する(S174)。
(解析部14[f1]):関数f1の末尾まで解析すると(S147でYes)、解析部14の処理が完了する(S149)。すなわち、ソースコード解析装置による解析処理が完了する。
(Analysis unit 14 [f1: line number 9]): Using the operation type recorded in the argument related information 162b in S193, the reference and substitution for the argument x are recorded in the analysis result 22 (S193). When the function analysis is completed (S195), the process returns to S162 in FIG. Since the flow of assignment statement analysis after S162 is No in S162, No in S163, No in S164, No in S165, the assignment statement analysis ends (S174).
(Analyzing unit 14 [f1: line number 10]): The assignment statement analysis for “y” is executed. Since the flow of assignment statement analysis is No in S161, No in S162, No in S163, No in S164, No in S165, the assignment statement analysis is terminated (S174).
(Analyzing unit 14 [f1]): When the analysis is performed up to the end of the function f1 (Yes in S147), the processing of the analyzing unit 14 is completed (S149). That is, the analysis process by the source code analysis apparatus is completed.

続いて、解析結果22の作成が完了した後の表示部15の動作について、図1、図16に基づき説明する。
図16は表示部15の動作を示すフローチャートである。
Next, the operation of the display unit 15 after the creation of the analysis result 22 is completed will be described with reference to FIGS.
FIG. 16 is a flowchart showing the operation of the display unit 15.

(S200):表示部15は、入力部10から解析部14までによる解析結果22の作成が完了すると、処理を開始する。
(S201):表示部15は、入力部10から表示形式を取得する。
(S202):表示部15は、解析結果22を読み込む。
(S203):表示部15は、S201で取得した表示形式に従い、解析結果22を表示する。
(S204):表示部15は、処理を完了する。
例えば、表示形式が「テーブル」の場合、図7のような表示となる。
(S200): The display unit 15 starts processing when the creation of the analysis result 22 from the input unit 10 to the analysis unit 14 is completed.
(S201): The display unit 15 acquires the display format from the input unit 10.
(S202): The display unit 15 reads the analysis result 22.
(S203): The display unit 15 displays the analysis result 22 in accordance with the display format acquired in S201.
(S204): The display unit 15 completes the process.
For example, when the display format is “table”, the display is as shown in FIG.

以上のように、本実施の形態によれば、大域変数のアドレスの代入、および関数の引数の関連情報を用いた解析を行うことにより、大域変数の名前のみに基づく解析よりも、大域変数に対する参照、代入を詳細に取り出すことができるといった利点がある。
具体的には、図6のソースコードを解析する場合、大域変数の名前のみに基づく解析では、/src/funcC.cの代入文「*r=100;」にて大域変数gValへの代入が発生していることが分からない。
しかし、本実施の形態によれば、/src/funcA.cの「x=&gVal;」によるアドレス代入、「y=f2(x);」による関数の引数を介したアドレスの伝播、/src/funcB.cの「int *q=p;」によるアドレスの代入、「b=f3(q);」による関数の引数を介したアドレスの伝播、/src/funcC.cの「*r=100;」によるポインタ型変数を介した大域変数への代入、をソースコードから抽出して解析結果22に出力することで、この解析結果22を用いてユーザは/src/funcC.cの代入文「*r=100;」にて大域変数gValへの代入が発生していると判断できる。
As described above, according to the present embodiment, by assigning the address of the global variable and performing analysis using the related information of the argument of the function, the analysis for the global variable is performed rather than the analysis based only on the name of the global variable. There is an advantage that reference and substitution can be extracted in detail.
Specifically, when analyzing the source code of FIG. 6, in the analysis based only on the name of the global variable, / src / funcC. It cannot be seen that the assignment to the global variable gVal occurs in the assignment statement “* r = 100;” of c.
However, according to the present embodiment, / src / funcA. c, “x = &gVal;”, address substitution via “y = f2 (x);”, address propagation via function argument, / src / funcB. substitution of the address by “int * q = p;” of c, propagation of the address through the function argument by “b = f3 (q);”, / src / funcC. By substituting c into the global variable via the pointer type variable by “* r = 100;” and extracting it from the source code and outputting it to the analysis result 22, the user can use the analysis result 22 to specify / src / funcC. It can be determined that the assignment to the global variable gVal has occurred in the assignment statement “* r = 100;” of c.

さらに、本実施の形態では、アドレスを格納する型である局所変数をすべて検査リストに格納せず、検査リストにある変数を代入した、もしくは関数の引数に指定された場合に検査リストに追加することにより、検査リストへの格納数を削減し、検査リストに対する探索処理の負荷軽減を図り、結果として解析の高速化を実現している。   Further, in the present embodiment, all local variables that store addresses are not stored in the check list, but are added to the check list when variables in the check list are assigned or specified as function arguments. As a result, the number of items stored in the inspection list is reduced, the load of search processing on the inspection list is reduced, and as a result, the analysis speed is increased.

また、上記説明では、S141にて静的大域変数(静的変数)を検査リストに格納しなかったが、静的大域変数を検査リストに格納しても構わない。
このようにすることで、静的大域変数に対する参照、代入も解析可能となるといった利点がある。
In the above description, the static global variable (static variable) is not stored in the inspection list in S141. However, the static global variable may be stored in the inspection list.
By doing this, there is an advantage that it is possible to analyze references and assignments to static global variables.

また、解析部14における静的大域変数に対する動作を、入力部10からの指示に基づき変更するようにしても構わない。
このようにすることで、1ファイルに多数の関数定義が記述されている場合は静的大域変数を検査リストに入れる、等のように、解析範囲に柔軟性を持たせることができ、かつ、静的大域変数を検査リストに格納しない場合は、解析の高速化が期待できる。
Further, the operation on the static global variable in the analysis unit 14 may be changed based on an instruction from the input unit 10.
By doing so, when a large number of function definitions are described in one file, it is possible to give flexibility to the analysis range, such as putting a static global variable in a check list, etc., and If static global variables are not stored in the test list, the analysis can be speeded up.

また、上記説明では、再帰呼び出しを行う関数について特に記述しなかったが、解析中の関数名をスタックに保存して、既にスタックに格納されている関数については、解析をスキップするといった動作としても構わない。
このようにすることで、再帰呼び出しを行う関数に対する解析が可能となる。
In the above description, the function that performs recursive calls was not described in particular. However, the function name being analyzed can be saved in the stack, and the analysis can be skipped for functions already stored in the stack. I do not care.
By doing so, it is possible to analyze a function that performs a recursive call.

また、上記説明では各関数の解析にて構文木160と記号表161を作成しているが、既に作成済の構文木160と記号表161を再利用してもよい。
このようにすることで、ソースコード展開部12の実行回数の削減が期待でき、結果として構文木160および記号表161を展開する記憶領域の削減、および解析の高速化が期待できる。
なお、このとき、構文木160および記号表161の破棄は、参照する解析処理がなくなった場合に実行する。
In the above description, the syntax tree 160 and the symbol table 161 are created by analyzing each function. However, the syntax tree 160 and the symbol table 161 that have already been created may be reused.
In this way, the number of executions of the source code expansion unit 12 can be reduced, and as a result, the storage area for expanding the syntax tree 160 and the symbol table 161 can be expected, and the analysis speed can be increased.
At this time, the syntax tree 160 and the symbol table 161 are discarded when there is no more analysis processing to be referred to.

また、上記説明では、int型の変数のみ用いているが、他の型であっても本実施の形態は適用可能である。
さらに、構造体および共用体のメンバについても、構文木160および記号表161を用いることで型の特定が可能であるため、変数と同様に解析できる。
このとき、解析結果22の変数名220にはメンバ名も含めて格納してもよい。ユーザ定義の型名(C言語の場合、typedefを使用)についても、同様に解析可能である。
In the above description, only int type variables are used, but the present embodiment can be applied to other types.
Furthermore, the structure and union members can be analyzed in the same manner as variables because the type can be specified by using the syntax tree 160 and the symbol table 161.
At this time, the variable name 220 of the analysis result 22 may be stored including the member name. A user-defined type name (in the case of C language, typedef is used) can be similarly analyzed.

また、上記説明では、引数関連情報162は引数の個数分作成するとしたが、実際に必要なものはアドレスを格納する型の引数のみである。
したがって、前記必要な引数のみを引数関連情報に格納するようにしてもよい。
このとき、各組が何番目であるか特定するための序数を、実引数1620、仮引数1621、初期設定1622、操作種別1623から成る組に追加する(図示せず)。
In the above description, the argument-related information 162 is created for the number of arguments. However, what is actually required is only an argument of a type for storing an address.
Therefore, only the necessary arguments may be stored in the argument related information.
At this time, an ordinal number for specifying the number of each group is added to a group including an actual argument 1620, a dummy argument 1621, an initial setting 1622, and an operation type 1623 (not shown).

また、上記説明では、表示部15が入力部10から解析部14までにより生成された解析結果22を表示するとしたが、入力部10から指定された、既に作成済の解析結果22を表示しても構わない。
つまり、解析と表示が独立して動作可能である。
Further, in the above description, the display unit 15 displays the analysis result 22 generated by the input unit 10 to the analysis unit 14, but displays the already created analysis result 22 designated from the input unit 10. It doesn't matter.
That is, analysis and display can operate independently.

また、上記説明では、表示部15にて、図7に示す解析結果22をそのまま表示するとしたが、解析結果22およびソースコード21を用いて、別の形式で表示しても構わない。
別の表示形式について、図17に基づき説明する。
図17は、解析結果22を木構造状に示した図である。ソースコード21から関数名を取り出し、解析結果22の呼出階層223を用いると、図17のような表示が実現できる。各関数を示すブロックの中には、関数名と、解析結果22に出現する操作種別224を表示している。
In the above description, the display unit 15 displays the analysis result 22 shown in FIG. 7 as it is. However, the analysis result 22 and the source code 21 may be used to display in another format.
Another display format will be described with reference to FIG.
FIG. 17 is a diagram showing the analysis result 22 in a tree structure. When the function name is extracted from the source code 21 and the call hierarchy 223 of the analysis result 22 is used, the display as shown in FIG. 17 can be realized. In the block indicating each function, the function name and the operation type 224 appearing in the analysis result 22 are displayed.

また、上記説明では、S165にて検査リストにある変数を代入した場合に代入された変数を検査リストに格納済か判断していたが、ソースコード21の動作対象機器におけるメモリのアドレスを意味する数値を代入する場合に、同様の判定を行っても構わない。
ただし、記憶装置2にメモリのアドレスと、そのアドレスに格納される変数の対応関係を事前に知っているものとする。
In the above description, when a variable in the inspection list is assigned in S165, it is determined whether the assigned variable has been stored in the inspection list. The same determination may be made when a numerical value is substituted.
However, it is assumed that the storage device 2 knows in advance the correspondence between the memory address and the variable stored in the address.

さらに、図17を表示している状態で、入力部10が関数f3の選択を検出すると、表示部15が、図18のように関数f3で実際に行われている処理を表示するようにしても構わない。
同様に、関数の呼び出し関係についても、表示部15は最初に解析開始関数であるf1のみ表示し、その後入力部10からの指示に従い、関数f2を表示するようにしても構わない。
また、複数の関数呼び出しがある場合、図17から図18のような情報の展開を行う関数呼び出しを選択できるようにしても構わない。
このようにすることで、複雑な呼び出し関係にある関数でも、特定の実行経路に着目できるといった利点がある。
Further, when the input unit 10 detects selection of the function f3 in the state where FIG. 17 is displayed, the display unit 15 displays the processing actually performed by the function f3 as shown in FIG. It doesn't matter.
Similarly, regarding the function calling relationship, the display unit 15 may first display only the analysis start function f1, and then display the function f2 in accordance with an instruction from the input unit 10.
Further, when there are a plurality of function calls, a function call for expanding information as shown in FIGS. 17 to 18 may be selected.
By doing so, there is an advantage that even a function having a complicated calling relationship can focus on a specific execution path.

図17、図18とは異なる表示形式の例を、図19に基づき説明する。
図19は、縦軸に着目する変数を1つ選択し(図19ではgValを選択)、横軸に解析開始関数から呼び出される関数を並べて、アドレスの代入、着目変数への代入を実行順序に従い表示した図である。
図19のような表示形式は、例えば、代入と参照のタイミングのみに着目する場合に、必要な情報のみを表示しているため、解析結果22の可読性が上がるといった利点がある。
An example of a display format different from FIGS. 17 and 18 will be described with reference to FIG.
In FIG. 19, one variable to be focused on on the vertical axis is selected (gVal is selected in FIG. 19), functions called from the analysis start function are arranged on the horizontal axis, and assignment of addresses and substitution to the variables of interest are performed according to the execution order. FIG.
The display format as shown in FIG. 19, for example, has an advantage that the readability of the analysis result 22 is improved because only necessary information is displayed when attention is paid only to the timing of substitution and reference.

また、表示部15は、図7、図17、図18に示す解析結果22と、対応するソースコード21を並べて表示するようにしても構わない。
このようにすることで、解析結果22とソースコード21の対応関係が分かりやすくなるという利点がある。
Further, the display unit 15 may display the analysis result 22 shown in FIGS. 7, 17, and 18 and the corresponding source code 21 side by side.
By doing in this way, there exists an advantage that the correspondence of the analysis result 22 and the source code 21 becomes easy to understand.

また、表示部15は、解析結果22に複数の大域変数がある場合、入力部10からの指示に基づき、表示する大域変数を選択しても構わない。
また、大域変数ではなく、局所変数を選択するようにしても構わない。
このようにすることで、解析結果22の可読性が上がるといった利点がある。
Further, when there are a plurality of global variables in the analysis result 22, the display unit 15 may select a global variable to be displayed based on an instruction from the input unit 10.
Moreover, you may make it select a local variable instead of a global variable.
By doing in this way, there exists an advantage that the readability of the analysis result 22 improves.

また、表示部15は、入力部10の指示に基づき、記憶装置2に蓄積された複数の解析結果22を同時に表示しても構わない。
このようにすることで、例えば複数のタスクにおける特定の大域変数への参照、代入を簡単に把握できるといった利点がある。
The display unit 15 may simultaneously display a plurality of analysis results 22 stored in the storage device 2 based on an instruction from the input unit 10.
By doing in this way, there exists an advantage that the reference and substitution to a specific global variable in a plurality of tasks can be grasped easily, for example.

以上、本実施の形態では、プログラミング言語で記述されたソースコードを解析するソースコード解析装置であり、
解析対象関数、または表示形式を入力する入力部と、
解析対象関数が記述されているファイルを特定するソースファイル特定部と、
上記ソースファイル特定部により特定されたソースコードを読み込み構文木および記号表を作成するソースコード展開部と、
構文木および記号表を一時的に蓄積する一時記憶部と、
構文木および記号表を用いて、大域変数と、大域変数のアドレスが格納されている局所変数と、関数の引数を用いた大域変数、に対する参照、代入を解析結果に出力する解析部と、
上記入力部から指定された表示形式に基づき、解析結果を表示する表示部と
を備えるソースコード解析装置を説明した。
As described above, in the present embodiment, the source code analyzing apparatus analyzes the source code described in the programming language.
An input part for inputting a function to be analyzed or a display format;
A source file specifying unit for specifying a file in which the analysis target function is described;
A source code expansion unit that reads the source code identified by the source file identification unit and creates a syntax tree and a symbol table;
A temporary storage unit for temporarily storing a syntax tree and a symbol table;
Using a syntax tree and a symbol table, an analysis unit that outputs a reference and assignment to the analysis result as a global variable, a local variable storing the address of the global variable, and a global variable using a function argument,
A source code analyzing apparatus including a display unit that displays an analysis result based on the display format specified from the input unit has been described.

また、上記解析部は、上記構文木に関数呼び出しが出現した場合、仮引数と実引数との対応関係と、出現した関数の名前を用いて、前記ソースファイル特定部の処理を実行し、
上記ソースコード解析装置は、さらに、
ソースファイル特定部が受け取った仮引数と実引数の対応関係を用いて、変数のアドレスが実引数に格納されていることを解析結果に出力する引数関連情報設定部
を備え、
さらに、
上記解析部は、ソースファイル特定部が受け取った仮引数と実引数の対応関係を用いて、仮引数、もしくは仮引数の値を代入した局所変数、に対する参照、代入を、仮引数と実引数の対応関係に記録することを説明した。
Further, when a function call appears in the syntax tree, the analysis unit executes the processing of the source file specifying unit using the correspondence between the dummy argument and the actual argument and the name of the function that has appeared,
The source code analysis device further includes:
Using the correspondence between the dummy argument and the actual argument received by the source file identification part, it has an argument related information setting part that outputs to the analysis result that the address of the variable is stored in the actual argument,
further,
The analysis unit uses the correspondence between the dummy argument and the actual argument received by the source file identification unit to refer to and assign the dummy argument or the local variable to which the value of the dummy argument is assigned. Explained to record in correspondence.

また、上記ソースファイル特定部は、解析対象関数の名前を記憶しており、上記解析部から記憶している関数に対する解析を指示されたときに解析処理をスキップすることを説明した。   In addition, it has been described that the source file specifying unit stores the name of the analysis target function, and skips the analysis process when the analysis unit is instructed to analyze the stored function.

また、上記ソースコード展開部は、上記構文木および記号表の作成に使用したソースコードのファイル名を記憶しており、上記ソースファイル特定部から記憶しているソースコードに対するソースコード展開処理を指示されたときにソースコード展開処理をスキップすることを説明した。   The source code expansion unit stores the file name of the source code used to create the syntax tree and symbol table, and instructs the source code expansion process for the source code stored from the source file specifying unit. Explained that the source code expansion process is skipped when it is done.

また、上記入力部は、静的大域変数を解析対象に含めるか否かの入力を受け取り、
上記解析部は、入力部が受け取った上記入力に基づき、静的大域変数を解析対象に含めるか否かを決定することを説明した。
The input unit receives an input as to whether or not to include a static global variable in the analysis target,
It has been described that the analysis unit determines whether to include a static global variable in the analysis target based on the input received by the input unit.

また、上記表示部は、上記解析結果と対応するソースコードを並べて表示することを説明した。   In addition, it has been described that the display unit displays the source code corresponding to the analysis result side by side.

また、上記表示部は、上記解析結果を用いて、上記入力部から指定された変数に関連する部分のみを表示することを説明した。   Moreover, the said display part demonstrated only displaying the part relevant to the variable designated from the said input part using the said analysis result.

また、上記表示部は、上記解析結果を複数用いて、それぞれの解析結果を並べて表示することを説明した。   Further, it has been described that the display unit uses a plurality of the analysis results and displays the analysis results side by side.

実施の形態2.
実施の形態1では、解析結果22の作成に必要なソースコード21すべてをその場で解析しており、なおかつ関数定義ファイルリスト20を事前に準備する必要があった。
これに対して、実施の形態2では、予め解析に必要と思われるソースコード21のそれぞれに対してソースコード展開部12により作成される構文木160と記号表161を記憶装置2に保存するとともに関数定義ファイルリスト20に関数とソースコードの対応関係を記録することで、解析の高速化を図る。
Embodiment 2. FIG.
In the first embodiment, all the source code 21 necessary for creating the analysis result 22 is analyzed on the spot, and the function definition file list 20 needs to be prepared in advance.
On the other hand, in the second embodiment, the syntax tree 160 and the symbol table 161 created by the source code development unit 12 for each source code 21 that seems to be necessary for analysis are stored in the storage device 2 in advance. The correspondence between the function and the source code is recorded in the function definition file list 20 to speed up the analysis.

図20は、実施の形態2におけるソースコード解析装置1を備える解析システムの機能ブロック図である。
実施の形態1との相違点は、記憶装置2に展開済データ23が追加されている点と、入力部10からソースコード展開部12への矢印が追加された点である。
FIG. 20 is a functional block diagram of an analysis system including the source code analysis device 1 according to the second embodiment.
The difference from the first embodiment is that expanded data 23 is added to the storage device 2 and an arrow from the input unit 10 to the source code expansion unit 12 is added.

展開済データ23は、一時記憶部16にある構文木160と記号表161を持つ(図示せず)。   The expanded data 23 has a syntax tree 160 and a symbol table 161 in the temporary storage unit 16 (not shown).

実施の形態2では、ソースコード解析装置1の動作が2つに分かれる。第1の動作は、展開済データ23の作成であり、第2の動作は展開済データ23を用いた解析である。   In the second embodiment, the operation of the source code analyzing apparatus 1 is divided into two. The first operation is the creation of the expanded data 23, and the second operation is an analysis using the expanded data 23.

実施の形態2における、ソースコード解析装置1の第1の動作、すなわち展開済データ23の作成処理について説明する。
入力部10は、解析システムの使用者からの入力として、ソースコード21のファイル名を受け取ると、受け取ったファイル名をソースコード展開部12に渡す。
A first operation of the source code analyzing apparatus 1 in the second embodiment, that is, a process for creating the expanded data 23 will be described.
When receiving the file name of the source code 21 as input from the user of the analysis system, the input unit 10 passes the received file name to the source code development unit 12.

実施の形態2における関数定義ファイルリスト20について説明する。
図21は、実施の形態2における関数定義ファイルリスト20の構造を示す図である。
関数定義ファイルリスト20には、ソースコード解析装置1による解析に用いる1つ以上のソースコード21で定義されている関数の数だけ、関数名200、ソースファイル名201、展開済データ名202が存在する。
すなわち、関数定義ファイルリスト20は、1つ以上の関数名200、ソースファイル名201、展開済データ名202から構成される組を備える。
The function definition file list 20 in the second embodiment will be described.
FIG. 21 is a diagram showing the structure of the function definition file list 20 in the second embodiment.
The function definition file list 20 includes function names 200, source file names 201, and expanded data names 202 corresponding to the number of functions defined in one or more source codes 21 used for analysis by the source code analysis apparatus 1. To do.
That is, the function definition file list 20 includes a set composed of one or more function names 200, source file names 201, and expanded data names 202.

ソースコード展開部12による展開済データ23の作成について、図20、図21、図22に基づき説明する。
図22は、実施の形態2におけるソースコード展開部12による展開済データ23作成の動作を示すフローチャートである。
Creation of the developed data 23 by the source code developing unit 12 will be described with reference to FIGS. 20, 21, and 22. FIG.
FIG. 22 is a flowchart showing the operation of creating the developed data 23 by the source code developing unit 12 according to the second embodiment.

(S120)〜(S122):図10と同様のため説明を省略する。
(S124):ソースコード展開部12は、構文木160、および記号表161を用いて、展開済データ23を作成する。展開済データ23は、ソースコード21と同じディレクトリに格納し、ファイル名はソースコードの拡張子を「.dat」に変更したものとする。
(S125):ソースコード展開部12は、構文木160、および記号表161を用いて、関数定義ファイルリスト20に記録する。このとき、関数名200は構文木160、および記号表161から取り出した関数定義の関数名であり、関数定義ごとに変更する。また、ソースファイル名201は、入力部10から与えられたファイル名を用いる。展開済データ名202はS124にて記載のものを用いる。
(S126):ソースコード展開部12は、処理を完了する。同時に、ソースコード解析装置1の第1の動作も完了する。
(S120)-(S122): Since it is the same as that of FIG. 10, description is abbreviate | omitted.
(S124): The source code expansion unit 12 creates the expanded data 23 using the syntax tree 160 and the symbol table 161. The expanded data 23 is stored in the same directory as the source code 21, and the file name is assumed to have the extension of the source code changed to “.dat”.
(S125): The source code development unit 12 records the function definition file list 20 using the syntax tree 160 and the symbol table 161. At this time, the function name 200 is a function name of the function definition extracted from the syntax tree 160 and the symbol table 161, and is changed for each function definition. The source file name 201 uses the file name given from the input unit 10. The expanded data name 202 uses the one described in S124.
(S126): The source code development unit 12 completes the process. At the same time, the first operation of the source code analyzing apparatus 1 is also completed.

実施の形態2における、ソースコード解析装置1の第2の動作、すなわち展開済データ23を用いた解析処理について説明する。
入力部10は、解析システムの使用者からの入力として、ソースコード21のファイル名を受け取ると、受け取ったファイル名をソースコード展開部12に渡す。
A second operation of the source code analyzing apparatus 1 in the second embodiment, that is, an analysis process using the expanded data 23 will be described.
When receiving the file name of the source code 21 as input from the user of the analysis system, the input unit 10 passes the received file name to the source code development unit 12.

ソースコード展開部12による展開済データ23の読込みについて、図20、図21、図23に基づき説明する。
図23は、実施の形態2におけるソースコード展開部12による展開済データ23読み込みの動作を示すフローチャートである。
Reading of the expanded data 23 by the source code expansion unit 12 will be described with reference to FIGS. 20, 21, and 23.
FIG. 23 is a flowchart showing an operation of reading the developed data 23 by the source code developing unit 12 according to the second embodiment.

(S120)、(S123):図10と同様のため説明を省略する。
(S127):ソースコード展開部12は、関数定義ファイルリスト20から、ソースコード21のファイル名に対応する展開済データ名202を取得し、該当する展開済データ23を読み込んで、構文木160と記号表161を一時記憶部16に格納する。
(S120), (S123): The description is omitted because it is the same as FIG.
(S127): The source code expansion unit 12 acquires the expanded data name 202 corresponding to the file name of the source code 21 from the function definition file list 20, reads the corresponding expanded data 23, The symbol table 161 is stored in the temporary storage unit 16.

実施の形態2における、引数関連情報設定部13、解析部14、表示部15の動作は実施の形態1と同様のため、説明を省略する。   Since the operations of the argument related information setting unit 13, the analysis unit 14, and the display unit 15 in the second embodiment are the same as those in the first embodiment, description thereof is omitted.

以上のように、本実施の形態によれば、構文木160と記号表161を展開済データ23として記憶装置2に格納し、解析にて展開済データ23を用いて構文木160および記号表161を展開することにより、構文木160と記号表161の作成処理の繰り返しを防ぎ、実施の形態1よりも解析を高速に行えるといった利点がある。
例えば、複数ファイルで構成されるプログラムにて、数ファイルのみ変更して解析を再度行う場合、実施の形態2では、展開済データ23の再利用が可能であるため、解析を高速に行える。
As described above, according to the present embodiment, the syntax tree 160 and the symbol table 161 are stored in the storage device 2 as the expanded data 23, and the syntax tree 160 and the symbol table 161 are used by using the expanded data 23 in the analysis. By expanding the syntax tree 160 and the symbol table 161, and the analysis can be performed faster than in the first embodiment.
For example, when only a few files are changed and the analysis is performed again in a program composed of a plurality of files, the expanded data 23 can be reused in the second embodiment, so that the analysis can be performed at high speed.

さらに、本実施の形態によれば、関数定義ファイルリスト20を事前に用意するといった手間が省略できるといった利点がある。   Furthermore, according to the present embodiment, there is an advantage that the trouble of preparing the function definition file list 20 in advance can be omitted.

また、上記説明では、展開済データ23のファイル名を展開済データ名202に格納するとしたが、実施の形態2のように展開済データ名202がソースファイル名201から一意に特定可能であれば、展開済データ名202がなくても構わない。
逆に、展開済データ名202があれば、展開済データ23をソースコード21と異なるディレクトリ格納しても構わない。
In the above description, the file name of the expanded data 23 is stored in the expanded data name 202. However, if the expanded data name 202 can be uniquely identified from the source file name 201 as in the second embodiment, The expanded data name 202 may not be present.
On the contrary, if the expanded data name 202 exists, the expanded data 23 may be stored in a directory different from the source code 21.

また、上記説明では、構文木160と記号表161のみ、展開済データ23に格納するとしたが、解析部14により解析結果22に出力される内容のうち、関数内部に閉じているもの、すなわち他の関数から影響を受けない内容について、展開済データ23に格納し、実施の形態2における解析システムの第2の動作にて再利用しても構わない。
このようにすることで、実施の形態2における解析システムの第2の動作では、関数呼び出しに関する箇所のみ解析すればよく、解析を高速に行えるといった利点がある。
In the above description, only the syntax tree 160 and the symbol table 161 are stored in the expanded data 23, but the contents output to the analysis result 22 by the analysis unit 14 are closed inside the function, that is, other The contents that are not affected by the function may be stored in the expanded data 23 and reused in the second operation of the analysis system according to the second embodiment.
In this way, the second operation of the analysis system according to the second embodiment has an advantage that only the part related to the function call needs to be analyzed, and the analysis can be performed at high speed.

また、上記説明では、展開済データ23を常に使用するとしたが、ソースコード21と展開済データ23の作成時間を調べて、展開済データ23がソースコード21よりも古い場合、展開済データ23を作り直しても構わない。
このようにすることで、ソースコード21に対する変更の後、単にソースコード解析装置1を用いた解析を行うだけで、ソースコード21に対する変更を解析結果22に反映することが可能になるといった利点がある。
In the above description, the expanded data 23 is always used. However, when the generation time of the source code 21 and the expanded data 23 is checked and the expanded data 23 is older than the source code 21, the expanded data 23 is used. You can make it again.
By doing in this way, after the change to the source code 21, it is possible to reflect the change to the source code 21 in the analysis result 22 simply by performing the analysis using the source code analyzing apparatus 1. is there.

以上、本実施の形態では、ソースコード展開部が、作成した構文木および記号表と、ソースコードと構文木および記号表の対応関係を不揮発性記憶装置に蓄積し、この動作を行った後の解析では不揮発性記憶装置に蓄積した構文木および記号表を読み込むことを説明した。   As described above, in the present embodiment, the source code development unit accumulates the created syntax tree and symbol table, and the correspondence relationship between the source code, syntax tree and symbol table in the nonvolatile storage device, and performs this operation. The analysis explained that the syntax tree and the symbol table stored in the non-volatile storage device are read.

また、解析部は、上記ソースコード展開部が不揮発性記憶装置に蓄積した構文木および記号表と、ソースコードと構文木および記号表の対応関係に加えて、関数呼び出し以外の解析結果も併せて蓄積し、この動作を行った後の解析では、不揮発性記憶装置に蓄積した解析結果を読み込んで別の解析結果の作成に利用することを説明した。   In addition to the correspondence relationship between the syntax tree and symbol table stored in the nonvolatile storage device by the source code development unit and the source code and syntax tree and symbol table, the analysis unit also includes analysis results other than function calls. In the analysis after accumulating and performing this operation, it was explained that the analysis result accumulated in the non-volatile storage device is read and used to create another analysis result.

また、上記ソースコード展開部および解析部は、不揮発性記憶装置に記憶した構文木および記号表と、ソースコードと構文木および記号表の対応関係と、関数呼び出し以外の解析結果の作成時間がソースコードよりも古い場合は、不揮発性記憶装置に記憶した構文木および記号表と、ソースコードと構文木および記号表の対応関係とを、ソースコードから再度作成することを説明した。   In addition, the source code expansion unit and the analysis unit have a syntax tree and a symbol table stored in the nonvolatile storage device, a correspondence relationship between the source code and the syntax tree and the symbol table, and a generation time of an analysis result other than the function call. In the case where it is older than the code, it has been described that the syntax tree and symbol table stored in the nonvolatile storage device and the correspondence between the source code and the syntax tree and symbol table are created again from the source code.

最後に、実施の形態1及び2に示したソースコード解析装置1のハードウェア構成例について説明する。
図25は、実施の形態1及び2に示すソースコード解析装置1のハードウェア資源の一例を示す図である。
なお、図25の構成は、あくまでもソースコード解析装置1のハードウェア構成の一例を示すものであり、ソースコード解析装置1のハードウェア構成は図25に記載の構成に限らず、他の構成であってもよい。
Finally, a hardware configuration example of the source code analysis apparatus 1 shown in the first and second embodiments will be described.
FIG. 25 is a diagram showing an example of hardware resources of the source code analysis apparatus 1 shown in the first and second embodiments.
Note that the configuration in FIG. 25 is merely an example of the hardware configuration of the source code analysis device 1, and the hardware configuration of the source code analysis device 1 is not limited to the configuration described in FIG. There may be.

図25において、ソースコード解析装置1は、プログラムを実行するCPU911(Central Processing Unit、中央処理装置、処理装置、演算装置、マイクロプロセッサ、マイクロコンピュータ、プロセッサともいう)を備えている。
CPU911は、バス912を介して、例えば、ROM(Read Only Memory)913、RAM(Random Access Memory)914、通信ボード915、表示装置901、キーボード902、マウス903、磁気ディスク装置920と接続され、これらのハードウェアデバイスを制御する。
更に、CPU911は、FDD904(Flexible Disk Drive)、コンパクトディスク装置905(CDD)、プリンタ装置906、スキャナ装置907と接続していてもよい。また、磁気ディスク装置920の代わりに、光ディスク装置、メモリカード(登録商標)読み書き装置などの記憶装置でもよい。
RAM914は、揮発性メモリの一例である。ROM913、FDD904、CDD905、磁気ディスク装置920の記憶媒体は、不揮発性メモリの一例である。これらは、記憶装置の一例である。
通信ボード915、キーボード902、マウス903、スキャナ装置907、FDD904などは、入力装置の一例である。
また、通信ボード915、表示装置901、プリンタ装置906などは、出力装置の一例である。
In FIG. 25, the source code analysis apparatus 1 includes a CPU 911 (also referred to as a central processing unit, a central processing unit, a processing unit, an arithmetic unit, a microprocessor, a microcomputer, and a processor) that executes a program.
The CPU 911 is connected to, for example, a ROM (Read Only Memory) 913, a RAM (Random Access Memory) 914, a communication board 915, a display device 901, a keyboard 902, a mouse 903, and a magnetic disk device 920 via a bus 912. Control hardware devices.
Further, the CPU 911 may be connected to an FDD 904 (Flexible Disk Drive), a compact disk device 905 (CDD), a printer device 906, and a scanner device 907. Further, instead of the magnetic disk device 920, a storage device such as an optical disk device or a memory card (registered trademark) read / write device may be used.
The RAM 914 is an example of a volatile memory. The storage media of the ROM 913, the FDD 904, the CDD 905, and the magnetic disk device 920 are an example of a nonvolatile memory. These are examples of the storage device.
A communication board 915, a keyboard 902, a mouse 903, a scanner device 907, an FDD 904, and the like are examples of input devices.
The communication board 915, the display device 901, the printer device 906, and the like are examples of output devices.

通信ボード915は、ネットワークに接続されている。例えば、通信ボード915は、LAN(ローカルエリアネットワーク)、インターネット、WAN(ワイドエリアネットワーク)、SAN(ストレージエリアネットワーク)などに接続されていても構わない。   The communication board 915 is connected to the network. For example, the communication board 915 may be connected to a LAN (local area network), the Internet, a WAN (wide area network), a SAN (storage area network), or the like.

磁気ディスク装置920には、オペレーティングシステム921(OS)、ウィンドウシステム922、プログラム群923、ファイル群924が記憶されている。
プログラム群923のプログラムは、CPU911がオペレーティングシステム921、ウィンドウシステム922を利用しながら実行する。
The magnetic disk device 920 stores an operating system 921 (OS), a window system 922, a program group 923, and a file group 924.
The programs in the program group 923 are executed by the CPU 911 using the operating system 921 and the window system 922.

また、RAM914には、CPU911に実行させるオペレーティングシステム921のプログラムやアプリケーションプログラムの少なくとも一部が一時的に格納される。
また、RAM914には、CPU911による処理に必要な各種データが格納される。
The RAM 914 temporarily stores at least part of the operating system 921 program and application programs to be executed by the CPU 911.
The RAM 914 stores various data necessary for processing by the CPU 911.

また、ROM913には、BIOS(Basic Input Output System)プログラムが格納され、磁気ディスク装置920にはブートプログラムが格納されている。
ソースコード解析装置1の起動時には、ROM913のBIOSプログラム及び磁気ディスク装置920のブートプログラムが実行され、BIOSプログラム及びブートプログラムによりオペレーティングシステム921が起動される。
The ROM 913 stores a BIOS (Basic Input Output System) program, and the magnetic disk device 920 stores a boot program.
When the source code analysis device 1 is activated, the BIOS program in the ROM 913 and the boot program in the magnetic disk device 920 are executed, and the operating system 921 is activated by the BIOS program and the boot program.

上記プログラム群923には、実施の形態1及び2の説明において「〜部」として説明している機能を実行するプログラムが記憶されている。プログラムは、CPU911により読み出され実行される。   The program group 923 stores programs that execute the functions described as “˜units” in the description of the first and second embodiments. The program is read and executed by the CPU 911.

ファイル群924には、実施の形態1及び2の説明において、「〜の判断」、「〜の解析」、「〜の計算」、「〜の比較」、「〜の更新」、「〜の設定」、「〜の登録」、「〜の選択」等として説明している処理の結果を示す情報やデータや信号値や変数値やパラメータが、「〜ファイル」や「〜データベース」の各項目として記憶されている。
「〜ファイル」や「〜データベース」は、ディスクやメモリなどの記録媒体に記憶される。ディスクやメモリなどの記憶媒体に記憶された情報やデータや信号値や変数値やパラメータは、読み書き回路を介してCPU911によりメインメモリやキャッシュメモリに読み出され、抽出・検索・参照・比較・演算・計算・処理・編集・出力・印刷・表示などのCPUの動作に用いられる。
抽出・検索・参照・比較・演算・計算・処理・編集・出力・印刷・表示のCPUの動作の間、情報やデータや信号値や変数値やパラメータは、メインメモリ、レジスタ、キャッシュメモリ、バッファメモリ等に一時的に記憶される。
また、実施の形態1及び2で説明しているフローチャートの矢印の部分は主としてデータや信号の入出力を示し、データや信号値は、RAM914のメモリ、FDD904のフレキシブルディスク、CDD905のコンパクトディスク、磁気ディスク装置920の磁気ディスク、その他光ディスク、ミニディスク、DVD等の記録媒体に記録される。また、データや信号は、バス912や信号線やケーブルその他の伝送媒体によりオンライン伝送される。
In the file group 924, in the description of the first and second embodiments, “determination of”, “analysis of”, “calculation of”, “comparison of”, “update of”, and “setting of” are set. ”,“ Registration of ”,“ Selection of ”, etc. Information, data, signal values, variable values, and parameters indicating the results of the processing are indicated as“ ˜file ”and“ ˜database ”items. It is remembered.
The “˜file” and “˜database” are stored in a recording medium such as a disk or a memory. Information, data, signal values, variable values, and parameters stored in a storage medium such as a disk or memory are read out to the main memory or cache memory by the CPU 911 via a read / write circuit, and extracted, searched, referenced, compared, and calculated. Used for CPU operations such as calculation, processing, editing, output, printing, and display.
Information, data, signal values, variable values, and parameters are stored in the main memory, registers, cache memory, and buffers during the CPU operations of extraction, search, reference, comparison, calculation, processing, editing, output, printing, and display. It is temporarily stored in a memory or the like.
In addition, the arrows in the flowcharts described in the first and second embodiments mainly indicate input / output of data and signals, and the data and signal values are the RAM 914 memory, the FDD 904 flexible disk, the CDD 905 compact disk, and the magnetic field. Recording is performed on a recording medium such as a magnetic disk of the disk device 920, other optical disks, mini disks, DVDs, and the like. Data and signals are transmitted online via a bus 912, signal lines, cables, or other transmission media.

また、実施の形態1及び2の説明において「〜部」として説明しているものは、「〜回路」、「〜装置」、「〜機器」であってもよく、また、「〜ステップ」、「〜手順」、「〜処理」であってもよい。すなわち、「〜部」として説明しているものは、ROM913に記憶されたファームウェアで実現されていても構わない。或いは、ソフトウェアのみ、或いは、素子・デバイス・基板・配線などのハードウェアのみ、或いは、ソフトウェアとハードウェアとの組み合わせ、さらには、ファームウェアとの組み合わせで実施されても構わない。ファームウェアとソフトウェアは、プログラムとして、磁気ディスク、フレキシブルディスク、光ディスク、コンパクトディスク、ミニディスク、DVD等の記録媒体に記憶される。プログラムはCPU911により読み出され、CPU911により実行される。すなわち、プログラムは、実施の形態1及び2の「〜部」としてコンピュータを機能させるものである。あるいは、実施の形態1及び2の「〜部」の手順や方法をコンピュータに実行させるものである。   In addition, what is described as “˜unit” in the description of the first and second embodiments may be “˜circuit”, “˜device”, “˜device”, and “˜step”, It may be “to procedure” or “to process”. That is, what is described as “˜unit” may be realized by firmware stored in the ROM 913. Alternatively, it may be implemented only by software, or only by hardware such as elements, devices, substrates, and wirings, by a combination of software and hardware, or by a combination of firmware. Firmware and software are stored as programs in a recording medium such as a magnetic disk, a flexible disk, an optical disk, a compact disk, a mini disk, and a DVD. The program is read by the CPU 911 and executed by the CPU 911. That is, the program causes the computer to function as “to part” in the first and second embodiments. Alternatively, the computer executes the procedure and method of “to unit” in the first and second embodiments.

このように、実施の形態1及び2に示すソースコード解析装置1は、処理装置たるCPU、記憶装置たるメモリ、磁気ディスク等、入力装置たるキーボード、マウス、通信ボード等、出力装置たる表示装置、通信ボード等を備えるコンピュータであり、上記したように「〜部」として示された機能をこれら処理装置、記憶装置、入力装置、出力装置を用いて実現するものである。   As described above, the source code analysis device 1 shown in the first and second embodiments includes a CPU as a processing device, a memory as a storage device, a magnetic disk, a keyboard as an input device, a mouse, a communication board, and a display device as an output device, A computer including a communication board or the like, and implements the functions indicated as “˜units” as described above using these processing devices, storage devices, input devices, and output devices.

1 ソースコード解析装置、2 記憶装置、10 入力部、11 ソースファイル特定部、12 ソースコード展開部、13 引数関連情報設定部、14 解析部、15 表示部、16 一時記憶部、20 関数定義ファイルリスト、21 ソースコード、22 解析結果、23 展開済データ、160 構文木、161 記号表、162 引数関連情報、163 階層値、164 解析結果。   1 source code analysis device, 2 storage device, 10 input unit, 11 source file specifying unit, 12 source code development unit, 13 argument related information setting unit, 14 analysis unit, 15 display unit, 16 temporary storage unit, 20 function definition file List, 21 source code, 22 analysis result, 23 expanded data, 160 syntax tree, 161 symbol table, 162 argument related information, 163 hierarchy value, 164 analysis result.

Claims (20)

大域変数及び局所変数が含まれるプログラムコードを解析対象プログラムコードとして指定するからコード指定部と、
前記コード指定部により指定された解析対象プログラムコードに対する解析を行い、大域変数のアドレスの局所変数への代入と、いずれかのアドレスを格納する引数の局所変数への代入と、大域変数のアドレスを格納する局所変数の他の局所変数への代入と、いずれかのアドレスを格納する引数を格納する局所変数の他の局所変数への代入の少なくともいずれかを前記解析対象プログラムコードから抽出するコード解析抽出部と、
前記コード解析抽出部の抽出結果を記憶する抽出結果記憶部とを有することを特徴とする情報処理装置。
Since a program code including a global variable and a local variable is specified as a program code to be analyzed, a code specifying part,
Analyzes the analysis target program code specified by the code specification unit, assigns the address of the global variable to a local variable, assigns an argument that stores one of the addresses to the local variable, and sets the address of the global variable Code analysis for extracting from the analysis target program code at least one of assignment of a local variable to be stored to another local variable and assignment of a local variable to store an argument for storing any address to another local variable An extractor;
An information processing apparatus comprising: an extraction result storage unit that stores an extraction result of the code analysis extraction unit.
前記コード解析抽出部は、
大域変数を格納する局所変数の参照と、いずれかのアドレスを格納する引数を格納する局所変数の参照を前記解析対象プログラムコードから抽出することを特徴とする請求項1に記載の情報処理装置。
The code analysis extraction unit
The information processing apparatus according to claim 1, wherein a reference to a local variable that stores a global variable and a reference to a local variable that stores an argument that stores any address are extracted from the analysis target program code.
前記コード解析抽出部は、
大域変数のアドレスを代入した局所変数を介した大域変数又は局所変数の参照と、
いずれかのアドレスを格納する引数を代入した局所変数を介した大域変数又は局所変数の参照と、
大域変数のアドレスを格納する局所変数を代入した局所変数を介した大域変数又は局所変数の参照と、
いずれかのアドレスを格納する引数を格納する局所変数を代入した局所変数を介した大域変数又は局所変数の参照の少なくともいずれかを前記解析対象プログラムコードから抽出することを特徴とする請求項1又は2に記載の情報処理装置。
The code analysis extraction unit
A reference to a global variable or local variable via a local variable assigned the address of the global variable, and
A reference to a global variable or local variable via a local variable assigned an argument that stores one of the addresses,
A global variable or local variable reference via a local variable assigned a local variable that stores the address of the global variable,
The global variable or local variable reference via a local variable assigned with a local variable storing an argument for storing any address is extracted from the analysis target program code. 2. The information processing apparatus according to 2.
前記コード解析抽出部は、
大域変数のアドレスを代入した局所変数を介した大域変数又は局所変数への代入と、
いずれかのアドレスを格納する引数を代入した局所変数を介した大域変数又は局所変数への代入と、
大域変数のアドレスを格納する局所変数を代入した局所変数を介した大域変数又は局所変数への代入と、
いずれかのアドレスを格納する引数を格納する局所変数を代入した局所変数を介した大域変数又は局所変数への代入の少なくともいずれかを前記解析対象プログラムコードから抽出することを特徴とする請求項1〜3のいずれかに記載の情報処理装置。
The code analysis extraction unit
Assignment to a global variable or local variable via a local variable assigned the address of a global variable;
Assignment to a global variable or local variable via a local variable assigned an argument that stores one of the addresses,
Assignment to a global variable or local variable via a local variable assigned a local variable that stores the address of the global variable;
2. At least one of a global variable or a substitution to a local variable via a local variable substituted with a local variable for storing an argument for storing any address is extracted from the analysis target program code. The information processing apparatus according to any one of?
前記コード解析抽出部は、
いずれかのアドレスを格納する引数の参照を前記解析対象プログラムコードから抽出することを特徴とする請求項1〜4のいずれかに記載の情報処理装置。
The code analysis extraction unit
The information processing apparatus according to claim 1, wherein a reference to an argument storing any one of the addresses is extracted from the analysis target program code.
前記コード解析抽出部は、
いずれかのアドレスを格納する引数を介した大域変数の参照と、いずれかのアドレスを格納する引数を介した局所変数の参照の少なくともいずれかを前記解析対象プログラムコードから抽出することを特徴とする請求項1〜5のいずれかに記載の情報処理装置。
The code analysis extraction unit
It is characterized in that at least one of a global variable reference via an argument storing any address and a local variable reference via an argument storing any address is extracted from the analysis target program code. The information processing apparatus according to claim 1.
前記コード解析抽出部は、
いずれかのアドレスを格納する引数を介した大域変数への代入と、いずれかのアドレスを格納する引数を介した局所変数への代入の少なくともいずれかを前記解析対象プログラムコードから抽出することを特徴とする請求項1〜6のいずれかに記載の情報処理装置。
The code analysis extraction unit
At least one of assignment to a global variable via an argument storing any address and assignment to a local variable via an argument storing any address is extracted from the analysis target program code The information processing apparatus according to claim 1.
前記コード解析抽出部は、
大域変数の参照と、大域変数への代入の少なくともいずれかを前記解析対象プログラムコードから抽出することを特徴とする請求項1〜7のいずれかに記載の情報処理装置。
The code analysis extraction unit
The information processing apparatus according to claim 1, wherein at least one of reference to a global variable and assignment to a global variable is extracted from the analysis target program code.
前記コード解析抽出部は、
前記解析対象プログラムコードに関数呼び出しが含まれている場合に、
前記関数呼び出しに関連する仮引数と実引数を抽出し、抽出した抽出仮引数と抽出実引数とを対応付け、呼び出し対象の関数のプログラムコードを解析し、抽出仮引数の参照と、抽出仮引数への代入と、抽出仮引数の値を代入した局所変数の参照と、抽出仮引数の値を代入した局所変数の他の局所変数への代入の少なくともといずれかを抽出し、抽出結果を、抽出仮引数と抽出実引数に対応付けることを特徴とする請求項1〜8のいずれかに記載の情報処理装置。
The code analysis extraction unit
When a function call is included in the analysis target program code,
Extract the dummy argument and actual argument related to the function call, associate the extracted extracted argument with the extracted actual argument, analyze the program code of the function to be called, refer to the extracted dummy argument, and extract the dummy argument And at least one of assignment to the local variable to which the value of the extracted dummy argument is assigned and assignment of the local variable to which the value of the extracted dummy argument is assigned to another local variable are extracted. The information processing apparatus according to claim 1, wherein the information processing apparatus associates the extracted dummy argument with the extracted actual argument.
前記コード指定部は、
前記解析対象プログラムコードに関数呼び出しが含まれている場合に、呼び出し対象の関数が含まれているプログラムコードを識別し、当該プログラムコードを新たな解析対象プログラムコードとして指定し、
前記コード解析抽出部は、
前記コード指定部により新たな解析対象プログラムコードが指定された場合に、それまで解析を行っていた解析対象プログラムコードに対する解析を中断し、前記新たな解析対象プログラムコードに対する解析を開始し、前記新たな解析対象プログラムコードに対する解析が終了した際に、前記新たな解析対象プログラムコードの前に解析を行っていた解析対象プログラムコードに対する解析を再開することを特徴とする請求項1〜9のいずれかに記載の情報処理装置。
The code designating part is
When a function call is included in the analysis target program code, the program code including the call target function is identified, the program code is designated as a new analysis target program code,
The code analysis extraction unit
When a new analysis target program code is specified by the code specifying unit, the analysis for the analysis target program code that has been analyzed until then is stopped, the analysis for the new analysis target program code is started, and the new analysis target program code is started. When the analysis with respect to the analysis target program code is completed, the analysis with respect to the analysis target program code that has been analyzed before the new analysis target program code is resumed. The information processing apparatus described in 1.
前記コード解析抽出部は、
大域変数と、アドレスを格納する実引数に記述されている変数と、アドレスを格納する実引数に対応する仮引数に記述されている変数と、宣言文に含まれている変数を検査対象変数とし、
検査対象変数の参照と、検査対象変数への代入と、検査対象要素を介した他の変数への代入と、他の変数への検査対象変数の代入の少なくともといずれかが前記解析対象プログラムコードに含まれているか否かを検査して抽出処理を行うことを特徴とする請求項1〜10のいずれかに記載の情報処理装置。
The code analysis extraction unit
Global variables, variables described in actual arguments that store addresses, variables described in dummy arguments corresponding to actual arguments that store addresses, and variables included in declaration statements ,
The analysis target program code includes at least one of reference to the inspection target variable, assignment to the inspection target variable, assignment to another variable via the inspection target element, and assignment of the inspection target variable to another variable. The information processing apparatus according to claim 1, wherein an extraction process is performed by checking whether or not the data is included in the information processing apparatus.
前記コード解析抽出部は、
他の変数へ検査対象変数が代入されている場合に、当該他の変数がアドレスを格納する変数であるかを判断し、当該他の変数がアドレスを格納する変数である場合に当該他の変数を検査対象変数とすることを特徴とする請求項11に記載の情報処理装置。
The code analysis extraction unit
If the variable to be examined is assigned to another variable, determine whether the other variable is a variable that stores an address. If the other variable is a variable that stores an address, the other variable The information processing apparatus according to claim 11, wherein a variable to be inspected is used.
前記コード解析抽出部は、
前記解析対象プログラムに静的変数が含まれている場合に、静的変数を検査対象変数に含ませることを特徴とする請求項11又は12に記載の情報処理装置。
The code analysis extraction unit
The information processing apparatus according to claim 11, wherein when the analysis target program includes a static variable, the static variable is included in the inspection target variable.
前記コード解析抽出部は、
前記解析対象プログラムコードを解析して、前記解析対象プログラムコードの構文木と記号表を生成し、生成した構文木と記号表を用いて抽出処理を行うことを特徴とする請求項1〜13のいずれかに記載の情報処理装置。
The code analysis extraction unit
14. The analysis target program code is analyzed, a syntax tree and a symbol table of the analysis target program code are generated, and extraction processing is performed using the generated syntax tree and symbol table. The information processing apparatus according to any one of the above.
前記コード解析抽出部は、
前記コード指定部による解析対象プログラムコードの指定前に複数のプログラムコードを解析し、各プログラムコードの構文木と記号表を生成し、
前記コード指定部により解析対象プログラムコードが指定された際に、解析対象プログラムコードの構文木と記号表を用いて抽出処理を行うことを特徴とする請求項1〜14のいずれかに記載の情報処理装置。
The code analysis extraction unit
Analyzing a plurality of program codes before specifying the analysis target program code by the code specifying unit, generating a syntax tree and a symbol table for each program code,
15. The information according to claim 1, wherein when an analysis target program code is specified by the code specifying unit, an extraction process is performed using a syntax tree and a symbol table of the analysis target program code. Processing equipment.
前記コード解析抽出部は、
他のプログラムコードについての以前の抽出結果を用いて、前記解析対象プログラムコードについての抽出処理を行うことを特徴とする請求項1〜15のいずれかに記載の情報処理装置。
The code analysis extraction unit
The information processing apparatus according to claim 1, wherein an extraction process for the analysis target program code is performed using a previous extraction result for another program code.
前記コード解析抽出部は、
抽出結果を示す抽出結果情報を生成し、
前記情報処理装置は、更に、
前記抽出結果情報と、前記解析対象プログラムコードとを併せて表示する表示部を有することを特徴とする請求項1〜16のいずれかに記載の情報処理装置。
The code analysis extraction unit
Generate extraction result information indicating the extraction result,
The information processing apparatus further includes:
The information processing apparatus according to claim 1, further comprising: a display unit that displays the extraction result information and the analysis target program code together.
前記表示部は、
前記抽出結果情報を用いて、前記解析対象プログラムコードに含まれる特定の変数が記述されているプログラム文及び前記特定の変数の伝播状況の少なくともいずれかを表示することを特徴とする請求項17に記載の情報処理装置。
The display unit
The at least one of a program statement in which a specific variable included in the analysis target program code is described and a propagation status of the specific variable are displayed using the extraction result information. The information processing apparatus described.
コンピュータが、大域変数及び局所変数が含まれるプログラムコードを解析対象プログラムコードとして指定するからコード指定ステップと、
前記コンピュータが、前記コード指定ステップにより指定された解析対象プログラムコードに対する解析を行い、大域変数のアドレスの局所変数への代入と、いずれかのアドレスを格納する引数の局所変数への代入と、大域変数のアドレスを格納する局所変数の他の局所変数への代入と、いずれかのアドレスを格納する引数を格納する局所変数の他の局所変数への代入の少なくともいずれかを前記解析対象プログラムコードから抽出するコード解析抽出ステップと、
前記コンピュータが、前記コード解析抽出ステップの抽出結果を記憶する抽出結果記憶ステップとを有することを特徴とする情報処理方法。
Since the computer designates a program code including a global variable and a local variable as a program code to be analyzed, a code designation step;
The computer analyzes the analysis target program code specified in the code specifying step, assigns a global variable address to a local variable, assigns an argument storing any address to a local variable, and global At least one of assignment of a local variable that stores the address of a variable to another local variable and assignment of a local variable that stores an argument that stores one of the addresses to another local variable from the analysis target program code A code analysis extraction step to extract;
An information processing method comprising: an extraction result storage step in which the computer stores an extraction result of the code analysis extraction step.
大域変数及び局所変数が含まれるプログラムコードを解析対象プログラムコードとして指定するからコード指定処理と、
前記コード指定処理により指定された解析対象プログラムコードに対する解析を行い、大域変数のアドレスの局所変数への代入と、いずれかのアドレスを格納する引数の局所変数への代入と、大域変数のアドレスを格納する局所変数の他の局所変数への代入と、いずれかのアドレスを格納する引数を格納する局所変数の他の局所変数への代入の少なくともいずれかを前記解析対象プログラムコードから抽出するコード解析抽出処理と、
前記コード解析抽出処理の抽出結果を記憶する抽出結果記憶処理とをコンピュータに実行させることを特徴とするプログラム。
Since the program code including the global variable and the local variable is specified as the analysis target program code, the code specifying process,
Analyzes the analysis target program code specified by the code specifying process, assigns the address of the global variable to the local variable, assigns the argument storing one of the addresses to the local variable, and sets the address of the global variable. Code analysis for extracting from the analysis target program code at least one of assignment of a local variable to be stored to another local variable and assignment of a local variable to store an argument for storing any address to another local variable Extraction process,
A program causing a computer to execute an extraction result storage process for storing an extraction result of the code analysis extraction process.
JP2009034105A 2009-02-17 2009-02-17 Information processing apparatus, information processing method, and program Expired - Fee Related JP5409039B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2009034105A JP5409039B2 (en) 2009-02-17 2009-02-17 Information processing apparatus, information processing method, and program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2009034105A JP5409039B2 (en) 2009-02-17 2009-02-17 Information processing apparatus, information processing method, and program

Publications (2)

Publication Number Publication Date
JP2010191598A true JP2010191598A (en) 2010-09-02
JP5409039B2 JP5409039B2 (en) 2014-02-05

Family

ID=42817595

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2009034105A Expired - Fee Related JP5409039B2 (en) 2009-02-17 2009-02-17 Information processing apparatus, information processing method, and program

Country Status (1)

Country Link
JP (1) JP5409039B2 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPWO2013088461A1 (en) * 2011-12-12 2015-04-27 株式会社日立製作所 Software analysis program and software analysis system
CN110413284A (en) * 2019-08-06 2019-11-05 腾讯科技(深圳)有限公司 Morphology analysis methods, device, computer equipment and storage medium

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH05241799A (en) * 1992-02-21 1993-09-21 Nec Corp Argument reference structure analysis device
JPH06348475A (en) * 1993-06-14 1994-12-22 Nec Corp Pointer analyzing system
JPH07281883A (en) * 1994-04-06 1995-10-27 Fujitsu Ltd Device and method for supporting program correction
JPH11224185A (en) * 1998-02-05 1999-08-17 Nippon Steel Corp Device and method for analyzing variable influence
JP2001117791A (en) * 1999-10-18 2001-04-27 Denso Corp Interruption instruction checker and recording medium
JP2003036186A (en) * 2001-07-25 2003-02-07 Toshiba Corp Device, method and program for alias retrieval
JP2003036170A (en) * 2001-07-25 2003-02-07 Toshiba Corp Device, method and program for cross reference construction
JP2003167926A (en) * 2001-11-30 2003-06-13 Masao Doi Scientific technological calculation analytical system and scientific technological calculation analytical program
JP2005190330A (en) * 2003-12-26 2005-07-14 Matsushita Electric Ind Co Ltd Source program review assisting system

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH05241799A (en) * 1992-02-21 1993-09-21 Nec Corp Argument reference structure analysis device
JPH06348475A (en) * 1993-06-14 1994-12-22 Nec Corp Pointer analyzing system
JPH07281883A (en) * 1994-04-06 1995-10-27 Fujitsu Ltd Device and method for supporting program correction
JPH11224185A (en) * 1998-02-05 1999-08-17 Nippon Steel Corp Device and method for analyzing variable influence
JP2001117791A (en) * 1999-10-18 2001-04-27 Denso Corp Interruption instruction checker and recording medium
JP2003036186A (en) * 2001-07-25 2003-02-07 Toshiba Corp Device, method and program for alias retrieval
JP2003036170A (en) * 2001-07-25 2003-02-07 Toshiba Corp Device, method and program for cross reference construction
JP2003167926A (en) * 2001-11-30 2003-06-13 Masao Doi Scientific technological calculation analytical system and scientific technological calculation analytical program
JP2005190330A (en) * 2003-12-26 2005-07-14 Matsushita Electric Ind Co Ltd Source program review assisting system

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
CSNG200000376002; 佐藤慎一、植田良一、井上克郎: '再帰やポインタを含むプログラムの効率的な依存関係解析法の提案' 電子情報通信学会技術研究報告 Vol.95,No.475, 19960124, p.9, 社団法人電子情報通信学会 *
JPN6013007216; 佐藤慎一、植田良一、井上克郎: '再帰やポインタを含むプログラムの効率的な依存関係解析法の提案' 電子情報通信学会技術研究報告 Vol.95,No.475, 19960124, p.9, 社団法人電子情報通信学会 *

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPWO2013088461A1 (en) * 2011-12-12 2015-04-27 株式会社日立製作所 Software analysis program and software analysis system
CN110413284A (en) * 2019-08-06 2019-11-05 腾讯科技(深圳)有限公司 Morphology analysis methods, device, computer equipment and storage medium
CN110413284B (en) * 2019-08-06 2023-10-17 腾讯科技(深圳)有限公司 Lexical analysis method, lexical analysis device, computer equipment and storage medium

Also Published As

Publication number Publication date
JP5409039B2 (en) 2014-02-05

Similar Documents

Publication Publication Date Title
JP4148527B2 (en) Functional test script generator
JP4619698B2 (en) Code segment creation method and system
US8566789B2 (en) Semantic-based query techniques for source code
JP2007521568A (en) Intermediate representation of multiple exception handling models
US20090182689A1 (en) Rule-based dynamic operation evaluation
JP4638484B2 (en) Data integrity in data processing equipment
JP2015143939A (en) Compilation program, compilation method, and compilation device
JP6070847B2 (en) Verification method, verification apparatus, and verification program
CN111813675A (en) SSA structure analysis method and device, electronic equipment and storage medium
JP6440895B2 (en) Software analysis apparatus and software analysis method
CN115017516A (en) Fuzzy test method based on symbolic execution
JP6845429B2 (en) Compiler program, information processing device and compilation method
JP5409039B2 (en) Information processing apparatus, information processing method, and program
JP5342508B2 (en) Information processing apparatus, information processing method, and program
CN111475150A (en) Cross-language binding method, device, equipment and storage medium
KR102614967B1 (en) Automation system and method for extracting intermediate representation based semantics of javascript
JP6748357B2 (en) Analysis device, analysis program, and analysis method
JP5578625B2 (en) Program analysis apparatus, program analysis method, and program
JP2022531515A (en) Computer-assisted computer programming systems and methods
Mennie et al. Giving meaning to macros
JP2021096685A (en) Test execution program, test execution method, and test execution device
WO2022254487A1 (en) Information processing program, information processing method, and information processing device
JP6983693B2 (en) Stub generation support device, stub generation support method, and program
CN114816425B (en) Method and system for converting an automation language program into a LUA language program
CN115185526B (en) Compiling system and method for programming language capable of reverse reasoning

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20110909

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20130123

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20130219

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20130322

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

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20131008

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20131105

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

LAPS Cancellation because of no payment of annual fees