JPH01154256A - Detecting method for program error position - Google Patents

Detecting method for program error position

Info

Publication number
JPH01154256A
JPH01154256A JP62311967A JP31196787A JPH01154256A JP H01154256 A JPH01154256 A JP H01154256A JP 62311967 A JP62311967 A JP 62311967A JP 31196787 A JP31196787 A JP 31196787A JP H01154256 A JPH01154256 A JP H01154256A
Authority
JP
Japan
Prior art keywords
program
execution
test data
source program
executing instruction
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
Application number
JP62311967A
Other languages
Japanese (ja)
Inventor
Makoto Hiramoto
誠 平本
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.)
Hitachi Ltd
Original Assignee
Hitachi Ltd
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 Hitachi Ltd filed Critical Hitachi Ltd
Priority to JP62311967A priority Critical patent/JPH01154256A/en
Publication of JPH01154256A publication Critical patent/JPH01154256A/en
Pending legal-status Critical Current

Links

Abstract

PURPOSE:To specify an error position in a common executing instruction by simulating a program at a source program level and extracting the difference from the expected value as a discordance test data group. CONSTITUTION:A source program 1 is read into a language analyzing part 3a for analysis of words/phrases and syntax structures. Then a directed graph structure and an executing instruction count table are given to a data holding part 3b. A simulation executing part 3c sets an accumulating executing instruction counter and an executing instruction counter of an executing instruction count table of the part 3b at zero and then reads a noncoincidence test data group 2 to carry out a simulation. When the simulation is ended for one-test data, the value of the executing instruction counter is added to the value of the accumulation executing instruction counter. Then the simulation is repeated for all data of the group 2. Thus it is possible to decide a specific instruction number having an error.

Description

【発明の詳細な説明】 〔産業上の利用分野〕 本発明は、プログラムのエラー位置検出方法に係り、特
に、ソフトウェアのテストによりエラーの存在が確認さ
れたプログラムのエラー位置の検出に好適なプログラム
のエラー位置検出方法に関する。
[Detailed Description of the Invention] [Industrial Application Field] The present invention relates to a method for detecting error positions in a program, and in particular to a program suitable for detecting error positions in a program in which the existence of an error has been confirmed by software testing. This invention relates to an error position detection method.

〔従来の技術〕[Conventional technology]

文献、ジー・ジエ・マイヤズ、′アート・オブ・ソフト
ウェア・テスティング、ジョン・ウイリ・アンド・サン
ズ、インコーポレーテツド。
Literature, G. J. Meyers, 'The Art of Software Testing,' John Willi & Sons, Incorporated.

1979 (G* J、 Myers、  The A
rt of SoftwareTesting”、 J
ohn Villey & 5ons、 Inc、、 
1979)。
1979 (G*J, Myers, The A
rt of SoftwareTesting”, J
ohn Village & 5ons, Inc.
1979).

長尾真監訳、松尾正信訳″ソフトウェアテストの技法′
″、近代科学社、1980年、141〜158頁に論じ
られているように、従来は、テストを行い、エラーを検
出したテストデータを入力としてプログラムを突杆し、
記憶域のダンプを調べる、あるいは、プログラムに変数
の値を表示するための命令を書き込み、実行過程におけ
る変数の値を調べることにより、エラー位置を検出する
方法、または、テスト結果からエラーの徴候と関係ある
情報を頭のなかで分析してエラー位置を検出する方法が
採用されていた。
``Software testing techniques'' translated by Makoto Nagao and Masanobu Matsuo
'', Kindai Kagakusha, 1980, pp. 141-158, conventionally, a test is performed and a program is run using the test data in which an error is detected as input.
How to detect the location of an error by examining a storage dump, or writing an instruction to display the value of a variable in a program, and examining the value of the variable during execution, or detecting the symptoms of an error from the test results. The method used was to mentally analyze related information and detect the location of the error.

〔発明が解決しようとする問題点〕[Problem that the invention seeks to solve]

上記従来方法には、次のような問題点があった。 The above conventional method has the following problems.

すなわち、ダンプを調べるためにソースプログラムの変
数に対応した記憶域の場所を調べ、エラーの原因に関係
のない変数の値までも分析しなければならないという問
題点、また、変数の値を表示するための命令を書き込む
ために、プログラムの変更が必要になり、この変更によ
って新しいエラーを招く可能性があるという問題点があ
った。
In other words, in order to examine the dump, it is necessary to check the storage locations corresponding to variables in the source program, and even analyze the values of variables that are unrelated to the cause of the error. In order to write the instructions for this, it is necessary to change the program, and this change has the problem of possibly introducing new errors.

本発明の目的は、従来の上記した問題点を解決し、デー
タの分析を自動化し、プログラムに変更を加えることな
く、エラー位置の検出が容易にできるプログラムのエラ
ー位置検出方法を提供することにある。
An object of the present invention is to solve the above-mentioned conventional problems, and to provide a method for detecting error positions in programs that automates data analysis and allows easy detection of error positions without making any changes to the program. be.

〔問題点を解決するための手段〕[Means for solving problems]

上記目的は、テストデータを入力してプログラムを実行
し実行結果と期待値とが一致しなかった不一致テストデ
ータ群を抽出するステップと、ソースプログラムを言語
解析し実行命令ごとに番号を設定するステップと、上記
解析結果に従って上記不一致テストデータ群を入力とし
て上記ソースプログラムを模擬的に実行するステップと
、この模擬実行ステップにおける命令実行の累積回数を
上記ソースプログラムの実行命令ごとに計数して実行命
令番号と累積実行回数との関係リストとして出力するス
テップとを含む検出方法とすることにより、達成される
The above purpose is to input test data, run the program, and extract a group of unmatched test data where the execution result does not match the expected value, and to analyze the language of the source program and set a number for each execution instruction. and a step of executing the source program in a simulated manner using the mismatch test data group as input according to the analysis results, and counting the cumulative number of instruction executions in this simulated execution step for each execution instruction of the source program to obtain an execution instruction. This is achieved by using a detection method that includes the step of outputting a relationship list between the number and the cumulative number of executions.

〔作用〕[Effect]

ソフトウェアテストステップにより、エラーの影響によ
り実行結果と期待値とが一致しない不一致テストデータ
群が抽出される。言語解析ステップでは、ソースプログ
ラムを字句解析、構文解析し、ソースプログラムの有向
グラフ構造を構築できる。模擬実行ステップでは、上記
有向グラフ構築に基づいて、ソースプログラムを模擬実
行できる。実行命令カウントステップでは、入力データ
に対して実行した命令の回数をカウントできる。
The software test step extracts a group of unmatched test data in which the execution result and the expected value do not match due to the influence of an error. In the language analysis step, the source program is lexically and syntactically analyzed to construct a directed graph structure of the source program. In the simulated execution step, the source program can be simulated executed based on the directed graph construction described above. In the executed instruction count step, the number of instructions executed on input data can be counted.

これを複数の入力データに対して行うことにより、共通
の実行命令を抽出できる。1つのエラーは複数のテスト
結果に影響を及ぼすため、前記不一致テストデータ群に
対する共通の実行命令にエラーがある可能性が高く、共
通の実行命令を抽出することにより、エラー位置の検出
を容易にすることができる。
By performing this on multiple pieces of input data, common execution instructions can be extracted. Since one error affects multiple test results, there is a high possibility that there is an error in a common execution instruction for the mismatched test data group, and by extracting the common execution instruction, the error location can be easily detected. can do.

〔実施例〕〔Example〕

以下、本発明の一実施例を第1図〜第5図により説明す
る。
An embodiment of the present invention will be described below with reference to FIGS. 1 to 5.

第1図は、本発明方法を適用したエラー位置検出プログ
ラムの処理内容を説明するための概念図である。第1図
において、3がエラー位置検出プログラムで、ソースプ
ログラム1を入力・走査して、ソースプログラム1のデ
ータ定義記述と実行定義記述に対する字句解析、構文解
析を行い、実行命令ごとに番号を設定して有向グラフ構
造をデータ保持部3bに出力する言語解析部3aと、不
一致テストデータ群2を入力して、データ保持部3bの
有向グラフ構造に従ってソースプログラム1を模擬的に
実行し、データ保持部3bの実行命令カウントテーブル
に模擬実行した命令の回数をカウントし、模擬実行した
結果の実行命令番号と累積実行命令カウント数との関係
リスト4を出力する模擬実行部3cとで構成される。
FIG. 1 is a conceptual diagram for explaining the processing contents of an error position detection program to which the method of the present invention is applied. In Figure 1, 3 is an error location detection program that inputs and scans source program 1, performs lexical and syntactic analysis on the data definition description and execution definition description of source program 1, and sets a number for each execution instruction. A language analysis unit 3a outputs the directed graph structure to the data holding unit 3b, inputs the discrepancy test data group 2, executes the source program 1 in a simulated manner according to the directed graph structure of the data holding unit 3b, and outputs the directed graph structure to the data holding unit 3b. The simulation execution unit 3c counts the number of simulated instructions in an execution instruction count table, and outputs a relationship list 4 between the execution instruction number as a result of the simulation execution and the cumulative execution instruction count number.

以下、第2図に示すソースプログラム1を例として説明
する。第2図に示すプログラムは、3つの数値A、B、
Cを入力し、その最大値MAXを出力するプログラムで
あるが、破線で囲んで示した条件文1aの条件式’B>
C’が’B<C’ と誤っていた場合、第3図に示す6
つのテストケースによってテストすると、ケース3,4
.6において期待値と実行結果とが一致しない、即ち、
エラーが検出される。これらのケース3,4,6のテス
トデータを不一致テストデータ群としてエラー位置検出
プログラム3を実行する。
The source program 1 shown in FIG. 2 will be explained below as an example. The program shown in Figure 2 consists of three numbers A, B,
This is a program that inputs C and outputs its maximum value MAX, but the conditional expression 'B> of conditional statement 1a shown surrounded by a broken line
If C' is incorrect as 'B<C', 6 shown in Figure 3.
When tested with two test cases, cases 3 and 4
.. 6, the expected value and the execution result do not match, that is,
An error is detected. The error position detection program 3 is executed using the test data of these cases 3, 4, and 6 as a group of mismatched test data.

エラー位置検出プログラム3は第4図に示す処理フロー
図により処理される。まず、ソースプログラム1を言語
解析部3aに読み込み(処理301)。
The error position detection program 3 is processed according to the processing flow diagram shown in FIG. First, the source program 1 is loaded into the language analysis section 3a (process 301).

字句解析、構文解析を行い(処理302)、第2図に示
す実行命令番号1〜11を設定(処理303)した有向
グラフ構造と実行命令カウントテーブルをデータ保持部
3bに出力する(処理304)。
Lexical analysis and syntactic analysis are performed (process 302), and the directed graph structure and execution command count table in which execution command numbers 1 to 11 shown in FIG. 2 are set (process 303) are output to the data holding unit 3b (process 304).

次に、模擬実行部3cは、データ保持部3bの実行命令
カウントテーブルの累積実行命令カウンタと実行命令カ
ウンタを零にセットしく処理305) 。
Next, the simulation execution unit 3c sets the cumulative execution instruction counter and the execution instruction counter of the execution instruction count table of the data holding unit 3b to zero (305).

(処理306)、前記不一致テストデータ群2を読み込
み、データ保持部3bの有向グラフ構造に従ってソース
プログラム1を模擬実行し、実行した命令の番号に対応
した命令カウンタを1にセットする(処理307)。1
テストデータに対する模擬実行終了後、実行命令カウン
タの値を累積実行命令カウンタに加算しく処理308)
、不一致テストデータ群2の全てについて模擬実行する
まで上述の処理306〜308を繰り返し、全ての不一
致テストデータ群2について終了したことを確認(処理
309)L、て、実行命令カウントテーブルの実行命令
番号と累積実行命令カウント値との関係リストを、第5
図に示すように、出力する(処理310)。
(Process 306), the mismatch test data group 2 is read, the source program 1 is simulated executed according to the directed graph structure of the data holding unit 3b, and the instruction counter corresponding to the number of the executed instruction is set to 1 (Process 307). 1
After the simulated execution of the test data is completed, the value of the execution instruction counter is added to the cumulative execution instruction counter (308)
, Repeat the above-mentioned processes 306 to 308 until the mock execution is performed for all of the mismatch test data group 2, and confirm that it has been completed for all the mismatch test data group 2 (process 309) L. Execute commands in the execution command count table The relationship list between the number and the cumulative execution instruction count value is
As shown in the figure, it is output (process 310).

第5図の関係リストにおいて、累積実行命令カウント値
が3である実行命令が、不一致テストデータ群に対する
共通実行命令であり、実行命令番号1,2,3,4,8
,11が対応している。実行命令番号1,2,3.11
はソースプログラムにおいて入出力命令であり、明らか
にエラーがないことがわかる。そこで、実行命令番号4
,8にエラーがある可能性があり、これらに対応したソ
ースプログラムを確認することにより、実行命令番号8
の条件文1aにエラーがあることを検出できる。
In the relationship list of FIG. 5, the execution instructions whose cumulative execution instruction count value is 3 are common execution instructions for the mismatch test data group, and execution instruction numbers 1, 2, 3, 4, 8
, 11 correspond. Execution instruction number 1, 2, 3.11
is an input/output instruction in the source program, and it is clear that there is no error. Therefore, execution instruction number 4
, 8 may have an error. By checking the source program corresponding to these, execution instruction number 8 may be found.
It can be detected that there is an error in the conditional statement 1a.

以上のように、本実施例によれば、ソースプログラムを
入力・走査し、解析した有向グラフ構造に基づいて、テ
ストによってエラーを検出した不一致テストデータ群を
入力として該ソースプログラムを模擬寒行させることに
より、第5図に示すような関係リストが得られ、この関
係リストからエラーがある可能性がある実行命令番号を
抽出でき、これらに対応したソースプログラムを確認す
ることでエラーを検出することができる。
As described above, according to the present embodiment, a source program is input and scanned, and based on the analyzed directed graph structure, the source program is subjected to a simulated test using as input a group of mismatched test data in which errors are detected by testing. As a result, a relationship list as shown in Figure 5 is obtained, and execution instruction numbers that may have errors can be extracted from this relationship list, and errors can be detected by checking the source program corresponding to these. can.

〔発明の効果〕〔Effect of the invention〕

本発明によれば、ソースプログラムレベルでプログラム
を模擬実行し、複数の入力データに対する共通実行命令
を抽出することができるので、ソースプログラムをコン
パイルする必要がなく、入力データをエラーを検出した
テストデータ群とすることによって、エラー位置を共通
実行命令中に特定することができ、エラー位置の検出効
率を大幅に向上させることができる。
According to the present invention, since it is possible to simulate execute a program at the source program level and extract common execution instructions for multiple input data, there is no need to compile the source program, and the input data can be used as test data in which an error has been detected. By forming a group, the error position can be specified in a common execution instruction, and the efficiency of detecting the error position can be greatly improved.

【図面の簡単な説明】[Brief explanation of the drawing]

第1図は本発明の一実施例のシステム構成図、第2図は
ソースプログラムの一例を示す図、第3図はソースプラ
グに対するテストケースの一例を示す図、第4図はエラ
ー位置検出プログラムの処理フロー図、第5図は実行命
令番号と累積実行命令カウント値との関係リストの一例
を示す図である。 1・・・ソースプログラム、2・・・不一致テストデー
タ群、3・・・エラー位置検出プログラム、3・・・言
語解析部、3a・・・言語解析部、3b・・・データ保
持部、3c・・・模擬実行部、4・・・実行命令番号と
累積実行$1の 第3昭 第41
Fig. 1 is a system configuration diagram of an embodiment of the present invention, Fig. 2 is a diagram showing an example of a source program, Fig. 3 is a diagram showing an example of a test case for a source plug, and Fig. 4 is an error position detection program. FIG. 5 is a diagram showing an example of a relationship list between execution instruction numbers and cumulative execution instruction count values. DESCRIPTION OF SYMBOLS 1... Source program, 2... Mismatch test data group, 3... Error position detection program, 3... Language analysis section, 3a... Language analysis section, 3b... Data holding section, 3c ...Mock execution unit, 4...Execution instruction number and cumulative execution $1 No. 3, No. 41

Claims (1)

【特許請求の範囲】[Claims] 1、テストデータを入力してプログラムを実行し実行結
果と期待値とが一致しなかつた不一致テストデータ群を
抽出するステップと、ソースプログラムを言語解析し実
行命令ごとに番号を設定するステップと、上記解析結果
に従つて上記不一致テストデータ群を入力として上記ソ
ースプログラムを模擬的に実行するステップと、この模
擬実行ステップにおける命令実行の累積回数を上記ソー
スプログラムの実行命令番号ごとに計数して実行命令番
号と累積実行回数との関係リストとして出力するステッ
プとを含み、この関係リストからプログラムのエラー位
置を検出することを特徴とするプログラムのエラー位置
検出方法。
1. A step of inputting test data and executing the program to extract a group of unmatched test data where the execution result and the expected value do not match; a step of linguistically analyzing the source program and setting a number for each execution instruction; A step of executing the source program in a simulated manner using the inconsistency test data group as input according to the analysis results, and counting and executing the cumulative number of instruction executions in this simulated execution step for each execution instruction number of the source program. A method for detecting error positions in a program, comprising the step of outputting a relationship list between instruction numbers and cumulative execution counts, and detecting error positions in the program from this relationship list.
JP62311967A 1987-12-11 1987-12-11 Detecting method for program error position Pending JPH01154256A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP62311967A JPH01154256A (en) 1987-12-11 1987-12-11 Detecting method for program error position

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP62311967A JPH01154256A (en) 1987-12-11 1987-12-11 Detecting method for program error position

Publications (1)

Publication Number Publication Date
JPH01154256A true JPH01154256A (en) 1989-06-16

Family

ID=18023591

Family Applications (1)

Application Number Title Priority Date Filing Date
JP62311967A Pending JPH01154256A (en) 1987-12-11 1987-12-11 Detecting method for program error position

Country Status (1)

Country Link
JP (1) JPH01154256A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH0855043A (en) * 1994-08-10 1996-02-27 Tekutomu:Kk Debugging/analyzing method due to comparison of access state of memory
JP2014182451A (en) * 2013-03-18 2014-09-29 Fujitsu Ltd Program analyzer, method and program
JP2017151977A (en) * 2016-02-23 2017-08-31 富士通株式会社 Method and program for repairing software program

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH0855043A (en) * 1994-08-10 1996-02-27 Tekutomu:Kk Debugging/analyzing method due to comparison of access state of memory
JP2014182451A (en) * 2013-03-18 2014-09-29 Fujitsu Ltd Program analyzer, method and program
JP2017151977A (en) * 2016-02-23 2017-08-31 富士通株式会社 Method and program for repairing software program

Similar Documents

Publication Publication Date Title
CN101739339B (en) Program dynamic dependency relation-based software fault positioning method
CN109189479B (en) Parallel automatic verification method for processor instruction set
Ramamoorthy et al. Application of a methodology for the development and validation of reliable process control software
CN104536883B (en) A kind of static defect detection method and its system
CN109857641B (en) Method and device for detecting defects of program source file
JP6316120B2 (en) Test case generation system and recording medium recording test case
JPS63132346A (en) Defect separation for digital logic circuit
CN102054100B (en) Static analysis-based method and system for detecting RTL (Resistor Transistor Logic) design errors
JP2672711B2 (en) How to test and debug computer programs
Polo et al. Integrating techniques and tools for testing automation
JPH0748182B2 (en) Program error detection method
Leung et al. C-to-verilog translation validation
Celik et al. Mutation analysis for Coq
Beller et al. The last line effect
EP3570173B1 (en) Equivalence verification apparatus and equivalence verification program
JPH01154256A (en) Detecting method for program error position
CN113836023B (en) Compiler security testing method based on architecture cross check
Friedler et al. Effective post-silicon failure localization using dynamic program slicing
Cheng et al. Empirical evaluation of test coverage for functional programs
Große et al. Guided lightweight software test qualification for IP integration using virtual prototypes
WO2021238462A1 (en) Method and device for detecting memory out-of-order
US7606692B2 (en) Gate-level netlist reduction for simulating target modules of a design
Harzevili et al. Automatic Static Vulnerability Detection for Machine Learning Libraries: Are We There Yet?
JPH01177165A (en) Definition-quotation relation checking system for array
CN116861829B (en) Method for locating errors in logic system design and electronic equipment