JP7504775B2 - Computer system, program, and program correction method - Google Patents

Computer system, program, and program correction method Download PDF

Info

Publication number
JP7504775B2
JP7504775B2 JP2020189291A JP2020189291A JP7504775B2 JP 7504775 B2 JP7504775 B2 JP 7504775B2 JP 2020189291 A JP2020189291 A JP 2020189291A JP 2020189291 A JP2020189291 A JP 2020189291A JP 7504775 B2 JP7504775 B2 JP 7504775B2
Authority
JP
Japan
Prior art keywords
correction
acquisition range
management information
computer
defect
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
JP2020189291A
Other languages
Japanese (ja)
Other versions
JP2022078548A (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 JP2020189291A priority Critical patent/JP7504775B2/en
Publication of JP2022078548A publication Critical patent/JP2022078548A/en
Application granted granted Critical
Publication of JP7504775B2 publication Critical patent/JP7504775B2/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 contained in source files.

ソフトウェア開発において、プログラムに故障(開発者の意図と異なる動作)が発生した場合、開発者は当該故障が発生しないようにプログラムを修正する。プログラムの故障を引き起こす原因を不具合(欠陥及びバグ等)と呼ぶ。プログラムのソースファイルから不具合を含む箇所を特定し、当該箇所を改変することで不具合を取り除く作業をデバッグと呼ぶ。デバッグには、開発者の意図する動作を表したテストファイルを用いることが多い。 In software development, if a program malfunctions (behavior different from what the developer intended), the developer modifies the program to prevent the malfunction from occurring. The cause of a program malfunction is called a defect (flaw, bug, etc.). The process of identifying the part of the program source file that contains the malfunction and removing the malfunction by modifying that part is called debugging. Debugging often involves using test files that represent the behavior intended by the developer.

通常、開発者は手作業でデバッグを行うため、デバッグには長い時間を要するという問題がある。そこで、非特許文献1には、デバッグを自動化する技術が開示されている。 Normally, developers perform debugging manually, which can take a long time. Therefore, Non-Patent Document 1 discloses a technology for automating debugging.

非特許文献1に記載された技術は、ソースファイルから不具合を含む箇所を特定し(fault localization)、当該箇所を書き換える(patch generation)ことで、不具合を修正する技術である。この技術は、修正パターン(fix pattern)に従い、不具合を含む箇所のコード片を、デバッグ対象のソースファイル中の別の箇所に存在する正しい素材コード片(donor code)に変更するものである。 The technology described in Non-Patent Document 1 is a technology that identifies the location containing the fault from the source file (fault localization) and fixes the fault by rewriting that location (patch generation). This technology follows a fix pattern (fix pattern) and changes the code fragment containing the fault to a correct donor code fragment that exists in another location in the source file to be debugged.

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 technology described in Non-Patent Document 1, if the correct raw code fragment does not exist in the source file to be debugged, the part containing the defect cannot be rewritten correctly, and the defect cannot be removed.

また、デバッグ対象のソースファイルとは異なるソースファイル及びテストファイルから素材コード片を抽出した場合、抽出された素材コード片はデバッグ対象のソースファイルには適合しないことが多い。そのため、単に、不具合を取り除けない不正解の素材コード片が増えるだけで、デバッグの効率化に寄与せず、むしろ不正解の素材コード片を除外するための時間を要してしまう。 In addition, if raw code fragments are extracted from source files and test files that are different from the source file to be debugged, the extracted raw code fragments often do not match the source file to be debugged. As a result, the number of incorrect raw code fragments that cannot remove defects simply increases, which does not contribute to the efficiency of debugging, and instead takes time to remove the incorrect raw code fragments.

すなわち、素材コード片の取得範囲が狭いと、不具合を取り除ける可能性が低いという問題があり、素材コード片の取得範囲が広いと、不正解の素材コード片が増え、デバッグの効率化が低くなるという問題がある。従って、デバッグの精度及び効率の両方を向上させること難しい。 In other words, if the range of source code fragments is narrow, there is a problem that the possibility of eliminating the defect is low, and if the range of source code fragments is wide, there is a problem that the number of incorrect source code fragments increases, resulting in low debugging efficiency. Therefore, it is difficult to improve both the accuracy and efficiency of debugging.

本発明は、高い精度でかつ効率的なデバッグを実現することを目的とする。 The purpose of the present invention is to achieve highly accurate and efficient debugging.

本願において開示される発明の代表的な一例を示せば以下の通りである。すなわち、プロセッサ及び前記プロセッサに接続される記憶装置を有する計算機を少なくとも一つ備える計算機システムであって、複数のソースファイル、前記ソースファイルを検査するために用いる、複数のテストファイル、及び、前記ソースファイルに含まれる不具合の修正方法を定義した修正パターンを管理する修正パターン管理情報と、前記修正パターンの識別情報、及び当該修正パターンに対して指定された取得範囲を対応づけたデータを格納する取得範囲管理情報と、を管理し、前記少なくとも一つの計算機は、ターゲットソースファイル及び当該ターゲットソースファイルに対応する前記テストファイルを用いて、前記ターゲットソースファイルの不具合が含まれる可能性がある箇所を特定する第1処理と、指定された取得範囲に基づいて、前記複数のソースファイル及び前記複数のテストファイルから素材コード片を取得し、前記記憶装置に格納する第2処理と、前記修正パターン及び前記素材コード片に基づいて、前記不具合を取り除くための改変内容を示す修正候補を生成し、前記修正候補を前記記憶装置に格納する第3処理と、を実行し、前記少なくとも一つの計算機は、前記第2処理において、前記修正パターン管理情報から前記修正パターンを選択し、前記取得範囲管理情報を参照して、前記選択された修正パターンに対応付けられる前記取得範囲に基づいて、前記複数のソースファイル及び前記複数のテストファイルから、命令及び式を前記素材コード片として取得する。 A representative example of the invention disclosed in the present application is as follows: That is, a computer system including at least one computer having a processor and a storage device connected to the processor manages a plurality of source files, a plurality of test files used to check the source files, and modification pattern management information for managing modification patterns defining a method of correcting defects contained in the source files , and acquisition range management information for storing identification information of the modification patterns and data correlating the acquisition ranges specified for the modification patterns, and the at least one computer detects a portion of the target source file that may contain a defect using a target source file and the test file corresponding to the target source file. a first process of identifying a defect, a second process of acquiring material code fragments from the plurality of source files and the plurality of test files based on a specified acquisition range and storing them in the storage device, and a third process of generating correction candidates indicating modifications to be made to remove the defect based on the correction pattern and the material code fragments and storing the correction candidates in the storage device , wherein in the second process, the at least one computer selects the correction pattern from the correction pattern management information, and, with reference to the acquisition range management information, acquires instructions and expressions as the material code fragments from the plurality of source files and the plurality of test files based on the acquisition range associated with the selected correction pattern .

本発明によれば、高い精度でかつ効率的なデバッグを実現できる。上記した以外の課題、構成及び効果は、以下の実施例の説明により明らかにされる。 The present invention makes it possible to achieve highly accurate and efficient debugging. Problems, configurations, and advantages other than those described above will become clear from the description of the following embodiments.

実施例1のプログラム修正装置のハードウェア構成の一例を示す図である。FIG. 2 illustrates an example of a hardware configuration of a program modifying device according to a first embodiment. 実施例1のプログラム修正装置の機能構成の一例を示す図である。FIG. 2 is a diagram illustrating an example of a functional configuration of a program correction device according to a first embodiment. 実施例1のソースファイル管理情報の一例を示す図である。FIG. 4 is a diagram illustrating an example of source file management information according to the first embodiment. 実施例1のテストファイル管理情報の一例を示す図である。FIG. 13 is a diagram illustrating an example of test file management information according to the first embodiment. 実施例1の不具合箇所候補管理情報の一例を示す図である。FIG. 11 is a diagram illustrating an example of defect part candidate management information according to the first embodiment. 実施例1の修正パターン管理情報の一例を示す図である。FIG. 4 is a diagram illustrating an example of correction pattern management information according to the first embodiment. 実施例1の取得範囲管理情報の一例を示す図である。FIG. 11 is a diagram illustrating an example of acquisition range management information according to the first embodiment. 実施例1の素材コード片管理情報の一例を示す図である。FIG. 11 is a diagram showing an example of material code piece management information according to the first embodiment; 実施例1の修正候補管理情報の一例を示す図である。FIG. 13 is a diagram illustrating an example of correction candidate management information according to the first embodiment. 実施例1の修正結果の一例を示す図である。FIG. 13 is a diagram illustrating an example of a correction result in the first embodiment. 実施例1のプログラム修正装置が実行するプログラム修正処理を説明するフローチャートである。1 is a flowchart illustrating a program correction process executed by the program correction device according to the first embodiment.

以下、図面を参照しつつ、本実施例について説明する。ただし、本発明は以下に示す実施例の記載内容に限定して解釈されるものではない。本発明の思想ないし趣旨から逸脱しない範囲で、その具体的構成を変更し得ることは当業者であれば容易に理解される。 The present embodiment will be described below with reference to the drawings. However, the present invention should not be interpreted as being limited to the description of the embodiment shown below. It will be easily understood by those skilled in the art that the specific configuration can be changed without departing from the concept or purpose of the present invention.

以下の説明において、同一の又は類似する構成について同一の符号を付して、重複した説明を省略することがある。 In the following description, identical or similar components will be given the same reference symbols, and duplicate descriptions may be omitted.

本明細書等における「第1」、「第2」、「第3」等の表記は、構成要素を識別するために付するものであり、必ずしも、数又は順序を限定するものではない。 The terms "first," "second," "third," and the like used in this specification are used to identify components and do not necessarily limit the number or order.

図1は、実施例1のプログラム修正装置のハードウェア構成の一例を示す図である。 Figure 1 is a diagram showing an example of the hardware configuration of a program correction device according to the first embodiment.

プログラム修正装置100は、プロセッサ110、主記憶装置120、補助記憶装置130、入力装置140、出力装置150、及び通信装置160を備える。これらは図示しないバス等の通信手段を介して互いに通信可能に接続されている。 The program correction device 100 includes a processor 110, a main memory device 120, an auxiliary memory device 130, an input device 140, an output device 150, and a communication device 160. These are connected to each other so that they can communicate with each other via a communication means such as a bus (not shown).

プロセッサ110は、例えば、CPU(Central Processing Unit)やMPU(Micro Processing Unit)等を用いて構成される。プロセッサ110は、主記憶装置120に格納されているプログラムを読み出して実行する。プロセッサ110がプログラムに従って処理を実行することによって、特定の機能を実現する機能部として動作する。以下の説明では、機能部を主語に処理を説明する場合、プロセッサ110が機能部を実現するプログラムを実行していることを示す。 The processor 110 is configured using, for example, a CPU (Central Processing Unit) or an MPU (Micro Processing Unit). The processor 110 reads and executes a program stored in the main memory device 120. The processor 110 operates as a functional unit that realizes a specific function by executing processing according to the program. In the following explanation, when the processing is explained using the functional unit as the subject, it indicates that the processor 110 is executing a program that realizes the functional unit.

主記憶装置120は、プロセッサ110が実行するプログラム及びプログラムが使用するデータを記憶する記憶装置であり、例えば、ROM(Read Only Memory)、RAM(Random Access Memory)、不揮発性半導体メモリ(Non Volatile RAM)等である。主記憶装置120に格納されるプログラムについては図2を用いて説明する。 The main memory 120 is a storage device that stores the programs executed by the processor 110 and the data used by the programs, and is, for example, a read only memory (ROM), a random access memory (RAM), or a non-volatile semiconductor memory (Non Volatile RAM). The programs stored in the main memory 120 will be described with reference to FIG. 2.

補助記憶装置130は、永続的にデータを記憶する大容量の記憶装置であり、例えば、ハードディスクドライブ、SSD(Solid State Drive)、CD(Compact Disc)及びDVD(Digital Versatile Disc)等の光学式記憶装置、並びに、ICカード、SDメモリカード、及び光学式記録媒体等の記録媒体の読取/書込装置等である。補助記憶装置130に格納されているプログラム及びデータは主記憶装置120に随時読み込まれる。なお、外部に接続されるストレージシステム及びクラウドサーバにより提供される記憶領域等を補助記憶装置130の代わりに用いてもよい。 The auxiliary storage device 130 is a large-capacity storage device that permanently stores data, such as a hard disk drive, an SSD (Solid State Drive), an optical storage device such as a CD (Compact Disc) or a DVD (Digital Versatile Disc), and a read/write device for recording media such as an IC card, an SD memory card, and an optical recording medium. The programs and data stored in the auxiliary storage device 130 are loaded into the main storage device 120 as needed. Note that a storage area provided by an externally connected storage system or a cloud server may be used instead of the auxiliary storage device 130.

入力装置140は、ユーザからの各種情報の入力を受け付けるインタフェースであり、例えば、キーボード、マウス、タッチパネル、カードリーダ、及び音声入力装置等である。出力装置150は、ユーザに処理経過及び処理結果等の各種情報を提供するユーザインタフェースであり、例えば、液晶モニタ、LCD(Liquid Crystal Display)、及びグラフィックカード等の画面表示装置、スピーカ等の音声出力装置、並びに印字装置等である。なお、プログラム修正装置100が通信装置160を介して他の装置との間で情報の入力や出力を行う構成としてもよい。 The input device 140 is an interface that accepts various information input from the user, and is, for example, a keyboard, a mouse, a touch panel, a card reader, and a voice input device. The output device 150 is a user interface that provides the user with various information such as the process progress and the process results, and is, for example, a screen display device such as a liquid crystal monitor, LCD (Liquid Crystal Display), and a graphics card, a voice output device such as a speaker, and a printer. The program correction device 100 may be configured to input and output information to and from other devices 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), a wireless communication module, a USB (Universal Serial Interface) module, and a serial communication module.

ここで、本実施例で使用する用語を定義する。 Here we define the terms used in this example.

「ソースコード」は、ソフトウェア開発の対象となるプログラムである。ソースコードには、開発者の意図と異なる動作を引き起こす不具合を含む場合がある。 "Source code" is the program that is the subject of software development. Source code may contain defects that cause the software to behave differently than the developer intended.

「メソッド」は、ソースコードをまとまった処理の単位で分割したものである。ソースコードは、1つ以上のメソッドを含む。メソッドは、1つ以上の命令(Statement)を含む。命令は、0以上の式(Expression)を含む。命令及び式をあわせて「コード片」と呼ぶ。 A "method" is a division of source code into a unit of processing. Source code contains one or more methods. A method contains one or more instructions (Statement). An instruction contains zero or more expressions (Expression). Instructions and expressions together are called a "piece of code."

「テストコード」は、ソースコードの動作を検査するプログラムである。テストコードは、開発者が意図するソースコードの動作を含む。 "Test code" is a program that checks the behavior of source code. Test code contains the behavior of the source code intended by the developer.

「テストメソッド」は、テストコードをまとまった処理の単位で分割したものである。テストメソッドは1つのメソッドの動作を検査するプログラムである。テストコードは、1つ以上のテストメソッドを含む。あるメソッドを検査するテストメソッドを、そのメソッドの「対応テストメソッド」と呼ぶ。1つのメソッドに2つ以上の対応テストメソッドが存在してもよい。 A "test method" is test code divided into units of coherent processing. A test method is a program that checks the behavior of a single method. Test code contains one or more test methods. A test method that checks a certain method is called the "corresponding test method" of that method. A single method may have two or more corresponding test methods.

「素材コード片」は、ソースコード及びテストコードのいずれかから取得したコード片である。実施例1では、ソースコードの不具合を含む可能性がある箇所(行)を、素材コード片を用いて改変することによってプログラムの修正を図る。このとき、正解の素材コード片を用いて改変することができればプログラムを修正できる。 A "raw code fragment" is a fragment of code obtained from either the source code or the test code. In the first embodiment, the program is corrected by modifying a portion (line) of the source code that may contain a defect using the raw code fragment. At this time, if the modification can be performed using the correct raw code fragment, the program can be corrected.

本明細書では、不具合を含む可能性がある箇所を不具合箇所候補と記載する。 In this specification, areas that may contain defects are referred to as potential defect areas.

図2は、実施例1のプログラム修正装置の機能構成の一例を示す図である。 Figure 2 is a diagram showing an example of the functional configuration of the program correction device of Example 1.

プログラム修正装置100は、不具合箇所特定部210、素材コード片取得部220、修正候補生成部230、及び修正候補検査部240を備える。プロセッサ110は、主記憶装置120に格納されるプログラム(プログラム修正プログラム)を実行することによって、各機能部として動作する。各機能部の具体的な処理については図11を用いて説明する。 The program correction device 100 includes a defect location identification unit 210, a raw code fragment acquisition unit 220, a correction candidate generation unit 230, and a correction candidate inspection unit 240. The processor 110 operates as each functional unit by executing a program (program correction program) stored in the main memory device 120. The specific processing of each functional unit will be described with reference to FIG. 11.

また、プログラム修正装置100は情報記憶部290を備える。情報記憶部290は、補助記憶装置130により実現される。 The program correction device 100 also includes an information storage unit 290. The information storage unit 290 is realized by the auxiliary storage device 130.

情報記憶部290は、ソースファイル管理情報291、テストファイル管理情報292、不具合箇所候補管理情報293、修正パターン管理情報294、取得範囲管理情報295、素材コード片管理情報296、修正候補管理情報297、及び修正結果298を記憶する。情報記憶部290に記憶される各種情報の詳細については図3から図10を用いて説明する。 The information storage unit 290 stores source file management information 291, test file management information 292, defect location candidate management information 293, correction pattern management information 294, acquisition range management information 295, material code piece management information 296, correction candidate management information 297, and correction result 298. Details of the various information stored in the information storage unit 290 will be described using Figures 3 to 10.

図3は、実施例1のソースファイル管理情報291の一例を示す図である。 Figure 3 shows an example of source file management information 291 in Example 1.

ソースファイル管理情報291は、1つ以上のソースフォルダ310を含む。ソースフォルダ310は、1つ以上のソースファイル320を含む。ソースファイル320は、1つ以上の行から構成されるソースコードを含む。 The source file management information 291 includes one or more source folders 310. The source folders 310 include one or more source files 320. The source files 320 include source code consisting of one or more lines.

図3には、ファイル名が「File1」であるソースファイル320を含む、フォルダ名が「dir1」であるソースフォルダ310を示している。ソースファイル320は、7行から構成され、1行目から7行目に「create」という名前のメソッドを含む。 Figure 3 shows a source folder 310 with the folder name "dir1" that contains a source file 320 with the file name "File1". The source file 320 is made up of seven lines, and contains a method named "create" in lines 1 to 7.

なお、ソースフォルダ310は、1つ以上の他のソースフォルダ310を含んでもよい。 Note that a source folder 310 may contain one or more other source folders 310.

なお、ソースコードは、Java(登録商標、以下同じ)及びC++等のプログラミング言語、又は、その他の任意のプログラミング言語を用いて記述される。 The source code is written in a programming language such as Java (registered trademark, the same applies below) or C++, or any other programming language.

図3に示すソースファイル320のソースコードは5行目に不具合を含む。当該不具合を取り除くためには、5行目に命令「createDirs(name);」を挿入すればよい。 The source code of source file 320 shown in FIG. 3 contains a defect on line 5. To remove the defect, the command "createDirs(name);" can be inserted on line 5.

図4は、実施例1のテストファイル管理情報292の一例を示す図である。 Figure 4 shows an example of test file management information 292 in Example 1.

テストファイル管理情報292は、1つ以上のテストフォルダ410を含む。テストフォルダ410は、1以上のテストファイル420を含む。テストファイル420は、1つ以上の行から構成されるテストコードを含む。 The test file management information 292 includes one or more test folders 410. The test folder 410 includes one or more test files 420. The test file 420 includes test code consisting of one or more lines.

図4には、ファイル名が「FileTest」であるテストファイル420を含む、フォルダ名が「dir1」であるテストフォルダ410を示している。テストファイル420は、14行から構成され、1行目から5行目に「testCreate1」という名前のテストメソッドを含み、7行目から14行目に「testCreate2」という名前のテストメソッドを含む。テストメソッド「testCreate1」及びテストメソッド「testCreate2」は共に、ソースファイル320に含まれるメソッド「create」の対応テストメソッドである。 Figure 4 shows a test folder 410 with the folder name "dir1" that contains a test file 420 with the file name "FileTest". Test file 420 is made up of 14 lines, and contains a test method named "testCreate1" from lines 1 to 5, and a test method named "testCreate2" from lines 7 to 14. Both test methods "testCreate1" and "testCreate2" are test methods corresponding to the method "create" contained in source file 320.

テストファイル420のテストコードの9行目から11行目には、ソースファイル320に含まれるメソッド「create」が命令「createDirs(name);」を実行する、という開発者の意図が含まれる。 Lines 9 to 11 of the test code in test file 420 contain the developer's intent that the method "create" contained in source file 320 executes the command "createDirs(name);".

図5は、実施例1の不具合箇所候補管理情報293の一例を示す図である。 Figure 5 shows an example of defect candidate management information 293 for Example 1.

不具合箇所特定部210は、ソースファイル管理情報291及びテストファイル管理情報292を入力として受け付け、不具合箇所候補管理情報293を出力する。 The defect location identification unit 210 accepts source file management information 291 and test file management information 292 as input, and outputs defect location candidate management information 293.

不具合箇所候補管理情報293は、ファイル名501、行番号502、及び疑わしさ503から構成されるエントリを1つ以上含む。1つのエントリは1つの不具合箇所候補に対応する。 The defect candidate management information 293 includes one or more entries each consisting of a file name 501, a line number 502, and a suspiciousness 503. One entry corresponds to one defect candidate.

ファイル名501は、不具合を含む可能性のあるソースファイル320のファイル名を格納するカラムである。 File name 501 is a column that stores the file name of the source file 320 that may contain a defect.

行番号502は、ソースファイル320の不具合箇所候補を表す行の番号を格納するカラムである。 Line number 502 is a column that stores the line number that represents the potential defect location in source file 320.

疑わしさ503は、不具合を含む可能性を示す値を格納するカラムである。本実施例では、0から1までの間の実数が疑わしさ503に格納される。値が1に近いほど、不具合を含む可能性が高いことを示す。 Suspicion 503 is a column that stores a value indicating the possibility of including a defect. In this embodiment, a real number between 0 and 1 is stored in suspicion 503. The closer the value is to 1, the more likely it is that a defect is included.

エントリの各カラムに格納される値は、ソースファイル320の不具合箇所候補を特定するための情報である。 The values stored in each column of an entry are information for identifying potential defect locations in source file 320.

なお、不具合箇所が一意に特定できるならば、エントリは、ファイル名501、行番号502、及び疑わしさ503の全てを含まなくてもよい。 Note that if the defective location can be uniquely identified, the entry does not need to include all of the file name 501, line number 502, and suspiciousness 503.

図6は、実施例1の修正パターン管理情報294の一例を示す図である。 Figure 6 is a diagram showing an example of correction pattern management information 294 in Example 1.

修正パターン管理情報294は、修正パターンを管理するための情報である。ここで、修正パターンは、不具合を含むソースファイル320から修正候補を作成するための方法を示す情報である。 The correction pattern management information 294 is information for managing correction patterns. Here, a correction pattern is information that indicates a method for creating correction candidates from a source file 320 that contains a defect.

修正パターン管理情報294は、修正パターンID601及び修正方法602から構成されるエントリを1つ以上含む。1つのエントリは1つの修正パターンに対応する。 The correction pattern management information 294 includes one or more entries each consisting of a correction pattern ID 601 and a correction method 602. One entry corresponds to one correction pattern.

修正パターンID601は、修正パターンを一意に識別するためのIDを格納するカラムである。 Correction pattern ID 601 is a column that stores an ID for uniquely identifying a correction pattern.

修正方法602は、修正方法を格納するカラムである。例えば、修正パターンID601が「1」のエントリの修正方法602には、不具合箇所候補に含まれる任意の式を、別の式に書き換える修正方法が格納される。また、修正パターンID601が「2」のエントリの修正方法602には、不具合箇所候補に、別の命令を挿入する修正方法が格納される。 The correction method 602 is a column that stores the correction method. For example, the correction method 602 of an entry with a correction pattern ID 601 of "1" stores a correction method of rewriting an arbitrary expression included in the defective part candidate to a different expression. Also, the correction method 602 of an entry with a correction pattern ID 601 of "2" stores a correction method of inserting a different instruction into the defective part candidate.

修正パターン管理情報294は、人手によって生成されてもよいし、過去のデバッグにおける修正方法の履歴情報から機械的に生成されてもよい。 The correction pattern management information 294 may be generated manually or mechanically from historical information on correction methods used in past debugging.

なお、図6の修正パターン管理情報294の修正方法602に含まれる「$exp」は、ソースコードに含まれる任意の式を表すプレースホルダであり、「$exp」以外の文字列を用いてもよい。また、図6の修正パターン管理情報294の修正方法602に含まれる「$newExp」は、任意の素材コード片の式を表すプレースホルダであり、「$newExp」以外の文字列を用いてもよい。また、図6の修正パターン管理情報294の修正方法602に含まれる「$newStmt」は、任意の素材コード片の命令を表すプレースホルダであり、「$newStmt」以外の文字列を用いてもよい。 Note that "$exp" included in the modification method 602 of the modification pattern management information 294 in FIG. 6 is a placeholder that represents any expression included in the source code, and a character string other than "$exp" may be used. Also, "$newExp" included in the modification method 602 of the modification pattern management information 294 in FIG. 6 is a placeholder that represents an expression of any material code fragment, and a character string other than "$newExp" may be used. Also, "$newStmt" included in the modification method 602 of the modification pattern management information 294 in FIG. 6 is a placeholder that represents a command of any material code fragment, and a character string other than "$newStmt" may be used.

図7は、実施例1の取得範囲管理情報295の一例を示す図である。 Figure 7 is a diagram showing an example of acquisition range management information 295 in Example 1.

取得範囲管理情報295は、素材コード片の取得範囲を定義した情報である。修正パターンID701、取得範囲702、及び優先度703から構成されるエントリを1つ以上含む。1つのエントリは1つの取得範囲に対応する。 The acquisition range management information 295 is information that defines the acquisition range of a material code fragment. It includes one or more entries each consisting of a correction pattern ID 701, an acquisition range 702, and a priority 703. One entry corresponds to one acquisition range.

修正パターンID701は修正パターンID601と同一のカラムである。 Correction pattern ID 701 is the same column as correction pattern ID 601.

取得範囲702は、素材コード片を取得する取得範囲を示す値を格納するカラムである。実施例1の取得範囲702には、「同一メソッド」、「同一ファイル」、及び「対応テストメソッド」のいずれかが格納される。「同一メソッド」は不具合箇所候補を含むメソッドを表し、「同一ファイル」は不具合箇所候補を含むソースファイル320を表し、「対応テストメソッド」は不具合箇所候補を含むメソッドの対応テストメソッドを表す。 Acquisition range 702 is a column that stores values indicating the acquisition range from which the source code fragment is acquired. In Example 1, acquisition range 702 stores either "same method", "same file", or "corresponding test method". "Same method" represents a method that includes a potential defect location, "same file" represents a source file 320 that includes a potential defect location, and "corresponding test method" represents a corresponding test method for a method that includes a potential defect location.

優先度703は、任意の修正方法に使用する素材コード片の取得範囲の優先順位を示す値(優先度)を格納するカラムである。実施例1では、正解の素材コード片が含まれる可能性が高い取得範囲には大きい優先度が設定され、優先度が大きい順に素材コード片が使用される。各エントリの優先度703には、例えば、初期値として「0」が設定される。 Priority 703 is a column that stores a value (priority) indicating the priority order of the acquisition range of material code fragments to be used for a given correction method. In Example 1, a high priority is set for an acquisition range that is more likely to contain a correct material code fragment, and material code fragments are used in descending order of priority. For example, the priority 703 of each entry is set to "0" as an initial value.

なお、取得範囲702には、「同一メソッド」、「同一ファイル」、及び「対応テストメソッド」以外の取得範囲を示す値が格納されてもよい。例えば、不具合箇所を含むソースファイル320を含むソースフォルダ310の他のソースファイル320が指定範囲として指定されてもよい。 In addition, the acquisition range 702 may store a value indicating an acquisition range other than "same method", "same file", and "corresponding test method". For example, other source files 320 in the source folder 310 that contains the source file 320 that contains the defective part may be specified as the specified range.

図8は、実施例1の素材コード片管理情報296の一例を示す図である。 Figure 8 shows an example of material code piece management information 296 in Example 1.

素材コード片取得部220は、ソースファイル管理情報291、テストファイル管理情報292、及び不具合箇所候補管理情報293を入力として受け付け、素材コード片管理情報296を出力する。 The material code fragment acquisition unit 220 accepts source file management information 291, test file management information 292, and defect location candidate management information 293 as input, and outputs material code fragment management information 296.

素材コード片管理情報296は、素材コード片801及び取得範囲802から構成されるエントリを1つ以上含む。1つのエントリは1つの素材コード片に対応する。 The material code fragment management information 296 includes one or more entries each consisting of a material code fragment 801 and an acquisition range 802. One entry corresponds to one material code fragment.

素材コード片801は、ソースファイル管理情報291及びテストファイル管理情報292のいずれかから取得された素材コード片を格納するカラムである。 Material code fragment 801 is a column that stores material code fragments obtained from either source file management information 291 or test file management information 292.

取得範囲802は取得範囲702と同一のカラムである。 Acquisition range 802 is the same column as acquisition range 702.

図9は、実施例1の修正候補管理情報297の一例を示す図である。 Figure 9 shows an example of correction candidate management information 297 in Example 1.

修正候補生成部230は、ソースファイル管理情報291、不具合箇所候補管理情報293、修正パターン管理情報294、及び素材コード片管理情報296を入力として受け付け、修正候補管理情報297を出力する。 The correction candidate generation unit 230 accepts as input source file management information 291, defect location candidate management information 293, correction pattern management information 294, and material code fragment management information 296, and outputs correction candidate management information 297.

修正候補管理情報297は、修正候補901、修正パターンID902、及び取得範囲903から構成されるエントリを1つ以上含む。1つのエントリは1つの修正候補に対応する。 The correction candidate management information 297 includes one or more entries each consisting of a correction candidate 901, a correction pattern ID 902, and an acquisition range 903. One entry corresponds to one correction candidate.

修正候補901は、修正パターン及び素材コード片に基づいて、不具合箇所候補の書き換え内容等を示すデータ、すなわち、修正候補を格納するカラムである。改変が行われたソースコード全体を修正候補としてもよいし、改変が行われたソースコードの改変部分のみを修正候補としてもよい。図9の修正候補管理情報297には、ファイル名「File1」のソースファイル320の5行目の不具合を取り除くための修正候補に対応するエントリ911、912、913が格納される。 Correction candidates 901 is a column that stores data indicating the rewrite contents of the defect candidate based on the correction pattern and the source code fragment, i.e., correction candidates. The entire modified source code may be the correction candidate, or only the modified part of the modified source code may be the correction candidate. Correction candidate management information 297 in FIG. 9 stores entries 911, 912, and 913 corresponding to correction candidates for removing the defect on line 5 of source file 320 with file name "File1".

修正パターンID902及び取得範囲903は、修正パターンID701及び取得範囲702と同一のカラムである。 Correction pattern ID 902 and acquisition range 903 are in the same columns as correction pattern ID 701 and acquisition range 702.

図10は、実施例1の修正結果298の一例を示す図である。 Figure 10 shows an example of the correction result 298 of Example 1.

修正候補検査部240は、テストファイル管理情報292及び修正候補管理情報297を入力として受け付け、修正結果298を出力する。 The correction candidate inspection unit 240 accepts test file management information 292 and correction candidate management information 297 as input, and outputs the correction result 298.

修正結果298は、修正候補管理情報297に格納される修正候補を検査した結果、不具合が取り除かれたことが確認された修正候補である。 The correction result 298 is a correction candidate that has been confirmed to have removed the defect as a result of inspecting the correction candidates stored in the correction candidate management information 297.

図10に示す修正結果298は、図3に示すソースファイル320の5行目に命令「createDirs(name);」が挿入されたソースコードである。 The modified result 298 shown in FIG. 10 is source code in which the instruction "createDirs(name);" has been inserted on line 5 of the source file 320 shown in FIG. 3.

図11は、実施例1のプログラム修正装置100が実行するプログラム修正処理を説明するフローチャートである。 Figure 11 is a flowchart illustrating the program correction process executed by the program correction device 100 of the first embodiment.

プログラム修正装置100は、例えば、ユーザからの指示を受信した場合にプログラム修正処理を開始してもよいし、また、スケジュールされたタイミングでバッチ処理等により自動的にプログラム修正処理を開始してもよい。以下において、符号の前に付している文字「S」は処理ステップを意味する。 The program modification device 100 may, for example, start the program modification process when it receives an instruction from a user, or may start the program modification process automatically at a scheduled timing by batch processing or the like. In the following, the letter "S" before the symbol indicates a processing step.

不具合箇所特定部210は、情報記憶部290に記憶されるソースファイル管理情報291及びテストファイル管理情報292に基づいて、ターゲットソースファイル320の不具合箇所候補を特定し、不具合箇所候補管理情報293を出力する(ステップS101)。 The defect identification unit 210 identifies defect candidate locations in the target source file 320 based on the source file management information 291 and the test file management information 292 stored in the information storage unit 290, and outputs defect candidate location management information 293 (step S101).

例えば、不具合箇所特定部210は、静的解析又は欠陥限局(fault localization)を用いて、不具合箇所候補を特定する。 For example, the fault location identification unit 210 identifies potential fault locations using static analysis or fault localization.

次に、素材コード片取得部220は、不具合箇所候補管理情報293を参照し、処理する不具合箇所候補を選択する(ステップS102)。 Next, the material code fragment acquisition unit 220 refers to the defect candidate management information 293 and selects the defect candidate to be processed (step S102).

具体的には、素材コード片取得部220は、不具合箇所候補管理情報293のエントリを1つ選択する。実施例1では、疑わしさ503の値が1に近い順にエントリが選択されるものとする。以下の説明では、選択されたエントリに対応する不具合箇所候補を選択箇所とも記載する。 Specifically, the material code piece acquisition unit 220 selects one entry from the defect part candidate management information 293. In the first embodiment, the entry is selected in order of suspiciousness 503 value closest to 1. In the following description, the defect part candidate corresponding to the selected entry is also referred to as the selected part.

次に、素材コード片取得部220は、修正パターン管理情報294を参照し、修正パターンを選択する(ステップS103)。 Next, the material code piece acquisition unit 220 refers to the correction pattern management information 294 and selects a correction pattern (step S103).

具体的には、素材コード片取得部220は、修正パターン管理情報294のエントリを1つ選択する。 Specifically, the material code fragment acquisition unit 220 selects one entry from the correction pattern management information 294.

次に、素材コード片取得部220は、ターゲットソースファイル320及び取得範囲管理情報295に基づいて、素材コード片の取得先となる取得範囲を選択する(ステップS104)。 Next, the material code fragment acquisition unit 220 selects the acquisition range from which the material code fragment will be acquired based on the target source file 320 and the acquisition range management information 295 (step S104).

具体的には、素材コード片取得部220は、優先度に基づいて、取得範囲管理情報295のエントリを1つ以上選択する。実施例1では優先度の高い順に取得範囲が1つ選択されるものとする。不必要な素材コード片の生成を抑制でき、また、不具合が取り除ける可能性が高い素材コード片を取得することができる。これによって、デバッグの精度が向上し、かつ、デバッグの効率化を実現できる。 Specifically, the material code fragment acquisition unit 220 selects one or more entries from the acquisition range management information 295 based on priority. In the first embodiment, one acquisition range is selected in descending order of priority. This makes it possible to prevent the generation of unnecessary material code fragments, and to acquire material code fragments that are likely to remove defects. This improves the accuracy of debugging, and makes it possible to achieve more efficient debugging.

なお、素材コード片取得部220は、閾値より高い優先度の取得範囲を選択してもよい。閾値は予め設定されてもよいし、ユーザが指定してもよい。 The material code piece acquisition unit 220 may select an acquisition range with a higher priority than the threshold. The threshold may be set in advance or may be specified by the user.

次に、素材コード片取得部220は、選択箇所を基準として、選択した取得範囲から素材コード片を取得する(ステップS105)。 Next, the material code fragment acquisition unit 220 acquires material code fragments from the selected acquisition range based on the selected location (step S105).

このとき、素材コード片取得部220は、素材コード片管理情報296に、取得した素材コード片と同数のエントリを生成し、生成された各エントリの素材コード片801に取得した素材コード片を格納する。また、素材コード片取得部220は、各エントリの取得範囲802に選択した取得範囲の値を設定する。 At this time, the material code fragment acquisition unit 220 generates the same number of entries as the acquired material code fragments in the material code fragment management information 296, and stores the acquired material code fragments in the material code fragment 801 of each generated entry. In addition, the material code fragment acquisition unit 220 sets the selected acquisition range value in the acquisition range 802 of each entry.

例えば、図7の取得範囲管理情報295の1番目のエントリが選択されている場合、素材コード片取得部220は、選択箇所が含まれるメソッドから素材コード片を取得する。ファイル名「File1」の5行目が選択箇所として選択された場合、図8の1番目及び2番目のエントリが追加される。 For example, when the first entry in the acquisition range management information 295 in FIG. 7 is selected, the material code fragment acquisition unit 220 acquires a material code fragment from the method that contains the selected portion. When the fifth line of the file name "File1" is selected as the selected portion, the first and second entries in FIG. 8 are added.

例えば、図7の取得範囲管理情報295の2番目のエントリが選択されている場合、素材コード片取得部220は、選択箇所が含まれるターゲットソースファイル320から素材コード片を取得する。ファイル名「File1」の5行目が選択箇所として選択された場合、図8の3番目のエントリが追加される。 For example, when the second entry in the acquisition range management information 295 in FIG. 7 is selected, the material code fragment acquisition unit 220 acquires a material code fragment from the target source file 320 that contains the selected portion. When the fifth line of the file name "File1" is selected as the selected portion, the third entry in FIG. 8 is added.

例えば、図7の取得範囲管理情報295の4番目のエントリが選択されている場合、素材コード片取得部220は、選択箇所が含まれるターゲットソースファイル320に対応するテストファイル420の、選択箇所の対応テストメソッドから素材コード片を取得する。ファイル名「File1」の5行目が選択箇所として選択された場合、図8の4番目のエントリが追加される。 For example, when the fourth entry in the acquisition range management information 295 in FIG. 7 is selected, the material code fragment acquisition unit 220 acquires the material code fragment from the test method corresponding to the selected portion in the test file 420 corresponding to the target source file 320 that contains the selected portion. When the fifth line of the file name "File1" is selected as the selected portion, the fourth entry in FIG. 8 is added.

次に、素材コード片取得部220は、全ての修正方法について処理が完了したか否かを判定する(ステップS106)。 Next, the material code fragment acquisition unit 220 determines whether processing has been completed for all correction methods (step S106).

全ての修正方法について処理が完了していない場合、素材コード片取得部220はステップS103に戻り、同様の処理を実行する。 If processing has not been completed for all correction methods, the material code fragment acquisition unit 220 returns to step S103 and executes the same processing.

全ての修正方法について処理が完了した場合、修正候補生成部230は、素材コード片及び修正方法に基づいて、修正候補を生成する(ステップS107)。 When processing has been completed for all correction methods, the correction candidate generation unit 230 generates correction candidates based on the source code fragment and the correction methods (step S107).

具体的には、修正候補生成部230は、素材コード片を用いて、各修正方法に従って、選択箇所に対する改変を行うことによって修正候補を生成する。例えば、修正候補生成部230は、素材コード片を用いて選択箇所を書き換えることによって、修正候補を生成する。このとき、修正候補生成部230は、修正候補管理情報297に、生成された修正候補と同数のエントリを生成し、生成された各エントリの修正候補901に修正候補を格納する。また、修正候補生成部230は、追加された各エントリの修正パターンID902に、使用した修正方法のIDを格納し、取得範囲903に、使用した素材コード片の取得範囲の値を格納する。 Specifically, the correction candidate generation unit 230 generates correction candidates by using the material code fragment to modify the selected portion according to each correction method. For example, the correction candidate generation unit 230 generates correction candidates by rewriting the selected portion using the material code fragment. At this time, the correction candidate generation unit 230 generates the same number of entries as the generated correction candidates in the correction candidate management information 297, and stores the correction candidates in the correction candidate 901 of each generated entry. In addition, the correction candidate generation unit 230 stores the ID of the correction method used in the correction pattern ID 902 of each added entry, and stores the value of the acquisition range of the material code fragment used in the acquisition range 903.

図9の修正候補管理情報297には、ファイル名「File1」の5行目が選択箇所として選択された場合に生成される修正候補を示している。1番目のエントリには、修正パターンID601が「1」の修正方法に従って、選択箇所に含まれる式「name」が同一メソッドから取得された素材コード片「null」に書き換えられた修正候補が格納される。3番目のエントリには、修正パターンID601が「2」の修正方法に従って、選択箇所に、対応テストメソッドから取得された素材コード片「createDirs(name);」が追加された修正候補が格納される。 The correction candidate management information 297 in FIG. 9 shows the correction candidates that are generated when the fifth line of the file name "File1" is selected as the selected portion. The first entry stores a correction candidate in which the expression "name" included in the selected portion is rewritten to the source code fragment "null" obtained from the same method, according to the correction method with correction pattern ID 601 of "1". The third entry stores a correction candidate in which the source code fragment "createDirs(name);" obtained from the corresponding test method is added to the selected portion, according to the correction method with correction pattern ID 601 of "2".

なお、修正候補生成部230は、選択した修正方法に従ってターゲットソースファイル320を改変するとき、改変前のコード片と型が合わない素材コード片は使用しないようにしてもよい。 When modifying the target source file 320 according to the selected modification method, the modification candidate generating unit 230 may avoid using material code fragments whose format does not match that of the code fragment before modification.

なお、修正候補生成部230は、選択した修正方法に従ってターゲットソースファイル320を改変するとき、修正方法の取得範囲として指定されていない取得範囲から取得された素材コード片を使用しないようにしてもよい。例えば、修正パターンID601が「1」の修正方法が選択された場合、図8の素材コード片管理情報296の4番目のエントリを除外する。これによって、修正方法ごとに使用する素材コード片を制限でき、生成される修正候補の数を減らすことができる。従って、ソースファイル320の不具合を効率よく取り除くことができる。 When modifying the target source file 320 according to the selected correction method, the correction candidate generating unit 230 may avoid using material code fragments acquired from acquisition ranges that are not specified as the acquisition range of the correction method. For example, if a correction method with correction pattern ID 601 of "1" is selected, the fourth entry in the material code fragment management information 296 in FIG. 8 is excluded. This makes it possible to limit the material code fragments used for each correction method, and reduce the number of correction candidates generated. Therefore, defects in the source file 320 can be efficiently removed.

なお、修正候補生成部230は、優先度703の値に基づいて、使用する修正方法を選択してもよい。例えば、修正候補生成部230は、優先度が閾値より大きい修正方法を選択する。これによって、生成される修正候補の数が削減できるため、ソースファイル320の不具合を効率よく取り除くことができる。 The correction candidate generating unit 230 may select a correction method to be used based on the value of the priority 703. For example, the correction candidate generating unit 230 selects a correction method whose priority is greater than a threshold value. This reduces the number of correction candidates to be generated, thereby making it possible to efficiently remove defects in the source file 320.

なお、修正候補生成部230は、改変された行を含む、改変後のソースファイル320の一部を修正候補として生成してもよい。 The correction candidate generator 230 may generate a part of the modified source file 320, including the modified line, as a correction candidate.

次に、修正候補検査部240は、ターゲットソースファイル320に対応するテストファイル420を用いて修正候補を検査する(ステップS108)。修正候補の検査は、例えば、静的解析及びテストコードを用いる方法が考えられる。 Next, the correction candidate inspection unit 240 inspects the correction candidates using the test file 420 corresponding to the target source file 320 (step S108). The inspection of the correction candidates can be performed, for example, using static analysis and test code.

修正候補検査部240は、検査の結果、不具合が取り除かれた修正候補が存在するか否かを判定する(ステップS109)。 The correction candidate inspection unit 240 determines whether or not there is a correction candidate that removes the defect as a result of the inspection (step S109).

不具合が取り除かれた修正候補が存在しない場合、修正候補検査部240は、優先度を変更できるか否かを判定する(ステップS110)。 If there is no correction candidate that removes the defect, the correction candidate inspection unit 240 determines whether the priority can be changed (step S110).

例えば、修正候補検査部240は、現在の優先度を下げることができるか否かを判定する。 For example, the correction candidate inspection unit 240 determines whether the current priority can be lowered.

優先度を変更できない場合、修正候補検査部240は、素材コード片取得部220を呼び出し、ステップS102に戻る。 If the priority cannot be changed, the correction candidate inspection unit 240 calls the material code fragment acquisition unit 220 and returns to step S102.

このとき、修正候補検査部240は、素材コード片管理情報296及び修正候補管理情報297を初期化する。なお、素材コード片管理情報296は初期化されなくてもよい。 At this time, the correction candidate inspection unit 240 initializes the material code fragment management information 296 and the correction candidate management information 297. Note that the material code fragment management information 296 does not have to be initialized.

これは、別の不具合箇所候補を改変することによって、不具合を取り除くことができる可能性があるためである。 This is because it may be possible to eliminate the defect by modifying another potential defect location.

優先度を変更できる場合、修正候補検査部240は、優先度を変更し(ステップS111)、素材コード片取得部220を呼び出し、ステップS103に戻る。 If the priority can be changed, the correction candidate inspection unit 240 changes the priority (step S111), calls the material code fragment acquisition unit 220, and returns to step S103.

このとき、修正候補検査部240は、素材コード片管理情報296及び修正候補管理情報297を初期化する。なお、素材コード片管理情報296は初期化されなくてもよい。 At this time, the correction candidate inspection unit 240 initializes the material code fragment management information 296 and the correction candidate management information 297. Note that the material code fragment management information 296 does not have to be initialized.

例えば、修正候補検査部240は現在の優先度を下げる。任意の優先度の取得範囲から取得された素材コード片では不具合を取り除くことができない場合、他の優先度の取得範囲から素材コード片を取得することによって、新たな修正候補を生成できる。このように、修正候補を効率的に生成しつつ、精度よく不具合を取り除くことができる。 For example, the correction candidate inspection unit 240 lowers the current priority. If the defect cannot be removed with the material code fragment obtained from the acquisition range of a given priority, a new correction candidate can be generated by obtaining a material code fragment from the acquisition range of another priority. In this way, the defect can be removed with high accuracy while efficiently generating correction candidates.

ステップS109において、不具合が取り除かれた修正候補が存在する場合、修正候補検査部240は、当該修正候補を修正結果298として出力する。その後、プログラム修正装置100はプログラム修正処理を終了する(ステップS112)。 In step S109, if a correction candidate that removes the defect is present, the correction candidate inspection unit 240 outputs the correction candidate as the correction result 298. After that, the program correction device 100 ends the program correction process (step S112).

このとき、修正候補検査部240は、取得範囲管理情報295の優先度703を更新してもよい。具体的には、修正候補検査部240は、修正パターンID701及び取得範囲702の値の組合せが、不具合が取り除かれた修正候補に対応するエントリの修正パターンID902及び取得範囲903の組合せと一致するエントリを検索する。修正候補検査部240は、検索されたエントリの優先度703の値に1を加算する。なお、加算する値は任意に設定できる。 At this time, the correction candidate inspection unit 240 may update the priority 703 of the acquisition range management information 295. Specifically, the correction candidate inspection unit 240 searches for an entry whose combination of the values of the correction pattern ID 701 and the acquisition range 702 matches the combination of the correction pattern ID 902 and the acquisition range 903 of the entry corresponding to the correction candidate from which the defect has been removed. The correction candidate inspection unit 240 adds 1 to the value of the priority 703 of the searched entry. Note that the value to be added can be set arbitrarily.

修正結果298に応じて優先度を更新することによって、各修正方法について、効率的に素材コード片を取得できる取得範囲を特定できる。これによって、人手により優先度を指定する手間を削減でき、効率よく不具合を取り除くことができる。 By updating the priority according to the correction result 298, it is possible to specify the acquisition range in which material code fragments can be efficiently acquired for each correction method. This reduces the effort required to manually specify priorities, and enables defects to be efficiently removed.

なお、優先度703は更新されなくてもよい。 Note that priority 703 does not need to be updated.

以上説明したように、実施例1に係るプログラム修正装置100は、不具合を含むソースファイル320だけでなく、他のソースファイル320及びテストファイル420から素材コード片を取得する。これによって、不具合を取り除く可能性を高めることができる。 As described above, the program correction device 100 according to the first embodiment obtains raw code fragments not only from the source file 320 containing the defect, but also from other source files 320 and the test file 420. This increases the likelihood of removing the defect.

また、実施例1に係るプログラム修正装置100は、取得範囲管理情報295を用いて、修正方法毎に素材コード片を取得する取得範囲を制御する。これによって、不具合を取り除く可能性が高い素材コード片を用いた修正候補を効率的に生成できる。 The program modification device 100 according to the first embodiment also uses the acquisition range management information 295 to control the acquisition range for acquiring the raw code fragments for each modification method. This makes it possible to efficiently generate modification candidates using raw code fragments that are likely to eliminate defects.

なお、本発明は上記した実施例に限定されるものではなく、様々な変形例が含まれる。また、例えば、上記した実施例は本発明を分かりやすく説明するために構成を詳細に説明したものであり、必ずしも説明した全ての構成を備えるものに限定されるものではない。また、各実施例の構成の一部について、他の構成に追加、削除、置換することが可能である。 The present invention is not limited to the above-described embodiments, but includes various modified examples. For example, the above-described embodiments are provided to explain the present invention in detail, and are not necessarily limited to those including all of the described configurations. In addition, it is possible to add, delete, or replace part of the configuration of each embodiment with another configuration.

また、上記の各構成、機能、処理部、処理手段等は、それらの一部又は全部を、例えば集積回路で設計する等によりハードウェアで実現してもよい。また、本発明は、実施例の機能を実現するソフトウェアのプログラムコードによっても実現できる。この場合、プログラムコードを記録した記憶媒体をコンピュータに提供し、そのコンピュータが備えるプロセッサが記憶媒体に格納されたプログラムコードを読み出す。この場合、記憶媒体から読み出されたプログラムコード自体が前述した実施例の機能を実現することになり、そのプログラムコード自体、及びそれを記憶した記憶媒体は本発明を構成することになる。このようなプログラムコードを供給するための記憶媒体としては、例えば、フレキシブルディスク、CD-ROM、DVD-ROM、ハードディスク、SSD(Solid State Drive)、光ディスク、光磁気ディスク、CD-R、磁気テープ、不揮発性のメモリカード、ROMなどが用いられる。 The above-mentioned configurations, functions, processing units, processing means, etc. may be realized in part or in whole by hardware, for example by designing them as integrated circuits. The present invention can also be realized by software program code that realizes the functions of the embodiments. In this case, a storage medium on which the program code is recorded is provided to a computer, and a processor included in the computer reads the program code stored in the storage medium. In this case, the program code itself read from the storage medium realizes the functions of the above-mentioned embodiments, and the program code itself and the storage medium on which it is stored constitute the present invention. Examples of storage media for supplying such program code include flexible disks, CD-ROMs, DVD-ROMs, hard disks, SSDs (Solid State Drives), optical disks, magneto-optical disks, CD-Rs, magnetic tapes, non-volatile memory cards, ROMs, etc.

また、本実施例に記載の機能を実現するプログラムコードは、例えば、アセンブラ、C/C++、perl、Shell、PHP、Python、Java等の広範囲のプログラム又はスクリプト言語で実装できる。 In addition, the program code that realizes the functions described in this embodiment can be implemented in a wide range of program or script languages, such as assembler, C/C++, perl, Shell, PHP, Python, Java, etc.

さらに、実施例の機能を実現するソフトウェアのプログラムコードを、ネットワークを介して配信することによって、それをコンピュータのハードディスクやメモリ等の記憶手段又はCD-RW、CD-R等の記憶媒体に格納し、コンピュータが備えるプロセッサが当該記憶手段や当該記憶媒体に格納されたプログラムコードを読み出して実行するようにしてもよい。 Furthermore, the program code of the software that realizes the functions of the embodiment may be distributed over a network and stored in a storage means such as a computer's hard disk or memory, or in a storage medium such as a CD-RW or CD-R, and the processor of the computer may read and execute the program code stored in the storage means or storage medium.

上述の実施例において、制御線や情報線は、説明上必要と考えられるものを示しており、製品上必ずしも全ての制御線や情報線を示しているとは限らない。全ての構成が相互に接続されていてもよい。 In the above examples, the control lines and information lines are those that are considered necessary for the explanation, and not all control lines and information lines in the product are necessarily shown. All components may be interconnected.

100 プログラム修正装置
110 プロセッサ
120 主記憶装置
130 補助記憶装置
140 入力装置
150 出力装置
160 通信装置
210 不具合箇所特定部
220 素材コード片取得部
230 修正候補生成部
240 修正候補検査部
290 情報記憶部
291 ソースファイル管理情報
292 テストファイル管理情報
293 不具合箇所候補管理情報
294 修正パターン管理情報
295 取得範囲管理情報
296 素材コード片管理情報
297 修正候補管理情報
298 修正結果
310 ソースフォルダ
320 ソースファイル
410 テストフォルダ
420 テストファイル
100 Program correction device 110 Processor 120 Main memory device 130 Auxiliary memory device 140 Input device 150 Output device 160 Communication device 210 Defective part identification unit 220 Code fragment acquisition unit 230 Correction candidate generation unit 240 Correction candidate inspection unit 290 Information storage unit 291 Source file management information 292 Test file management information 293 Defective part candidate management information 294 Correction pattern management information 295 Acquisition range management information 296 Code fragment management information 297 Correction candidate management information 298 Correction result 310 Source folder 320 Source file 410 Test folder 420 Test file

Claims (8)

プロセッサ及び前記プロセッサに接続される記憶装置を有する計算機を少なくとも一つ備える計算機システムであって、
複数のソースファイル、前記ソースファイルを検査するために用いる、複数のテストファイル、及び、前記ソースファイルに含まれる不具合の修正方法を定義した修正パターンを管理する修正パターン管理情報と、前記修正パターンの識別情報、及び当該修正パターンに対して指定された取得範囲を対応づけたデータを格納する取得範囲管理情報と、を管理し、
前記少なくとも一つの計算機は、
ターゲットソースファイル及び当該ターゲットソースファイルに対応する前記テストファイルを用いて、前記ターゲットソースファイルの不具合が含まれる可能性がある箇所を特定する第1処理と、
前記取得範囲に基づいて、前記複数のソースファイル及び前記複数のテストファイルから素材コード片を取得し、前記記憶装置に格納する第2処理と、
前記修正パターン及び前記素材コード片に基づいて、前記不具合を取り除くための改変内容を示す修正候補を生成し、前記修正候補を前記記憶装置に格納する第3処理と、を実行し、
前記少なくとも一つの計算機は、前記第2処理において、
前記修正パターン管理情報から前記修正パターンを選択し、
前記取得範囲管理情報を参照して、前記選択された修正パターンに対応付けられる前記取得範囲に基づいて、前記複数のソースファイル及び前記複数のテストファイルから、命令及び式を前記素材コード片として取得することを特徴とする計算機システム。
A computer system including at least one computer having a processor and a storage device connected to the processor,
managing a plurality of source files, a plurality of test files used to check the source files, and correction pattern management information for managing correction patterns defining a method of correcting defects contained in the source files ; and acquiring range management information for storing identification information of the correction patterns and data correlating an acquiring range designated for the correction patterns;
The at least one computer
a first process of identifying a portion of the target source file that may contain a defect, using a target source file and the test file corresponding to the target source file;
a second process of acquiring material code fragments from the plurality of source files and the plurality of test files based on the acquisition range and storing the material code fragments in the storage device;
a third process of generating a correction candidate indicating a modification content for removing the defect based on the correction pattern and the raw code fragment, and storing the correction candidate in the storage device ;
The at least one computer, in the second process,
selecting the correction pattern from the correction pattern management information;
A computer system characterized by referring to the acquisition range management information and acquiring instructions and expressions as the material code fragments from the multiple source files and the multiple test files based on the acquisition range associated with the selected modification pattern .
請求項1に記載の計算機システムであって、2. The computer system of claim 1,
前記取得範囲管理情報に格納される前記データは、前記取得範囲の優先順位を示す優先度が対応づけられ、The data stored in the acquisition range management information is associated with a priority indicating a priority order of the acquisition range,
前記少なくとも一つの計算機は、前記第2処理において、The at least one computer, in the second process,
前記優先度に基づいて、前記選択された修正パターンに対応付けられる前記取得範囲の中から使用する前記取得範囲を選択し、selecting the acquisition range to be used from the acquisition ranges associated with the selected correction pattern based on the priority;
前記選択された取得範囲に基づいて、前記複数のソースファイル及び前記複数のテストファイルから前記素材コード片を取得することを特徴とする計算機システム。A computer system comprising: a computer that acquires the source code fragments from the plurality of source files and the plurality of test files based on the selected acquisition range.
請求項2に記載の計算機システムであって、3. The computer system of claim 2,
前記少なくとも一つの計算機は、The at least one computer
前記選択された取得範囲から取得された前記素材コード片を用いて生成された前記修正候補を検査し、前記不具合が取り除かれているか否かを判定する第4処理を実行し、executing a fourth process of inspecting the correction candidate generated using the material code fragment acquired from the selected acquisition range and determining whether the defect has been removed;
前記不具合が取り除かれている場合、前記修正候補を修正結果として出力し、If the defect is removed, output the correction candidate as a correction result;
前記不具合が取り除かれていない場合、前記第2処理、前記第3処理、及び前記第4処理を再実行し、If the defect is not eliminated, re-executing the second process, the third process, and the fourth process;
再実行される前記第2処理では、前記少なくとも一つの計算機は、前記優先度に基づいて、前記選択された修正パターンに対応付けられる前記取得範囲の中から、前回と異なる前記取得範囲を選択することを特徴とする計算機システム。A computer system characterized in that, in the second process being re-executed, the at least one computer selects, based on the priority, from the acquisition ranges associated with the selected modification pattern, an acquisition range that is different from the previous acquisition range.
請求項3に記載の計算機システムであってA computer system according to claim 3,
前記少なくとも一つの計算機は、前記第4処理において、前記修正結果に基づいて、当該修正結果として出力された前記修正候補を生成するために用いた前記素材コード片の前記取得範囲に対応付けられる前記優先度を更新することを特徴とする計算機システム。The at least one computer in the fourth process updates, based on the correction result, the priority associated with the acquisition range of the material code fragment used to generate the correction candidate output as the correction result.
プロセッサ及び前記プロセッサに接続される記憶装置を有する計算機に実行させるプログラムであって、A program to be executed by a computer having a processor and a storage device connected to the processor,
前記計算機は、複数のソースファイル、前記ソースファイルを検査するために用いる、複数のテストファイル、及び、前記ソースファイルに含まれる不具合の修正方法を定義した修正パターンを管理する修正パターン管理情報と、前記修正パターンの識別情報、当該修正パターンに対して指定された取得範囲、及び前記取得範囲の優先順位を示す優先度を対応づけたデータを格納する取得範囲管理情報と、を保持し、the computer holds correction pattern management information for managing a plurality of source files, a plurality of test files used to check the source files, and correction patterns defining a method of correcting defects included in the source files, and acquisition range management information for storing data correlating identification information of the correction patterns, acquisition ranges designated for the correction patterns, and priorities indicating the priority levels of the acquisition ranges;
前記プログラムは、The program is
ターゲットソースファイル及び当該ターゲットソースファイルに対応する前記テストファイルを用いて、前記ターゲットソースファイルの不具合が含まれる可能性がある箇所を特定する第1処理と、a first process of identifying a portion of the target source file that may contain a defect, using a target source file and the test file corresponding to the target source file;
指定された取得範囲に基づいて、前記複数のソースファイル及び前記複数のテストファイルから素材コード片を取得し、前記記憶装置に格納する第2処理と、a second process of acquiring material code fragments from the plurality of source files and the plurality of test files based on a specified acquisition range and storing the material code fragments in the storage device;
前記修正パターン及び前記素材コード片に基づいて、前記不具合を取り除くための改変内容を示す修正候補を生成し、前記修正候補を前記記憶装置に格納する第3処理と、を前記計算機に実行させ、a third process of generating a modification candidate indicating a modification content for removing the defect based on the modification pattern and the original code fragment, and storing the modification candidate in the storage device;
前記第2処理は、The second process includes:
前記修正パターン管理情報から前記修正パターンを選択する処理と、a process of selecting the correction pattern from the correction pattern management information;
前記優先度に基づいて、前記選択された修正パターンに対応付けられる前記取得範囲の中から使用する前記取得範囲を選択する処理と、a process of selecting the acquisition range to be used from the acquisition ranges associated with the selected correction pattern based on the priority;
前記選択された取得範囲に基づいて、前記複数のソースファイル及び前記複数のテストファイルから、命令及び式を前記素材コード片として取得する処理と、を含むことを特徴とするプログラム。and a process of acquiring instructions and expressions as the raw code fragments from the plurality of source files and the plurality of test files based on the selected acquisition range.
請求項5に記載のプログラムであって、The program according to claim 5,
前記選択された取得範囲から取得された前記素材コード片を用いて生成された前記修正候補を検査し、前記不具合が取り除かれているか否かを判定する第4処理と、a fourth process of inspecting the correction candidates generated using the material code fragments acquired from the selected acquisition range and determining whether the defect has been removed;
前記不具合が取り除かれている場合、前記修正候補を修正結果として出力する処理と、outputting the correction candidate as a correction result when the defect is removed;
前記不具合が取り除かれていない場合、前記第2処理、前記第3処理、及び前記第4処理と、If the defect is not removed, the second process, the third process, and the fourth process;
を前記計算機に実行させ、causing the computer to execute the
再実行される前記第2処理は、前記優先度に基づいて、前記選択された修正パターンに対応付けられる前記取得範囲の中から、前回と異なる前記取得範囲を選択する処理を含むことを特徴とするプログラム。the second process being re-executed includes a process of selecting, from the acquisition ranges associated with the selected correction pattern, an acquisition range that is different from that of the previous time, based on the priority.
請求項6に記載のプログラムであって、The program according to claim 6,
前記第4処理は、前記修正結果に基づいて、当該修正結果として出力された前記修正候補を生成するために用いた前記素材コード片の前記取得範囲に対応付けられる前記優先度を更新する処理を含むことを特徴とするプログラム。The fourth process is a program characterized by including a process of updating, based on the correction result, the priority associated with the acquisition range of the material code fragment used to generate the correction candidate output as the correction result.
プロセッサ及び前記プロセッサに接続される記憶装置を有する計算機を少なくとも一つ備える計算機システムが実行するプログラム修正方法であって、A program modification method executed by a computer system including at least one computer having a processor and a storage device connected to the processor, comprising:
前記計算機システムは、複数のソースファイル、前記ソースファイルを検査するために用いる、複数のテストファイル、及び、前記ソースファイルに含まれる不具合の修正方法を定義した修正パターンを管理する修正パターン管理情報と、前記修正パターンの識別情報、及び当該修正パターンに対して指定された取得範囲を対応づけたデータを格納する取得範囲管理情報と、を管理し、the computer system manages a plurality of source files, a plurality of test files used to check the source files, and correction pattern management information that manages correction patterns that define a method of correcting defects included in the source files, and acquisition range management information that stores identification information of the correction patterns and data that associates an acquisition range specified for the correction patterns;
前記プログラム修正方法は、The program correction method includes:
前記少なくとも一つの計算機が、ターゲットソースファイル及び当該ターゲットソースファイルに対応する前記テストファイルを用いて、前記ターゲットソースファイルの不具合が含まれる可能性がある箇所を特定する第1のステップと、a first step of identifying a portion of the target source file that may contain a defect by the at least one computer using a target source file and the test file corresponding to the target source file;
前記少なくとも一つの計算機が、前記取得範囲に基づいて、前記複数のソースファイル及び前記複数のテストファイルから素材コード片を取得し、前記記憶装置に格納する第2のステップと、a second step of the at least one computer acquiring source code fragments from the plurality of source files and the plurality of test files based on the acquisition range, and storing the source code fragments in the storage device;
前記少なくとも一つの計算機が、前記修正パターン及び前記素材コード片に基づいて、前記不具合を取り除くための改変内容を示す修正候補を生成し、前記修正候補を前記記憶装置に格納する第3のステップと、a third step of generating, by the at least one computer, a modification candidate indicating a modification content for removing the defect based on the modification pattern and the original code fragment, and storing the modification candidate in the storage device;
前記少なくとも一つの計算機が、前記取得範囲から取得された前記素材コード片を用いて生成された前記修正候補を検査し、前記不具合が取り除かれているか否かを判定する第4のステップと、a fourth step in which the at least one computer checks the correction candidates generated using the raw code fragments obtained from the acquisition range to determine whether the defect has been removed;
前記少なくとも一つの計算機が、前記不具合が取り除かれている場合、前記修正候補を修正結果として出力する第5のステップと、を含み、a fifth step of outputting, by the at least one computer, the candidate correction as a correction result if the defect is removed;
前記第2のステップは、The second step includes:
前記少なくとも一つの計算機が、前記修正パターン管理情報から前記修正パターンを選択するステップと、the at least one computer selecting the modification pattern from the modification pattern management information;
前記少なくとも一つの計算機が、前記取得範囲管理情報を参照して、前記選択された修正パターンに対応付けられる前記取得範囲に基づいて、前記複数のソースファイル及び前記複数のテストファイルから、命令及び式を前記素材コード片として取得するステップと、を含むことを特徴とするプログラム修正方法。and a step of the at least one computer referring to the acquisition range management information and acquiring instructions and expressions as the raw code fragments from the plurality of source files and the plurality of test files based on the acquisition range associated with the selected modification pattern.
JP2020189291A 2020-11-13 2020-11-13 Computer system, program, and program correction method Active JP7504775B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2020189291A JP7504775B2 (en) 2020-11-13 2020-11-13 Computer system, program, and program correction method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2020189291A JP7504775B2 (en) 2020-11-13 2020-11-13 Computer system, program, and program correction method

Publications (2)

Publication Number Publication Date
JP2022078548A JP2022078548A (en) 2022-05-25
JP7504775B2 true JP7504775B2 (en) 2024-06-24

Family

ID=81706962

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2020189291A Active JP7504775B2 (en) 2020-11-13 2020-11-13 Computer system, program, and program correction method

Country Status (1)

Country Link
JP (1) JP7504775B2 (en)

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2017151977A (en) 2016-02-23 2017-08-31 富士通株式会社 Method and program for repairing software 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
JP2017151977A (en) 2016-02-23 2017-08-31 富士通株式会社 Method and program for repairing software program
JP2019096292A (en) 2017-11-24 2019-06-20 富士通株式会社 Automated selection of software program repair candidate

Also Published As

Publication number Publication date
JP2022078548A (en) 2022-05-25

Similar Documents

Publication Publication Date Title
US20130346956A1 (en) Providing a Software Upgrade Risk Map for a Deployed Customer System
WO2019055376A1 (en) Library upgrade method, apparatus, and system
US20140380279A1 (en) Prioritizing test cases using multiple variables
BR112015011537B1 (en) STORAGE METHOD AND DEVICE FOR ASSOCIATION OF METADATA WITH SOURCE CODE
GB2508643A (en) Method for Performing a Regression Test after Modifying Source Code File
US20120185669A1 (en) Program inspection method and non-transitory, computer readable storage medium storing inspection program
JP7504775B2 (en) Computer system, program, and program correction method
US11379207B2 (en) Rapid bug identification in container images
CN111274117A (en) Recommended service experiment and management method, device and system thereof
JP7456843B2 (en) Program modification device, program modification method, and program modification program
US20180225165A1 (en) Configurable system wide tests
JP5578625B2 (en) Program analysis apparatus, program analysis method, and program
US11392371B2 (en) Identification of a partial code to be refactored within a source code
US10754876B2 (en) Cloning of a system
JP2023003882A (en) Failure place specification support device and failure place specification support method
CN112035367B (en) Method and system for checking workflow correctness of big data platform
JP6888336B2 (en) Stub generators, methods, and programs
US9665454B2 (en) Extracting test model from textual test suite
US11321225B2 (en) Reducing the memory load time for logic simulator by leveraging architecture simulator
JP4959807B2 (en) Method and apparatus for storing data on disk
JP2022157976A (en) Analysis program, analysis device, and analysis method
CN112613256B (en) Method and device for generating circuit reference file of verification platform and computer equipment
JP7261101B2 (en) Defect detection device, defect detection method, and defect detection program
JP2024090191A (en) Refactoring effect evaluation device, refactoring effect evaluation method, and program
JP6954806B2 (en) Defect detection device and defect detection method

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20230213

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20240229

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20240312

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20240425

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

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20240604

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20240612

R150 Certificate of patent or registration of utility model

Ref document number: 7504775

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150