JP2010102663A - Device, method and program for analyzing program - Google Patents
Device, method and program for analyzing program Download PDFInfo
- Publication number
- JP2010102663A JP2010102663A JP2008276019A JP2008276019A JP2010102663A JP 2010102663 A JP2010102663 A JP 2010102663A JP 2008276019 A JP2008276019 A JP 2008276019A JP 2008276019 A JP2008276019 A JP 2008276019A JP 2010102663 A JP2010102663 A JP 2010102663A
- Authority
- JP
- Japan
- Prior art keywords
- subroutine
- procedure
- call
- trace
- program
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Abstract
Description
本発明は、業務システム等のプログラムの保守や再構築に際し、プログラム内容の解析を容易に行うことができるプログラム解析装置およびプログラム解析方法並びにプログラム解析用プログラムに関する。 The present invention relates to a program analysis apparatus, a program analysis method, and a program analysis program that can easily analyze program contents when maintaining or reconstructing a program such as a business system.
業務システム等のプログラムの保守や再構築を効率的に行うためには、プログラムのデータ構造や制御構造を理解する必要がある。しかし、プログラムが大規模でなおかつ修正が頻繁に行われる場合には、データ構造や処理構造が容易には理解できない程にまで複雑化してしまうことが多い。また、プログラムの運用・保守が長期に渡ると、当初の開発者が不在となる場合や、ドキュメントがプログラムの変更内容と同期していない場合が多い。そこで、プログラムソースコードを解析し、サブルーチンなどのプログラム要素単位で相互の呼び出し関係を図式化して提示するプログラム解析技術が用いられてきた。 In order to efficiently maintain and reconstruct a program such as a business system, it is necessary to understand the data structure and control structure of the program. However, when the program is large and the correction is frequently performed, the data structure and the processing structure often become so complex that they cannot be easily understood. In addition, when a program is operated and maintained for a long period of time, there are many cases where the original developer is absent or the document is not synchronized with the change contents of the program. In view of this, a program analysis technique has been used in which a program source code is analyzed and a mutual call relationship is graphically presented in units of program elements such as subroutines.
この種のプログラム解析装置の一例が、特許文献1に記載されている。この特許文献1記載の装置は、図9に示すように、プログラムを解析し、実行経路を分析する実行経路分析部5と、分析されたプログラムの中から実行経路にサブルーチンを含む条件分岐文の条件変数およびそのサブルーチンの呼出し先変数を検出する変数値取得部12と、検出された変数について、変数検出箇所からプログラムの実行経路を順次遡り、変数の代入元の定数を探索し確定する変数値確定処理部7と、確定された変数値を基に条件分岐文の分岐箇所を限定し、限定した経路から呼出し先が確定したサブルーチンを抽出する実行経路限定部6とを備え、抽出したサブルーチンを基に予め指定されたプログラムの構成図を生成出力する。
ところで、プログラム解析においては、設計書が完備していないプログラムを保守するとき、保守対象の機能がプログラム内のどのサブルーチンによって実現されているかを特定し、それらサブルーチンがどのように相互作用しているかを調べる必要がある。このとき、上述した特許文献1に記載のプログラム解析技術には次の課題がある。すなわち、プログラムの規模が大きい場合に、サブルーチンの呼出し関係図の中でどこを最初に参照するとよいのかが容易に見出すことができない。その理由は、呼出し関係図には機能との関連を示す情報が含まれていないため、ひとつずつサブルーチンの内容を確認する必要があるためである。 By the way, in program analysis, when maintaining a program that does not have a complete design document, specify which subroutine in the program realizes the function to be maintained, and how these subroutines interact. Need to look into. At this time, the program analysis technique described in Patent Document 1 described above has the following problems. That is, when the scale of the program is large, it is not easy to find out where to refer first in the subroutine call relationship diagram. The reason is that since the call relationship diagram does not include information indicating the relationship with the function, it is necessary to check the contents of the subroutine one by one.
本発明は、このような事情に鑑みてなされたもので、その目的は、調べようとするプログラム機能の開始に関与するサブルーチンを、呼出し関係図中に存在する多数のサブルーチンの中から容易に特定することができるプログラム解析装置およびプログラム解析方法並びにプログラム解析用プログラムを提供することにある。 The present invention has been made in view of such circumstances, and its purpose is to easily identify the subroutine involved in the start of the program function to be examined from among the many subroutines existing in the call relationship diagram. Another object of the present invention is to provide a program analysis apparatus, a program analysis method, and a program analysis program that can be used.
本発明は、調査対象機能を使う第一の手順と、前記調査対象機能を使わない第二の手順とをそれぞれ実行して第一の実行トレースと第二の実行トレースとをそれぞれ取得するトレース取得手段と、前記第一の実行トレースと前記第二の実行トレースとを時系列順に比較し、最初に差異が発生するトレース個所に相当するサブルーチン呼び出しまたはサブルーチン復帰を検出する検出手段とを具備することを特徴とするプログラム解析装置である。 The present invention acquires a first execution trace and a second execution trace by executing a first procedure that uses the investigation target function and a second procedure that does not use the investigation target function, respectively. And means for comparing the first execution trace and the second execution trace in chronological order, and detecting a subroutine call or subroutine return corresponding to the trace location where the difference first occurs. Is a program analysis apparatus characterized by
また、本発明は 調査対象機能を使う第一の手順と、前記調査対象機能を使わない第二の手順とが準備され、前記第一の手順と前記第二の手順とをそれぞれ実行して第一の実行トレースと第二の実行トレースとをそれぞれ取得するトレース取得処理と、前記第一の実行トレースと前記第二の実行トレースとを時系列順に比較し、最初に差異が発生するトレース個所に相当するサブルーチン呼び出しまたはサブルーチン復帰を検出する検出処理とを有することを特徴とするプログラム解析方法である。 In the present invention, a first procedure that uses the survey target function and a second procedure that does not use the survey target function are prepared, and the first procedure and the second procedure are executed respectively. The trace acquisition process for acquiring each of the first execution trace and the second execution trace, the first execution trace and the second execution trace are compared in chronological order, and the first trace where the difference occurs is determined. And a detection process for detecting a subroutine call or a subroutine return.
また、本発明は、調査対象機能を使う第一の手順と、前記調査対象機能を使わない第二の手順とが準備され、前記第一の手順と前記第二の手順とをそれぞれ実行して第一の実行トレースと第二の実行トレースとをそれぞれ取得するトレース取得処理と、前記第一の実行トレースと前記第二の実行トレースとを時系列順に比較し、最初に差異が発生するトレース個所に相当するサブルーチン呼び出しまたはサブルーチン復帰を検出する検出処理とをコンピュータに実行させるためのプログラム解析用プログラムである。 In the present invention, a first procedure that uses the survey target function and a second procedure that does not use the survey target function are prepared, and the first procedure and the second procedure are executed respectively. Trace acquisition processing for acquiring the first execution trace and the second execution trace respectively, the first execution trace and the second execution trace are compared in chronological order, and the trace portion where the difference first occurs Is a program analysis program for causing a computer to execute a detection process for detecting a subroutine call or a subroutine return.
本発明によれば、保守対象のプログラム機能について調べるときに、第一の実行トレースと第二の実行トレースとを時系列順に比較し、最初に差異が発生するトレース個所に相当するサブルーチン呼び出しまたはサブルーチン復帰を検出するようにしたので、最初に調べるべきサブルーチンを多数のサブルーチンの中から容易に見出すことができる効果がある。 According to the present invention, when the program function to be maintained is examined, the first execution trace and the second execution trace are compared in time series order, and the subroutine call or subroutine corresponding to the trace location where the difference first occurs. Since the return is detected, there is an effect that the subroutine to be checked first can be easily found out of a large number of subroutines.
以下、図面を参照し、本発明の実施形態について説明する。
図1は本発明の一実施形態によるプログラム解析装置の構成を示すブロック図である。実施形態によるプログラム解析装置は、プログラム制御により動作するコンピュータ(中央処理装置;プロセッサ;データ処理装置)100と、記憶装置200から構成されている。コンピュータ100は、対照トレース取得手段110と、サブルーチン選択手段120と、解析対象プログラム130とを含む。
Hereinafter, embodiments of the present invention will be described with reference to the drawings.
FIG. 1 is a block diagram showing the configuration of a program analysis apparatus according to an embodiment of the present invention. The program analysis apparatus according to the embodiment includes a computer (central processing unit; processor; data processing unit) 100 that operates under program control, and a
対照トレース取得手段110は、あらかじめ準備された、調査対象機能を使う第1の手順と、調査対象機能を使わないように変更した第2の手順とを解析対象プログラム130に対してそれぞれ実行して第1の実行トレースと第2の実行トレースとをそれぞれ取得する(トレース取得処理)。ここで、トレースとは、プログラムの実行中に発生するサブルーチン呼び出しおよびサブルーチン復帰の系列である。
The control
図2に、第1の手順と第2の手順の例を示す。例1では、第1の手順に調査対象機能1が含まれ、また、第1の手順から調査対象の機能1を除去したものが第2の手順である。例2のように機能2の操作手順からオプション設定を外すという変更も想定する。
また、対照トレース取得手段110は、第1の実行トレースと第2の実行トレースを比較し、最初に差異が発生するトレース箇所に相当するサブルーチン呼び出しまたはサブルーチン復帰を検出する(検出処理)。
FIG. 2 shows an example of the first procedure and the second procedure. In Example 1, the investigation target function 1 is included in the first procedure, and the second procedure is obtained by removing the investigation target function 1 from the first procedure. Assume that the option setting is removed from the operation procedure of
Further, the control
サブルーチン選択手段120は、対照トレース取得手段110が検出したサブルーチン呼び出しまたはサブルーチン復帰に相当するサブルーチン呼出しに対応するサブルーチン呼出しを、あらかじめ準備された呼び出し関係図中で選択する(選択処理)。 The subroutine selection means 120 selects a subroutine call corresponding to the subroutine call detected by the control trace acquisition means 110 or the subroutine return in the call relationship diagram prepared in advance (selection process).
次に、図3のフローチャートを参照して本実施形態の全体の動作について詳細に説明する。
まず、第1の手順を実行する(図3のステップS110)。次に、第1の手順の実行についての実行トレースを第1の実行トレースとして取得する(ステップS120)。次に、第2の手順を実行する(ステップS130)。次に、第2の手順の実行についての実行トレースを第2の実行トレースとして取得する(ステップS140)。次に、第1の実行トレースと第2の実行トレースを比較し、最初に差異が発生するサブルーチン呼び出しまたはサブルーチン復帰を検出する(ステップS150)。最後に、ステップS160において抽出したサブルーチン呼出しまたはサブルーチン復帰に相当するサブルーチン呼出しを呼び出し関係図中で選択する。すなわち、ステップS160では、サブルーチンをノードとしサブルーチン間の呼出し関係をエッジとするグラフ構造からなる呼出し関係図が準備され、検出されたサブルーチン呼出しまたはサブルーチン復帰に対応する、呼び出し関係図中のサブルーチン呼出しエッジを選択する。
Next, the overall operation of this embodiment will be described in detail with reference to the flowchart of FIG.
First, the first procedure is executed (step S110 in FIG. 3). Next, an execution trace for the execution of the first procedure is acquired as the first execution trace (step S120). Next, the second procedure is executed (step S130). Next, an execution trace for the execution of the second procedure is acquired as a second execution trace (step S140). Next, the first execution trace and the second execution trace are compared, and a subroutine call or subroutine return in which a difference first occurs is detected (step S150). Finally, the subroutine call corresponding to the subroutine call or subroutine return extracted in step S160 is selected in the call relationship diagram. That is, in step S160, a call relationship diagram having a graph structure with a subroutine as a node and a call relationship between subroutines as an edge is prepared, and the subroutine call edge in the call relationship diagram corresponding to the detected subroutine call or subroutine return is prepared. Select.
上述した実施形態によれば、調査対象の機能を実行する場合とそうでない場合の二つの実行トレースの比較に基づいて、該機能の開始に関与するサブルーチン呼出しを呼び出し関係図中に示すように構成されているため、保守対象の機能について調べたい場合に、調べるべきサブルーチンを容易に見出すことができる。
(実施例)
According to the above-described embodiment, the subroutine call related to the start of the function is shown in the call relation diagram based on the comparison of the two execution traces when the function to be investigated is executed and when it is not. Therefore, when it is desired to check the function to be maintained, the subroutine to be checked can be easily found.
(Example)
次に、具体的な実施例を用いて上記実施形態の動作を説明する。
図4に示すような画面操作を受け付けるGUIプログラムを解析対象のプログラムとして動作を説明する。このプログラムは、main.exeというコマンドの発行により起動し、最初にログイン画面が表示され、ログイン画面でログイン操作を行った後に幾つかの操作を経て操作画面1が表示され、操作画面1においてパラメータを入力し処理Aのボタンを押すと、入力待ち状態1となるものである。
Next, the operation of the above embodiment will be described using specific examples.
The operation will be described with a GUI program that accepts a screen operation as shown in FIG. 4 as a program to be analyzed. This program is started by issuing the command main.exe, the login screen is displayed first, and after performing login operations on the login screen, the operation screen 1 is displayed through several operations. Is input and the process A button is pressed, the input waiting state 1 is entered.
図5には、対照トレース取得手段110があらかじめ保持する第1の手順と第2の手順を示した。調査対象の機能は、操作画面1における処理Aボタンの実行におけるオプション1であるとする。第1の手順と第2の手順の共通な手順は、main.exeコマンドの発行から操作画面1の表示に至るまでの操作手順である。第1の手順は共通な手順に引き続いて、操作画面においてパラメータ1に"aaa"をパラメータ2に"ccc"をパラメータ3に「有り」を設定して処理Aボタンを押すという操作手順を保持する。第2の手順は共通な手順に引き続いて、操作画面においてパラメータ1に"aaa"をパラメータ2に"ccc"をパラメータ3に「無し」を設定して処理Aボタンを押すという操作手順を保持する。つまり操作画面1のままとどまるものとする。
FIG. 5 shows a first procedure and a second procedure that the control
なお、調査対象の機能としてここではオプションの有無を扱ったが、一般には実行するボタンの種類の違いや、パラメータの値の違いを調査対象として操作手順を構成しても良い。 Here, the presence or absence of an option is dealt with here as a function to be investigated. However, in general, an operation procedure may be configured by examining differences in the types of buttons to be executed or differences in parameter values.
対照トレース取得手段110は、初期化手順と第1の手順の操作を順次実行しその間の実行トレースを第1の実行トレースとして取得する。次に、初期化手順と第2の手順の操作を順次実行し第2の実行トレースとして取得する。トレース取得の対象となるプログラムの構造を図6に示す。ここで、図4の画面において処理Aボタンを押したときにプログラム内部ではサブルーチン1が呼び出されるものとする。そして、オプション1が「無し」に設定されている場合はサブルーチン1においてサブルーチン2のみが呼び出され、オプション1が「有り」に設定されている場合はサブルーチン1においてサブルーチン2のあとにサブルーチン3が呼び出されるものとする。このとき、第1の実行トレース、第2の実行トレースは図7のようになる。
The control
サブルーチン選択手段120は、図7に示す第1の実行トレースと第2の実行トレースを時系列順に比較し、差異を検出する。第1の実行トレースの側だけに、サブルーチン3の呼出しから復帰までの記録が余分に存在する。差異の最初の記録は「サブルーチン3呼出し」である。このサブルーチン3呼出しは、図6の呼び出し関係図中においてサブルーチン1からサブルーチン3への矢に相当する。相当する矢を選択した結果を図8に示す。なお、差異の先頭部分がサブルーチン復帰である場合は、そのサブルーチン開始に関するサブルーチン呼出しを選択する。
Subroutine selection means 120 compares the first execution trace and the second execution trace shown in FIG. 7 in chronological order, and detects a difference. Only on the side of the first execution trace, there is an extra record from the
このように、実施形態によれば、第1の実行トレースと第2の実行トレースを時系列順に比較し、差異を検出することによって、調査対象機能(上記実施例では「オプション1有り」)に係るサブルーチン3の呼び出しを容易に検出することができる。
As described above, according to the embodiment, the first execution trace and the second execution trace are compared in time series order, and the difference is detected, so that the function to be investigated (“option 1 is present” in the above embodiment) is obtained. Such a call of the
本発明は、プログラムの保守や再構築におけるプログラム内容の解析に用いて好適である。 The present invention is suitable for use in analyzing program contents during program maintenance and reconstruction.
100…コンピュータ
110…対象トレース取得手段
120…サブルーチン選択手段
130…解析対象プログラム
200…記憶装置
DESCRIPTION OF
Claims (6)
前記第一の実行トレースと前記第二の実行トレースとを時系列順に比較し、最初に差異が発生するトレース個所に相当するサブルーチン呼び出しまたはサブルーチン復帰を検出する検出手段と、
を具備することを特徴とするプログラム解析装置。 Trace acquisition means for acquiring the first execution trace and the second execution trace by executing the first procedure using the investigation target function and the second procedure not using the investigation target function, respectively.
Detecting means for comparing the first execution trace and the second execution trace in chronological order, and detecting a subroutine call or a subroutine return corresponding to a trace portion where a difference first occurs;
A program analysis apparatus comprising:
前記第一の手順と前記第二の手順とをそれぞれ実行して第一の実行トレースと第二の実行トレースとをそれぞれ取得するトレース取得処理と、
前記第一の実行トレースと前記第二の実行トレースとを時系列順に比較し、最初に差異が発生するトレース個所に相当するサブルーチン呼び出しまたはサブルーチン復帰を検出する検出処理と、
を有することを特徴とするプログラム解析方法。 A first procedure using the survey target function and a second procedure not using the survey target function are prepared,
Trace acquisition processing for acquiring the first execution trace and the second execution trace by executing the first procedure and the second procedure, respectively,
A detection process for comparing the first execution trace and the second execution trace in chronological order, and detecting a subroutine call or a subroutine return corresponding to a trace location where a difference first occurs;
The program analysis method characterized by having.
前記検出処理おいて検出されたサブルーチン呼出しまたはサブルーチン復帰に対応する、呼び出し関係図中のサブルーチン呼出しエッジを選択する選択処理を有することを特徴とする請求項3に記載のプログラム解析方法。 A call relationship diagram consisting of a graph structure with a subroutine as a node and a call relationship between subroutines as an edge is prepared,
4. The program analysis method according to claim 3, further comprising a selection process for selecting a subroutine call edge in a call relation diagram corresponding to the subroutine call or subroutine return detected in the detection process.
前記第一の手順と前記第二の手順とをそれぞれ実行して第一の実行トレースと第二の実行トレースとをそれぞれ取得するトレース取得処理と、
前記第一の実行トレースと前記第二の実行トレースとを時系列順に比較し、最初に差異が発生するトレース個所に相当するサブルーチン呼び出しまたはサブルーチン復帰を検出する検出処理と、
をコンピュータに実行させるためのプログラム解析用プログラム。 A first procedure using the survey target function and a second procedure not using the survey target function are prepared,
Trace acquisition processing for acquiring the first execution trace and the second execution trace by executing the first procedure and the second procedure, respectively,
A detection process for comparing the first execution trace and the second execution trace in chronological order, and detecting a subroutine call or a subroutine return corresponding to a trace location where a difference first occurs;
A program analysis program that causes a computer to execute.
前記検出処理おいて検出されたサブルーチン呼出しまたはサブルーチン復帰に対応する、呼び出し関係図中のサブルーチン呼出しエッジを選択する選択処理をコンピュータに実行させることを特徴とする請求項5記載のプログラム解析用プログラム。
A call relationship diagram consisting of a graph structure with a subroutine as a node and a call relationship between subroutines as an edge is prepared,
6. The program analysis program according to claim 5, wherein the computer executes a selection process for selecting a subroutine call edge in a call relation diagram corresponding to the subroutine call or subroutine return detected in the detection process.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2008276019A JP2010102663A (en) | 2008-10-27 | 2008-10-27 | Device, method and program for analyzing program |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2008276019A JP2010102663A (en) | 2008-10-27 | 2008-10-27 | Device, method and program for analyzing program |
Publications (1)
Publication Number | Publication Date |
---|---|
JP2010102663A true JP2010102663A (en) | 2010-05-06 |
Family
ID=42293232
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2008276019A Pending JP2010102663A (en) | 2008-10-27 | 2008-10-27 | Device, method and program for analyzing program |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP2010102663A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2012155680A (en) * | 2011-01-28 | 2012-08-16 | Fujitsu Ltd | Computer program, program analysis method, and program analysis apparatus |
-
2008
- 2008-10-27 JP JP2008276019A patent/JP2010102663A/en active Pending
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2012155680A (en) * | 2011-01-28 | 2012-08-16 | Fujitsu Ltd | Computer program, program analysis method, and program analysis apparatus |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US9298598B2 (en) | Automated visual testing | |
US8793578B2 (en) | Automating execution of arbitrary graphical interface applications | |
US20180060222A1 (en) | Building signatures of application flows | |
JP4395761B2 (en) | Program test support apparatus and method | |
US20110154300A1 (en) | Debugging From A Call Graph | |
JP5556655B2 (en) | Analysis support program, analysis support apparatus, and analysis support method | |
EP2932393B1 (en) | Automated correlation and analysis of callstack and context data | |
US9690682B2 (en) | Program information generating system, method, and computer program product | |
US9262125B2 (en) | Contextual focus-agnostic parsing-validated alternatives information | |
JP3888389B2 (en) | Chromatographic data processing apparatus, chromatographic data processing method, and chromatographic analyzer | |
Calpur et al. | Model dressing for automated exploratory testing | |
JP6559600B2 (en) | Information processing apparatus, information processing program, and inspection system | |
JP6020383B2 (en) | Display / execution auxiliary program | |
JP6440895B2 (en) | Software analysis apparatus and software analysis method | |
JP3807306B2 (en) | Chromatographic data processing apparatus, chromatographic data processing method, and chromatographic analyzer | |
JP2010122959A (en) | Test support system, method, and program | |
KR101796009B1 (en) | Program automatic analysis system and automatic analysis method using the same | |
JP2010102620A (en) | User operation scenario generating device, method and program | |
JP2007155687A (en) | Data processor for measuring device | |
JP2010102663A (en) | Device, method and program for analyzing program | |
Koutsopoulos et al. | Advancing data race investigation and classification through visualization | |
JP4888663B2 (en) | Verification program automatic generation apparatus, method and program thereof | |
JP6068639B2 (en) | User interface inspection method, apparatus, and program | |
CN113326193A (en) | Applet testing method and device | |
JP5733269B2 (en) | Method for supporting program generation and apparatus for supporting program generation |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
RD04 | Notification of resignation of power of attorney |
Free format text: JAPANESE INTERMEDIATE CODE: A7424 Effective date: 20100709 |