JP6965202B2 - Analytical equipment, analysis method and program - Google Patents

Analytical equipment, analysis method and program Download PDF

Info

Publication number
JP6965202B2
JP6965202B2 JP2018078398A JP2018078398A JP6965202B2 JP 6965202 B2 JP6965202 B2 JP 6965202B2 JP 2018078398 A JP2018078398 A JP 2018078398A JP 2018078398 A JP2018078398 A JP 2018078398A JP 6965202 B2 JP6965202 B2 JP 6965202B2
Authority
JP
Japan
Prior art keywords
compile
information
source code
code
switch
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
JP2018078398A
Other languages
Japanese (ja)
Other versions
JP2019185593A (en
Inventor
大 荒木
理恵 藤浦
昌幸 根本
稔 内田
信隆 鶴我
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Toshiba Corp
Toshiba Digital Solutions Corp
Original Assignee
Toshiba Corp
Toshiba Digital Solutions 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 Toshiba Corp, Toshiba Digital Solutions Corp filed Critical Toshiba Corp
Priority to JP2018078398A priority Critical patent/JP6965202B2/en
Publication of JP2019185593A publication Critical patent/JP2019185593A/en
Application granted granted Critical
Publication of JP6965202B2 publication Critical patent/JP6965202B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Description

本発明の実施形態は解析装置、解析方法及びプログラムに関する。 Embodiments of the present invention relate to analyzers, analysis methods and programs.

C言語等のコンピュータプログラムのソースコードでは、プリプロセッサ命令を使用した条件付きコンパイル(コンパイルスイッチ)のための記述が、従来から利用されている。所定の条件を示すコンパイルスイッチを利用することによって、コンピュータプログラムの動作を変更することができる。 In the source code of a computer program such as C language, a description for conditional compilation (compile switch) using a preprocessor instruction has been conventionally used. The behavior of a computer program can be changed by using a compile switch that indicates a predetermined condition.

条件付きコンパイル(コンパイルスイッチ)のための記述とは、C言語のコンピュータプログラムのソースコードにおいては、#ではじまるプリプロセッサディレクティブの中で、#ifdef、#ifndef、#endif、#if、#elif、#elseから始まる文を意味する。その他の、#include、#define、#undefなどから始まるプリプロセッサディレクティブは除く。 The description for conditional compilation (compile switch) is, in the source code of a computer program in C language, in the preprocessor directives starting with #, #ifdef, #ifndef, #endif, #if, #elif, # It means a sentence starting with else. Other preprocessor directives starting with #include, #define, #undef, etc. are excluded.

特許第4827418号公報Japanese Patent No. 4827418 特開2000−148508号公報Japanese Unexamined Patent Publication No. 2000-148508 特開平5−341976号公報Japanese Unexamined Patent Publication No. 5-341976 特開平11−073305号公報Japanese Unexamined Patent Publication No. 11-073305

しかしながら、従来の技術では、条件付きコンパイルに使用される条件が多いほど、ソースコードを解析することが難しかった。例えば、ソースコードを解析する際には、条件の組み合わせを考慮する必要があるため、条件付きコンパイルに使用される条件が多いほど、解析回数及び解析時間を要していた。 However, with conventional techniques, the more conditions used for conditional compilation, the more difficult it is to analyze the source code. For example, when analyzing the source code, it is necessary to consider the combination of conditions. Therefore, the more conditions used for conditional compilation, the more the number of analyzes and the analysis time are required.

実施形態の解析装置は、ソースコードを、コンパイルスイッチの状態制御を示すコンパイルスイッチコード情報と、前記コンパイルスイッチコード情報を含まない本体コード情報とに分割する分割部と、前記コンパイルスイッチコード情報から、前記ソースコードの行毎の前記コンパイルスイッチの状態を示す状態情報を生成する生成部と、前記状態情報から、前記コンパイルスイッチの組み合わせを解析する解析部と、を備える。 The analysis device of the embodiment is based on a division unit that divides the source code into compile switch code information indicating the state control of the compile switch and main body code information that does not include the compile switch code information, and the compile switch code information. It includes a generation unit that generates state information indicating the state of the compile switch for each line of the source code, and an analysis unit that analyzes the combination of the compile switches from the state information.

図1は実施形態の解析装置の機能構成の例を示す図である。FIG. 1 is a diagram showing an example of a functional configuration of the analysis device of the embodiment. 図2は実施形態のソースコードの例を示す図である。FIG. 2 is a diagram showing an example of the source code of the embodiment. 図3は実施形態の本体コード情報の例を示す図である。FIG. 3 is a diagram showing an example of the main body code information of the embodiment. 図4は実施形態のコンパイルスイッチコード情報の例を示す図である。FIG. 4 is a diagram showing an example of compile switch code information of the embodiment. 図5は実施形態の状態情報の例を示す図である。FIG. 5 is a diagram showing an example of state information of the embodiment. 図6は実施形態の解析結果の例を示す図である。FIG. 6 is a diagram showing an example of the analysis result of the embodiment. 図7は実施形態の解析方法と、従来の解析方法との差異を説明するための図である。FIG. 7 is a diagram for explaining the difference between the analysis method of the embodiment and the conventional analysis method. 図8Aは従来の条件別ソースコードの例を示す図である。FIG. 8A is a diagram showing an example of a conventional conditional source code. 図8Bは従来の条件別ソースコードの例を示す図である。FIG. 8B is a diagram showing an example of a conventional conditional source code. 図8Cは従来の条件別ソースコードの例を示す図である。FIG. 8C is a diagram showing an example of a conventional conditional source code. 図8Dは従来の条件別ソースコードの例を示す図である。FIG. 8D is a diagram showing an example of a conventional conditional source code. 図9は従来の解析方法を示す図である。FIG. 9 is a diagram showing a conventional analysis method. 図10は実施形態の解析装置のハードウェア構成の例を示す図である。FIG. 10 is a diagram showing an example of the hardware configuration of the analysis device of the embodiment.

以下に添付図面を参照して、解析装置、解析方法及びプログラムの実施形態を詳細に説明する。 An analyzer, an analysis method, and an embodiment of a program will be described in detail with reference to the accompanying drawings.

[機能構成の例]
図1は実施形態の解析装置10の機能構成の例を示す図である。実施形態の解析装置10は、分割部1、生成部2及び解析部3を備える。
[Example of functional configuration]
FIG. 1 is a diagram showing an example of a functional configuration of the analysis device 10 of the embodiment. The analysis device 10 of the embodiment includes a division unit 1, a generation unit 2, and an analysis unit 3.

分割部1は、ソースコード101を受け付ける。ソースコード101の種類は任意でよい。ソースコード101は、例えば自動車を制御するC言語プログラムのソースコードである。 The division unit 1 receives the source code 101. The type of source code 101 may be arbitrary. The source code 101 is, for example, the source code of a C language program that controls an automobile.

図2は実施形態のソースコード101の例を示す図である。図2の例は、ソースコード101がC言語である場合を示す。例えば、9行目に記述されたint型変数t_1の定義は、コンパイルスイッチTYPE_Aが指定されている場合に有効になる。TYPE_Aは、例えばソースコード101のコンパイル時に指定される。 FIG. 2 is a diagram showing an example of the source code 101 of the embodiment. The example of FIG. 2 shows a case where the source code 101 is in C language. For example, the definition of the int type variable t_1 described on the 9th line is valid when the compile switch TYPE_A is specified. TYPE_A is specified, for example, when the source code 101 is compiled.

それぞれのコンパイルスイッチは、所定の条件を示す。所定の条件は任意でよい。所定の条件は、例えばプログラムの仕向け毎に定められる。具体的には、所定の条件は、例えばプログラムが動作する製品の種類、及び、当該製品の販売地域等である。 Each compile switch indicates a predetermined condition. The predetermined conditions may be arbitrary. Predetermined conditions are determined, for example, for each program destination. Specifically, the predetermined conditions are, for example, the type of product on which the program operates, the sales area of the product, and the like.

図1に戻り、分割部1は、ソースコード101を受け付けると、当該ソースコード101を、コンパイルスイッチの状態制御を示すコンパイルスイッチコード情報103と、コンパイルスイッチコード情報103を含まない本体コード情報102とに分割する。 Returning to FIG. 1, when the division unit 1 receives the source code 101, the division unit 1 transmits the source code 101 to the compile switch code information 103 indicating the state control of the compile switch and the main body code information 102 not including the compile switch code information 103. Divide into.

図3は実施形態の本体コード情報102の例を示す図である。図3の例では、ソースコード101から、#ではじまるプリプロセッサディレクティブの記述(コンパイルスイッチコード情報103)が削除されている。 FIG. 3 is a diagram showing an example of the main body code information 102 of the embodiment. In the example of FIG. 3, the description of the preprocessor directive (compile switch code information 103) starting with # is deleted from the source code 101.

図4は実施形態のコンパイルスイッチコード情報103の例を示す図である。図4の例では、ソースコード101から、#ではじまるプリプロセッサディレクティブ以外の記述(本体コード情報102)が削除されている。 FIG. 4 is a diagram showing an example of the compile switch code information 103 of the embodiment. In the example of FIG. 4, the description (main body code information 102) other than the preprocessor directive starting with # is deleted from the source code 101.

図1に戻り、分割部1は、本体コード情報102を生成部2に入力し、コンパイルスイッチコード情報103を解析部3に入力する。 Returning to FIG. 1, the division unit 1 inputs the main body code information 102 to the generation unit 2, and inputs the compile switch code information 103 to the analysis unit 3.

生成部2は、分割部1からコンパイルスイッチコード情報103を受け付けると、ソースコード101の行毎のコンパイルスイッチの状態(有効/無効)を示す状態情報を生成する。 When the generation unit 2 receives the compile switch code information 103 from the division unit 1, it generates state information indicating the state (valid / invalid) of the compile switch for each line of the source code 101.

図5は実施形態の状態情報104の例を示す図である。図5の例では、生成部2は、コンパイルスイッチの状態を制御するif条件及びelse条件の組み合わせ(コンパイルスイッチの組み合わせ)を計算する。例えば、生成部2は、ソースコード101の13行目〜26行目のように、入れ子になった記述等を解析することにより、コンパイルスイッチの組み合わせを、ソースコード101の行毎に特定する。そして、生成部2は、コンパイルスイッチの状態(有効/無効)をソースコード101の行毎に特定する。 FIG. 5 is a diagram showing an example of the state information 104 of the embodiment. In the example of FIG. 5, the generation unit 2 calculates the combination of the if condition and the else condition (combination of the compile switch) that controls the state of the compile switch. For example, the generation unit 2 identifies the combination of the compile switches for each line of the source code 101 by analyzing the nested description and the like as in the 13th to 26th lines of the source code 101. Then, the generation unit 2 specifies the state (valid / invalid) of the compile switch for each line of the source code 101.

図5の例では、状態情報104は、例えば1行目から8行目には、有効なコンパイルスイッチがないことを示す。また例えば、状態情報104は、9行目及び10行目では、コンパイルスイッチTYPE_Aが有効であることを示す。また例えば、状態情報104は、11行目及び12行目には、有効なコンパイルスイッチがないことを示す。また例えば、状態情報104は、13行目では、コンパイルスイッチTYPE_Aが有効であることを示す。また例えば、状態情報104は、14行目及び15行目では、コンパイルスイッチTYPE_A及びコンパイルスイッチTYPE_Bが有効であることを示す。以下、同様に、16行目から27行目についても、状態情報104からコンパイルスイッチの状態を特定することができる。 In the example of FIG. 5, the state information 104 indicates that, for example, the first to eighth lines do not have a valid compile switch. Further, for example, the state information 104 indicates that the compile switch TYPE_A is valid on the 9th and 10th lines. Further, for example, the state information 104 indicates that there is no valid compile switch on the 11th and 12th lines. Further, for example, the state information 104 indicates that the compile switch TYPE_A is valid on the 13th line. Further, for example, the state information 104 indicates that the compile switch TYPE_A and the compile switch TYPE_B are valid on the 14th and 15th lines. Hereinafter, similarly, the state of the compile switch can be specified from the state information 104 also in the 16th to 27th lines.

図1に戻り、解析部3は、分割部1から本体コード情報102を受け付け、生成部2から状態情報104を受け付ける。解析部3は、本体コード情報102と、状態情報104とを使用して、ソースコード101を解析する。 Returning to FIG. 1, the analysis unit 3 receives the main body code information 102 from the division unit 1 and the state information 104 from the generation unit 2. The analysis unit 3 analyzes the source code 101 by using the main body code information 102 and the state information 104.

図6は実施形態の解析結果105の例を示す図である。解析部3は、本体コード情報102と、状態情報104とを照らし合わせることにより、解析結果105を取得する。図6の例では、解析結果105は、コンパイルスイッチの組み合わせ毎に、コンパイルスイッチの組み合わせに依存する依存情報が抽出されている。 FIG. 6 is a diagram showing an example of the analysis result 105 of the embodiment. The analysis unit 3 acquires the analysis result 105 by comparing the main body code information 102 with the state information 104. In the example of FIG. 6, in the analysis result 105, the dependency information depending on the combination of the compile switches is extracted for each combination of the compile switches.

図6の解析結果105の例では、例えば、コンパイルスイッチTYPE_Aが有効であり、かつ、コンパイルスイッチTYPE_Bが無効の場合は、入力変数in_1〜in_3が有効になり、入力変数in_4が無効になり、出力変数out_1及びt_1が有効になり、利用関数func2が有効になり、利用関数func3及びfunc4が無効になることが示されている。 In the example of the analysis result 105 of FIG. 6, for example, when the compile switch TYPE_A is valid and the compile switch TYPE_B is invalid, the input variables in_1 to in_3 are valid, the input variables in_4 are invalid, and the output is output. It is shown that the variables out_1 and t_1 are valid, the utilization functions func2 are valid, and the utilization functions func3 and func4 are invalid.

なお、図6の例では、コンパイルスイッチの組み合わせ(プリプロセッサの条件)が4通りである場合を例示しているが、コンパイルスイッチの種類が多いほど、コンパイルスイッチの組み合わせは複雑になる。 In the example of FIG. 6, the case where there are four combinations of compile switches (preprocessor conditions) is illustrated, but the more types of compile switches, the more complicated the combinations of compile switches.

図6の解析結果105の例では、依存情報として、入力変数、出力変数及び利用関数が抽出されているが、入力変数、出力変数及び利用関数以外の情報が、依存情報として抽出されてもよい。 In the example of the analysis result 105 of FIG. 6, the input variable, the output variable, and the utilization function are extracted as the dependency information, but information other than the input variable, the output variable, and the utilization function may be extracted as the dependency information. ..

例えば、変数の型(例えば、int型等)が依存情報に含まれていてもよい。また例えば、変数の種類(例えば、ローカル変数又はグローバル変数等)が、依存情報に含まれていてもよい。なお、図6の解析結果105の例では、変数の種類として、入力又は出力が示されている。また例えば、変数のコメント行に含まれる情報(例えば、変数が取り得る値の範囲、及び、当該値の説明等)が含まれていてもよい。変数が取り得る値の説明は、例えば値の単位(例えば、値が距離であればkm等)等である。 For example, the type of the variable (for example, int type) may be included in the dependency information. Further, for example, the type of variable (for example, a local variable or a global variable) may be included in the dependency information. In the example of the analysis result 105 of FIG. 6, input or output is shown as the type of variable. Further, for example, the information included in the comment line of the variable (for example, the range of values that the variable can take, the explanation of the value, etc.) may be included. The description of the value that a variable can take is, for example, a unit of value (for example, km if the value is a distance) or the like.

また例えば、関数の定義(例えば、戻り値及び引数等)が、依存情報に含まれていてもよい。また例えば、関数のコメント行に含まれる情報(例えば、関数の説明等)が依存情報に含まれていてもよい。関数の説明は、例えば戻り値として取り得る値の説明、及び、引数として取り得る値の説明等である。 Further, for example, the definition of the function (for example, the return value and the argument) may be included in the dependency information. Further, for example, the information included in the comment line of the function (for example, the description of the function) may be included in the dependency information. The description of the function is, for example, a description of a value that can be taken as a return value, a description of a value that can be taken as an argument, and the like.

また、図6の解析結果105は、コンパイルスイッチの組み合わせ毎のテーブル形式で表されているが、解析結果105のデータ形式は、テーブル形式以外のデータ形式でもよい。 Further, although the analysis result 105 of FIG. 6 is represented in a table format for each combination of compile switches, the data format of the analysis result 105 may be a data format other than the table format.

図6の解析結果105のように、コンパイルスイッチの組み合わせ(プリプロセッサの条件)毎に、上述の依存情報の一覧が取得されることにより、ソースコード101をより容易に確認することができる。例えば、解析結果105を使用して、プリプロセッサの条件の正しさを確認することができる。また例えば、解析結果105をソースコード101のテスト工程で活用することができる。具体的には、解析結果105を、例えばコンパイルスイッチの組み合わせ毎のテスト項目(例えば、入出力に関するテスト項目等)の洗い出しに活用することができる。また例えば、解析結果105を、コンパイルスイッチの組み合わせ毎の仕様(機能)の確認に活用することができる。 As shown in the analysis result 105 of FIG. 6, the source code 101 can be confirmed more easily by acquiring the above-mentioned list of dependency information for each combination of compile switches (preprocessor conditions). For example, the analysis result 105 can be used to confirm the correctness of the preprocessor condition. Further, for example, the analysis result 105 can be utilized in the test process of the source code 101. Specifically, the analysis result 105 can be used, for example, to identify test items (for example, test items related to input / output) for each combination of compile switches. Further, for example, the analysis result 105 can be used for confirming the specifications (functions) for each combination of compile switches.

以上、説明したように、実施形態の解析装置10では、分割部1が、ソースコード101を、コンパイルスイッチの状態制御を示すコンパイルスイッチコード情報103と、コンパイルスイッチコード情報103を含まない本体コード情報102とに分割する。生成部2が、コンパイルスイッチコード情報103から、ソースコード101の行毎のコンパイルスイッチの状態を示す状態情報104を生成する。そして、解析部3が、状態情報104から、コンパイルスイッチの組み合わせを解析する。 As described above, in the analysis device 10 of the embodiment, the division unit 1 divides the source code 101 into the compile switch code information 103 indicating the state control of the compile switch and the main body code information that does not include the compile switch code information 103. Divide into 102. The generation unit 2 generates the state information 104 indicating the state of the compile switch for each line of the source code 101 from the compile switch code information 103. Then, the analysis unit 3 analyzes the combination of the compile switches from the state information 104.

これにより実施形態の解析装置10によれば、条件付きコンパイルに使用される条件(コンパイルスイッチ)が複数ある場合でも、ソースコード101をより容易に解析することができる。 As a result, according to the analysis device 10 of the embodiment, the source code 101 can be analyzed more easily even when there are a plurality of conditions (compile switches) used for conditional compilation.

[効果の説明]
次に、実施形態の解析装置10の効果について、従来の解析方法と対比させることにより、具体的に説明する。
[Explanation of effect]
Next, the effect of the analysis device 10 of the embodiment will be specifically described by comparing it with the conventional analysis method.

図7は実施形態の解析方法と、従来の解析方法との差異を説明するための図である。図7に示すように、従来の解析方法では、仕向け毎にソースコード101を解析する必要があった。具体的には、例えばプリプロセッサの条件が4通りの場合、まず、プリプロセッサの条件毎に条件別ソースコード201a〜201dを用意する必要があった。 FIG. 7 is a diagram for explaining the difference between the analysis method of the embodiment and the conventional analysis method. As shown in FIG. 7, in the conventional analysis method, it is necessary to analyze the source code 101 for each destination. Specifically, for example, when there are four preprocessor conditions, it is necessary to first prepare the conditional source codes 201a to 201d for each preprocessor condition.

図8Aは従来の条件別ソースコード201aの例を示す図である。図8Aは、仕向けa用のソースコード101を示す。具体的には、条件別ソースコード201aは、コンパイルスイッチTYPE_Aが無効であり、かつ、コンパイルスイッチTYPE_Bが無効の場合のソースコード101を示す。 FIG. 8A is a diagram showing an example of the conventional conditional source code 201a. FIG. 8A shows the source code 101 for destination a. Specifically, the conditional source code 201a indicates the source code 101 when the compile switch TYPE_A is invalid and the compile switch TYPE_B is invalid.

図8Bは従来の条件別ソースコード201bの例を示す図である。図8Bは、仕向けb用のソースコード101を示す。具体的には、条件別ソースコード201bは、コンパイルスイッチTYPE_Aが有効であり、かつ、コンパイルスイッチTYPE_Bが無効の場合のソースコード101を示す。 FIG. 8B is a diagram showing an example of the conventional conditional source code 201b. FIG. 8B shows the source code 101 for the destination b. Specifically, the conditional source code 201b indicates the source code 101 when the compile switch TYPE_A is valid and the compile switch TYPE_B is invalid.

図8Cは従来の条件別ソースコード201cの例を示す図である。図8Cは、仕向けc用のソースコード101を示す。具体的には、条件別ソースコード201cは、コンパイルスイッチTYPE_Aが無効であり、かつ、コンパイルスイッチTYPE_Bが有効の場合のソースコード101を示す。 FIG. 8C is a diagram showing an example of the conventional conditional source code 201c. FIG. 8C shows the source code 101 for the destination c. Specifically, the conditional source code 201c indicates the source code 101 when the compile switch TYPE_A is invalid and the compile switch TYPE_B is valid.

図8Dは従来の条件別ソースコード201dの例を示す図である。図8Dは、仕向けd用のソースコード101を示す。具体的には、条件別ソースコード201dは、コンパイルスイッチTYPE_Aが有効であり、かつ、コンパイルスイッチTYPE_Bが有効の場合のソースコード101を示す。 FIG. 8D is a diagram showing an example of the conventional conditional source code 201d. FIG. 8D shows the source code 101 for the destination d. Specifically, the conditional source code 201d indicates the source code 101 when the compile switch TYPE_A is valid and the compile switch TYPE_B is valid.

図9は従来の解析方法を示す図である。図9に示すように、従来は、条件別ソースコード201a〜201dを別々に解析することにより得られた解析結果202a〜202dを集計することにより、集計結果203(実施形態の解析結果105に相当)が得られていた。そのため、コンパイルスイッチがN種の場合、2のN乗通りの組み合わせを特定後、2のN乗通りの条件別ソースコード201のコード解析が必要だった。 FIG. 9 is a diagram showing a conventional analysis method. As shown in FIG. 9, conventionally, by aggregating the analysis results 202a to 202d obtained by separately analyzing the conditional source codes 201a to 201d, the aggregation result 203 (corresponding to the analysis result 105 of the embodiment). ) Was obtained. Therefore, when there are N types of compile switches, it is necessary to analyze the code of the conditional source code 201 according to the Nth power of 2 after identifying the combination of 2 to the Nth power.

実施形態の解析装置10によれば、条件付きコンパイルに使用される条件(コンパイルスイッチ)の組み合わせが2のN乗通りである場合であっても、ソースコード101の解析は、1回で済む。そのため、実施形態の解析装置10によれば、条件付きコンパイルに使用される条件が多いほど、従来の解析方法に比べて、解析回数及び解析時間を削減することができる。 According to the analysis device 10 of the embodiment, even if the combination of conditions (compile switches) used for conditional compilation is 2 to the Nth power, the analysis of the source code 101 can be performed only once. Therefore, according to the analysis device 10 of the embodiment, the more conditions used for conditional compilation, the more the number of analyzes and the analysis time can be reduced as compared with the conventional analysis method.

最後に実施形態の解析装置10のハードウェア構成の例について説明する。 Finally, an example of the hardware configuration of the analysis device 10 of the embodiment will be described.

[ハードウェア構成の例]
図10は実施形態の解析装置10のハードウェア構成の例を示す図である。実施形態の解析装置10は、制御装置301、主記憶装置302、補助記憶装置303、表示装置304、入力装置305及び通信装置306を備える。制御装置301、主記憶装置302、補助記憶装置303、表示装置304、入力装置305及び通信装置306は、バス310を介して接続されている。
[Example of hardware configuration]
FIG. 10 is a diagram showing an example of the hardware configuration of the analysis device 10 of the embodiment. The analysis device 10 of the embodiment includes a control device 301, a main storage device 302, an auxiliary storage device 303, a display device 304, an input device 305, and a communication device 306. The control device 301, the main storage device 302, the auxiliary storage device 303, the display device 304, the input device 305, and the communication device 306 are connected via the bus 310.

制御装置301は、補助記憶装置303から主記憶装置302に読み出されたプログラムを実行する。主記憶装置302は、ROM(Read Only Memory)、及び、RAM(Random Access Memory)等のメモリである。補助記憶装置303は、HDD(Hard Disk Drive)、及び、メモリカード等である。 The control device 301 executes the program read from the auxiliary storage device 303 to the main storage device 302. The main storage device 302 is a memory such as a ROM (Read Only Memory) and a RAM (Random Access Memory). The auxiliary storage device 303 is an HDD (Hard Disk Drive), a memory card, or the like.

表示装置304は、解析装置10の状態等を表示する。表示装置304は、例えば液晶ディスプレイ等である。入力装置305は、解析装置10を操作するためのインタフェースである。入力装置305は、例えばキーボードやマウス等である。解析装置10がスマートフォン及びタブレット型端末等のスマートデバイスの場合、表示装置304及び入力装置305は、例えばタッチパネルである。通信装置306は、他の装置と通信するためのインタフェースである。 The display device 304 displays the state and the like of the analysis device 10. The display device 304 is, for example, a liquid crystal display or the like. The input device 305 is an interface for operating the analysis device 10. The input device 305 is, for example, a keyboard, a mouse, or the like. When the analysis device 10 is a smart device such as a smartphone or a tablet terminal, the display device 304 and the input device 305 are, for example, a touch panel. The communication device 306 is an interface for communicating with another device.

実施形態の解析装置10で実行されるプログラムは、インストール可能な形式又は実行可能な形式のファイルでCD−ROM、メモリカード、CD−R及びDVD(Digital Versatile Disc)等のコンピュータで読み取り可能な記憶媒体に記録されてコンピュータ・プログラム・プロダクトとして提供される。 The program executed by the analyzer 10 of the embodiment is a file in an installable format or an executable format, and is a computer-readable storage such as a CD-ROM, a memory card, a CD-R, and a DVD (Digital Versaille Disc). It is recorded on a medium and provided as a computer program product.

また実施形態の解析装置10で実行されるプログラムを、インターネット等のネットワークに接続されたコンピュータ上に格納し、ネットワーク経由でダウンロードさせることにより提供するように構成してもよい。また実施形態の解析装置10で実行されるプログラムをダウンロードさせずにインターネット等のネットワーク経由で提供するように構成してもよい。 Further, the program executed by the analysis device 10 of the embodiment may be stored on a computer connected to a network such as the Internet and provided by downloading via the network. Further, the program executed by the analysis device 10 of the embodiment may be configured to be provided via a network such as the Internet without being downloaded.

また実施形態の解析装置10のプログラムを、ROM等に予め組み込んで提供するように構成してもよい。 Further, the program of the analysis device 10 of the embodiment may be configured to be provided by incorporating it into a ROM or the like in advance.

実施形態の解析装置10で実行されるプログラムは、上述した図1の解析装置10の機能ブロックのうち、プログラムによっても実現可能な機能ブロックを含むモジュール構成となっている。当該各機能ブロックは、実際のハードウェアとしては、制御装置301が記憶媒体からプログラムを読み出して実行することにより、上記各機能ブロックが主記憶装置302上にロードされる。すなわち上記各機能ブロックは主記憶装置302上に生成される。 The program executed by the analysis device 10 of the embodiment has a module configuration including the functional blocks that can be realized by the program among the functional blocks of the analysis device 10 of FIG. 1 described above. As actual hardware, each functional block is loaded onto the main storage device 302 by the control device 301 reading a program from the storage medium and executing the program. That is, each of the above functional blocks is generated on the main storage device 302.

なお上述した図1の各機能ブロックの一部又は全部をソフトウェアにより実現せずに、IC等のハードウェアにより実現してもよい。 It should be noted that a part or all of each functional block of FIG. 1 described above may not be realized by software, but may be realized by hardware such as an IC.

また複数のプロセッサを用いて各機能を実現する場合、各プロセッサは、各機能のうち1つを実現してもよいし、各機能のうち2以上を実現してもよい。 Further, when each function is realized by using a plurality of processors, each processor may realize one of each function, or may realize two or more of each function.

また実施形態の解析装置10の動作形態は任意でよい。実施形態の解析装置10を、例えばネットワーク上のクラウドシステムとして動作させてもよい。 Further, the operation mode of the analysis device 10 of the embodiment may be arbitrary. The analysis device 10 of the embodiment may be operated as, for example, a cloud system on a network.

本発明のいくつかの実施形態を説明したが、これらの実施形態は、例として提示したものであり、発明の範囲を限定することは意図していない。これら新規な実施形態は、その他の様々な形態で実施されることが可能であり、発明の要旨を逸脱しない範囲で、種々の省略、置き換え、変更を行うことができる。これら実施形態やその変形は、発明の範囲や要旨に含まれるとともに、特許請求の範囲に記載された発明とその均等の範囲に含まれる。 Although some embodiments of the present invention have been described, these embodiments are presented as examples and are not intended to limit the scope of the invention. These novel embodiments can be implemented in various other embodiments, and various omissions, replacements, and changes can be made without departing from the gist of the invention. These embodiments and modifications thereof are included in the scope and gist of the invention, and are also included in the scope of the invention described in the claims and the equivalent scope thereof.

1 分割部
2 生成部
3 解析部
10 解析装置
101 ソースコード
102 本体コード情報
103 コンパイルスイッチコード情報
104 状態情報
105 解析結果
201 条件別ソースコード
202 解析結果
203 集計結果
301 制御装置
302 主記憶装置
303 補助記憶装置
304 表示装置
305 入力装置
306 通信装置
310 バス
1 Division 2 Generation unit 3 Analysis unit 10 Analysis device 101 Source code 102 Main body code information 103 Compile switch code information 104 Status information 105 Analysis result 201 Conditional source code 202 Analysis result 203 Aggregation result 301 Control device 302 Main storage device 303 Auxiliary Storage device 304 Display device 305 Input device 306 Communication device 310 Bus

Claims (8)

ソースコードを、コンパイルスイッチの状態制御を示すコンパイルスイッチコード情報と、前記コンパイルスイッチコード情報を含まない本体コード情報とに分割する分割部と、
前記コンパイルスイッチコード情報から、前記ソースコードの行毎の前記コンパイルスイッチの状態を示す状態情報を生成する生成部と、
前記状態情報から、前記コンパイルスイッチの組み合わせを解析する解析部と、
を備える解析装置。
A division unit that divides the source code into compile switch code information indicating the state control of the compile switch and main body code information that does not include the compile switch code information.
A generator that generates state information indicating the state of the compile switch for each line of the source code from the compile switch code information.
An analysis unit that analyzes the combination of the compile switches from the state information,
An analyzer equipped with.
前記解析部は、前記本体コード情報と、前記状態情報とから、前記コンパイルスイッチの組み合わせに依存する依存情報を、前記コンパイルスイッチの組み合わせ毎に更に解析する、
請求項1に記載の解析装置。
The analysis unit further analyzes the dependency information depending on the combination of the compile switches from the main body code information and the state information for each combination of the compile switches.
The analyzer according to claim 1.
前記依存情報は、前記ソースコードに含まれる変数が有効であるか否かを、前記コンパイルスイッチの組み合わせ毎に示す変数情報を含む、
請求項2に記載の解析装置。
The dependency information includes variable information indicating whether or not the variables included in the source code are valid for each combination of the compile switches.
The analyzer according to claim 2.
前記変数情報は、前記変数の型、前記変数の種類、及び、前記変数のコメント行に含まれる情報のうち、少なくとも1つを更に含む、
請求項3に記載の解析装置。
The variable information further includes at least one of the type of the variable, the type of the variable, and the information contained in the comment line of the variable.
The analyzer according to claim 3.
前記依存情報は、前記ソースコードに含まれる関数が有効であるか否かを、前記コンパイルスイッチの組み合わせ毎に示す関数情報を含む、
請求項2乃至4のいずれか1項に記載の解析装置。
The dependency information includes function information indicating whether or not the function included in the source code is valid for each combination of the compile switches.
The analyzer according to any one of claims 2 to 4.
前記関数情報は、前記関数の定義、及び、前記関数のコメント行に含まれる情報の少なくとも一方を更に含む、
請求項5に記載の解析装置。
The function information further includes at least one of the definition of the function and the information contained in the comment line of the function.
The analyzer according to claim 5.
分割部が、ソースコードを、コンパイルスイッチの状態制御を示すコンパイルスイッチコード情報と、前記コンパイルスイッチコード情報を含まない本体コード情報とに分割するステップと、
生成部が、前記コンパイルスイッチコード情報から、前記ソースコードの行毎の前記コンパイルスイッチの状態を示す状態情報を生成するステップと、
解析部が、前記状態情報から、前記コンパイルスイッチの組み合わせを解析するステップと、
を含む解析方法。
The step of dividing the source code into the compile switch code information indicating the state control of the compile switch and the main body code information not including the compile switch code information.
A step in which the generation unit generates state information indicating the state of the compile switch for each line of the source code from the compile switch code information.
A step in which the analysis unit analyzes the combination of the compile switches from the state information,
Analysis method including.
コンピュータを、
ソースコードを、コンパイルスイッチの状態制御を示すコンパイルスイッチコード情報と、前記コンパイルスイッチコード情報を含まない本体コード情報とに分割する分割部と、
前記コンパイルスイッチコード情報から、前記ソースコードの行毎の前記コンパイルスイッチの状態を示す状態情報を生成する生成部と、
前記状態情報から、前記コンパイルスイッチの組み合わせを解析する解析部、
として機能させるためのプログラム。
Computer,
A division unit that divides the source code into compile switch code information indicating the state control of the compile switch and main body code information that does not include the compile switch code information.
A generator that generates state information indicating the state of the compile switch for each line of the source code from the compile switch code information.
An analysis unit that analyzes the combination of the compile switches from the state information.
A program to function as.
JP2018078398A 2018-04-16 2018-04-16 Analytical equipment, analysis method and program Active JP6965202B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2018078398A JP6965202B2 (en) 2018-04-16 2018-04-16 Analytical equipment, analysis method and program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2018078398A JP6965202B2 (en) 2018-04-16 2018-04-16 Analytical equipment, analysis method and program

Publications (2)

Publication Number Publication Date
JP2019185593A JP2019185593A (en) 2019-10-24
JP6965202B2 true JP6965202B2 (en) 2021-11-10

Family

ID=68341450

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2018078398A Active JP6965202B2 (en) 2018-04-16 2018-04-16 Analytical equipment, analysis method and program

Country Status (1)

Country Link
JP (1) JP6965202B2 (en)

Also Published As

Publication number Publication date
JP2019185593A (en) 2019-10-24

Similar Documents

Publication Publication Date Title
US9081586B2 (en) Systems and methods for customizing optimization/transformation/ processing strategies
US20140013299A1 (en) Generalization and/or specialization of code fragments
US11481200B1 (en) Checking source code validity at time of code update
CN110058861B (en) Source code processing method and device, storage medium and electronic equipment
CN107015904B (en) Stack protection method and device
US10241759B2 (en) Detecting open source components built into mobile applications
CN111459499A (en) Program compiling method and device, computer storage medium and electronic equipment
US20180267783A1 (en) Apparatus and method to facilitate extraction of unused symbols in a program source code
US20220244931A1 (en) Image file obtaining method and apparatus
JP6440895B2 (en) Software analysis apparatus and software analysis method
CN112835587B (en) Compiling integration method and device
JP6965202B2 (en) Analytical equipment, analysis method and program
US10133652B2 (en) Debugging optimized code using FAT binary
US11947966B2 (en) Identifying computer instructions enclosed by macros and conflicting macros at build time
CN112953721B (en) IPA file analysis method, IPA file analysis device, IPA file analysis equipment and storage medium
JP6111150B2 (en) Source code analysis apparatus, source code analysis method, and program
CN115777096A (en) Data analysis program creation support device, data analysis program creation support method, and data analysis program creation support program
CN111258910B (en) Static link library function verification method and device, electronic equipment and storage medium
CN111596906B (en) MVPVM-based Android application development method, device, equipment and medium
CN116991735A (en) Front-end component change testing system, method, device, equipment and storage medium
JP2018147114A (en) Test case generation method, computer, and program
US20240135253A1 (en) Computer-readable recording medium storing machine learning support program, machine learning support method, and information processing apparatus
US10761840B2 (en) Software analysis device, software analysis method, and recording medium
CN116755703A (en) Method, device, computer equipment and storage medium for flexibly deploying SDK package
CN116166254A (en) System development method and device, electronic equipment and storage medium

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20200924

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20210908

TRDD Decision of grant or rejection written
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20210921

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20211020

R150 Certificate of patent or registration of utility model

Ref document number: 6965202

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150