JP2015069332A - Object range extractor, static verification system, object range extraction method, and object range extraction program for extracting object range to be subjected to static verification by static verification device - Google Patents
Object range extractor, static verification system, object range extraction method, and object range extraction program for extracting object range to be subjected to static verification by static verification device Download PDFInfo
- Publication number
- JP2015069332A JP2015069332A JP2013201991A JP2013201991A JP2015069332A JP 2015069332 A JP2015069332 A JP 2015069332A JP 2013201991 A JP2013201991 A JP 2013201991A JP 2013201991 A JP2013201991 A JP 2013201991A JP 2015069332 A JP2015069332 A JP 2015069332A
- Authority
- JP
- Japan
- Prior art keywords
- difference
- module
- target range
- source file
- information
- 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.)
- Pending
Links
Images
Abstract
Description
本発明は、静的検証装置に静的検証を実行させる対象範囲を抽出する、対象範囲抽出装置、静的検証システム、対象範囲抽出方法、及び対象範囲抽出プログラムに関する。 The present invention relates to a target range extraction device, a static verification system, a target range extraction method, and a target range extraction program that extract a target range that causes a static verification device to perform static verification.
ソフトウェアの静的解析(「静的検証」、「静的コード解析」、「静的プログラム解析」ともいう。)とは、コンピュータのソフトウェア(プログラム)の解析手法の一種であり、実行ファイルを動作させることなく解析を行うことである。 Software static analysis (also referred to as “static verification”, “static code analysis”, or “static program analysis”) is a type of computer software (program) analysis method that operates an executable file. It is to analyze without letting.
ソフトウェア開発において、ソフトウェアの品質を高めるために、ソフトウェアのコードの静的解析が行われる。一般に、ソースコードファイルは、バグの修正や、ソフトウェアの機能変更、機能追加等の理由で、繰り返し変更される。 In software development, static analysis of software code is performed to improve software quality. Generally, a source code file is repeatedly changed for reasons such as bug correction, software function change, and function addition.
ソースコードの静的解析工程では、ソースコードの一部しか変更されない場合であっても、ソフトウェアの品質を高めるために、全てのソースコードファイルに対して静的解析が行なわれることが多い。このとき、前回の静的解析の実行後に、内容が変更されていないソースコードファイルにおいては、前回と同様の静的解析結果が表示される。特に、ソースコードの規模が大きい場合等には、静的解析結果における指摘事項が大量に表示され、確認作業が煩雑である。ソースコードの静的解析において、静的解析システムのユーザが、前回の静的解析結果において確認済みの指摘項目を、同じ指摘項目であると判別できないことにより、再度、確認しなければならないことは非効率である。 In the source code static analysis process, even if only a part of the source code is changed, static analysis is often performed on all source code files in order to improve the quality of the software. At this time, in the source code file whose contents have not been changed after the previous static analysis, the same static analysis result as the previous one is displayed. In particular, when the source code is large, a large amount of indication items are displayed in the static analysis result, and the confirmation work is complicated. In static analysis of the source code, the user of the static analysis system must check again because it cannot distinguish the pointed item confirmed in the previous static analysis result as the same pointed item. Inefficient.
特許文献1のソースコード解析支援装置は、変更前のソースコードと、変更後のソースコードの差分を抽出して自動解析を実施すべき範囲を特定し、特定した部分に対してのみ自動解析を行う。このとき、特許文献1のソースコード解析支援装置は、変更のないソースコード箇所に対する同一指摘項目を再表示しない。
The source code analysis support device of
上記の動作の結果、特許文献1のソースコード解析支援装置は、静的解析結果における指摘事項の表示量を低減する。
As a result of the above operation, the source code analysis support device of
静的解析技術は、コンパイラ言語に限らず、インタプリタ言語やアセンブラ言語等、任意の言語で記述されたプログラムに対しても適用可能である。そこで、以下では、任意の言語により記述されたプログラムコードを「ソースコード」という。又、「ソースコード」を含むファイルを「ソースコードファイル」又は「ソースファイル」という。更に、1つの実行可能プログラムを記述するソースファイルの全体を「全体ソースファイル」といい、1つの「全体ソースファイル」に含まれる個々のソースファイルを「部分ソースファイル」という。1つの全体ソースファイルの構成要素を「モジュール」という。モジュールは、例えば、部分ソースファイル、又は手続型プログラミング言語における手続き(以下、単に「手続き」という。)である。モジュールは、モジュールの名称(以下、「モジュール名」という。)により識別される。モジュール名は、例えば、部分ソースファイルのファイル名、又は手続き名(例えば、関数名)である。 The static analysis technique is applicable not only to a compiler language but also to a program written in an arbitrary language such as an interpreter language or an assembler language. Therefore, in the following, program code written in an arbitrary language is referred to as “source code”. A file including “source code” is referred to as “source code file” or “source file”. Further, an entire source file describing one executable program is referred to as an “entire source file”, and individual source files included in one “entire source file” are referred to as “partial source files”. A component of one whole source file is called a “module”. The module is, for example, a partial source file or a procedure in a procedural programming language (hereinafter simply referred to as “procedure”). The module is identified by the name of the module (hereinafter referred to as “module name”). The module name is, for example, a file name of a partial source file or a procedure name (for example, a function name).
変更されたソースコードと、変更されていないソースコードとの依存関係によっては、変更されていないソースコードに対しても、追加の指摘事項が必要になる場合がある。尚、ソースコードの「依存関係」とは、あるソースコードの一部(例えば、手続き、部分ソースファイル等のモジュール)が、他のソースコードから参照(例えば、手続きの呼び出し、部分ソースファイルの取り込み)されることを意味する。特許文献1のソースコード解析支援装置は、静的解析を実行する対象を、差分のあったソースコード箇所に限定する。つまり、差分のない箇所については、追加すべき指摘事項があったとしもそれらは表示されない。従って、特許文献1のソースコード解析支援装置では、ソースコードの変更により必要になった指摘事項のすべてが表示されない可能性があるという問題がある。
(発明の目的)
本発明の目的は、静的検証において、2つの全体ソースファイル間の差分に起因して指摘することが必要になる事項に関し、2つの全体ソースファイル間で差分があるモジュール以外についても必要な指摘事項を表示することができる、対象範囲抽出装置、静的検証システム、対象範囲抽出方法、及び対象範囲抽出プログラムを提供することにある。
Depending on the dependency between the source code that has been changed and the source code that has not been changed, additional indications may be required even for source code that has not been changed. Note that the “dependency” of the source code refers to a part of a certain source code (for example, a module such as a procedure or a partial source file) that is referenced from another source code (for example, a procedure call or a partial source file import). ) Means. The source code analysis support apparatus of
(Object of invention)
The object of the present invention relates to matters that need to be pointed out due to differences between two whole source files in static verification, and points that are necessary other than for modules that have differences between two whole source files An object of the present invention is to provide a target range extraction device, a static verification system, a target range extraction method, and a target range extraction program that can display items.
本発明の対象範囲抽出装置は、第1の全体ソースファイルに含まれる複数の第1のモジュールの相互の依存関係を示す依存関係情報と、複数の第1のモジュールのうちの第2のモジュールと共通の名称を有し、第2の全体ソースファイルに含まれる第3のモジュールと第2のモジュールの差分の有無を示す差分情報とに基づいて、第2のモジュールのうちの差分により定義の差分を生じうる第4のモジュールを限定する対象範囲情報を生成する対象範囲生成手段と、を備えることを特徴とする。 The target range extraction apparatus of the present invention includes dependency relationship information indicating a mutual dependency relationship among a plurality of first modules included in the first entire source file, a second module among the plurality of first modules, Difference of definition based on difference of second module based on difference information indicating presence / absence of difference between third module and second module having common name and included in second whole source file And target range generation means for generating target range information for limiting the fourth module capable of generating
本発明の静的検証システムは、複数の第1のモジュールを含む第1の全体ソースファイル、及び複数の第1のモジュールのうちの第2のモジュールと共通の名称を有する第3のモジュールを含む第2の全体ソースファイルに含まれる、部分ソースファイル及びビルドファイルを保持し、第3のモジュールと第2のモジュールの差分の有無を示す差分情報を生成する構成管理装置と、複数の第1のモジュールの相互の依存関係を示す依存関係情報を生成する影響分析装置と、第1の全体ソースファイルに含まれるビルドファイルから静的検証の実行条件を示す実行条件情報を生成するビルド解析装置と、依存関係情報と、差分情報とに基づいて、第2のモジュールのうちの差分により定義の差分を生じうる第4のモジュールを限定する対象範囲情報を生成する対象範囲生成手段を含む対象範囲抽出装置と、対象範囲情報及び実行条件情報に基づいて静的検証のためのコマンドを生成するコマンド生成装置と、コマンドを実行する静的検証装置と、を備えることを特徴とする。 The static verification system of the present invention includes a first entire source file including a plurality of first modules, and a third module having a common name with a second module of the plurality of first modules. A configuration management device that holds a partial source file and a build file included in the second whole source file, and generates difference information indicating whether there is a difference between the third module and the second module; An impact analysis device that generates dependency information indicating mutual dependencies of modules, a build analysis device that generates execution condition information indicating an execution condition of static verification from a build file included in the first entire source file, The target range that limits the fourth module that can produce a definition difference by the difference among the second modules based on the dependency relationship information and the difference information. Target range extraction device including target range generation means for generating information, command generation device for generating a command for static verification based on target range information and execution condition information, and static verification device for executing a command It is characterized by providing.
本発明の対象範囲抽出方法は、第1の全体ソースファイルに含まれる複数の第1のモジュールの相互の依存関係を示す依存関係情報と、複数の第1のモジュールのうちの第2のモジュールと共通の名称を有し、第2の全体ソースファイルに含まれる第3のモジュールと第2のモジュールの差分の有無を示す差分情報とに基づいて、第2のモジュールのうちの差分により定義の差分を生じうる第4のモジュールを限定することを特徴とする。 The target range extraction method of the present invention includes dependency information indicating a mutual dependency of a plurality of first modules included in the first entire source file, a second module of the plurality of first modules, Difference of definition based on difference of second module based on difference information indicating presence / absence of difference between third module and second module having common name and included in second whole source file The fourth module that can produce the above is limited.
本発明の対象範囲抽出プログラムは、対象範囲抽出装置が備えるコンピュータを、第1の全体ソースファイルに含まれる複数の第1のモジュールの相互の依存関係を示す依存関係情報と、複数の第1のモジュールのうちの第2のモジュールと共通の名称を有し、第2の全体ソースファイルに含まれる第3のモジュールと第2のモジュールの差分の有無を示す差分情報とに基づいて、第2のモジュールのうちの差分により定義の差分を生じうる第4のモジュールを限定する対象範囲情報を生成する対象範囲生成手段として機能させることを特徴とする。 The target range extraction program according to the present invention includes a computer included in a target range extraction apparatus, dependency relationship information indicating a mutual dependency relationship between a plurality of first modules included in a first entire source file, and a plurality of first items. Based on the difference information indicating whether or not there is a difference between the third module and the second module having the same name as the second module among the modules and included in the second entire source file, the second It is made to function as a target range production | generation means which produces | generates the target range information which limits the 4th module which can produce the difference of a definition by the difference among modules.
本発明によれば、静的検証において、2つの全体ソースファイル間の差分に起因して指摘することが必要になる事項に関し、2つの全体ソースファイル間で差分があるモジュール以外についても必要な指摘事項を表示することができるという効果がある。 According to the present invention, in matters that need to be pointed out due to a difference between two whole source files in static verification, necessary points other than a module that has a difference between two whole source files are also required. There is an effect that items can be displayed.
以下、本発明の実施形態について図面を参照して詳細に説明する。尚、すべての図面において、同等の構成要素には同じ符号を付し、適宜説明を省略する。
(第1の実施形態)
図1は、本実施形態における対象範囲抽出装置100の構成の一例を示すブロック図である。
Hereinafter, embodiments of the present invention will be described in detail with reference to the drawings. In all the drawings, equivalent components are denoted by the same reference numerals, and description thereof will be omitted as appropriate.
(First embodiment)
FIG. 1 is a block diagram showing an example of the configuration of the target
対象範囲抽出装置100は、例えば、コンピュータ等の情報処理機器である。
The target
対象範囲抽出装置100は、対象範囲抽出手段140を含む。
The target
対象範囲抽出手段140は、ソース差分情報210及び影響範囲情報410に基づいて、対象範囲情報510を生成する。
The target
ソース差分情報210は、共通するモジュール名を有する2つの全体ソースファイル(以下、一方を「第1の全体ソースファイル」、他方を「第2の全体ソースファイル」という。)における、モジュール毎の違いの有無を示す情報である。ソース差分情報210は、例えば、新旧2時点の全体ソースファイルにおける、部分ソースファイル毎のファイル内容の差分の有無を示す情報である。あるいは、ソース差分情報210は、例えば、プログラムの2つの変種に対応する2つの全体ソースファイルにおける、手続き毎のコードの差分の有無を示す情報である。
The
影響範囲情報410は、静的検証の対象を含む1つの全体ソースファイル(以下、「第1の全体ソースファイル」とする。)における、モジュール間の依存関係を示す情報である。尚、モジュールの「依存関係」とは、あるモジュール(例えば、手続き、部分ソースファイル等)が、他のモジュールから参照(例えば、手続きの呼び出し、部分ソースファイルの取り込み)されることを意味する。影響範囲情報410は、例えば、第1の全体ソースファイルにおける、2つのソースファイルの組毎の、一方のソースファイルから他方のソースファイルへの手続き又はマクロの呼び出しの有無を示す情報である。あるいは、影響範囲情報410は、例えば、第1の全体ソースファイルにおける、2つの手続きの組毎の、一方の手続きから他方の手続きの呼び出しの有無を示す情報である。
The
対象範囲情報510は、第1の全体ソースファイルにおける、モジュール毎の影響の有無を示す情報である。対象範囲情報510は、例えば、新しい1時点に対応する第1の全体ソースファイルにおける、古い1時点に対応する第2の全体ソースファイルからの、部分ソースファイル毎のファイル内容の変更の有無を示す情報である。あるいは、対象範囲情報510は、例えば、静的検証の対象である1つのプログラムの変種に対応する第1の全体ソースファイルにおける、プログラムの別の変種に対応する第2の全体ソースファイルからの、手続き毎の定義(手続きの動作)の変更の有無を示す情報である。
The
つまり、対象範囲抽出手段140は、ソース差分情報210及び影響範囲情報410に基づいて、差分が第1の全体ソースファイルにおける各モジュールに影響を及ぼす範囲を限定することにより、対象範囲情報510を生成する。尚、「差分がモジュールに及ぼす影響」とは、差分により生じるモジュールの定義の差分を意味する。つまり、あるモジュールにおける他のモジュールへの参照(例えば、手続き(コード)の呼び出し、部分ソースファイルの取り込み)を含めた、モジュールを定義するコード全体の差分を意味する。
That is, the target
図2は、本実施形態における対象範囲抽出装置のハードウェア構成の一例を示すブロック図である。 FIG. 2 is a block diagram illustrating an example of a hardware configuration of the target range extraction device in the present embodiment.
対象範囲抽出装置101は、記憶装置102と、CPU(Central Processing Unit)103と、キーボード104と、モニタ105と、I/O(Input/Output)108とを備え、これらが内部バス106で接続されている。記憶装置102は、対象範囲抽出手段140等のCPU103の動作プログラムを格納する。CPU103は、対象範囲抽出装置101全体を制御し、記憶装置102に格納された動作プログラムを実行し、I/O108を介して対象範囲抽出手段140等のプログラムの実行やデータの送受信を行なう。なお、上記の対象範囲抽出装置101の内部構成は一例である。対象範囲抽出装置101は、CPU103、記憶装置102、及びI/O108のみを備え、外部に備えられた、キーボード104、及びモニタ105を用いて動作してもよい。
The target
次に、本実施形態の動作を説明する。 Next, the operation of this embodiment will be described.
図3は、本実施形態における対象範囲抽出装置100の動作を示すフローチャートである。
FIG. 3 is a flowchart showing the operation of the target
対象範囲抽出手段140は、ソース差分情報210及び影響範囲情報410に基づいて、対象範囲情報510を生成する(ステップS11)。
The target
次に、本実施形態の処理手順の具体例を説明する。 Next, a specific example of the processing procedure of this embodiment will be described.
図4は、本実施形態における対象範囲抽出装置100の処理手順の具体例を説明するための図である。
FIG. 4 is a diagram for explaining a specific example of a processing procedure of the target
まず、本実施形態における対象範囲抽出装置100の処理手順の具体例を説明するための前提について説明する。
(前提1)全体ソースファイルは、モジュールである手続き“main”、“sub”を含む。
(前提2)全体ソースファイルには、2つの全体ソースファイルが存在する。
(前提3)第1の全体ソースファイルに含まれる手続きのうち、“sub”のみが、第2の全体ソースファイルからの差分を有する。
(前提4)第1の全体ソースファイルに含まれる手続きのうち、“main”は、“sub”の手続きを呼び出す。この関係は、第1の全体ソースファイルにおける関係を示せばよく、第2の全体ソースファイルにおける関係は任意である。
(前提5)第1の全体ソースファイルに含まれる手続きのうち、“sub”は、他の手続きを呼び出さない。この関係も、第1の全体ソースファイルにおける関係を示せばよく、第2の全体ソースファイルにおける関係は任意である。
First, the premise for demonstrating the specific example of the process sequence of the target
(Premise 1) The entire source file includes procedures “main” and “sub” which are modules.
(Premise 2) There are two whole source files in the whole source file.
(Premise 3) Of the procedures included in the first entire source file, only “sub” has a difference from the second entire source file.
(Assumption 4) “main” calls the “sub” procedure among the procedures included in the first entire source file. This relationship may indicate the relationship in the first entire source file, and the relationship in the second entire source file is arbitrary.
(Premise 5) Of the procedures included in the first entire source file, “sub” does not call other procedures. This relationship may also indicate the relationship in the first entire source file, and the relationship in the second entire source file is arbitrary.
以上が、本実施形態における対象範囲抽出装置100の処理手順の具体例を説明するための前提である。
The above is a premise for explaining a specific example of the processing procedure of the target
ソース差分情報210は、前提1により2つのモジュールを持ち、前提2―3により“sub”にのみ2つの全体ソースファイルの間で差分が存在することを示す。尚、図4の表においては、差分が存在することを「真」を表す論理値“1”で、存在しないことを「偽」を表す論理値“0”で示す。以下、「真」を表す論理値を“1”で、「偽」を表す論理値を“0”で示す。
The
影響範囲情報410は、前提1により2つのモジュールに関する情報を持つ。又、前提4―5により、影響範囲情報410が示すモジュール間の呼び出し関係は、図4の表に示したとおりである。尚、表の行は呼び出し側のモジュールを、表の列は呼び出される側のモジュールを示し、呼び出しが存在することを“1”で、呼び出しが存在しないことを“0”で示す。又、あるモジュールからそのモジュール自身への呼び出しは、常に存在するものとみなす。
The influence range
対象範囲抽出手段140は、ソース差分情報210及び影響範囲情報410に基づいて、対象範囲情報510を生成する(ステップS11、詳細は後述)。
The target
対象範囲情報510は、前提1により2つのモジュールを持ち、“main”及び“sub”にソース差分210の影響が及ぶこと、つまり静的検証の対象であることを示す。尚、図4の表においては、影響が及ぶことを“1”で、及ばないことを“0”で示す。
The
図5は、本実施形態における対象範囲抽出装置100の対象範囲抽出手段140の処理手順の具体例を説明するための図である。
FIG. 5 is a diagram for explaining a specific example of the processing procedure of the target
図中の行列は、依存構造マトリックス(DSM:Dependency Structure Matrix)と呼ばれる。依存構造マトリックスは、モジュール数に一致する次元(図では、次元が“4”である例を示す。)を持つ。マトリックスの行は依存先のモジュールを、表の列は依存元のモジュールを示し、モジュール間に依存関係が存在することを“1”で、モジュール間に依存関係が存在しないことを“0”で示す。 The matrix in the figure is called a dependency structure matrix (DSM). The dependency structure matrix has a dimension that matches the number of modules (in the figure, an example in which the dimension is “4” is shown). The matrix row indicates the dependency destination module, the table column indicates the dependency source module, “1” indicates that there is a dependency relationship between modules, and “0” indicates that no dependency relationship exists between the modules. Show.
図中の右側の列ベクトル(以下、「変化ベクトル」という。)は、モジュール数に一致する次元(例えば、“4”)を持つ。尚、表においては、モジュールに変化が存在することを“1”で、モジュールに変化が存在しないことを“0”で示す。 The right column vector (hereinafter referred to as “change vector”) in the figure has a dimension (for example, “4”) that matches the number of modules. In the table, “1” indicates that there is a change in the module, and “0” indicates that there is no change in the module.
図中の左側の列ベクトル(以下、「影響ベクトル」という。)は、モジュール数に一致する次元(例えば、“4”)を持つ。尚、表においては、モジュールに変化の影響が存在することを“1”で、モジュールに変化の影響が存在しないことを“0”で示す。 The left column vector (hereinafter referred to as “influence vector”) in the figure has a dimension (for example, “4”) that matches the number of modules. In the table, “1” indicates that the module has an influence of change, and “0” indicates that the module has no influence of change.
影響ベクトルは、依存構造マトリックスに変化ベクトルを乗算することにより得られる。依存構造マトリックスと変化ベクトルの乗算は、通常の行列同士の乗算と同じ規則により計算される。つまり、変化ベクトルのj番目(j=0,1,・・・,m。mは第1の全体ソースファイル中のモジュールの個数)の成分をbj、影響ベクトルのi番目(i=0,1,・・・,m)の成分をci、依存構造マトリックスのi行j列の成分をaijとすると、影響ベクトルはci=Σaij*bjにより計算される。ここで、“*”は論理積を意味し、“Σ”は全てのj番目の成分についての総和を意味する。総和は、全成分についての論理和である。 The influence vector is obtained by multiplying the dependency structure matrix by the change vector. The multiplication of the dependency structure matrix and the change vector is calculated according to the same rule as the multiplication of ordinary matrices. That is, the j-th component (j = 0, 1,..., M, where m is the number of modules in the first entire source file) of the change vector is b j , and the i-th component (i = 0, 1, ..., component c i of m), the components of the row i and column j of the dependency structure matrix When a ij, effect vector is calculated by c i = Σa ij * b j . Here, “*” means a logical product, and “Σ” means a sum for all the j-th components. The sum is a logical sum of all components.
ここで、aij*bjは、依存元のj番目のモジュールの変化が依存先のi番目のモジュールに実際に影響を与えるか否かを示す。従って、ci=Σaij*bjは、影響ベクトルのi番目の要素が影響を受けるか否かを示す。すなわち、対象範囲情報の各要素は、部分ソースコードの差分によって、一部でも影響を受けた場合には、必ず、静的検証の対象であることを示す“1”になる。 Here, a ij * b j indicates whether or not the change of the j-th module of the dependence source actually affects the i-th module of the dependence destination. Therefore, c i = Σa ij * b j indicates whether or not the i-th element of the influence vector is affected. That is, each element of the target range information is always “1” indicating that it is a target of static verification when it is partially affected by the difference of the partial source code.
尚、影響ベクトルの代わりに、変化ベクトルの転置ベクトルに依存構造マトリックスの転置マトリックスを乗じることにより、影響ベクトルの転置ベクトルが計算されてもよい。 Instead of the influence vector, the transposed vector of the influence vector may be calculated by multiplying the transposed vector of the change vector by the transposed matrix of the dependency structure matrix.
対象範囲抽出手段140は、各モジュールに所定の順番を与え、影響範囲情報410を依存構造マトリックスとみなし、ソース差分情報210を変化ベクトルとみなして、依存構造マトリックスに変化ベクトルを乗算することにより、影響ベクトルである対象範囲情報510を生成する(ステップS11)。尚、前述のように、対象範囲抽出手段140は、変化ベクトルの転置ベクトルに依存構造マトリックスの転置マトリックスを乗じて影響ベクトルの転置ベクトルを限定することにより、対象範囲情報510を生成してもよい。
The target
図4において、影響範囲情報410(依存構造マトリックス)にソース差分情報210(変化ベクトル)を乗じることによって、対象範囲情報500(影響ベクトル)が得られる。 In FIG. 4, the target range information 500 (influence vector) is obtained by multiplying the influence range information 410 (dependence structure matrix) by the source difference information 210 (change vector).
尚、第1の全体ソースファイルのあるモジュールが、第2の全体ソースファイルに含まれない場合には、対象範囲抽出手段140は、第2の全体ソースファイルに含まれないモジュールにも所定の順番(例えば、k(kは自然数))を与える。対象範囲抽出手段140は、影響範囲情報410を依存構造マトリックスに、ソース差分情報210を変化ベクトルに、影響ベクトルを対象範囲情報510に対応付ける。ここで、変化ベクトルの第k行成分bkは“1”とみなす。
When a module having the first entire source file is not included in the second entire source file, the target
依存構造マトリックスはモジュール間の間接的な依存関係を含む依存関係を示す。仮に、依存構造マトリックスが、モジュール間の直接の依存関係のみを含み、間接的な依存関係を含まない場合には、依存構造マトリックスを冪乗(例えば、M乗(Mは自然数))することにより、モジュール間の直接的な依存関係のM回までの連鎖を考慮した間接的な依存関係を含む依存関係を示す間接依存構造マトリックスが得られる。なぜなら、前述の場合には、影響ベクトルは、変化ベクトルが直接的な依存関係のみの影響をM回受けた結果を示すからである。従って、第1の全体ソースファイル中にモジュールがm個ある場合は、連鎖は(m−1)回起きうるので、Mはm−1に等しい。前述の場合には、対象範囲抽出手段140は、依存構造マトリックスの2乗以上の冪乗に、さらに変化ベクトルを乗算することにより、影響ベクトルを生成してもよい。尚、依存構造マトリックスの冪乗は、複数個の依存構造マトリックスを行列として乗算した結果の行列である。依存構造マトリックスの行列としての乗算において、成分間の積は論理積を、成分間の和は論理和である。
The dependency structure matrix indicates dependency relationships including indirect dependency relationships between modules. If the dependency structure matrix includes only a direct dependency relationship between modules and does not include an indirect dependency relationship, the dependency structure matrix is raised to a power (for example, M power (M is a natural number)). As a result, an indirect dependency structure matrix showing the dependency including indirect dependency considering the chain of the direct dependency between modules up to M times is obtained. This is because, in the above-described case, the influence vector indicates the result of the change vector being affected by the influence of only the direct dependency relationship M times. Thus, if there are m modules in the first overall source file, the chain can occur (m−1) times, so M is equal to m−1. In the above-described case, the target
例えば、3つのモジュール間に、以下の直接的な依存関係があり、他の直接的な依存関係は存在しない場合を考える。モジュール“1”は、モジュール“2”に直接的に依存する。モジュール“2”は、モジュール“3”に直接的に依存する。上記の場合、モジュール“1”は、モジュール“2”を介して、モジュール“3”に依存する。このことを依存構造マトリックスで表現すると、依存構造マトリックスのi行j列の成分aijは、
a12=a23=a11=a22=a33=1
aij=0(上記以外のすべての要素)
である。
For example, consider the case where there are the following direct dependencies between three modules, and no other direct dependencies. Module “1” depends directly on module “2”. Module “2” depends directly on module “3”. In the above case, module “1” depends on module “3” via module “2”. If this is expressed by the dependency structure matrix, the component a ij of i rows and j columns of the dependency structure matrix is
a 12 = a 23 = a 11 = a 22 = a 33 = 1
a ij = 0 (all elements other than the above)
It is.
上記の依存構造マトリックスを2乗して得られる間接依存構造マトリックスのi行j列の成分dijは、
dij=Σaim*amj(m=1,2,3)
=ai1*a1j+ai2*a2j+ai3*a3j
であるから、例えば、
d13=a11*a13+a12*a23+a13*a33
=1*0+1*1+0*1
=1
である。
A component d ij of i rows and j columns of the indirect dependency structure matrix obtained by squaring the dependency structure matrix is
d ij = Σa im * a mj (m = 1, 2, 3)
= A i1 * a 1j + a i2 * a 2j + a i3 * a 3j
So, for example,
d 13 = a 11 * a 13 + a 12 * a 23 + a 13 * a 33
= 1 * 0 + 1 * 1 + 0 * 1
= 1
It is.
このように、依存構造マトリックスを2乗することによって、直接的依存関係の1回の連鎖により、あるモジュールが他のモジュールに間接的に依存するか否かを示す間接依存構造マトリックスが得られる。なぜなら、例えば、モジュール“1”のモジュール“3”への依存関係に着目すると、モジュール“1”のモジュール“3”への間接的依存の有無を示す要素d13に、モジュール“1”のモジュール“2”への直接的依存の有無を示す要素a12と、モジュール“2”のモジュール“3”への直接的依存の有無を示すa23の積が含まれるからである。上記の2つの直接的依存関係が存在するときは、2つの要素の積は”1”になり、モジュール“1”のモジュール“3”への間接的依存が存在することを示す。2つの直接的依存関係の一方でも存在しないときは、2つの要素の積は”0”になり、モジュール“1”のモジュール“3”への間接的依存は存在しないことを示す。 Thus, by squaring the dependency structure matrix, an indirect dependency structure matrix indicating whether a certain module indirectly depends on another module is obtained by one chain of direct dependency relationships. This is because, for example, focusing on the dependency relationship of module “1” to module “3”, module d of module “1” is included in element d 13 indicating whether or not module “1” is indirectly dependent on module “3”. This is because the product of the element a 12 indicating whether or not there is a direct dependency on “2” and a 23 indicating whether or not the module “2” is directly dependent on the module “3” is included. When the above two direct dependencies exist, the product of the two elements is “1”, indicating that there is an indirect dependency of module “1” on module “3”. When one of the two direct dependencies does not exist, the product of the two elements is “0”, indicating that there is no indirect dependency of module “1” on module “3”.
モジュールの個数が4以上の場合についても同様である。すなわち、直接的依存関係の1回の連鎖による、あるモジュールの他のモジュールへの間接的依存の有無は、上記の方法によって求められた間接依存構造マトリックスによって示される。従って、求められた間接依存構造マトリックスにさらに依存構造マトリックスを乗算することによって、直接的依存関係の2回の連鎖による、あるモジュールの他のモジュールへの間接的依存の有無を示す間接依存構造マトリックスを求めることができる。このように、間接依存構造マトリックスへの依存構造マトリックスの乗算の繰り返し、すなわち依存構造マトリックスの(m−1)乗を求めることによって、モジュール“1”、…、モジュール“m”相互間の間接的依存の有無を示す間接依存構造マトリックスを求めることができる。尚、依存構造マトリックスの(M−1)乗がM乗に等しいならば、依存構造マトリックスの(M−1)乗以上の冪乗はすべて同一であるので、依存構造マトリックスの(M+1)乗以上の計算は不要である。 The same applies to the case where the number of modules is four or more. That is, the presence or absence of indirect dependence of a module on other modules by one chain of direct dependence is indicated by the indirect dependence structure matrix obtained by the above method. Therefore, the indirect dependency structure matrix that indicates the presence or absence of an indirect dependency of one module on another module by multiplying the obtained indirect dependency structure matrix by the dependency structure matrix further, by two chains of direct dependencies. Can be requested. In this way, by repeating the multiplication of the dependency structure matrix to the indirect dependency structure matrix, that is, by obtaining the (m−1) th power of the dependency structure matrix, indirect between the modules “1”,. An indirect dependency structure matrix indicating the presence or absence of dependency can be obtained. If the (M−1) th power of the dependency structure matrix is equal to the Mth power, all the powers of the dependency structure matrix that are (M−1) th power or higher are the same. The calculation of is unnecessary.
図6は、本実施形態における対象範囲抽出装置100の対象範囲抽出手段140の処理手順の別の具体例を説明するための図である。
FIG. 6 is a diagram for explaining another specific example of the processing procedure of the target
影響範囲情報420は、モジュール間の直接の呼び出し関係のみを含む呼び出し関係を示す例である。影響範囲情報420は、“main”が“sub”を直接呼び出し、“sub”が“sub2”を直接呼び出し、それ以外には直接の呼び出し関係がないことを示す。
The influence range
一方、影響範囲情報430は、モジュール間の間接の呼び出し関係を含む呼び出し関係を示す例である。影響範囲情報430は、影響範囲情報420が示す呼び出し関係に加えて、“main”は”sub”を介して“sub2”を間接的に呼び出すことを示す。影響範囲情報430に対応する依存構造マトリックスは、影響範囲情報420に対応する依存構造マトリックスの2乗以上の冪乗である。
On the other hand, the
第1の全体ソースファイルに対する静的検証が行われる以前に、第2の全体ソースファイルに対する静的検証が行われるものとする。第2の全体ソースファイルと第1の全体ソースファイルと間で差分があるモジュール“sub”については、第1の全体ソースファイルにおいて、静的検証が必要である。 It is assumed that the static verification is performed on the second entire source file before the static verification is performed on the first entire source file. For the module “sub” having a difference between the second entire source file and the first entire source file, static verification is required in the first entire source file.
一方、第2の全体ソースファイルと第1の全体ソースファイルと間で差分がないモジュール“main”については、“main”は“sub”を呼び出すので、“sub”の動作の変化により、動作が変わる可能性がある。そのため、“main”については、第2の全体ソースファイルと第1の全体ソースファイルと間で差分はないが、改めて静的検証することが必要である。対象範囲抽出装置100は、静的検証の対象範囲として、“main”と“sub”の両方を抽出する。従って、検証結果には、静的検証の対象として指定された、第1の全体ソースコード及び第2の全体ソースコード間で差分の無い手続き“main()”と、第1の全体ソースコード及び第2の全体ソースコード間で差分のある手続き“sub()”に関する指摘事項が含まれる。
On the other hand, for the module “main” in which there is no difference between the second whole source file and the first whole source file, “main” calls “sub”. It may change. Therefore, regarding “main”, there is no difference between the second entire source file and the first entire source file, but static verification is required again. The target
以上説明したように、本実施形態における対象範囲抽出装置100では、2つの全体ソースファイル間で差分がない手続き(例えば、“main”)についても、別の手続き(例えば、“sub”)の差分により差分の影響が及ぶならば、静的検証の対象に指定する。従って、本実施形態における対象範囲抽出装置100は、静的検証において、2つの全体ソースファイル間の差分に起因して指摘することが必要になる事項に関し、2つの全体ソースファイル間で差分があるモジュール以外についても必要な指摘事項を表示することができる。
As described above, in the target
尚、上述の説明では、影響範囲情報410が手続型プログラミング言語における手続き間の依存関係である場合について説明した。しかしながら、本実施形態の影響範囲情報410は手続き間の依存関係を示す情報である必要はない。すなわち、本実施形態の影響範囲情報410は部分ソースファイル間の依存関係を示す情報であってもよい。対象範囲抽出装置100の対象範囲抽出手段140は、部分ソースファイル毎のソース差分情報210及び部分ソースファイル毎の影響範囲情報410に基づいて、部分ソースファイル毎の対象範囲情報510を生成する。外部の静的検証装置が手続き毎に検証範囲を限定することができるならば、対象範囲抽出装置100は、静的検証において、2つの全体ソースファイル間の差分に起因して指摘することが必要になる事項に関し、2つの全体ソースファイル間で差分があるモジュール以外についても必要な指摘事項を表示することができる。
(第2の実施形態)
本実施形態の説明においては、第1の実施形態と本実施形態とで共通する説明は省略し、第1の実施形態に対する本実施形態の相違点のみについて説明する。
In the above description, the case where the
(Second Embodiment)
In the description of the present embodiment, descriptions common to the first embodiment and the present embodiment are omitted, and only the differences of the present embodiment from the first embodiment will be described.
尚、本実施形態では、本実施形態における対象範囲抽出装置190を含む、静的検証システム全体の構成を説明する。
In the present embodiment, the configuration of the entire static verification system including the target
図7は、本実施形態における対象範囲抽出装置190の構成の一例を示すブロック図である。本実施形態における対象範囲抽出装置190の構成は、図1に示した第1の実施形態における対象範囲抽出装置100の構成と同じであるが、入力である、ソース差分情報215、及び影響範囲情報415のデータ形式が異なる。
FIG. 7 is a block diagram illustrating an example of the configuration of the target
本実施形態における対象範囲抽出装置190を含む静的検証システムについて説明する。静的検証システムは、構成管理装置110と、影響分析装置130と、ビルド解析装置120と、対象範囲抽出装置190と、コマンド生成装置400と、静的検証装置500とを含む。
A static verification system including the target
構成管理装置110は、例えば、コンピュータ等の情報処理機器である。構成管理装置110は、「構成管理システム」とも呼ばれる。構成管理システムには、例えば、「Subversion(登録商標)」がある。構成管理装置110は、第1の全体ソースファイル220における部分ソースファイル221−224及びビルドファイル225、並びに第2の全体ソースファイル230における部分ソースファイル231−234及びビルドファイル235を保持する。構成管理装置110は、更に、第1の全体ソースファイル220における部分ソースファイル221−224及びビルドファイル225を出力する。構成管理装置110は、更に、第1の全体ソースファイル220における部分ソースファイル221−224及びビルドファイル225、並びに第2の全体ソースファイル230における部分ソースファイル231−234及びビルドファイル235に基づき、第1の全体ソースファイル220と第2の全体ソースファイル230間の部分ソースファイル毎の差分を示すソース差分情報215を生成する。
The
影響分析装置130は、例えば、コンピュータ等の情報処理機器である。影響分析装置130は、「影響分析システム」とも呼ばれる。影響分析システムには、例えば、TechMatrix(登録商標)社の「Lattix」がある。影響分析装置130は、第1の全体ソースファイル220における、部分ソースファイル221−224及びビルドファイル225に基づき、部分ソースファイル221−224間の依存関係を示す影響範囲情報415を生成する。
The
ビルド解析装置120は、例えば、コンピュータ等の情報処理機器である。ビルド解析装置120は、「ビルド解析システム」とも呼ばれる。ビルド解析システムには、例えば、TechMatrix社の「Lattix」がある。ビルド解析装置120は、第1の全体ソースファイル220におけるビルドファイル225から静的検証の実行条件を示す実行条件情報310を生成する。
The
対象範囲抽出装置190は、対象範囲生成手段145を含む。対象範囲生成手段145は、ソース差分情報215及び影響範囲情報415に基づいて、差分が第1の全体ソースファイル220における各モジュールに影響を及ぼす範囲を限定することにより、第1の全体ソースファイル220における静的検証の対象モジュールを示す対象範囲情報510を生成する。
The target
コマンド生成装置400は、対象範囲情報510及び実行条件情報310に基づいて、静的検証を実行させるための静的検証コマンド520を生成する。
The
実行条件情報310は、静的検証時の検証条件(プログラムの動作を指定するための情報)である。ソースファイルがコンパイラ言語で記述される場合、実行ファイルはソースファイルがコンパイルされることにより生成される。実行条件情報310は、コンパイル時に指定されるオプション(以下、「コンパイル時オプション」という。)の一部を含む。コンパイル時オプションは、ビルドファイルに記述される。又、実行条件情報310は、実行ファイルの実行時に指定されるオプション(以下、「実行時オプション」という。)の一部を含んでもよい。実行時オプションは、例えば、実行ファイルのコマンドラインオプションを含み、スクリプトファイル(シェルスクリプト、コマンドファイル)やテスト実行ファイル等に記述されることがある。
The
静的検証コマンド520は、静的検証装置500に静的検証を実行させるためのコマンドラインである。静的検証コマンド520は、一群のソースファイルから静的検証の対象として選択されたソースファイルと、静的検証時のプログラムの動作を指定するためのコマンドラインオプション(以下、「静的検証時オプション」という。)とを含む。
The
静的検証装置500は、例えば、コンピュータ等の情報処理機器である。静的検証装置500は、「静的検証システム」とも呼ばれる。静的検証システムに、例えば、TechMatrix社の「C++test」、「Jtest」がある。静的検証装置500は、静的検証の対象として選択された部分ソースファイルと静的検証時オプションとが指定された静的検証コマンド520を実行し、検証結果530を生成する。検証結果530には、静的検証の対象として指定された部分ソースファイルに関する指摘事項が含まれ、静的検証の対象として指定されない部分ソースファイルに関する指摘事項は含まれない。
The
次に、本実施形態の動作を説明する。 Next, the operation of this embodiment will be described.
図8は、本実施形態における静的検証システムの動作を示すフローチャートである。 FIG. 8 is a flowchart showing the operation of the static verification system in the present embodiment.
構成管理装置110は、第1の全体ソースファイル220における部分ソースファイル221−224及びビルドファイル225、並びに第2の全体ソースファイル230における部分ソースファイル231−234及びビルドファイル235からソース差分情報215を生成する(ステップS21)。
The
影響分析装置130は、第1の全体ソースファイル220における、部分ソースファイル221−224及びビルドファイル225から、部分ソースファイル221−224間の依存関係を示す影響範囲情報415を生成する(ステップS22)。
The
ビルド解析装置120は、第1の全体ソースファイル220におけるビルドファイル225から静的検証の実行条件を示す実行条件情報310を生成する(ステップS23)。
The
対象範囲抽出装置190の対象範囲生成手段145は、影響範囲情報415と、ソース差分情報215とに基づいて、第1の全体ソースファイル220における静的検証の対象モジュール(部分ソースファイル)を示す対象範囲情報510を生成する(ステップS24)。
The target
コマンド生成装置400は、対象範囲情報510及び実行条件情報310に基づいて、静的検証コマンド520を生成する(ステップS25)。
The
静的検証装置500は、静的検証の対象として選択された部分ソースファイルと静的検証時オプションとが指定された静的検証コマンド520を実行し、検証結果530を生成する(ステップS26)。
The
次に、本実施形態の処理手順の具体例を説明する。 Next, a specific example of the processing procedure of this embodiment will be described.
図9は、本実施形態における静的検証システムの処理手順の具体例を説明するための図である。 FIG. 9 is a diagram for explaining a specific example of the processing procedure of the static verification system in the present embodiment.
全体ソースファイルには、2つの全体ソースファイル220、230が存在する。ビルドファイル235及び部分ソースファイル231−234は、第2の時点(例えば、古い時点)のビルドファイル及び部分ソースファイルである。ビルドファイル225及び部分ソースファイル221−224は、第1の時点(例えば、新しい時点)のビルドファイル及び部分ソースファイルである。全体ソースファイル220、230は、C言語により記述され、部分ソースファイル“main.c”221、231、“sub.c”222、232、“sub2.c”223、233、“com.h”224、234を含む。ヘッダファイル(“com.h”)224、234を除く2つの全体ソースファイル220、230は、それぞれ異なるディレクトリ(フォルダ。例えば、「new」、「old」。)に格納される。ヘッダファイル224、234は、ヘッダファイルを除く部分ソースファイルが格納されるディレクトリ配下の“include”ディレクトリに格納される。
Two whole source files 220 and 230 exist in the whole source file. The
第1の全体ソースファイル220に含まれる部分ソースファイルのうち、“sub.c”222のみが、第2の全体ソースファイル230からの差分を有する。部分ソースファイル222には、部分ソースファイル232に対し、第6行に1行追加されている。ビルドファイル225には、ビルドファイル235に対する差分はない。部分ソースファイル221、222、224には、それぞれ、部分ソースファイル231、232、234に対する差分はない。
Of the partial source files included in the first whole source file 220, only “sub.c” 222 has a difference from the second whole source file 230. In the
第1の全体ソースファイル220に含まれる部分ソースファイルのうち、“main.c”221は、“sub.c”222の手続き、及び“com.h”224のマクロを呼び出す。この関係は、第1の全体ソースファイル220における関係を示せばよく、第2の全体ソースファイル230における関係は任意である。 Of the partial source files included in the first whole source file 220, “main.c” 221 calls the procedure “sub.c” 222 and the macro “com.h” 224. This relationship may indicate the relationship in the first entire source file 220, and the relationship in the second entire source file 230 is arbitrary.
第1の全体ソースファイル220に含まれる部分ソースファイルのうち、“sub.c”222は、“sub2.c”223の手続き、及び“com.h”224のマクロを呼び出す。この関係も、第1の全体ソースファイル220における関係を示せばよく、第2の全体ソースファイル230における関係は任意である。 Of the partial source files included in the first whole source file 220, “sub.c” 222 calls the procedure “sub2.c” 223 and the macro “com.h” 224. This relationship may also indicate the relationship in the first entire source file 220, and the relationship in the second entire source file 230 is arbitrary.
第1の全体ソースファイル220に含まれる部分ソースファイルのうち、“sub2.c”223は、他のソースファイルの手続き、及び“com.h”224のマクロの双方とも呼び出さない。この関係も、第1の全体ソースファイル220における関係を示せばよく、第2の全体ソースファイル230における関係は任意である。 Of the partial source files included in the first whole source file 220, “sub2.c” 223 does not call both the procedures of the other source files and the macro of “com.h” 224. This relationship may also indicate the relationship in the first entire source file 220, and the relationship in the second entire source file 230 is arbitrary.
図10は、本実施形態における静的検証システムの処理手順の別の具体例を説明するための図の前半部分である。 FIG. 10 is the first half of a diagram for explaining another specific example of the processing procedure of the static verification system in the present embodiment.
構成管理装置110は、第1の全体ソースファイル220における部分ソースファイル221−224及び第2の全体ソースファイル230における部分ソースファイル231−234からソース差分情報215を生成する(ステップS21)。
The
ソース差分情報215は、第1の全体ソースファイル220及び第2の全体ソースファイル230間における、部分ソースファイル毎の差分の有無を示す。“sub.c”にのみ2つの全体ソースファイルの間で差分が存在することを示す。
The
ソース差分情報225は、一般的な“diff”コマンドの実行結果の例である。第1の全体ソースファイル及び第2の全体ソースファイル間における部分ソースファイル及びビルドファイルのうち、部分ソースファイル“sub.c”222と部分ソースファイル“sub.c”232との間にのみ差分がある。そのため、ソース差分情報225には、部分ソースファイル222と部分ソースファイル232との間に差分がある旨と差分の内容が示される。本ソース差分情報225は、ソース差分情報215に示す内容に一致する。
The
影響分析装置130は、第1の全体ソースファイル220における、部分ソースファイル221−224及びビルドファイル225から、部分ソースファイル221−224間の依存関係を示す影響範囲情報415を生成する(ステップS22)。
The
影響範囲情報415は、4つの部分ソースファイル221−114間の依存関係に関する情報を持つ。影響範囲情報415が示すモジュール間の呼び出し関係は、図10の表に示すとおりである。影響範囲情報415は、モジュール間の直接及び間接のすべての呼び出し関係を含む呼び出し関係を示す。尚、あるモジュールからそのモジュール自身への呼び出しは、常に存在するものとみなす。
The influence range
部分ソースファイル“main.c”221は、関数“sub()”を介して部分ソースファイル“sub.c”222に依存し、関数“sub()”及び“sub2()”を介して部分ソースファイル“sub2.c”223に依存し、“include”行を介して部分ソースファイル“com.h”224に依存する。すなわち、部分ソースファイル“main.c221”は、部分ソースファイル“sub.c”222、部分ソースファイル“sub2.c”223、及び部分ソースファイル“com.h”224に直接的又は間接的に依存する。 The partial source file “main.c” 221 depends on the partial source file “sub.c” 222 via the function “sub ()”, and the partial source file via the functions “sub ()” and “sub2 ()”. Depends on the file “sub2.c” 223 and on the partial source file “com.h” 224 via the “include” line. That is, the partial source file “main.c221” is directly or indirectly dependent on the partial source file “sub.c” 222, the partial source file “sub2.c” 223, and the partial source file “com.h” 224. To do.
部分ソースファイル“sub.c”222は、関数“sub2()”を介して部分ソースファイル“sub2.c”223に依存し、“include”行を介して部分ソースファイル“com.h”224に依存する。すなわち、部分ソースファイル“sub.c”222は、部分ソースファイル“sub2.c”223、部分ソースファイル“com.h”224に直接的又は間接的に依存する。 The partial source file “sub.c” 222 depends on the partial source file “sub2.c” 223 via the function “sub2 ()”, and changes to the partial source file “com.h” 224 via the “include” line. Dependent. That is, the partial source file “sub.c” 222 depends directly or indirectly on the partial source file “sub2.c” 223 and the partial source file “com.h” 224.
部分ソースファイル“sub2.c”223、“com.h”224は、関数を介しても、“include”行を介しても、他の部分ソースファイルに依存しない。 The partial source files “sub2.c” 223 and “com.h” 224 do not depend on other partial source files, whether through functions or “include” lines.
影響範囲情報425は、4つの部分ソースファイル221−114間の直接の呼び出し関係のみを含む呼び出し関係を示す。部分ソースファイル“main.c”221は、関数“sub()”及び“sub2()”を介して部分ソースファイル“sub2.c”223に間接的に依存するが、直接的には依存しない。影響範囲情報425の依存構造マトリックスの2乗以上の冪乗は、影響範囲情報415の依存構造マトリックスに一致する。
The influence range
4つのモジュール間の直接的な依存関係は以下に示すとおりである。モジュール“1”は、モジュール“2”及びモジュール“4”に直接的に依存する。モジュール“2”は、モジュール“3”及びモジュール“4”に直接的に依存する。上記の場合、モジュール“1”は、モジュール“2”を介して、モジュール“3”に依存する。このことを依存構造マトリックスで表現すると、依存構造マトリックスのi行j列の成分aijは、
a12=a14=a23=a24=a11=a22=a33=a44=1
aij=“0”(上記以外のすべての要素)
である。
The direct dependencies between the four modules are as follows: Module “1” depends directly on module “2” and module “4”. Module “2” depends directly on module “3” and module “4”. In the above case, module “1” depends on module “3” via module “2”. If this is expressed by the dependency structure matrix, the component a ij of i rows and j columns of the dependency structure matrix is
a 12 = a 14 = a 23 = a 24 = a 11 = a 22 = a 33 = a 44 = 1
a ij = “0” (all elements other than the above)
It is.
上記の依存構造マトリックスを2乗して得られる間接依存構造マトリックスのi行j列の成分dijは、
dij=Σaim*amj(m=1,2,3,4)
=ai1*a1j+ai2*a2j+ai3*a3j+ai4*a4j
であるから、例えば、
d13=a11*a13+a12*a23+a13*a33+a14*a43
=1*0+1*1+0*1+1*0
=1
である。つまり、モジュール“1”は、モジュール“3”に間接的に依存する。本実施形態の場合は、モジュール“1”は、モジュール“2”に直接的に依存し、モジュール“2”は、モジュール“3”に直接的に依存するため、a12=a23=1となっている。そのため、モジュールの個数は4個であるが、依存構造マトリックスを2乗するだけで、モジュール“1”のモジュール“3”への間接的依存の有無が判明する。
A component d ij of i rows and j columns of the indirect dependency structure matrix obtained by squaring the dependency structure matrix is
d ij = Σa im * a mj (m = 1, 2, 3, 4)
= A i1 * a 1j + a i2 * a 2j + a i3 * a 3j + a i4 * a 4j
So, for example,
d 13 = a 11 * a 13 + a 12 * a 23 + a 13 * a 33 + a 14 * a 43
= 1 * 0 + 1 * 1 + 0 * 1 + 1 * 0
= 1
It is. That is, module “1” depends indirectly on module “3”. In the present embodiment, the module “1” directly depends on the module “2”, and the module “2” directly depends on the module “3”. Therefore, a 12 = a 23 = 1 It has become. Therefore, although the number of modules is four, the presence / absence of indirect dependence of module “1” on module “3” can be determined only by squaring the dependency structure matrix.
対象範囲生成手段145は、影響範囲情報415及びソース差分情報215に基づいて、第1の全体ソースファイル220における静的検証の対象モジュールを示す対象範囲情報515を生成する(ステップS24)。対象範囲情報515は、影響範囲情報415に対応する依存構造マトリックスに、ソース差分情報215に対応する変化ベクトルを乗算した結果である影響ベクトルに一致する。
Based on the
尚、影響範囲情報が、部分ソースファイル間の直接の呼び出し関係のみを含み、間接的な呼び出し関係を含まない場合には、対象範囲抽出手段145は、影響範囲情報425に対応する依存構造マトリックスの2乗以上の冪乗に、ソース差分情報215に対応する変化ベクトルを乗算することにより、対象範囲情報515に対応する影響ベクトルを生成してもよい。
When the influence range information includes only a direct call relationship between partial source files and does not include an indirect call relationship, the target
図11は、本実施形態における静的検証システムの処理手順の別の具体例を説明するための図の後半部分である。 FIG. 11 is the latter half of the diagram for explaining another specific example of the processing procedure of the static verification system in the present embodiment.
ビルド解析装置120は、第1の全体ソースファイル220におけるビルドファイル225から静的検証の実行条件を示す実行条件情報315を生成する(ステップS23)。ビルドファイル225の第2行には、“main.c”のコンパイルオプションとして、“−I./include”が含まれる。ビルドファイル225の第3行には、“sub.c”のコンパイルオプションとして、“−I./include”が含まれる。ビルドファイル225の第4行には、“sub2.c”のコンパイルオプションとして、有効なオプションは含まれない。前述のコンパイルオプション情報は、図11のビルド情報315に示した内容に含まれる。図11のビルド情報315において、“main.c”、“sub.c”のオプションであることは第5行に、“main.c”、“sub.c”のオプションの内容は第9行に、“sub2.c”のオプションであることは第25行に、“sub2.c”のオプションの内容は第29行に示される。尚、図11のビルド情報315において、ディレクトリは絶対パスで示されているが、相対パスに読み替え可能である。
The
コマンド生成装置400は、対象範囲情報515及び実行条件情報315に基づいて、静的検証コマンド520を生成する(ステップS25)。
The
実行条件情報310は、“main.c”221及び“sub.c”222のみが“com.h”225を呼び出すので、“main.c”及び“sub.c”のみが値“−I./include”(一般的なCコンパイラのコマンドラインオプション)を持つことを示す。尚、“−I./include”は、“com.h”の呼び出し先ディレクトリが“./include”であることを示す。
In the
コマンド生成装置400は、例えば、コマンド名を“tool”に指定し、対象範囲情報510により“main.c”及び“sub.c”を検証対象に指定する。そして、コマンド生成装置400は、実行条件情報310により“main.c”及び“sub.c”に対応するCコンパイラのコマンドラインオプション“−I./include”を検証条件に指定して、静的検証コマンド520を生成する。
For example, the
尚、上述の説明では、静的検証時オプションとして、ヘッダファイルを指定する“−I”オプションの例を示した。静的検証時オプションは、マクロを追加定義する“−D”オプション、又はマクロを未定義にする“−U”オプション、又は標準ヘッダファイルを検索しない“−nostdinc” オプション等を含んでもよい。 In the above description, an example of the “-I” option for specifying a header file is shown as an option at the time of static verification. The static verification option may include a “-D” option for additionally defining a macro, a “-U” option for undefining a macro, or a “-nostdinc” option for not searching a standard header file.
静的検証装置500は、対象範囲情報と実行条件情報とが指定された静的検証コマンド520を実行し、検証結果530を生成する(ステップS26)。
The
第1の全体ソースファイルに対する静的検証が行われる以前に、第2の全体ソースファイルに対する静的検証が行われるものとする。第2の全体ソースファイルと第1の全体ソースファイルと間で差分があるモジュール“sub.c”については、第1の全体ソースファイルにおいて、静的検証が必要である。 It is assumed that the static verification is performed on the second entire source file before the static verification is performed on the first entire source file. For the module “sub.c” having a difference between the second entire source file and the first entire source file, static verification is required in the first entire source file.
一方、第2の全体ソースファイルと第1の全体ソースファイルと間で差分がないモジュール“main.c”については、“main.c”は“sub.c”を呼び出すので、“sub.c”の動作の変化により、動作が変わる可能性がある。そのため、“main.c”については、第2の全体ソースファイルと第1の全体ソースファイルと間で差分はないが、改めて静的検証することが必要である。第2の全体ソースファイルと第1の全体ソースファイルと間で差分がないモジュール“sub2.c”、“com.h”は、他の部分ソースファイルを呼び出さないので、改めての静的検証は必要ない。対象範囲抽出装置190は、静的検証の対象範囲として、“main.c”と“sub.c”の両方を抽出する。従って、検証結果530には、静的検証の対象として指定された、第1の全体ソースコード及び第2の全体ソースコード間で差分の無い部分ソースファイル“main.c”と、第1の全体ソースコード及び第2の全体ソースコード間で差分のある部分ソースファイル“sub.c”に関する指摘事項が含まれる。
On the other hand, for the module “main.c” in which there is no difference between the second entire source file and the first entire source file, “main.c” calls “sub.c”, so “sub.c”. The operation may change due to the change in the operation. Therefore, for “main.c”, there is no difference between the second whole source file and the first whole source file, but it is necessary to perform static verification again. Modules “sub2.c” and “com.h” that do not differ between the second whole source file and the first whole source file do not call other partial source files, so a static verification is necessary again. Absent. The target
以上説明したように、本実施形態における対象範囲抽出装置190では、2つの全体ソースファイル間で差分がないソースファイル(例えば、”main.c”)についても、別のソースファイル(例えば、”sub.c”)の差分により差分の影響が及ぶならば、静的検証の対象に指定する。従って、本実施形態における対象範囲抽出装置190は、静的検証において、2つの全体ソースファイル間の差分に起因して指摘することが必要になる事項に関し、2つの全体ソースファイル間で差分があるモジュール以外についても必要な指摘事項を表示することができる。
As described above, in the target
第1及び第2の実施形態では、対象範囲抽出装置が、独立した装置である場合について説明した。しかしながら、本発明の対象範囲抽出装置は、必ずしも独立した装置である必要はない。すなわち、構成管理装置110、影響分析装置130、ビルド解析装置120、静的検証装置500、又は静的検証装置のうちの1台以上、及び対象範囲抽出装置が、1台の装置に統合されてもよい。
In the first and second embodiments, the case where the target range extraction device is an independent device has been described. However, the target range extraction device of the present invention is not necessarily an independent device. That is, one or more of the
尚、図3の対象範囲抽出装置の各処理は、ソフトウェアによって実行されてもよい。すなわち、各処理を行うためのコンピュータプログラムが、対象範囲抽出装置が備えるCPU(図2:903)によって読み込まれ、実行されてもよい。プログラムを用いて各処理を行っても、上述の実施形態の処理と同内容の処理を行うことができる。そして、上記のプログラムは、ROM(Read Only Memory)、RAM(Random Access Memory)、フラッシュメモリ等の半導体記憶装置、光ディスク、磁気ディスク、光磁気ディスク等、非一時的な媒体に格納されてもよい。 Each process of the target range extraction device in FIG. 3 may be executed by software. That is, a computer program for performing each process may be read and executed by a CPU (FIG. 2: 903) provided in the target range extraction device. Even if each process is performed using a program, the same process as the process of the above-described embodiment can be performed. The above program may be stored in a non-transitory medium such as a ROM (Read Only Memory), a RAM (Random Access Memory), a semiconductor memory device such as a flash memory, an optical disk, a magnetic disk, or a magneto-optical disk. .
あるいは、各処理は、個別の回路等の構成要素によって実行されてもよい。 Alternatively, each process may be executed by a component such as an individual circuit.
尚、本願発明は、上述の実施形態に限定されるものではなく、本願発明の要旨を逸脱しない範囲で種々変更、変形して実施することができる。 In addition, this invention is not limited to the above-mentioned embodiment, It can implement in various changes and deformation | transformation in the range which does not deviate from the summary of this invention.
Claims (8)
を備えることを特徴とする対象範囲抽出装置。 Dependency information indicating mutual dependency among a plurality of first modules included in the first overall source file, and a name common to a second module of the plurality of first modules, And a difference that indicates whether or not there is a difference between the third module and the second module included in the entire second source file, and a difference in definition may be generated by the difference in the second module. Target range generation means for generating target range information for limiting the module of
A target range extracting apparatus comprising:
前記対象範囲生成手段は、前記依存関係情報である依存構造マトリックスに、前記差分情報である変化ベクトルを乗じることにより、前記対象範囲情報である影響ベクトルを生成する
ことを特徴とする請求項1に記載の対象範囲抽出装置。 The dependency information includes all information indicating direct and indirect dependency relationships between the plurality of first modules,
The target range generation unit generates the influence vector as the target range information by multiplying the dependency structure matrix as the dependency relationship information by a change vector as the difference information. The target range extraction device described.
前記対象範囲生成手段は、前記直接依存関係情報である依存構造マトリックスの2乃至(m−1)乗(mは前記第1のモジュールの個数)に、前記差分情報である変化ベクトルを乗じることにより、前記対象範囲情報である影響ベクトルを生成する
ことを特徴とする請求項1に記載の対象範囲抽出装置。 The dependency relationship information includes all direct dependency relationship information indicating a direct dependency relationship between the plurality of first modules, and includes indirect dependency relationship information indicating an indirect dependency relationship between the plurality of first modules. not included,
The target range generation means multiplies the dependency structure matrix, which is the direct dependency relationship information, to the 2nd to (m-1) th power (m is the number of the first modules) by the change vector, which is the difference information. The target range extraction apparatus according to claim 1, wherein an influence vector that is the target range information is generated.
ことを特徴とする請求項1乃至3のいずれか1項に記載の対象範囲抽出装置。 4. The target range extracting apparatus according to claim 1, wherein the module is a file, and the difference is a difference in contents of the file. 5.
ことを特徴とする請求項1乃至3のいずれか1項に記載の対象範囲抽出装置。 4. The target range extracting apparatus according to claim 1, wherein the module is a procedure in a procedural programming language, and the difference is a difference in code of the procedure.
前記複数の第1のモジュールの相互の依存関係を示す依存関係情報を生成する影響分析装置と、
前記第1の全体ソースファイルに含まれるビルドファイルから静的検証の実行条件を示す実行条件情報を生成するビルド解析装置と、
前記依存関係情報と、前記差分情報とに基づいて、前記第2のモジュールのうちの前記差分により定義の差分を生じうる第4のモジュールを限定する対象範囲情報を生成する対象範囲生成手段を含む対象範囲抽出装置と、
前記対象範囲情報及び前記実行条件情報に基づいて前記静的検証のためのコマンドを生成するコマンド生成装置と、
前記コマンドを実行する静的検証装置と、
を備えることを特徴とする静的検証システム。 Included in a first overall source file including a plurality of first modules and a second overall source file including a third module having a common name with a second module of the plurality of first modules A configuration management device that holds a partial source file and a build file, and generates difference information indicating whether there is a difference between the third module and the second module;
An impact analysis device that generates dependency information indicating mutual dependency among the plurality of first modules;
A build analysis device that generates execution condition information indicating an execution condition of static verification from a build file included in the first entire source file;
Including target range generation means for generating target range information for limiting a fourth module that can cause a difference in definition by the difference among the second modules based on the dependency relationship information and the difference information. A target range extraction device;
A command generation device for generating a command for the static verification based on the target range information and the execution condition information;
A static verification device for executing the command;
A static verification system comprising:
ことを特徴とする対象範囲抽出方法。 Dependency information indicating mutual dependency among a plurality of first modules included in the first overall source file, and a name common to a second module of the plurality of first modules, And a difference that indicates whether or not there is a difference between the third module and the second module included in the entire second source file, and a difference in definition may be generated by the difference in the second module. A target range extraction method characterized by limiting the number of modules.
第1の全体ソースファイルに含まれる複数の第1のモジュールの相互の依存関係を示す依存関係情報と、前記複数の第1のモジュールのうちの第2のモジュールと共通の名称を有し、第2の全体ソースファイルに含まれる第3のモジュールと前記第2のモジュールの差分の有無を示す差分情報とに基づいて、前記第2のモジュールのうちの前記差分により定義の差分を生じうる第4のモジュールを限定する対象範囲情報を生成する対象範囲生成手段と
して機能させるための対象範囲抽出プログラム。 A computer included in the target range extraction device,
Dependency information indicating mutual dependency among a plurality of first modules included in the first overall source file, and a name common to a second module of the plurality of first modules, And a difference that indicates whether or not there is a difference between the third module and the second module included in the entire second source file, and a difference in definition may be generated by the difference in the second module. A target range extraction program for functioning as target range generation means for generating target range information for limiting the modules.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2013201991A JP2015069332A (en) | 2013-09-27 | 2013-09-27 | Object range extractor, static verification system, object range extraction method, and object range extraction program for extracting object range to be subjected to static verification by static verification device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2013201991A JP2015069332A (en) | 2013-09-27 | 2013-09-27 | Object range extractor, static verification system, object range extraction method, and object range extraction program for extracting object range to be subjected to static verification by static verification device |
Publications (1)
Publication Number | Publication Date |
---|---|
JP2015069332A true JP2015069332A (en) | 2015-04-13 |
Family
ID=52835953
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2013201991A Pending JP2015069332A (en) | 2013-09-27 | 2013-09-27 | Object range extractor, static verification system, object range extraction method, and object range extraction program for extracting object range to be subjected to static verification by static verification device |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP2015069332A (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110286934A (en) * | 2019-06-30 | 2019-09-27 | 潍柴动力股份有限公司 | A kind of inspection method and device of static code |
US10606571B2 (en) | 2016-04-26 | 2020-03-31 | Mitsubishi Electric Corporation | Dependence relationship extraction apparatus and computer readable medium |
-
2013
- 2013-09-27 JP JP2013201991A patent/JP2015069332A/en active Pending
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US10606571B2 (en) | 2016-04-26 | 2020-03-31 | Mitsubishi Electric Corporation | Dependence relationship extraction apparatus and computer readable medium |
CN110286934A (en) * | 2019-06-30 | 2019-09-27 | 潍柴动力股份有限公司 | A kind of inspection method and device of static code |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
WO2018228211A1 (en) | Application conversion method, apparatus and device | |
CN109901834B (en) | Document page generation method, device, computer equipment and storage medium | |
US10649836B2 (en) | Detecting an error message and automatically presenting links to relevant solution pages | |
CN110502520B (en) | Method, system and equipment for data warehousing and computer readable storage medium | |
CN108415826B (en) | Application testing method, terminal device and computer readable storage medium | |
CN107038060B (en) | Debugging method and device for page shader codes | |
US20150089415A1 (en) | Method of processing big data, apparatus performing the same and storage media storing the same | |
CN104375858A (en) | Method and device for multiple browser platforms to execute javascript | |
US20190087160A1 (en) | System and method for creating domain specific language | |
US11615016B2 (en) | System and method for executing a test case | |
CA2949210C (en) | Tabular format transaction editor | |
JP5440287B2 (en) | Symbolic execution support program, method and apparatus | |
JP2015069332A (en) | Object range extractor, static verification system, object range extraction method, and object range extraction program for extracting object range to be subjected to static verification by static verification device | |
CN111026604B (en) | Log file analysis method and device | |
JP5163172B2 (en) | Software test item editing support apparatus and software test item editing support method | |
CN110515653B (en) | Document generation method and device, electronic equipment and computer readable storage medium | |
US7849404B2 (en) | System for determining whether screen displayed by program satisfies specification | |
JP2007080049A (en) | Built-in program generation method, built-in program development system and information table section | |
CN112988298A (en) | Visual interface configuration method and device, computer equipment and storage medium | |
KR20220067011A (en) | Method for generating vulnerability identification code of binary, and apparatus implementing the same method | |
JP5702265B2 (en) | Program automatic generation apparatus and program automatic generation method | |
Zhou | An observer-based technique with trace links for requirements validation in embedded real-time systems | |
US11960560B1 (en) | Methods for analyzing recurring accessibility issues with dynamic web site behavior and devices thereof | |
JP2014232428A (en) | Test execution assisting device, test system, test execution method, and test execution assisting program | |
JP7322964B2 (en) | Test information extraction device, test information extraction method and program |