JP7456843B2 - Program modification device, program modification method, and program modification program - Google Patents

Program modification device, program modification method, and program modification program Download PDF

Info

Publication number
JP7456843B2
JP7456843B2 JP2020082700A JP2020082700A JP7456843B2 JP 7456843 B2 JP7456843 B2 JP 7456843B2 JP 2020082700 A JP2020082700 A JP 2020082700A JP 2020082700 A JP2020082700 A JP 2020082700A JP 7456843 B2 JP7456843 B2 JP 7456843B2
Authority
JP
Japan
Prior art keywords
derived
code piece
expression
pattern
source
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
JP2020082700A
Other languages
Japanese (ja)
Other versions
JP2021177343A (en
Inventor
和矢 安田
信治 伊藤
良太 三部
真雄 原田
知倫 中村
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
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 JP2020082700A priority Critical patent/JP7456843B2/en
Publication of JP2021177343A publication Critical patent/JP2021177343A/en
Application granted granted Critical
Publication of JP7456843B2 publication Critical patent/JP7456843B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Debugging And Monitoring (AREA)

Description

本発明は、ソースコードにおける不具合を修正する技術に関する。 The present invention relates to a technique for correcting defects in source code.

ソフトウェア開発において、プログラムに故障(開発者の意図と異なる動作)が発生した場合、当該故障が発生しないようにプログラムを修正する。プログラムの故障を引き起こす原因を不具合(欠陥、フォールト、バグ)と呼ぶ。プログラムのソースコード中から不具合を含む箇所を特定し、当該箇所を書き換えることで不具合を取り除く作業をデバッグと呼ぶ。 In software development, when a malfunction occurs in a program (an operation that differs from the developer's intention), the program is modified so that the malfunction does not occur. The causes of program failures are called defects (defects, faults, bugs). Debugging is the process of identifying a location in a program's source code that contains a defect and rewriting that location to eliminate the defect.

開発者は手作業によりデバッグを行うが、これには長い時間を要するという問題がある。そこで、非特許文献1には、デバッグ作業を自動化する技術が開示されている。
非特許文献1に記載された技術は、具体的には、ソースコードから不具合を含む箇所を特定し(fault localization)、当該箇所を書き換える(patch generation)ことで、不具合を修正する技術である。この技術は、不具合を含む箇所の書き換えにおいて、ソース修正パターン(fix pattern)に従い、不具合を含む箇所のコード片を、ソースコード中の別の箇所に存在する正しい素材コード片(donor code)に変更するものである。
Developers manually debug, but this has the problem of taking a long time. Therefore, Non-Patent Document 1 discloses a technique for automating debugging work.
Specifically, the technique described in Non-Patent Document 1 is a technique for correcting the defect by identifying a location containing a defect from the source code (fault localization) and rewriting the location (patch generation). This technology follows a source modification pattern (fix pattern) when rewriting a part containing a defect, and changes the code fragment containing the defect to a correct material code piece (donor code) that exists elsewhere in the source code. It is something to do.

K. Liu, A. Koyuncu, D. Kim, and T. F. Bissyande, “TBar: Revisiting Template-based Automated Program Repair,” in Proceedings of the 28th International Symposium on Software Testing and Analysis, 2019, pp. 31-42.K. Liu, A. Koyuncu, D. Kim, and T. F. Bissyande, “TBar: Revisiting Template-based Automated Program Repair,” in Proceedings of the 28th International Symposium on Software Testing and Analysis, 2019, pp. 31-42.

非特許文献1に記載された技術では、正しい素材コード片がデバッグ対象のソースコード中に存在しない場合、不具合を含む箇所を正しく書き換えることができず、不具合を取り除くことができない。
また、仮にデバッグ対象のソースコードとは別のソースコードから素材コード片を大量に抽出したとしても、それらの抽出した素材コード片は、デバッグ対象のソースコードには適合しないことも多い。つまり、不正解の素材コード片を増やしただけでは、デバッグ作業は効率化されず、むしろ不正解の素材コード片を除外する余分な負担を開発者に強いてしまうだけである。
In the technique described in Non-Patent Document 1, if a correct material code piece does not exist in the source code to be debugged, the part containing the defect cannot be correctly rewritten, and the defect cannot be removed.
Furthermore, even if a large number of material code fragments are extracted from source code other than the source code to be debugged, these extracted material code fragments often do not match the source code to be debugged. In other words, simply increasing the number of incorrect material code pieces does not make the debugging process more efficient, but rather only imposes an extra burden on the developer to exclude incorrect material code pieces.

本発明は、上記事情に鑑みなされたものであり、バグを書き換える適切な修正候補により、開発者のデバッグ作業を効率化することを主な課題とする。 The present invention was developed in consideration of the above circumstances, and its main objective is to make developers' debugging work more efficient by providing appropriate correction candidates for rewriting bugs.

上記の課題を解決するため、本発明のプログラム修正装置は以下の特徴を有する。
本発明は、ソースファイルに含まれる式を原形コード片として取得する原形コード片取得部と、
取得した前記原形コード片の式から、式の書き換え方法を示す派生パターンに従い、派生コード片の式を生成する派生コード片生成部と、
前記ソースファイルにおける不具合の箇所を、前記原形コード片または前記派生コード片に書き換える旨のソース修正パターンに従い、前記ソースファイルの修正候補を生成する修正候補生成部と、を備えることを特徴とする。
その他の手段は、後記する。
In order to solve the above problems, the program correction device of the present invention has the following features.
The present invention includes an original code piece acquisition unit that acquires an expression included in a source file as an original code piece;
a derived code fragment generation unit that generates a derived code fragment formula from the obtained formula of the original code fragment according to a derived pattern indicating a method of rewriting the formula;
The present invention is characterized by comprising a modification candidate generation unit that generates modification candidates for the source file according to a source modification pattern for rewriting a defective part in the source file to the original code piece or the derived code piece.
Other means will be described later.

本発明によれば、バグを書き換える適切な修正候補により、開発者のデバッグ作業を効率化することができる。 According to the present invention, a developer's debugging work can be made more efficient by using appropriate correction candidates for rewriting bugs.

本実施形態に関するプログラム修正装置のハードウェア構成例を示す図である。1 is a diagram showing an example of the hardware configuration of a program modification device according to the present embodiment. 本実施形態に関するプログラム修正装置の機能構成例を示す図である。1 is a diagram illustrating an example of a functional configuration of a program modification device according to the present embodiment. 本実施形態に関するソースファイル群の例を示す図である。FIG. 3 is a diagram showing an example of a source file group according to the present embodiment. 本実施形態に関するソース修正パターンの例を示す図である。It is a figure which shows the example of the source modification pattern regarding this embodiment. 本実施形態に関する不具合箇所候補の例を示す図である。FIG. 3 is a diagram showing an example of defect location candidates according to the present embodiment. 本実施形態に関する原形コード片の例を示す図である。It is a figure which shows the example of the original code piece regarding this embodiment. 本実施形態に関する派生パターンの例を示す図である。It is a figure which shows the example of the derived pattern regarding this embodiment. 本実施形態に関する派生コード片の例を示す図である。It is a figure which shows the example of the derived code piece regarding this embodiment. 本実施形態に関する修正候補群の例を示す図である。FIG. 13 is a diagram showing an example of a group of correction candidates according to the present embodiment. 本実施形態に関するプログラム修正処理のフローチャートである。7 is a flowchart of program modification processing according to the present embodiment. 本実施形態に関する派生パターン取得処理のフローチャートである。It is a flowchart of derived pattern acquisition processing regarding this embodiment.

以下、図面を参照しつつ、本実施形態について説明する。以下の説明において、同一の又は類似する構成について同一の符号を付して、重複した説明を省略することがある。 This embodiment will be described below with reference to the drawings. In the following description, the same or similar configurations may be denoted by the same reference numerals and redundant description may be omitted.

図1は、プログラム修正装置のハードウェア構成例を示す図である。
プログラム修正装置100は、プロセッサ110、主記憶装置120、補助記憶装置130、入力装置140、出力装置150、及び通信装置160を備える。これらは図示しないバス等の通信手段を介して互いに通信可能に接続されている。
プロセッサ110は、例えば、CPU(Central Processing Unit)やMPU(Micro Processing Unit)を用いて構成されている。プロセッサ110が、主記憶装置120に格納されているプログラムを読み出して実行することにより、後述するプログラム修正装置100の様々な機能部が実現される。
FIG. 1 is a diagram showing an example of the hardware configuration of a program modification device.
The program modification device 100 includes a processor 110, a main storage device 120, an auxiliary storage device 130, an input device 140, an output device 150, and a communication device 160. These are communicably connected to each other via a communication means such as a bus (not shown).
The processor 110 is configured using, for example, a CPU (Central Processing Unit) or an MPU (Micro Processing Unit). When the processor 110 reads and executes programs stored in the main storage device 120, various functional units of the program modification device 100, which will be described later, are realized.

主記憶装置120は、プログラムやデータを記憶する装置であり、例えば、ROM(Read Only Memory)、RAM(Random Access Memory)、不揮発性半導体メモリ(NVRAM(Non Volatile RAM))等である。主記憶装置120は、例えば、プログラム修正プログラムを記憶する。
補助記憶装置130は、例えば、ハードディスクドライブ、SSD(Solid State Drive)、光学式記憶装置(CD(Compact Disc)、DVD(Digital Versatile Disc)等)、ストレージシステム、ICカード、SDメモリカードや光学式記録媒体等の記録媒体の読取/書込装置、クラウドサーバの記憶領域等である。補助記憶装置130に格納されているプログラムやデータは主記憶装置120に随時読み込まれる。
The main storage device 120 is a device that stores programs and data, and is, for example, a ROM (Read Only Memory), a RAM (Random Access Memory), a nonvolatile semiconductor memory (NVRAM (Non Volatile RAM)), or the like. The main storage device 120 stores, for example, a program modification program.
The auxiliary storage device 130 is, for example, a hard disk drive, SSD (Solid State Drive), optical storage device (CD (Compact Disc), DVD (Digital Versatile Disc), etc.), storage system, IC card, SD memory card, or optical storage device. These include a reading/writing device for a recording medium such as a recording medium, a storage area of a cloud server, and the like. Programs and data stored in the auxiliary storage device 130 are read into the main storage device 120 at any time.

入力装置140は、例えば、キーボード、マウス、タッチパネル、カードリーダ、音声入力装置等であり、ユーザからの各種情報の入力を受け付ける。出力装置150は、ユーザに処理経過や処理結果等の各種情報を提供するユーザインタフェースであり、例えば、画面表示装置(液晶モニタ、LCD(Liquid Crystal Display)、グラフィックカード等)、音声出力装置(スピーカ等)、印字装置等である。なお、例えば、プログラム修正装置100が通信装置160を介して他の装置との間で情報の入力や出力を行う構成としてもよい。 The input device 140 is, for example, a keyboard, a mouse, a touch panel, a card reader, a voice input device, etc., and receives input of various information from the user. The output device 150 is a user interface that provides the user with various information such as processing progress and processing results, and includes, for example, a screen display device (liquid crystal monitor, LCD (Liquid Crystal Display), graphic card, etc.), an audio output device (speaker, etc.). etc.), printing devices, etc. Note that, for example, a configuration may be adopted in which the program modification device 100 inputs and outputs information to and from another device via the communication device 160.

通信装置160は、LAN(Local Area Network)やインターネット等の通信ネットワークを介して他の装置との間の通信を実現する有線方式又は無線方式の通信インタフェースであり、例えば、NIC(Network Interface Card)、無線通信モジュール、USB(Universal Serial Interface)モジュール、シリアル通信モジュール等である。 The communication device 160 is a wired or wireless communication interface that realizes communication with other devices via a communication network such as a LAN (Local Area Network) or the Internet, and is, for example, a NIC (Network Interface Card). , wireless communication module, USB (Universal Serial Interface) module, serial communication module, etc.

ここで、本実施形態で使用する用語を定義する。
「ソースコード」は、ソフトウェア開発の対象となるプログラムであり、開発者の意図と異なる動作を引き起こす不具合を含んでいることもある。ソースコードは、1以上の式(Expression)を含む。
「プログラムの修正」とは、ソースコード中の不具合を含む箇所を、正しい記述に修正する作業である。その修正方法には、書き換え元の式(不具合を含む箇所に含まれる式)と、書き換え先の正しい記述である式(下記の「素材コード片」の式)とのペアが「式の書き換え方法」として含まれている。
Here, terms used in this embodiment will be defined.
"Source code" is a program that is the target of software development, and may contain defects that cause the program to behave differently than the developer intended. The source code includes one or more expressions.
"Program modification" is the work of correcting a part of the source code that contains a defect to a correct description. The correction method requires a pair of the source expression (the expression included in the part containing the defect) and the expression that is the correct description of the destination to be rewritten (the expression in the "Material code fragment" below). ” is included.

「素材コード片」には、不具合箇所を含むソースコードからそのままの記述を抽出した「原形コード片」と、その原形コード片を変形した「派生コード片」とに分類される。
本実施形態の主な特徴は、原形コード片だけでなく、新たに派生コード片を生成して、その両方のコード片を素材コード片として充実させることで、正しい式に書き換える精度を向上させる点にある。
「派生パターン」とは、原形コード片から派生コード片を作成するために参照されるパターンであり、開発者の経験則やノウハウなどが具現化したものである。
"Material code fragments" are classified into "original code fragments", which are extracted as-is from source code containing defective parts, and "derivative code fragments", which are modified versions of the original code fragments.
The main feature of this embodiment is that not only the original code piece but also a newly derived code piece is generated and both code pieces are enriched as material code pieces, thereby improving the accuracy of rewriting to the correct formula. It is in.
A "derivative pattern" is a pattern that is referenced to create a derived code piece from an original code piece, and is an embodiment of the developer's empirical rules and know-how.

図2は、プログラム修正装置の機能構成例を示す図である。
プログラム修正装置100は、不具合箇所特定部210、原形コード片取得部220、派生コード片生成部230、修正候補生成部240、派生パターン取得部250、情報記憶部290の各機能部を備える。これら機能部により実行される処理については、図10、図11のフローチャートにて後述する。
不具合箇所特定部210、原形コード片取得部220、派生コード片生成部230、修正候補生成部240、及び派生パターン取得部250は、プロセッサ110が主記憶装置120に格納されたプログラム修正プログラムを実行することにより構成される。
FIG. 2 is a diagram showing an example of the functional configuration of the program modification device.
The program correction device 100 includes functional units such as a defect location identifying section 210, an original code piece acquisition section 220, a derived code piece generation section 230, a modification candidate generation section 240, a derived pattern acquisition section 250, and an information storage section 290. The processes executed by these functional units will be described later using flowcharts shown in FIGS. 10 and 11.
The defect location identification unit 210 , the original code piece acquisition unit 220 , the derived code piece generation unit 230 , the modification candidate generation unit 240 , and the derived pattern acquisition unit 250 enable the processor 110 to execute the program modification program stored in the main storage device 120 . It consists of:

情報記憶部290は、主に、図1の補助記憶装置130により構成される。
情報記憶部290は、ソースファイル群291と、ソース修正パターン292と、不具合箇所候補293と、原形コード片294と、派生パターン295と、派生コード片296と、修正候補群297とを記憶する。これら情報記憶部290内の各種情報の詳細については、図3~図9にて後述する。
The information storage unit 290 is mainly composed of the auxiliary storage device 130 shown in FIG.
The information storage unit 290 stores a source file group 291 , a source correction pattern 292 , defect location candidates 293 , an original code piece 294 , a derived pattern 295 , a derived code piece 296 , and a group of correction candidates 297 . Details of the various information in the information storage section 290 will be described later with reference to FIGS. 3 to 9.

図3は、ソースファイル群291の例を示す図である。
ソースファイル群291は、1以上のソースファイル291Aを含む。ソースファイル291Aは、ファイル名がFILE1である。ソースファイル291Aは、1以上の行(Line)のソースコードを含み、図3では7行の例を示す。
なお、ソースコードは、JAVA(登録商標)やC++等のプログラミング言語でもよく、その他の任意のプログラミング言語でもよい。
FIG. 3 is a diagram showing an example of the source file group 291.
The source file group 291 includes one or more source files 291A. The source file 291A has a file name FILE1. The source file 291A includes one or more lines of source code, and FIG. 3 shows an example of seven lines.
Note that the source code may be a programming language such as JAVA (registered trademark) or C++, or any other programming language.

ソースファイル291Aのソースコードは、2行目の「name」、2行目の「name == null」、6行目の「data」という式を含む。ソースコードに含まれる式は、夫々が1以上の型(クラス)を持つ。ソースファイル291Aのソースコードでは、式「name」は型「String」と「Object」を、式「name == null」は型「boolean」を、式「data」は型「Article」と「Object」を持つ。
ソースファイル291Aのソースコードは、2行目に不具合を含む。不具合を取り除くためには、式「name == null」を別の式「isEmpty(name)」に書き換えなければならない。
The source code of source file 291A includes the expressions "name" on line 2, "name == null" on line 2, and "data" on line 6. Each expression included in the source code has one or more types (classes). In the source code of source file 291A, the expression "name" has types "String" and "Object", the expression "name == null" has type "boolean", and the expression "data" has types "Article" and "Object".
The source code of source file 291A contains a defect in line 2. To remove the defect, the expression "name == null" must be rewritten as a different expression "isEmpty(name)".

図4は、ソース修正パターン292の例を示す図である。
ソース修正パターン292とは、不具合箇所を含むソースコードから、1つ以上の修正候補群297を作成するための修正方法のパターンである。ソース修正パターン292は、1以上のエントリを含む。ソース修正パターン292のエントリは、ソース修正パターンIDと、修正方法とのカラムを含む。ソース修正パターンIDには、ソース修正パターンを識別するIDが格納される。
修正方法として、例えば、ソース修正パターンID「M1」のエントリは、不具合を含む箇所に存在する「if (」と「)」に挟まれた任意の式を、別の式に書き換えることを示す。
FIG. 4 is a diagram illustrating an example of the source modification pattern 292.
The source modification pattern 292 is a pattern of a modification method for creating one or more modification candidate group 297 from a source code including a defective part. Source modification pattern 292 includes one or more entries. The entry for the source modification pattern 292 includes columns for source modification pattern ID and modification method. The source modification pattern ID stores an ID that identifies a source modification pattern.
As a modification method, for example, an entry with the source modification pattern ID "M1" indicates that an arbitrary expression between "if (" and ")" existing in a location including a defect is rewritten to another expression.

なお、図4のソース修正パターン292の修正方法に含まれる「$exp」は、ソースコードに含まれる任意の式を表すプレースホルダであり、「$exp」以外の文字列を用いてもよい。また、図4のソース修正パターン292の修正方法に含まれる「$newExp」は、任意の素材コード片を表すプレースホルダであり、「$newExp」以外の文字列を用いてもよい。 Note that "$exp" included in the modification method of the source modification pattern 292 in FIG. 4 is a placeholder representing an arbitrary expression included in the source code, and a character string other than "$exp" may be used. Further, "$newExp" included in the modification method of the source modification pattern 292 in FIG. 4 is a placeholder representing an arbitrary material code piece, and a character string other than "$newExp" may be used.

図5は、不具合箇所候補293の例を示す図である。
不具合箇所特定部210は、ソースファイル群291を入力として、不具合箇所候補293を出力する(詳細は図10のS101)。
不具合箇所候補293は、1以上のエントリを含む。不具合箇所候補293のエントリは、ファイル名と、行番号と、疑わしさとのカラムを含む。ファイル名には、不具合を含む可能性のあるソースファイルのファイル名が格納され、行番号にはそのソースファイル中の行番号が格納される。疑わしさには、欠陥を含む可能性の高さが格納される。
ファイル名、行番号、及び疑わしさに格納された情報は、ソースコードの不具合を含む箇所を特定するための情報である。なお、不具合を含む箇所が一意に特定できるならば、ファイル名、行番号、疑わしさの全てを不具合箇所候補293のエントリに含んでいなくてもよい。
FIG. 5 is a diagram showing an example of defect location candidates 293.
The defect location identification unit 210 receives the source file group 291 as input and outputs a defect location candidate 293 (details are in S101 in FIG. 10).
The defect location candidate 293 includes one or more entries. The entry of the defect location candidate 293 includes columns for file name, line number, and suspicion. The file name stores the file name of a source file that may contain a defect, and the line number stores the line number in the source file. Suspicion stores the high possibility that a defect is included.
The information stored in the file name, line number, and suspiciousness is information for identifying a location in the source code that contains a defect. Note that, if the location containing the defect can be uniquely identified, the file name, line number, and suspicion need not all be included in the entry of the defect location candidate 293.

図6は、原形コード片294の例を示す図である。
原形コード片取得部220は、ソースファイル群291を入力として、原形コード片294を出力する(詳細は図10のS102)。
原形コード片294は、1以上のエントリを含む。原形コード片294のエントリは、エントリのID(A1~A3)と、式と、型と、ファイル名と、行番号とのカラムを含む。式には、ソースコードに含まれる式が格納される。型には、式の持つ型が格納される。ファイル名には、式を含むソースファイルのファイル名が格納される。行番号には、式を含むソースファイルの行番号が格納される。
FIG. 6 is a diagram showing an example of the original code piece 294.
The original code piece acquisition unit 220 receives the source file group 291 as input and outputs the original code piece 294 (for details, see S102 in FIG. 10).
Original code piece 294 includes one or more entries. The entry of the original code piece 294 includes columns of entry ID (A1 to A3), expression, type, file name, and line number. Expression stores expressions included in the source code. The type of the expression is stored in the type. The file name stores the file name of the source file containing the formula. The line number stores the line number of the source file that contains the formula.

図7は、派生パターン295の例を示す図である。
派生パターン取得部250は、原形コード片294を入力として、派生パターン295を出力する(詳細は図10のS112)。または、派生パターン295は、ユーザにより作成されてよい。
派生パターン295は、1以上のエントリを含む。派生パターン295のエントリは、エントリのID(B1~B6)と、元の式と、元の型と、追加する式と、ソース修正パターンIDと、優先度とのカラムを含む。
FIG. 7 is a diagram showing an example of the derived pattern 295.
The derived pattern acquisition unit 250 receives the original code piece 294 and outputs the derived pattern 295 (details are in S112 in FIG. 10). Alternatively, derived pattern 295 may be created by a user.
Derived pattern 295 includes one or more entries. The entry of the derived pattern 295 includes columns of entry ID (B1 to B6), original expression, original type, added expression, source modification pattern ID, and priority.

元の式には、原形コード片294の式が格納される。元の型には、原形コード片294の型が格納される。追加する式には、原形コード片294の式から、派生コード片296の式を生成する方法が格納される。
例えば、派生パターン295のエントリ「B1」は、原形コード片294に含まれる、型「String」を持つ任意の式「$exp」に対して、文字列「isEmpty(」と「)」とを結合することで、派生コード片296の式「isEmpty($exp)」を生成することを表す。
The expression of the original code piece 294 is stored in the original expression. The original model stores the model of the original code piece 294. The added formula stores a method for generating the formula of the derived code piece 296 from the formula of the original code piece 294.
For example, the entry "B1" of the derived pattern 295 combines the strings "isEmpty(" and ")" with respect to an arbitrary expression "$exp" of type "String" included in the original code piece 294. This indicates that the expression "isEmpty($exp)" of the derived code piece 296 is generated.

ソース修正パターンIDには、生成した派生コード片296の式を使用する、1以上のソース修正パターンIDが格納される。優先度には、追加する式の優先度が格納される。派生パターン295のエントリ「B1」は、生成した派生コード片「isEmpty($exp)」が、ソース修正パターンID「M1」のみで、優先度30で使用されることを表す。優先度は大きいほど使用されやすくなる。 The source modification pattern ID stores one or more source modification pattern IDs that use the expression of the generated derived code piece 296. Priority stores the priority of the expression to be added. The entry “B1” in the derived pattern 295 indicates that the generated derived code piece “isEmpty($exp)” is used only with the source modification pattern ID “M1” and with a priority of 30. The higher the priority, the more likely it is to be used.

なお、派生パターン295に含まれる「$exp」は、原形コード片294の任意の式を表すプレースホルダであり、「$exp」以外の文字列を用いてもよい。また、派生パターン295に含まれる「$field」は、式「$exp」の任意のフィールドを表すプレースホルダであり、「$field」以外の文字列を用いてもよい。 Note that "$exp" included in the derived pattern 295 is a placeholder representing an arbitrary expression of the original code piece 294, and a character string other than "$exp" may be used. Further, "$field" included in the derived pattern 295 is a placeholder representing an arbitrary field of the expression "$exp", and a character string other than "$field" may be used.

また、派生パターン295に含まれる「$getter」は、式「$exp」の任意のゲッターメソッド名を表すプレースホルダであり、「$getter」以外の文字列を用いてもよい。また、派生パターン295に含まれる「$str」は、任意の文字列を表すプレースホルダであり、「$str」以外の文字列を用いてもよい。 Further, "$getter" included in the derived pattern 295 is a placeholder representing an arbitrary getter method name for the expression "$exp", and a character string other than "$getter" may be used. Further, "$str" included in the derived pattern 295 is a placeholder representing an arbitrary character string, and a character string other than "$str" may be used.

図8は、派生コード片296の例を示す図である。
派生コード片生成部230は、原形コード片294と、派生パターン295とを入力として、派生コード片296を出力する(詳細は図10のS103)。
派生コード片296は、1以上のエントリを含む。派生コード片296のエントリは、エントリのID(C1~C5)と、式と、ソース修正パターンIDとのカラムを含む。式には、原形コード片294から、派生パターン295に従い生成された式が格納される。ソース修正パターンIDには、式を使用する、1以上のソース修正パターンIDが格納される。
FIG. 8 is a diagram showing an example of the derived code piece 296.
The derived code piece generation unit 230 receives the original code piece 294 and the derived pattern 295 as input, and outputs a derived code piece 296 (for details, see S103 in FIG. 10).
Derived code piece 296 includes one or more entries. The entry of the derived code piece 296 includes columns of entry ID (C1 to C5), expression, and source modification pattern ID. An expression generated from the original code piece 294 according to the derived pattern 295 is stored in the expression. The source modification pattern ID stores one or more source modification pattern IDs that use formulas.

図9は、修正候補群297の例を示す図である。
修正候補生成部240は、ソースファイル群291と、ソース修正パターン292と、不具合箇所候補293と、原形コード片294と、派生コード片296とを入力として、修正候補群297を出力する(詳細は図10のS104)。
修正候補群297は、1以上の(ここでは5つの)修正候補「G1~G5」を含む。修正候補「G1~G5」は、ソースファイル群291に含まれるソースコードのうち、不具合箇所候補293に示された不具合を含む箇所(2行目のif()内の式)を、ソース修正パターン292に従い、原形コード片294の式または派生コード片296の式に書き換えたソースコードを含む(書き換えた箇所を太字下線で示す)。
FIG. 9 is a diagram showing an example of the correction candidate group 297.
The correction candidate generation unit 240 receives as input a source file group 291, a source correction pattern 292, a defect location candidate 293, an original code piece 294, and a derived code piece 296, and outputs a correction candidate group 297 (for details, see S104 in FIG. 10).
The modification candidate group 297 includes one or more (here, five) modification candidates “G1 to G5”. The correction candidates "G1 to G5" are the source code included in the source file group 291 that contains the defect shown in the defect location candidate 293 (the expression in if() on the second line) using a source correction pattern. 292, the source code is rewritten to the formula of the original code piece 294 or the formula of the derived code piece 296 (rewritten portions are shown in bold and underlined).

図10は、プログラム修正処理のフローチャートである。
プログラム修正処理は、例えば、ユーザからの指示を契機として開始されてもよく、スケジュールされたタイミングでバッチ処理等により自動的に開始してもよい。以下において、符号の前に付している文字「S」は処理ステップを意味する。
FIG. 10 is a flowchart of program modification processing.
The program modification process may be started, for example, in response to an instruction from the user, or may be started automatically by batch processing or the like at a scheduled timing. In the following, the letter "S" added before the reference numeral means a processing step.

まず、不具合箇所特定部210は、情報記憶部290に記憶されているソースファイル群291を読み込み、不具合箇所を特定して、不具合箇所候補293とする(S101)。不具合箇所は、例えば静的解析を用いて特定してもよいし、欠陥限局(fault localization)を用いて特定してもよい。 First, the defective location identification unit 210 reads the source file group 291 stored in the information storage unit 290, identifies a defective location, and sets it as a defective location candidate 293 (S101). The defect location may be identified using, for example, static analysis or fault localization.

次に、原形コード片取得部220は、情報記憶部290に記憶されているソースファイル群291を読み込み、ソースコードに含まれる式と、夫々の式の型とを取得して、原形コード片294とする(S102)。
なお、原形コード片取得部220は、ソースコードに含まれるすべての式を取得してもよいし、不具合を含む箇所で使用可能な式のみを取得してもよい。
Next, the original code piece acquisition unit 220 reads the source file group 291 stored in the information storage unit 290, acquires the expressions included in the source code and the type of each expression, and generates the original code piece 294. (S102).
Note that the original code piece acquisition unit 220 may acquire all formulas included in the source code, or may acquire only formulas that can be used at a location containing a defect.

次に、派生コード片生成部230は、情報記憶部290に記憶されている原形コード片294と、派生パターン295とを読み込み、以下の(手順A1)~(手順A4)により派生コード片296を生成する(S103)。 Next, the derived code piece generation unit 230 reads the original code piece 294 and the derived pattern 295 stored in the information storage unit 290, and generates the derived code piece 296 by the following (procedure A1) to (procedure A4). Generate (S103).

(手順A1):派生コード片生成部230は、原形コード片294の夫々のエントリと、派生パターン295の夫々のエントリとの組(以下、エントリペアと呼ぶ)を生成する。
例えば、図6の原形コード片294には3つのエントリ「A1~A3」があり、図7の派生パターン295には6つのエントリ「B1~B6」があるので、それぞれの組み合わせで合計3×6=18個のエントリペアが生成される。
(Procedure A1): The derived code piece generation unit 230 generates a pair (hereinafter referred to as an entry pair) of each entry of the original code piece 294 and each entry of the derived pattern 295.
For example, the original code piece 294 in FIG. 6 has three entries "A1 to A3", and the derived pattern 295 in FIG. 7 has six entries "B1 to B6", so each combination has a total of 3 x 6 entries. =18 entry pairs are generated.

(手順A2):派生コード片生成部230は、エントリペアのうち、原形コード片294の式が、派生パターン295の元の式と一致しないものを除外する。例えば、派生パターン295の元の式「$exp」は原形コード片294の式をそのまま示すので、エントリ「A1~A3」と、エントリ「B1~B5」とのエントリペア(例えば、A1-B1やA3-B3など)は、除外されない。
一方、エントリ「B6」の「some$str()」は原形コード片294の式に「some」という文字列と任意の文字列「str()」とを含むことを示すので、エントリ「A1~A3」のどの式も該当しない。よって、エントリ「A1~A3」と、エントリ「B6」とのエントリペア(例えば、A1-B6)は、除外される。
(Step A2): The derived code piece generation unit 230 excludes entry pairs in which the expression of the original code piece 294 does not match the original expression of the derived pattern 295. For example, the original expression "$exp" of the derived pattern 295 shows the expression of the original code piece 294 as is, so an entry pair of entries "A1-A3" and entries "B1-B5" (for example, A1-B1, A3-B3, etc.) are not excluded.
On the other hand, "some$str()" of entry "B6" indicates that the expression of original code piece 294 includes the character string "some" and the arbitrary character string "str()", so entry "A1~ None of the formulas in "A3" apply. Therefore, the entry pair (eg, A1-B6) of entries "A1-A3" and entry "B6" is excluded.

なお、手順A2の変形処理として、派生コード片生成部230は、原形コード片294の型が、派生パターン295の元の型と一致しないエントリペアを除外してもよい。例えば、エントリ「A2」の型「boolean」と、エントリ「B1」の型「String」とは不一致なので、エントリペア「A2-B1」は除外される。
一方、エントリ「A1」の型「String」と、エントリ「B4」の型「Object」とは一見すると不一致であるが、型「Object」はStringやbooleanなども含む任意の型を示す特別な型なので、エントリペア「A1-B4」は除外されない。
Note that as the modification process in step A2, the derived code piece generation unit 230 may exclude entry pairs in which the type of the original code piece 294 does not match the original type of the derived pattern 295. For example, the entry pair "A2-B1" is excluded because the type "boolean" of the entry "A2" and the type "String" of the entry "B1" do not match.
On the other hand, the type "String" of entry "A1" and the type "Object" of entry "B4" do not match at first glance, but type "Object" is a special type that indicates any type including String and boolean. Therefore, the entry pair "A1-B4" is not excluded.

(手順A3):除外されなかったエントリペアの夫々について、派生コード片生成部230は、派生パターン295の追加する式に従い、原形コード片294の式から派生コード片296の式を生成する。なお、派生コード片生成部230は、派生パターン295のエントリのうち、優先度が閾値以上のもののみを処理してもよい。この時の閾値は、ユーザにより指定されてもよい。
(手順A4):当該エントリペアの夫々について、派生コード片生成部230は、派生パターン295のソース修正パターンIDを、派生コード片296のソース修正パターンIDに転記する。
(Step A3): For each of the entry pairs that have not been excluded, the derived code fragment generation unit 230 generates an expression of a derived code fragment 296 from the expression of the original code fragment 294 according to the expression added by the derivation pattern 295. Note that the derived code fragment generation unit 230 may process only those entries of the derivation pattern 295 whose priority is equal to or higher than a threshold. The threshold may be specified by the user.
(Step A4): For each of the entry pairs, the derived code fragment generation unit 230 transcribes the source modification pattern ID of the derived pattern 295 into the source modification pattern ID of the derived code fragment 296 .

以下、(手順A1)~(手順A4)により生成された派生コード片296の各エントリを説明する(図6~図8を参照)。
・派生コード片296のエントリ「C1」は、原形コード片294のエントリ「A1」を、派生パターン295のエントリ「B1」の$expに適用(代入)することで生成される。
・派生コード片296のエントリ「C2」は、原形コード片294のエントリ「A1」を、派生パターン295のエントリ「B2」の$expに適用することで生成される。
・派生コード片296のエントリ「C3」は、原形コード片294のエントリ「A3」を、派生パターン295のエントリ「B3」の$expに適用することで生成される。
・派生コード片296のエントリ「C4」は、原形コード片294のエントリ「A1」を、派生パターン295のエントリ「B4」の$expに適用することで生成される。なお、B4の「.$field」は、原形コード片294の型に応じて事前登録されている文字列(ここではString型に応じた「length」)に置き換えられる。
・派生コード片296のエントリ「C5」は、原形コード片294のエントリ「A3」を、派生パターン295のエントリ「B4」の$expに適用することで生成される。なお、B4の「.$field」は、Article型に応じた「title」)に置き換えられる。
Each entry of the derived code piece 296 generated in steps A1 to A4 will be described below (see FIGS. 6 to 8).
- Entry “C1” of derived code piece 296 is generated by applying (substituting) entry “A1” of original code piece 294 to $exp of entry “B1” of derived pattern 295.
- Entry “C2” of derived code piece 296 is generated by applying entry “A1” of original code piece 294 to $exp of entry “B2” of derived pattern 295.
- Entry “C3” of derived code piece 296 is generated by applying entry “A3” of original code piece 294 to $exp of entry “B3” of derived pattern 295.
- Entry “C4” of derived code piece 296 is generated by applying entry “A1” of original code piece 294 to $exp of entry “B4” of derived pattern 295. Note that ".$field" in B4 is replaced with a character string that is pre-registered according to the type of the original code piece 294 (here, "length" according to the String type).
- Entry “C5” of derived code piece 296 is generated by applying entry “A3” of original code piece 294 to $exp of entry “B4” of derived pattern 295. Note that ".$field" in B4 is replaced with "title" according to the Article type.

次に、修正候補生成部240は、情報記憶部290に記憶されているソースファイル群291と、ソース修正パターン292と、不具合箇所候補293と、原形コード片294と、派生コード片296とを読み込み、図9の修正候補群297を生成する(S104)。
具体的には、修正候補生成部240は、不具合箇所候補293の夫々のエントリについて、当該エントリが示すソースファイルの行を、ソース修正パターン292の夫々のエントリの修正方法に従い書き換えることで、修正候補「G1~G5」を生成する。なお、修正候補生成部240は、不具合箇所候補293の夫々のエントリについて、修正候補を1以上生成してもよいし、修正候補を生成しなくてもよい。
Next, the correction candidate generation unit 240 reads the source file group 291, the source correction pattern 292, the defect location candidates 293, the original code piece 294, and the derived code piece 296 stored in the information storage unit 290. , a correction candidate group 297 in FIG. 9 is generated (S104).
Specifically, the correction candidate generating unit 240 generates a correction candidate by rewriting the line of the source file indicated by the entry in each entry of the defect location candidate 293 according to the correction method of each entry of the source correction pattern 292. Generate "G1~G5". Note that the correction candidate generation unit 240 may generate one or more correction candidates for each entry of the defect location candidates 293, or may not generate any correction candidates.

修正候補生成部240は、ソース修正パターン292の修正方法に含まれる、任意の素材コード片を表すプレースホルダに、原形コード片294の任意の式または派生コード片296の任意の式を挿入する。
例えば、図9の修正候補群297のエントリ「G3」として、修正候補生成部240は、図4のソース修正パターン292のエントリ「M1」の修正方法に含まれるプレースホルダ「$newExp」に、図8の派生コード片296のエントリ「C1」の式「isEmpty(name)」を挿入することで、「if ($exp)」から「if (isEmpty(name))」へ書き換える。
The modification candidate generation unit 240 inserts an arbitrary expression of the original code piece 294 or an arbitrary expression of the derived code piece 296 into a placeholder representing an arbitrary material code piece included in the correction method of the source correction pattern 292.
For example, for the entry "G3" in the modification candidate group 297 in FIG. 9, the modification candidate generation unit 240 adds the By inserting the expression "isEmpty(name)" in the entry "C1" of the derived code fragment 296 of No. 8, "if ($exp)" is rewritten to "if (isEmpty(name))".

同様に、修正候補生成部240は、以下の修正候補群297を作成する。
・原形コード片294「name」を挿入したエントリ「G1」
・原形コード片294「data」を挿入したエントリ「G2」
・派生コード片296「name.length」を挿入したエントリ「G4」
・派生コード片296「data.title」を挿入したエントリ「G5」
Similarly, the modification candidate generation unit 240 creates the following modification candidate group 297.
・Entry “G1” where original code piece 294 “name” was inserted
・Entry “G2” where original code piece 294 “data” was inserted
・Entry “G4” with derived code fragment 296 “name.length” inserted
・Entry “G5” with derived code fragment 296 “data.title” inserted

なお、修正候補生成部240は、ソース修正パターン292の修正方法に含まれる、任意の素材コード片を表すプレースホルダに、派生コード片296の式を挿入する際、ソース修正パターン292のソース修正パターンIDを含まないような、派生コード片296のエントリを除外してもよい。つまり、修正候補生成部240は、不具合の箇所を、使用するソース修正パターン292のソース修正パターンIDに合致する派生コード片296に書き換える。 Note that when inserting the expression of the derived code piece 296 into a placeholder representing an arbitrary material code piece included in the correction method of the source correction pattern 292, the correction candidate generation unit 240 uses the source correction pattern of the source correction pattern 292. Entries of derived code pieces 296 that do not include an ID may be excluded. In other words, the modification candidate generation unit 240 rewrites the defective part to the derived code piece 296 that matches the source modification pattern ID of the source modification pattern 292 to be used.

例えば、派生コード片296のエントリ「C3」の「data.getTitle()」は、ソース修正パターンID「M1」に対応づけられていないので、ソース修正パターン292のエントリ「M1」は適用されない。よって、エントリ「C3」はソースコード2行目の(if文の)の修正候補からは除外される。これにより、修正候補の数が減るため、ソースコードの不具合を効率よく取り除くことができる。 For example, "data.getTitle()" in entry "C3" of derived code fragment 296 is not associated with source correction pattern ID "M1", so entry "M1" in source correction pattern 292 is not applied. Therefore, entry "C3" is excluded from the correction candidates for the second line of the source code (in the if statement). This reduces the number of correction candidates, making it possible to efficiently remove defects in the source code.

また、修正候補生成部240は、ソース修正パターン292の修正方法に含まれる、任意の素材コード片を表すプレースホルダに、原形コード片294の式を挿入する際、原形コード片294のエントリの一部を除外してもよい。例えば、修正候補生成部240は、不具合箇所候補293の行番号を、原形コード片294の行番号と比較し、行番号が閾値以上離れているものを除外してもよい。
換言すると、修正候補生成部240は、ソースファイル291Aにおける不具合の箇所を、その箇所から行番号が閾値以内に記載されている原形コード片294に書き換える。この時の閾値は、ユーザにより指定されてもよい。これにより、修正候補の数が減るため、ソースコードの不具合を効率よく取り除くことができる。
In addition, when inserting the expression of the original code piece 294 into a placeholder representing an arbitrary material code piece included in the correction method of the source correction pattern 292, the correction candidate generation unit 240 inserts one of the entries of the original code piece 294. may be excluded. For example, the correction candidate generation unit 240 may compare the line number of the defect location candidate 293 with the line number of the original code piece 294, and exclude those whose line numbers are separated by a threshold value or more.
In other words, the modification candidate generation unit 240 rewrites the defective part in the source file 291A to the original code piece 294 whose line number is within the threshold value from that part. The threshold value at this time may be specified by the user. This reduces the number of correction candidates, making it possible to efficiently remove source code defects.

また、修正候補生成部240は、静的解析やテストによって、修正候補「G1~G5」の夫々の妥当性を評価し、妥当でないと判断した修正候補を修正候補群297から除外してもよい。これにより、修正候補の数が減るため、ソースコードの不具合を効率よく取り除くことができる。 The correction candidate generator 240 may also evaluate the validity of each of the correction candidates "G1 to G5" through static analysis or testing, and remove correction candidates that are determined to be inappropriate from the correction candidate group 297. This reduces the number of correction candidates, making it possible to efficiently remove defects in the source code.

図11は、派生パターン取得処理のフローチャートである。
派生パターン取得処理は、S103で派生コード片296を生成する処理に用いられる派生パターン295をあらかじめ用意する処理である。派生パターン295は、ユーザが手動で派生パターン295を作成してもよいし、計算機が自動で派生パターン295を作成してもよい。図11は自動で派生パターン295を作成する処理の一例である。
図11の派生パターン取得処理は、例えば、ユーザからの指示を契機として開始されてもよく、スケジュールされたタイミングでバッチ処理等により自動的に開始してもよい。例えば、派生パターン取得処理は、プログラム修正処理より前に開始されてもよい。
FIG. 11 is a flowchart of the derived pattern acquisition process.
The derived pattern acquisition process is a process of preparing in advance the derived pattern 295 used in the process of generating the derived code piece 296 in S103. The derived pattern 295 may be created manually by a user, or automatically created by a computer. FIG. 11 is an example of a process for automatically creating a derived pattern 295.
The derived pattern acquisition process in FIG. 11 may be started, for example, in response to an instruction from the user, or may be started automatically by batch processing or the like at a scheduled timing. For example, the derived pattern acquisition process may be started before the program modification process.

まず、原形コード片取得部220は、情報記憶部290に記憶されているソースファイル群291を読み込み、ソースコードに含まれるすべての式と、夫々の式の型とを取得し、原形コード片294を生成する(S111)。 First, the original code piece acquisition unit 220 reads the source file group 291 stored in the information storage unit 290, acquires all expressions included in the source code and the type of each expression, and obtains the original code piece 294. is generated (S111).

次に、派生パターン取得部250は、S111で生成した原形コード片294の式の集合を読み込み、同じソースコードから読み込んだ第1式(第1の原形コード片)を書き換え元の式とし、読み込んだ第2式(第2の原形コード片)を書き換え先の式とする旨の式の書き換え方法を、新たに派生パターン295として生成する(S112)。
例えば、派生パターン取得部250は、以下の(手順B1)~(手順B3)により派生パターン295を生成する。
(手順B1):派生パターン取得部250は、原形コード片294の式のうち、第1式(以下、部分式と呼ぶ)が第2式(以下、全体式と呼ぶ)に含まれるような式の組を取得する。
(手順B2):派生パターン取得部250は、全体式のうち、全体式に含まれる部分式を、任意の式を表すプレースホルダに置換することで、派生パターン295の追加する式を生成する。
Next, the derived pattern acquisition unit 250 reads the set of expressions of the original code piece 294 generated in S111, sets the first expression (first original code piece) read from the same source code as the original expression, and reads it. A method for rewriting an expression that makes the second expression (second original code piece) the expression to be rewritten is newly generated as a derived pattern 295 (S112).
For example, the derived pattern acquisition unit 250 generates the derived pattern 295 by the following (procedure B1) to (procedure B3).
(Step B1): The derived pattern acquisition unit 250 selects an expression in which the first expression (hereinafter referred to as a partial expression) is included in the second expression (hereinafter referred to as an overall expression) among the expressions of the original code piece 294. Get the set of .
(Step B2): The derived pattern acquisition unit 250 generates an expression to be added to the derived pattern 295 by replacing a partial expression included in the entire expression with a placeholder representing an arbitrary expression.

(手順B3):派生パターン取得部250は、部分式の型を、派生パターン295の元の型とする。また、派生パターン取得部250は、任意の式を表すプレースホルダを、派生パターン295の元の式とする。 (Step B3): The derived pattern acquisition unit 250 sets the type of the subexpression to the original type of the derived pattern 295. Further, the derived pattern acquisition unit 250 sets a placeholder representing an arbitrary expression as the original expression of the derived pattern 295.

例えば、図6の原形コード片294において、部分式を「name」、全体式を「name == null」とすることで、派生パターン取得部250は派生パターン295のエントリ「B2」を生成する。
なお、派生パターン取得部250は、ソースファイル群291における全体式の出現頻度等を用いて、派生パターン295の優先度を生成してもよい(出現頻度が高いほど、優先度も高くするなど)。
For example, in the original code piece 294 of FIG. 6, the derived pattern acquisition unit 250 generates the entry "B2" of the derived pattern 295 by setting the partial expression to "name" and the entire expression to "name == null."
Note that the derived pattern acquisition unit 250 may generate the priority of the derived pattern 295 using the appearance frequency of the overall expression in the source file group 291 (for example, the higher the appearance frequency, the higher the priority). .

以上説明したように、本実施形態に係るプログラム修正装置100は、ソースファイル群291のソースコード中に存在する原形コード片294に加え、派生コード片生成部230が生成した派生コード片296も用いて、不具合箇所候補293の示すソースコード中の不具合を含む箇所を書き換えることができる。これにより、原形コード片294のみを用いて不具合を含む箇所を書き換えるプログラム修正装置に比べて、より多くの不具合を取り除くことができる。 As explained above, the program modification device 100 according to the present embodiment uses the derived code piece 296 generated by the derived code piece generation unit 230 in addition to the original code piece 294 existing in the source code of the source file group 291. By doing so, it is possible to rewrite the location containing the defect in the source code indicated by the defect location candidate 293. As a result, more defects can be removed compared to a program correction device that uses only the original code piece 294 to rewrite portions containing defects.

なお、本発明は前記した実施例に限定されるものではなく、さまざまな変形例が含まれる。例えば、前記した実施例は本発明を分かりやすく説明するために詳細に説明したものであり、必ずしも説明した全ての構成を備えるものに限定されるものではない。
また、ある実施例の構成の一部を他の実施例の構成に置き換えることが可能であり、また、ある実施例の構成に他の実施例の構成を加えることも可能である。
また、各実施例の構成の一部について、他の構成の追加・削除・置換をすることが可能である。また、上記の各構成、機能、処理部、処理手段などは、それらの一部または全部を、例えば集積回路で設計するなどによりハードウェアで実現してもよい。
また、前記の各構成、機能などは、プロセッサがそれぞれの機能を実現するプログラムを解釈し、実行することによりソフトウェアで実現してもよい。
Note that the present invention is not limited to the embodiments described above, and includes various modifications. For example, the embodiments described above are described in detail to explain the present invention in an easy-to-understand manner, and the present invention is not necessarily limited to having all the configurations described.
Furthermore, it is possible to replace a part of the configuration of one embodiment with the configuration of another embodiment, and it is also possible to add the configuration of another embodiment to the configuration of one embodiment.
Further, it is possible to add, delete, or replace a part of the configuration of each embodiment with other configurations. Further, each of the above-mentioned configurations, functions, processing units, processing means, etc. may be partially or entirely realized in hardware by, for example, designing an integrated circuit.
Further, each of the configurations, functions, etc. described above may be realized by software by a processor interpreting and executing programs for realizing the respective functions.

各機能を実現するプログラム、テーブル、ファイルなどの情報は、メモリや、ハードディスク、SSD(Solid State Drive)などの記録装置、または、IC(Integrated Circuit)カード、SDカード、DVD(Digital Versatile Disc)などの記録媒体におくことができる。
また、制御線や情報線は説明上必要と考えられるものを示しており、製品上必ずしも全ての制御線や情報線を示しているとは限らない。実際にはほとんど全ての構成が相互に接続されていると考えてもよい。
さらに、各装置を繋ぐ通信手段は、無線LANに限定せず、有線LANやその他の通信手段に変更してもよい。
Information such as programs, tables, and files that realize each function can be stored in memory, recording devices such as hard disks, SSDs (Solid State Drives), IC (Integrated Circuit) cards, SD cards, DVDs (Digital Versatile Discs), etc. can be stored on a recording medium.
Further, the control lines and information lines are shown to be necessary for explanation purposes, and not all control lines and information lines are necessarily shown in the product. In reality, almost all configurations may be considered to be interconnected.
Furthermore, the communication means for connecting each device is not limited to wireless LAN, but may be changed to wired LAN or other communication means.

100 プログラム修正装置
110 プロセッサ
120 主記憶装置
130 補助記憶装置
140 入力装置
150 出力装置
160 通信装置
210 不具合箇所特定部
220 原形コード片取得部
230 派生コード片生成部
240 修正候補生成部
250 派生パターン取得部
290 情報記憶部
291 ソースファイル群
291A ソースファイル
292 ソース修正パターン
293 不具合箇所候補
294 原形コード片
295 派生パターン
296 派生コード片
297 修正候補群
Reference Signs List 100 Program correction device 110 Processor 120 Main storage device 130 Auxiliary storage device 140 Input device 150 Output device 160 Communication device 210 Fault location identification unit 220 Original code piece acquisition unit 230 Derived code piece generation unit 240 Correction candidate generation unit 250 Derived pattern acquisition unit 290 Information storage unit 291 Source file group 291A Source file 292 Source correction pattern 293 Defect location candidate 294 Original code piece 295 Derived pattern 296 Derived code piece 297 Group of correction candidates

Claims (10)

ソースファイルに含まれる式を原形コード片として取得する原形コード片取得部と、
取得した前記原形コード片の式から、式の書き換え方法を示す派生パターンに従い、派生コード片の式を生成する派生コード片生成部と、
前記ソースファイルにおける不具合の箇所を、前記原形コード片または前記派生コード片に書き換える旨のソース修正パターンに従い、前記ソースファイルの修正候補を生成する修正候補生成部と、を備えることを特徴とする
プログラム修正装置。
an original code piece acquisition unit that acquires an expression included in the source file as an original code piece;
a derived code fragment generation unit that generates a derived code fragment formula from the obtained formula of the original code fragment according to a derived pattern indicating a method of rewriting the formula;
A program comprising: a modification candidate generation unit that generates modification candidates for the source file according to a source modification pattern for rewriting a defective part in the source file to the original code piece or the derived code piece. Correction device.
前記派生パターンは、前記式の書き換え方法ごとに式の型を対応づけており、
前記派生コード片生成部は、前記派生パターンの式の型と一致する前記原形コード片の式から、前記派生コード片の式を生成することを特徴とする
請求項1に記載のプログラム修正装置。
The derived pattern associates the type of the expression with each method of rewriting the expression,
The program modification device according to claim 1, wherein the derived code piece generation unit generates the formula of the derived code piece from the formula of the original code piece that matches the type of the formula of the derived pattern.
前記派生パターンは、前記式の書き換え方法ごとに優先度を対応づけており、
前記派生コード片生成部は、優先度が閾値以上の前記派生パターンに従い、前記原形コード片の式から、前記派生コード片の式を生成することを特徴とする
請求項1に記載のプログラム修正装置。
The derived pattern associates a priority with each method of rewriting the expression,
The program modification device according to claim 1, wherein the derived code piece generation unit generates the formula of the derived code piece from the formula of the original code piece according to the derived pattern whose priority is equal to or higher than a threshold value. .
前記派生パターンは、前記式の書き換え方法ごとに前記ソース修正パターンのIDを対応づけており、
前記修正候補生成部は、前記ソースファイルにおける不具合の箇所を、使用する前記ソース修正パターンのIDに合致する前記派生コード片に書き換えることで、前記ソースファイルの修正候補を生成することを特徴とする
請求項1に記載のプログラム修正装置。
The derived pattern associates the ID of the source modification pattern with each method of rewriting the expression,
The correction candidate generation unit generates correction candidates for the source file by rewriting the defective part in the source file with the derived code fragment that matches the ID of the source correction pattern to be used. A program modification device according to claim 1.
前記修正候補生成部は、前記ソースファイルにおける不具合の箇所を、その箇所から行番号が閾値以内に記載されている前記原形コード片に書き換えることで、前記ソースファイルの修正候補を生成することを特徴とする
請求項1に記載のプログラム修正装置。
The correction candidate generation unit generates correction candidates for the source file by rewriting a defective part in the source file to the original code piece whose line number is within a threshold value from the defective part. The program modification device according to claim 1.
前記原形コード片取得部が同じ前記ソースファイルから取得した複数の前記原形コード片のうち、第1の原形コード片を書き換え元の式とし、第2の原形コード片を書き換え先の式とする前記式の書き換え方法を示す前記派生パターンを作成する派生パターン取得部を有することを特徴とする
請求項1に記載のプログラム修正装置。
Of the plurality of original code pieces acquired by the original code piece acquisition unit from the same source file, the first original code piece is used as the source expression to be rewritten, and the second original code piece is used as the rewritten expression. The program correction device according to claim 1, further comprising a derived pattern acquisition unit that creates the derived pattern indicating a method for rewriting an expression.
前記派生パターン取得部は、前記書き換え先の式が前記書き換え元の式を含む前記式の書き換え方法を示す前記派生パターンを作成することを特徴とする
請求項6に記載のプログラム修正装置。
The program modification device according to claim 6, wherein the derived pattern acquisition unit creates the derived pattern indicating a method for rewriting the expression in which the destination expression includes the source expression.
前記ソースファイルから不具合の箇所を特定する不具合箇所特定部を有することを特徴とする
請求項1に記載のプログラム修正装置。
The program correction device according to claim 1, further comprising a defective location identification unit that identifies a defective location from the source file.
プログラム修正装置は、原形コード片取得部と、派生コード片生成部と、修正候補生成部と、を備えており、
前記原形コード片取得部は、ソースファイルに含まれる式を原形コード片として取得し、
前記派生コード片生成部は、取得した前記原形コード片の式から、式の書き換え方法を示す派生パターンに従い、派生コード片の式を生成し、
前記修正候補生成部は、前記ソースファイルにおける不具合の箇所を、前記原形コード片または前記派生コード片に書き換える旨のソース修正パターンに従い、前記ソースファイルの修正候補を生成することを特徴とする
プログラム修正方法。
The program correction device includes an original code piece acquisition unit, a derived code piece generation unit, and a correction candidate generation unit,
The original code piece acquisition unit acquires an expression included in the source file as an original code piece,
The derived code piece generation unit generates an expression of the derived code piece from the acquired expression of the original code piece according to a derivation pattern indicating a method of rewriting the expression,
The correction candidate generation unit generates correction candidates for the source file according to a source correction pattern that rewrites a defective part in the source file to the original code piece or the derived code piece. Method.
コンピュータである前記プログラム修正装置に、請求項9に記載のプログラム修正方法を実行させるための
プログラム修正プログラム。
A program modification program for causing the program modification device, which is a computer, to execute the program modification method according to claim 9.
JP2020082700A 2020-05-08 2020-05-08 Program modification device, program modification method, and program modification program Active JP7456843B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2020082700A JP7456843B2 (en) 2020-05-08 2020-05-08 Program modification device, program modification method, and program modification program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2020082700A JP7456843B2 (en) 2020-05-08 2020-05-08 Program modification device, program modification method, and program modification program

Publications (2)

Publication Number Publication Date
JP2021177343A JP2021177343A (en) 2021-11-11
JP7456843B2 true JP7456843B2 (en) 2024-03-27

Family

ID=78409525

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2020082700A Active JP7456843B2 (en) 2020-05-08 2020-05-08 Program modification device, program modification method, and program modification program

Country Status (1)

Country Link
JP (1) JP7456843B2 (en)

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2013134573A (en) 2011-12-26 2013-07-08 Nec Corp Software correction device, software correction system, software correction method and software correction program
JP2019096292A (en) 2017-11-24 2019-06-20 富士通株式会社 Automated selection of software program repair candidate

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2013134573A (en) 2011-12-26 2013-07-08 Nec Corp Software correction device, software correction system, software correction method and software correction program
JP2019096292A (en) 2017-11-24 2019-06-20 富士通株式会社 Automated selection of software program repair candidate

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
松下 誠,「プログラム書き換えのための「プログラム修正パターン」記述」,情報処理学会シンポジウムシリーズ Vol.2006, No.2 ウィンターワークショップ2006・イン・鴨川 論文集,社団法人情報処理学会,2006年01月25日,pp.55-56
鷲見 創一 外2名,「自動バグ修正における対応可能バグ数の拡充に向けて ~大規模データセットを用いるアプローチのフィージビリティ調査~」,電子情報通信学会技術研究報告,一般社団法人電子情報通信学会,2015年07月15日,第115巻, 第154号,pp.131-136

Also Published As

Publication number Publication date
JP2021177343A (en) 2021-11-11

Similar Documents

Publication Publication Date Title
US8140907B2 (en) Accelerated virtual environments deployment troubleshooting based on two level file system signature
Zhang et al. Which configuration option should I change?
US10255086B2 (en) Determining optimal methods for creating virtual machines
US20140380279A1 (en) Prioritizing test cases using multiple variables
US20130290937A1 (en) Efficient extraction of software dependencies from program code
GB2508643A (en) Method for Performing a Regression Test after Modifying Source Code File
JP6440895B2 (en) Software analysis apparatus and software analysis method
US11194703B2 (en) System testing infrastructure for analyzing soft failures in active environment
JP4586864B2 (en) Automatic property generator
JP7456843B2 (en) Program modification device, program modification method, and program modification program
US10481969B2 (en) Configurable system wide tests
JP7504775B2 (en) Computer system, program, and program correction method
JP5578625B2 (en) Program analysis apparatus, program analysis method, and program
US11593256B2 (en) System testing infrastructure for detecting soft failure in active environment
JP7380851B2 (en) Test script generation device, test script generation method and program
CN110399156B (en) On-orbit upgrading method for aerospace software
WO2012104991A1 (en) Program test method, program test system, and program
JP2024003945A (en) Program correction device, program correction method, and program correction program
JP6748357B2 (en) Analysis device, analysis program, and analysis method
JP6954806B2 (en) Defect detection device and defect detection method
JP2023003882A (en) Failure place specification support device and failure place specification support method
US20240193072A1 (en) Autosuggestion of involved code paths based on bug tracking data
US9665454B2 (en) Extracting test model from textual test suite
JP7420269B2 (en) Bug detection support device, bug detection support method, and bug detection support program
JP2018147114A (en) Test case generation method, computer, and program

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20230209

TRDD Decision of grant or rejection written
A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20240229

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

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20240305

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20240314

R150 Certificate of patent or registration of utility model

Ref document number: 7456843

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150