KR20190089615A - Bug fixing system and bug fixing method - Google Patents

Bug fixing system and bug fixing method Download PDF

Info

Publication number
KR20190089615A
KR20190089615A KR1020180008380A KR20180008380A KR20190089615A KR 20190089615 A KR20190089615 A KR 20190089615A KR 1020180008380 A KR1020180008380 A KR 1020180008380A KR 20180008380 A KR20180008380 A KR 20180008380A KR 20190089615 A KR20190089615 A KR 20190089615A
Authority
KR
South Korea
Prior art keywords
bug
new
tree
code
past
Prior art date
Application number
KR1020180008380A
Other languages
Korean (ko)
Other versions
KR102160780B1 (en
Inventor
이병정
정영준
민경식
양근석
Original Assignee
서울시립대학교 산학협력단
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 서울시립대학교 산학협력단 filed Critical 서울시립대학교 산학협력단
Priority to KR1020180008380A priority Critical patent/KR102160780B1/en
Publication of KR20190089615A publication Critical patent/KR20190089615A/en
Application granted granted Critical
Publication of KR102160780B1 publication Critical patent/KR102160780B1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/362Software debugging
    • G06F11/366Software debugging using diagnostics

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)

Abstract

According to one embodiment of the present invention, provided is a bug correction system, which comprises: a search unit for receiving new bug information and searching for past bug information similar to the new bug information from past bug information stored in bug storage; an abstract syntax tree (AST) conversion unit for converting bug correction codes of the past bug information, similar to a bug code of the new bug information, into ASTs, separately; a GP operation unit for generating a new tree by applying genetic programming (GP) to the ASTs, calculating fitness a new tree, and outputting a new tree having fitness equal to or more than a predetermined threshold value; and a correction code output unit for outputting the new tree having fitness equal to or more than a predetermined threshold value as a patch code.

Description

버그 정정 시스템 및 버그 정정 방법{BUG FIXING SYSTEM AND BUG FIXING METHOD}{BUG FIXING SYSTEM AND BUG FIXING METHOD}

본 개시는 유전 프로그래밍 기반의 버그 정정 시스템 및 버그 정정 방법에 관한 것이다.This disclosure relates to a genetic programming based bug correction system and a bug correction method.

근래에는 PC, 스마트폰과 같은 단말에 탑재되거나 또는 단말에서 실행되는 소프트웨어의 구조가 더욱 복잡해지고, 그 크기가 더욱 증가하고 있다. 이로 인해 소프트웨어를 구성하는 코드 중 오류와 오작동을 야기하는 버그(bug) 코드의 수량이 증가되고 있다. In recent years, the structure of software installed in a terminal such as a PC or a smart phone or executed in a terminal has become more complex, and the size of the software has been further increased. This increases the number of bug cords that cause errors and malfunctions in the code that makes up the software.

이러한 버그들을 자동으로 정정하기 위한 연구가 진행되고 있다. 예를 들어, 유전 프로그래밍을 활용하여 자동으로 패치를 생성하는 방식과 사전 조사를 통해 버그의 패턴과 그 정정 동작에 관한 템플릿을 작성하여 적절한 패치를 생성하는 방식이 주로 연구되고 있다. Research is underway to automatically correct these bugs. For example, a method of automatically generating a patch using genetic programming and a method of creating a proper patch by creating a template of a bug pattern and its correcting action through a preliminary investigation are mainly studied.

이러한 방식들 중 유전 프로그래밍을 활용하는 종래의 방식은 버그 코드를 포함하는 프로그램 코드로부터 유전 프로그래밍을 위한 정보를 획득하므로, 해당 버그 코드의 정정 코드에 대한 정보가 전혀 없다면 패치를 성공적으로 생성할 수 없다. 템플릿에 기반한 방식은 정확한 정정 과정에 대해 명시함으로써 식별된 패턴을 가진 버그에 대해 효율적이지만, 버그와 그 정정 패턴에 대한 템플릿을 미리 작성해야 하는 문제가 있다.Among these approaches, the conventional method of utilizing genetic programming acquires information for genetic programming from program code including bug code, so that if there is no information about the correction code of the corresponding bug code, the patch can not be successfully generated . The template-based approach is efficient for bugs with identified patterns by specifying precise correcting procedures, but there is a problem that templates for bugs and their correction patterns must be written in advance.

실시예들은 소프트웨어 유지보수 비용을 감소시키는 버그 정정 시스템 및 버그 정정 방법을 제공하기 위한 것이다.Embodiments are intended to provide a bug correction system and a bug correction method that reduce software maintenance costs.

또한, 실시예들은 디버깅 작업량을 감소시키는 버그 정정 시스템 및 버그 정정 방법을 제공하기 위한 것이다.Embodiments are also intended to provide a bug correction system and a bug correction method that reduce the amount of debugging work.

상기 또는 다른 목적을 달성하기 위해 일 실시예에 따른 버그 정정 시스템은 새로운 버그 정보를 수신하고, 버그 저장소에 저장된 과거 버그 정보 중 새로운 버그 정보와 유사한 과거 버그 정보를 탐색하는 탐색부, 새로운 버그 정보의 버그 코드와 유사한 과거 버그 정보의 버그 정정 코드를 각각 추상 구문 트리(AST: abstract syntax tree)로 변환하는 AST 변환부, 추상 구문 트리들에 유전 프로그래밍(GP: genetic programming)을 적용하여 새로운 트리를 생성하고, 새로운 트리의 적합도를 계산하며, 소정 임계치 이상의 적합도를 갖는 새로운 트리를 출력하는 GP 연산부, 그리고 소정 임계치 이상의 적합도를 갖는 새로운 트리를 패치 코드로 출력하는 정정 코드 출력부를 포함한다.In order to achieve the above or other objects, a bug correction system according to an embodiment of the present invention includes a search unit for receiving new bug information and searching past bug information similar to new bug information among past bug information stored in the bug storage, The AST transformer converts the bug correction code of the old bug information similar to the bug code into an abstract syntax tree (AST), and generates a new tree by applying genetic programming (GP) to abstract syntax trees A GP operation unit for calculating a fitness of a new tree and outputting a new tree having a fitness value equal to or higher than a predetermined threshold value and a correction code output unit for outputting a new tree having a fitness value of a predetermined threshold value or more to a patch code.

탐색부는 새로운 버그 정보로서 새로운 버그 리포트를 수신하면, 모델링된 토픽을 기반으로 수신한 새로운 버그 리포트와 대응하는 토픽(topic)을 식별하고, 버그 저장소에서 식별된 토픽을 가진 과거 버그 리포트를 탐색하며, 새로운 버그 리포트에 포함된 버그 코드와 탐색된 과거 버그 리포트의 버그 정정 코드를 추출하여 코드 블록 유사도를 계산함으로써, 새로운 버그 리포트에 포함된 버그 코드와 유사한 과거 버그 리포트의 버그 정정 코드를 결정할 수 있다.Upon receiving a new bug report as new bug information, the search unit identifies a new bug report and a corresponding topic received based on the modeled topic, searches past bug reports with the topic identified in the bug repository, The bug correction code of the past bug report similar to the bug code included in the new bug report can be determined by extracting the bug code included in the new bug report and the bug correction code of the searched past bug report and calculating the code block similarity.

탐색부는, [수학식 1]

Figure pat00001
The searching unit calculates the following equation (1)
Figure pat00001

을 이용하여 코드 블록 유사도를 계산하고, 여기서 Src1, Src2는 각각 새로운 버그 리포트에 포함된 버그 코드 및 과거 버그 리포트의 버그 정정 코드를 의미할 수 있다., Where Src1 and Src2 may denote the bug code included in the new bug report and the bug correction code of the past bug report, respectively.

탐색부는 새로운 버그 정보로서 새로운 버그 코드를 수신하면, 버그 저장소에서 새로운 버그 코드와 유사한 과거 버그 코드를 탐색할 수 있다.When the search unit receives a new bug code as new bug information, it can search past bug code similar to the new bug code in the bug repository.

GP 연산부는 추상 구문 트리들을 이용하여 초기 모집단을 생성하고, 초기 모집단에서 두 개의 연산 대상 트리를 선택하여 유전 프로그래밍을 적용할 수 있다.The GP operation unit can generate an initial population using abstract syntax trees, and apply genetic programming by selecting two operation subject trees in the initial population.

GP 연산부는, 추상 구문 트리들을 사용하여 교차 연산을 수행하고, 교차 연산에 의해 생성된 제1 트리에 대해 변이 연산을 수행하며, 변이 연산이 수행된 제1 트리의 적합도를 계산하고, 변이 연산이 수행된 제1 트리를 초기 모집단에 추가하며, 초기 모집단의 트리 개수가 기 설정된 제1 개수 이상이면 초기 모집단의 생성을 완료할 수 있다.The GP operation unit performs the intersection operation using the abstract syntax trees, performs the transition operation on the first tree generated by the intersection operation, calculates the fitness of the first tree on which the transition operation is performed, Adding the performed first tree to the initial population, and if the number of trees in the initial population is equal to or greater than a predetermined first number, generation of the initial population can be completed.

GP 연산부는, 초기 모집단의 생성이 완료되면, 초기 모집단으로부터 적합도 값을 이용하여 두 개의 연산 대상 트리를 선택하고, 두 개의 연산 대상 트리를 사용하여 교차 연산을 수행하고, 교차 연산에 의해 생성된 제2 트리에 대해 변이 연산을 수행하며, 변이 연산이 수행된 제2 트리의 적합도를 계산하고, 계산된 적합도가 임계치 이상이면, 변이 연산이 수행된 제2 트리를 패치 트리로서 출력할 수 있다.When the generation of the initial population is completed, the GP operation unit selects two operation subject trees from the initial population using the fitness value, performs the intersection operation using the two operation subject trees, 2 tree, calculates the fitness of the second tree on which the mutation operation is performed, and outputs the second tree on which the mutation operation has been performed as a patch tree if the calculated fitness is equal to or greater than the threshold value.

GP 연산부는 계산된 적합도가 임계치보다 더 작으면, 변이 연산이 수행된 제2 트리를 초기 모집단을 포함하는 모집단에 추가하고, 모집단의 트리 개수가 기 설정된 제2 개수 이상인지 판단하며, 모집단의 트리 개수가 기 설정된 제2 개수 이상이면, 모집단이 마지막 세대 모집단인지를 판단하고, 모집단이 마지막 세대 모집단이 아니면, 다음 세대 모집단을 생성할 수 있다.If the calculated fitness is smaller than the threshold value, the GP operation unit adds the second tree in which the mutation operation is performed to the population including the initial population, determines whether the number of trees in the population is equal to or greater than a predetermined second number, If the number is greater than or equal to the predetermined second number, it is determined whether the population is the last-generation population, and if the population is not the last-generation population, the next-generation population can be created.

GP 연산부는 모집단에서 소정의 적합도 미만의 트리를 제거하여 다음 세대 모집단을 생성할 수 있다.The GP operation unit can generate a next generation population by removing a tree less than a predetermined fitness from the population.

GP 연산부는 두 개의 연산 대상 트리에서 각각 대상 노드를 정한 후, 대상 노드로부터의 서브 트리들을 서로 뒤바꿔 교차 연산을 수행할 수 있다.The GP operation unit can set the target nodes in the two operation target trees and then perform the intersection operation by rearranging the subtrees from the target node to each other.

변이 연산은, (1) 하나의 트리에서 대상 노드를 결정한 후, 대상 노드만을 삭제하거나, 또는 대상 노드로부터의 하위 트리 전부를 삭제하는 삭제 연산, (2) 하나의 트리에서 대상 노드를 결정한 후, 대상 노드의 위치에 하나의 트리의 일부 노드를 복사하여 삽입하는 삽입 연산, 및 (3) 하나의 트리에서 두 개의 대상 노드를 결정한 후, 두 개의 대상 노드의 위치를 서로 뒤바꾸는 교환 연산을 포함할 수 있다.The mutation operation includes (1) a deletion operation of deleting only a target node after deleting a target node in one tree, or deleting all subtrees from the target node, (2) determining a target node in one tree, An insertion operation of copying and inserting some nodes of one tree at a position of a target node, and (3) an exchange operation of determining two target nodes in one tree and then reversing the positions of two target nodes .

일 실시예에 따른 버그 정정 방법은 새로운 버그 정보를 수신하고, 버그 저장소에 저장된 과거 버그 정보 중 새로운 버그 정보와 유사한 과거 버그 정보를 탐색하는 단계, 새로운 버그 정보의 버그 코드와 유사한 과거 버그 정보의 버그 정정 코드를 각각 추상 구문 트리(AST: abstract syntax tree)로 변환하는 단계, 추상 구문 트리들에 유전 프로그래밍(GP: genetic programming)을 적용하여 새로운 트리를 생성하는 단계, 새로운 트리의 적합도를 계산하는 단계, 소정 임계치 이상의 적합도를 갖는 새로운 트리를 출력하는 단계, 그리고 소정 임계치 이상의 적합도를 갖는 새로운 트리를 패치 코드로 출력하는 단계를 포함한다.According to an exemplary embodiment of the present invention, there is provided a method for correcting a bug, the method comprising: receiving new bug information, searching past bug information similar to new bug information among past bug information stored in the bug storage, Transforming the correction code into an abstract syntax tree (AST), generating a new tree by applying genetic programming (GP) to the abstract syntax trees, calculating a fitness of the new tree , Outputting a new tree having a fitness greater than or equal to a predetermined threshold value, and outputting a new tree having a fitness greater than or equal to a predetermined threshold to the patch code.

새로운 버그 정보와 유사한 과거 버그 정보를 탐색하는 단계는, 새로운 버그 정보로서 새로운 버그 리포트를 수신하는 단계, 모델링된 토픽을 기반으로 수신한 새로운 버그 리포트와 대응하는 토픽(topic)을 식별하는 단계, 버그 저장소에서 식별된 토픽을 가진 과거 버그 리포트를 탐색하는 단계, 그리고 새로운 버그 리포트에 포함된 버그 코드와 탐색된 과거 버그 리포트의 버그 정정 코드를 추출하여 코드 블록 유사도를 계산함으로써, 새로운 버그 리포트에 포함된 버그 코드와 유사한 과거 버그 리포트의 버그 정정 코드를 결정하는 단계를 포함할 수 있다.The step of searching for past bug information similar to the new bug information may include receiving a new bug report as new bug information, identifying a topic corresponding to the new bug report received based on the modeled topic, Searching a past bug report having a topic identified in the repository, and extracting the bug code included in the new bug report and the bug correction code of the searched past bug report to calculate the code block similarity, Determining a bug correction code of a past bug report similar to the bug code.

코드 블록 유사도를 계산하는 것은, [수학식 1]

Figure pat00002
을 이용하여 코드 블록 유사도를 계산하고, 여기서 Src1, Src2는 각각 새로운 버그 리포트에 포함된 버그 코드 및 과거 버그 리포트의 버그 정정 코드를 의미하는 것인, 버그 정정 방법.To calculate the code block similarity, Equation (1)
Figure pat00002
Wherein Src1 and Src2 refer to the bug code included in the new bug report and the bug correction code of the past bug report, respectively.

새로운 버그 정보와 유사한 과거 버그 정보를 탐색하는 단계는, 새로운 버그 정보로서 새로운 버그 코드를 수신하는 단계, 그리고 버그 저장소에서 새로운 버그 코드와 유사한 과거 버그 코드를 탐색하는 단계를 포함할 수 있다.The step of searching for past bug information similar to the new bug information may include receiving a new bug code as new bug information and searching for a past bug code similar to the new bug code in the bug repository.

실시예들에 따르면, 소프트웨어 유지 보수 작업에 필요한 비용과 작업 시간을 감소시킬 수 있는 효과가 있다.According to the embodiments, it is possible to reduce the cost and the work time required for the software maintenance work.

실시예들에 따르면, 버그 정정의 품질을 향상시킬 수 있는 효과가 있다.According to the embodiments, it is possible to improve the quality of bug correction.

도 1은 일 실시예에 따른 버그 정정 시스템의 개략적인 블록도이다.
도 2는 일 실시예에 따른 버그 정정 방법의 순서도이다.
도 3은 도 2의 버그 정정 방법의 과거 버그 코드 탐색 단계의 일례를 구체적으로 나타낸 순서도이다.
도 4는 새로운 버그 코드, 과거 버그 코드, 및 과거 버그 코드의 정정 코드의 일례를 나타낸 도면이다.
도 5는 추상 구문 트리(AST: abstract syntax tree)로 변환된 새로운 버그 코드와 과거 버그 코드의 정정 코드의 일례를 나타낸 도면이다.
도 6은 도 2의 버그 정정 방법의 유전 프로그래밍 적용 단계 및 적합도 평가 단계의 일례를 구체적으로 나타낸 순서도이다.
도 7은 새로운 버그 코드의 정정 코드의 일례를 나타낸 도면이다.
1 is a schematic block diagram of a bug correction system in accordance with one embodiment.
2 is a flowchart of a bug correction method according to an embodiment.
3 is a flowchart specifically showing an example of a bug code search step of the bug correction method of FIG.
4 is a diagram showing an example of a new bug code, a past bug code, and a correction code of a past bug code.
5 is a diagram showing an example of a new bug code converted into an abstract syntax tree (AST) and a correction code of a past bug code.
FIG. 6 is a flowchart specifically illustrating an example of a genetic programming application step and a fitness evaluation step of the bug correction method of FIG.
7 is a diagram showing an example of a new bug code correcting code.

이하, 첨부한 도면을 참고로 하여 본 발명의 여러 실시예들에 대하여 본 발명이 속하는 기술 분야에서 통상의 지식을 가진 자가 용이하게 실시할 수 있도록 상세히 설명한다. 본 발명은 여러 가지 상이한 형태로 구현될 수 있으며 여기에서 설명하는 실시예들에 한정되지 않는다.DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS Hereinafter, embodiments of the present invention will be described in detail with reference to the accompanying drawings. The present invention may be embodied in many different forms and is not limited to the embodiments described herein.

본 발명을 명확하게 설명하기 위해서 설명과 관계없는 부분은 생략하였으며, 명세서 전체를 통하여 동일 또는 유사한 구성요소에 대해서는 동일한 참조 부호를 붙이도록 한다.In order to clearly illustrate the present invention, parts not related to the description are omitted, and the same or similar components are denoted by the same reference numerals throughout the specification.

또한, 명세서 전체에서, 어떤 부분이 어떤 구성요소를 "포함" 한다고 할 때, 이는 특별히 반대되는 기재가 없는 한 다른 구성요소를 제외하는 것이 아니라 다른 구성요소를 더 포함할 수 있는 것을 의미한다.Also, throughout the specification, when an element is referred to as "including" an element, it is understood that the element may include other elements as well, without departing from the other elements unless specifically stated otherwise.

이하 도면을 참조로 하여 일 실시예에 따른 버그 정정 시스템 및 버그 정정 방법에 대해 설명한다.Hereinafter, a bug correction system and a bug correction method according to an embodiment will be described with reference to the drawings.

도 1은 일 실시예에 따른 버그 정정 시스템의 개략적인 블록도이다. 1 is a schematic block diagram of a bug correction system in accordance with one embodiment.

도 1을 참조하면, 본 발명의 일 실시예에 따른 버그 정정 시스템(100)은 저장소(repository)(110), 탐색부(120), AST 변환부(130), GP 연산부(140), 및 정정 코드 출력부(140)를 포함한다.Referring to FIG. 1, a bug correction system 100 according to an exemplary embodiment of the present invention includes a repository 110, a search unit 120, an AST transformation unit 130, a GP operation unit 140, And a code output unit 140.

저장소(110)에는 과거에 발생했던 버그에 관한 정보가 저장되어 있다. 예를 들어, 저장소(110)에는 과거에 발생했던 버그 코드들에 대한 정보, 버그 코드들에 대한 버그 리포트 정보, 해당 버그 리포트를 정정한 적이 있는 개발자들의 정보, 버그 리포트를 정정한 개발자들의 정정 히스토리 정보 등이 저장되어 있을 수 있다.The storage 110 stores information on bugs that have occurred in the past. For example, the storage 110 may store information on bug codes that have occurred in the past, bug report information on bug codes, information on developers who have corrected the bug reports, correction history of developers who have corrected bug reports, Information may be stored.

또한, 저장소(110)에 저장된 버그 리포트는 기본적으로 프로그램 소스 코드 파일에 존재하는 에러(error)를 다양한 필드로 기록한 것으로서, 버그 리포트에는 버그 리포트를 작성한 보고자, 현재 상태, 현재 버그 리포트의 심각성 및 우선순위 등 중요한 필드가 포함되어 있을 수도 있다.The bug report stored in the storage 110 basically records an error present in the program source code file in various fields. The bug report includes a report of the bug report, the current status, the severity of the current bug report, Ranking, and so on.

탐색부(120)는 새로운 버그에 대한 정보(10)(예를 들어, 버그 코드 또는 버그 리포트)를 수신하고, 저장소(110)에 저장된 과거 버그 정보 중 새로운 버그 정보(10)와 유사한 과거 버그 정보를 탐색할 수 있다. 그리고 탐색부(120)는 새로운 버그 정보(10) 및 이와 유사한 과거 버그 정보를 AST 변환부(130)에 전달할 수 있다.The search unit 120 receives information 10 about a new bug (for example, a bug code or a bug report), and retrieves past bug information similar to the new bug information 10 . ≪ / RTI > The search unit 120 may transmit the new bug information 10 and similar past bug information to the AST conversion unit 130.

AST 변환부(130)는 전달받은 코드들을 추상 구문 트리로 변환한다. 이 과정을 거쳐 코드들은 각 노드가 정보를 갖는 트리 형태로 변환될 수 있다. 추상 구문 트리에 대해서는 도 2 및 도 5를 참조하여 후술한다.The AST conversion unit 130 converts the received codes into an abstract syntax tree. Through this process, the codes can be transformed into a tree form in which each node has information. The abstract syntax tree will be described later with reference to FIG. 2 and FIG.

GP 연산부(140)는 변환된 추상 구문 트리들에 유전 프로그래밍을 적용하고, 유전 프로그래밍에 의해 생성된 패치의 적합도를 평가하며, 소정 임계치 이상의 적합도를 갖는 패치를 출력한다. 유전 프로그래밍은 초기 모집단 생성, 선택(selection), 교차(Crossover), 변이(mutation) 연산을 반복하여 수행하는 것으로서, 이에 대해서는 도 6 및 도 7을 참조하여 후술한다.The GP operation unit 140 applies genetic programming to the transformed abstract syntax trees, evaluates the fitness of the patches generated by genetic programming, and outputs a patch having a fitness value equal to or greater than a predetermined threshold value. Genetic programming is performed by repeating initial population generation, selection, crossover, and mutation operations, which will be described later with reference to FIGS. 6 and 7. FIG.

정정 코드 출력부(150)는 소정 임계치 이상의 적합도를 갖는 패치를 패치 코드(20)로 변환하여 출력한다.The correction code output unit 150 converts a patch having a fitness value of a predetermined threshold value or more into a patch code 20 and outputs the patch code.

다음으로 도 2를 참조하여, 상기의 버그 정정 시스템(100)의 버그 정정 방법에 대해 설명한다. Next, a bug correction method of the bug correction system 100 will be described with reference to FIG.

도 2는 일 실시예에 따른 버그 정정 방법의 순서도이다. 2 is a flowchart of a bug correction method according to an embodiment.

도 2를 참조하면, 탐색부(120)는 저장소(110)에 저장된 과거 버그 정보 중 새로운 버그 정보(10)와 유사한 과거 버그 정보를 탐색(S110)한다.Referring to FIG. 2, the search unit 120 searches past bug information similar to new bug information 10 among past bug information stored in the storage 110 (S110).

일례로, 새로운 버그 리포트(10)가 수신되는 경우, 탐색부(120)는 새로운 버그 리포트와 대응하는 과거 버그 리포트를 탐색하여 유사한 과거 버그 정보를 탐색한다. 이와 관련하여 도 3을 참조하여 함께 설명한다.For example, when a new bug report 10 is received, the search unit 120 searches for a past bug report corresponding to a new bug report and searches for similar past bug information. This will be described together with reference to FIG.

도 3은 도 2의 버그 정정 방법의 과거 버그 코드 탐색 단계의 일례를 구체적으로 나타낸 순서도이다.3 is a flowchart specifically showing an example of a bug code search step of the bug correction method of FIG.

탐색부(120)는 모델링된 토픽을 기반으로 수신한 새로운 버그 리포트(10)와 대응하는 토픽(topic)을 식별(S112)한다. 예를 들어, 탐색부(120)는 수신한 새로운 버그 리포트에 나타나는 토픽 용어의 빈도수를 이용하여, 새로운 버그 리포트와 대응하는 토픽을 식별한다. 그리고 탐색부(120)는 저장소(110)에서 식별된 토픽을 가진 과거 버그 리포트를 탐색(S114)한다. The search unit 120 identifies a new bug report 10 and a corresponding topic received based on the modeled topic (S112). For example, the search unit 120 identifies a topic corresponding to a new bug report, using the frequency of the topic term appearing in the received new bug report. The search unit 120 searches for a past bug report having the topic identified in the storage 110 (S114).

다음으로 탐색부(120)는 새로운 버그 리포트(10)에 포함된 버그 코드를 추출하고, 탐색된 과거 버그 리포트에 포함된 버그 정정 코드를 추출하여 코드 블록 유사도를 계산 및 판단(S116)한다. Next, the search unit 120 extracts the bug code included in the new bug report 10, extracts the bug correction code included in the found bug report, and calculates and determines the code block similarity (S116).

코드 블록 유사도는 다음의 수학식 1과 같이 계산될 수 있다.The code block similarity can be calculated by the following Equation (1).

Figure pat00003
Figure pat00003

여기서, Src1, Src2는 두 개의 소스 코드 블록을 나타낸다. 결과는 점수의 쌍으로 나타나며, (1.0, .221)은 첫 번째 코드 블록이 두 번째 코드 블록 내용 100 %로 포함한다는 것을 의미한다.Here, Src1 and Src2 represent two source code blocks. The result is a pair of scores, where (1.0, .221) means that the first code block contains 100% of the second code block.

탐색부(120)는 새로운 버그 리포트(10)에서 추출된 버그 코드 및 설정된 임계치 이상의 코드 블록 유사도를 갖는 버그 정정 코드를 유사 과거 버그 코드로서 결정(S118)하고, AST 변환부(130)에 전달한다. The search unit 120 determines a bug correction code having a code block similarity degree that is equal to or larger than a threshold value that is extracted from the new bug report 10 as a similar past bug code (S118), and transmits the bug correction code to the AST conversion unit 130 .

다른 예로, 새로운 버그 코드(10)가 수신되는 경우, 탐색부(120)는 저장소(110)에서 새로운 버그 코드(10)와 유사한 과거 버그 코드를 탐색한다. 예를 들어 탐색부(120)는 T. Kamiya et al. 이 제안한 CCFinder(T. Kamiya, S. Kusumoto and K. Inoue, “CCFinder: A Multilinguistic Token-Based Code Clone Detection System for Large Scale Source Code,” IEEE Transaction on Software Engineering, pp. 654-670, 2002.) 등을 사용하여 유사한 과거 버그 코드를 식별할 수 있다. 그러면 탐색부(120)는 탐색된 유사한 과거 버그 코드의 버그 정정 코드를 추출하고, 수신된 새로운 버그 코드(10)와 추출된 버그 정정 코드를 AST 변환부(130)에 전달한다.In another example, when a new bug code 10 is received, the search unit 120 searches for a past bug code similar to the new bug code 10 in the storage 110. For example, the search unit 120 may be implemented by T. Kamiya et al. (IEEE Transactions on Software Engineering, pp. 654-670, 2002), which is proposed by K. Kiyoung, S. Kusumoto and K. Inoue, "CCFinder: A Multilingual Token-Based Code Clone Detection System for Large Scale Source Code, Etc. can be used to identify similar past bug codes. Then, the search unit 120 extracts a bug correction code of a similar past bug code and transmits the received new bug code 10 and the extracted bug correction code to the AST conversion unit 130.

단계(S100)에서의 버그 코드 탐색 및 버그 코드의 정정 코드 추출과 관련하여 도 4를 참조하여 설명한다.Referring to FIG. 4, the exploration of the bug code in step S100 and the correction code extraction of the bug code will be described.

도 4는 새로운 버그 코드, 과거 버그 코드, 및 과거 버그 코드의 정정 코드의 일례를 나타낸 도면이다.4 is a diagram showing an example of a new bug code, a past bug code, and a correction code of a past bug code.

도 4의 (a)의 코드는 새로운 버그 코드를 나타낸다. 새로운 버그 코드는 일련의 문자열을 입력으로 받아 그에 해당하는 체크 섬 값을 출력하는 프로그램을 구성한다. 해당 코드에서 결함의 원인이 되는 부분은 7번째 라인과 14번째 라인이다. 다만 7번째 라인은 초기화되지 않음으로 인해 런타임 오류가 발생할 수 있는 라인이다. 실제 테스크 케이스의 출력에 영향을 주는 것은 14번째 라인으로서, 14번째 라인에 의해 잘못된 수(22)를 가산하므로 결함이 발생된다. 즉, 14번째 라인은 새로운 버그 구문(B1)에 해당한다.The code of FIG. 4 (a) represents a new bug code. The new bug code constructs a program that takes a string of strings as input and prints the corresponding checksum value. The cause of the defect in the code is the 7th line and the 14th line. However, line 7 is a line that can cause run-time errors due to uninitialized lines. The 14th line that affects the output of the actual task case is the fault, since the 14th line adds the wrong number (22). That is, the 14th line corresponds to the new bug syntax (B1).

도 4의 (b)의 코드는 탐색부(120)에 의해 탐색된 유사 과거 버그 코드를 나타낸다. 유사 과거 버그 코드는 while문을 사용한 점, while문 내에 scanf() 함수와 수식이 들어간 점, 수식을 구하는 과정에서 모듈로(modulo) 연산과 가산 연산(+)을 사용한 점 등이 새로운 버그 코드와 유사하다. 20번째 라인이 버그 구문(B2)에 해당한다.4B shows a pseudo-past bug code searched by the search unit 120. The pseudo-past bug code shown in FIG. Similar past bug codes include the use of the while statement, the point where the scanf () function and formula are contained in the while statement, the use of the modulo operation and the addition operation (+) in the process of finding the expression, similar. The twentieth line corresponds to the bug syntax (B2).

도 4의 (c)의 코드는 유사 과거 버그 코드에 대응하는 정정 코드를 나타낸다. 21번째 라인이 버그 코드가 정정된 부분으로서 과거 버그 코드의 정정 구문(C1)로서 사용된다. The code of FIG. 4 (c) shows a correction code corresponding to the pseudo-past bug code. The 21st line is used as the correction phrase C1 of the past bug code as the corrected bug code.

새로운 버그 구문(B1)에는 공백 문자에 해당하는 정수형 상수 값이 없다. 따라서 유사 과거 버그 코드의 정정 구문(C1)을 사용하지 않는다면 해당 버그는 정정될 수 없다.The new bug syntax (B1) does not have an integer constant value corresponding to a space character. Therefore, the bug can not be corrected unless the correction syntax C1 of the similar past bug code is used.

다음으로, AST 변환부(130)는 전달받은 코드들을 추상 구문 트리로 변환(S120)한다. 코드들이 추상 구문 트리로 변환되면, 노드 연결 관계 또는 노드 내의 정보의 조작이 용이하여 유전 프로그래밍의 입력으로 사용될 수 있다. Next, the AST conversion unit 130 converts the received codes into an abstract syntax tree (S120). When codes are translated into abstract syntax trees, it is easy to manipulate node connectivity or information within nodes and can be used as inputs to genetic programming.

GP 연산부(140)는 변환된 추상 구문 트리에 유전 프로그래밍을 적용(S130)하고, 적합도를 평가(S140)한다. 추상 구문 트리 변환, 유전 프로그래밍, 및 적합도 평가와 관련하여, 도 5를 함께 참조하여 설명한다.The GP operation unit 140 applies genetic programming to the transformed abstract syntax tree (S130) and evaluates fitness (S140). With reference to abstract syntax tree transformations, genetic programming, and fitness evaluation, FIG. 5 will be described together.

도 5는 추상 구문 트리(AST: abstract syntax tree)로 변환된 새로운 버그 코드와 과거 버그 코드의 정정 코드의 일례를 나타낸 도면이다. 도 5에서는 새로운 버그 코드와 과거 버그 코드의 일부에 대한 추상 구문 트리를 도시한다.5 is a diagram showing an example of a new bug code converted into an abstract syntax tree (AST) and a correction code of a past bug code. FIG. 5 shows an abstract syntax tree for a new bug code and a portion of the past bug code.

도 5의 (a)에 도시된 바와 같이, 새로운 버그 코드(도 4의 B1)의 구성 요소들은 추상 구문 트리의 노드로서 표현된다. As shown in FIG. 5 (a), the components of the new bug code (B1 in FIG. 4) are represented as nodes of the abstract syntax tree.

마찬가지로, 도 5의 (b)에 도시된 바와 같이, 과거 버그 코드의 정정 코드(도 4의 C1)의 구성 요소들은 추상 구문 트리의 노드로서 표현된다.Similarly, as shown in FIG. 5B, the components of the correction code (C1 in FIG. 4) of the past bug code are expressed as nodes of the abstract syntax tree.

추상 구문 트리에 유전 프로그래밍을 적용하면 도 5의 (c)과 같은 트리가 획득될 수 있다. 각 연산은 수행 이전에 정해진 확률에 따라 적용되며, 여러 번의 반복을 거친다. 해당 트리는 원본 트리(도 5의 (a))의 대상 노드(N1)가 노드(N2)로 변경되었음을 알 수 있다.If genetic programming is applied to the abstract syntax tree, the same tree as in Fig. 5 (c) can be obtained. Each operation is applied according to a predetermined probability before execution, and it is repeated several times. The tree can know that the target node N1 of the source tree (Fig. 5 (a)) has been changed to the node N2.

이하에서는 도 6을 참조하여 단계들(S130, S140)을 구체적으로 설명한다.Hereinafter, steps S130 and S140 will be described in detail with reference to FIG.

도 6은 도 2의 버그 정정 방법의 유전 프로그래밍 적용 단계 및 적합도 평가 단계의 일례를 구체적으로 나타낸 순서도이다.FIG. 6 is a flowchart specifically illustrating an example of a genetic programming application step and a fitness evaluation step of the bug correction method of FIG.

먼저 GP 연산부(140)는 두 개의 연산 대상 트리를 선택(S131)한다. 초기에 모집단 형성을 위해서 GP 연산부(140)는 새로운 버그 코드 트리와 과거 버그 코드의 정정 코드 트리를 연산 대상 트리로서 선택할 수 있다.First, the GP operation unit 140 selects two operation subject trees (S131). The GP operation unit 140 can initially select a new bug code tree and a corrected code tree of the past bug code as the operation target tree.

GP 연산부(140)는 두 연산 대상 트리를 사용하여 교차 연산을 수행(S132)한다. 구체적으로 GP 연산부(140)는 두 연산 대상 트리에서 각각 대상 노드를 정한 후, 대상 노드로부터의 서브 트리들을 서로 뒤바꾼다. The GP operation unit 140 performs a cross operation using the two operation subject trees (S132). Specifically, the GP operation unit 140 sets the target nodes in the two operation target trees, and then changes the subtrees from the target node to each other.

이 때, GP 연산부(140)는 두 노드가 서로 교환 가능한 노드 타입인지를 부모 노드로부터 추적한다. 교차 연산 시 부모가 되는 두 트리 중 하나는 버그가 있는 것으로 판단되는 노드만을 연산 대상으로 하고, 다른 트리는 트리 내에 존재하는 모든 노드에 대해 전자와 교환 가능한 노드 타입인지만 확인되면 서로 교환될 수 있다. 이를 통해 두 코드의 트리가 서로 섞이고, 이를 소스 코드로 추출하면 프로그램 소스 코드 일부가 서로 뒤바뀔 수 있다.At this time, the GP operation unit 140 tracks from the parent node whether the two nodes are interchangeable node types. One of the two trees that is the parent in the intersecting operation can be exchanged only when it is determined that only the node judged to be a bug exists and another tree is confirmed to be the node type exchangeable with the former for all the nodes existing in the tree. This allows the trees of the two codes to blend into one another and extract them from the source code, turning some of the program's source code back and forth.

즉, GP 연산부(140)는 단계(S132)에서, 새로운 버그 코드 트리의 일부가 정정 코드 트리의 일부로 교환된 제1 트리를 생성할 수 있다.That is, in step S132, the GP computation unit 140 can generate the first tree in which a part of the new bug code tree is exchanged as a part of the corrected code tree.

GP 연산부(140)는 교차 연산이 수행된 제1 트리에 대해 변이 연산을 수행(S133)한다. The GP operation unit 140 performs a shift operation on the first tree in which the intersection operation is performed (S133).

예를 들어, GP 연산부(140)는 대상 노드를 삭제하거나, 대상 노드에 새로운 자식 노드를 추가하거나, 또는 대상 트리에 있는 두 노드의 정보를 부모-자식 노드 정보를 제외하고 노드 내부의 정보만을 교환한다. For example, the GP operation unit 140 may delete the target node, add a new child node to the target node, or exchange information of two nodes in the target tree except for the parent-child node information, do.

이외에도 GP 연산부(140)는 조건문에 사용되는 비교 연산자가 대상 노드로 선택될 경우, 해당 조건문이 가졌을지도 모르는 결함을 수정하기 위해 비교 연산자를 수정한다. In addition, when the comparison operator used in the conditional statement is selected as the target node, the GP operation unit 140 modifies the comparison operator to correct a defect that the conditional statement may have.

구체적으로 변이 연산은 아래와 같이 세 개의 연산을 포함할 수 있다. Specifically, the mutation operation can include three operations as follows.

(1) 삭제 연산은 하나의 트리에서 대상 노드를 결정한 후, 대상 노드만을 삭제하거나, 또는 대상 노드로부터의 하위 트리 전부를 삭제하는 연산이다. 이를 통해 버그의 원인이 되는 소스 코드를 삭제하는 효과를 기대할 수 있다.(1) The delete operation is an operation for determining a target node in one tree, and then deleting only the target node or deleting all subtrees from the target node. This can be expected to eliminate the source code that causes the bug.

(2) 삽입 연산은 하나의 트리에서 대상 노드를 결정한 후, 그 위치에 그 트리의 일부 노드를 복사하여 삽입하는 것이다. (2) The insert operation determines a target node in one tree, and then copies and inserts some nodes of the tree at that position.

(3) 교환 연산은 하나의 트리에서 두 개의 대상 노드를 결정한 후 두 대상 노드의 위치를 뒤바꾸는 것이다. (3) The exchange operation reverses the position of two target nodes after determining two target nodes in one tree.

GP 연산부(140)는 기 설정된 확률에 따라 교차 연산과 변이 연산을 수행할 수 있으며, 확률 값은 조정 가능하다. 예를 들어, 교차 연산은 0.95의 확률로 수행되고, 변이 연산은 0.20의 확률로 수행될 수 있다. The GP operation unit 140 can perform the intersection operation and the disparity operation according to the predetermined probability, and the probability value can be adjusted. For example, the crossover is performed with a probability of 0.95, and the crossover can be performed with a probability of 0.20.

다음으로 GP 연산부(140)는 적합도를 계산(S134)한다. 유전 프로그래밍 연산을 통해 새로 생성된 트리는 하나의 제안된 패치 프로그램에 대응한다. Next, the GP calculation unit 140 calculates the fitness (S134). The newly generated tree through the genetic programming operation corresponds to one proposed patch program.

적합도를 계산하기 위해, 미리 정의된 테스트 케이스를 통해 테스팅을 수행한 뒤, 각 테스트 케이스를 통과하는 수가 높을수록 적합도가 높은 것으로 간주한다. In order to calculate the fitness, the test is performed through a predefined test case, and the higher the number of passes through each test case, the higher the fitness is considered.

예를 들어, GP 연산부(140)는 포지티브 테스트 케이스와 네거티브 테스트 케이스를 통해 테스팅을 수행한다. For example, the GP operation unit 140 performs testing through a positive test case and a negative test case.

포지티브 테스트 케이스는 패치 트리에 대응하는 코드를 포함하는 프로그램이 필수적인 기능을 포함하는지를 검사하기 위한 테스트 케이스이고, 해당 테스트 케이스를 모두 통과한다면 테스팅 대상 프로그램은 올바른 값을 반환할 때 정상적으로 동작한다고 간주된다. A positive test case is a test case for checking whether a program containing code corresponding to the patch tree contains necessary functions. If the test case passes all the test cases, the program to be tested is considered to operate normally when returning the correct value.

네거티브 테스트 케이스는 오류를 일으킬 수 있는 동작을 일부러 수행시켜봄으로써 패치 트리에 대응하는 코드를 포함하는 프로그램이 기대되지 않은 동작을 수행하는지를 검사하기 위한 테스트 케이스이다. A negative test case is a test case for checking whether a program containing code corresponding to a patch tree performs an unexpected operation by deliberately performing an operation that may cause an error.

즉, 포지티브 테스트 케이스는 필수적 기능의 포함여부를 검사하고, 네거티브 테스트 케이스는 오류 가능성이 있는 동작을 수행시켜봄으로써 에러를 검출한다.That is, the positive test case checks whether or not an essential function is included, and the negative test case detects an error by performing an operation with a possibility of error.

GP 연산부(140)는 하기의 수학식 2을 사용하여 포지티브 및 네거티브 테스트 케이스를 통해 적합도를 계산할 수 있다.The GP operation unit 140 can calculate the fitness through the positive and negative test cases using the following equation (2).

Figure pat00004
Figure pat00004

여기서, I는 패치 트리에 대응하는 코드를 포함하는 평가 대상 프로그램이고,

Figure pat00005
,
Figure pat00006
, 및
Figure pat00007
는 각가 성공한 포지티브 테스트 케이스의 개수에 대한 가중치, 실패한 네거티브 테스트 케이스의 개수에 대한 가중치, 및 성공한 네거티브 테스트 케이스 각각의 개수에 대한 가중치이며, ptc는 성공한 포지티브 테스트 케이스의 개수이고, ntc는 실패한 네거티브 테스트 케이스의 개수이며,
Figure pat00008
는 전체 포지티브 테스트 케이스의 개수이고,
Figure pat00009
는 네거티브 테스트 케이스의 개수이다. 결과값이 클수록 적합도가 더 높은 패치이며, 1.0 이면 경우 패치 생성에 성공했음을 나타낸다.
Figure pat00010
,
Figure pat00011
, 및
Figure pat00012
의 값을 변경하여, 적합도 평가 시 필수 기능 요소 포함 여부와 결함 발생 동작 여부에 대한 중요도를 바꿈으로써 적합도 평가의 기준을 조절 가능하다.Here, I is an evaluation target program including a code corresponding to a patch tree,
Figure pat00005
,
Figure pat00006
, And
Figure pat00007
Ptc is the number of positive test cases that succeeded, ntc is the number of failed negative test cases, and ptc is the number of successful positive test cases. The number of cases,
Figure pat00008
Is the total number of positive test cases,
Figure pat00009
Is the number of negative test cases. The larger the result value, the higher the fitness. If the result is 1.0, the patch generation is successful.
Figure pat00010
,
Figure pat00011
, And
Figure pat00012
, It is possible to adjust the criteria of the fitness evaluation by changing the importance of whether the essential functional elements are included in the fitness evaluation and whether the defect occurrence operation is performed.

GP 연산부(140)는 적합도가 계산된 트리를 초기 모집단에 추가(S135)하고, 초기 모집단의 트리 개수가 기 설정된 제1 개수 이상인지 판단(S136)한다. 예를 들어, GP 연산부(140)는 초기 모집단에 포함된 트리 개수가 50개가 될 때까지 교차, 변이 연산을 통해 트리를 생성하여 초기 모집단에 추가할 수 있다.The GP operation unit 140 adds the tree to which the fitness is calculated to the initial population (S135), and determines whether the number of trees in the initial population is greater than or equal to a predetermined first number (S136). For example, the GP operation unit 140 may generate a tree through intersection and mutation operations until the number of trees included in the initial population reaches 50, and add the tree to the initial population.

초기 모집단의 트리 개수가 기 설정된 제1 개수보다 더 작으면, GP 연산부(140)는 모집단으로부터 두 개의 연산 대상 트리를 다시 선택(S131)한다. If the number of trees in the initial population is smaller than the predetermined first number, the GP operation unit 140 again selects two operation subject trees from the population (S131).

초기 모집단의 트리 개수가 기 설정된 제1 개수 이상이면, GP 연산부(140)는 제1 개수 이상의 트리를 갖는 초기 모집단으로부터 두 개의 연산 대상 트리를 선택(S137)한다. 이 때, 각 트리는 단계(S134)에서 계산된 적합도 값을 이용하여 결정될 수 있다. 예를 들어, GP 연산부(140)는 적합도 값을 이용하여 최상위의 적합도 값을 갖는 두 개의 트리를 연산 대상 트리로서 선택하거나, 또는 적합도 값을 이용하여 룰렛 휠 방식(적합도의 총합에 대한 각각의 트리의 적합도를 확률로 사용함)을 사용함으로써, 연산 대상 트리를 선택할 수 있다.If the number of trees in the initial population is greater than or equal to the predetermined first number, the GP operation unit 140 selects two operation subject trees from the initial population having the first number or more trees (S137). At this time, each tree may be determined using the fitness value calculated in step S134. For example, the GP operation unit 140 may select two trees having a fitness value of the highest level as the operation target tree by using the fitness value, or use the roulette wheel method (each tree of the fitness of the fitness By using the probability of fitness of the target tree as a probability).

그리고, GP 연산부(140)는 두 개의 연산 대상 트리를 사용하여, 교차 연산(S138), 변이 연산(S139)을 수행하여 새로운 패치 트리를 생성하고, GP 연산부(140)는 연산에 의해 생성된 패치 트리의 적합도(S141)를 평가한다. The GP operation unit 140 generates a new patch tree by performing the intersection operation (S138) and the variation operation (S139) using the two operation subject trees, and the GP operation unit 140 generates a patch tree The fitness of the tree (S141) is evaluated.

GP 연산부(140)는 연산에 의해 생성된 패치 트리의 적합도가 임계치 이상인지 평가(S142)한다. The GP computing unit 140 evaluates whether the fitness of the patch tree generated by the computation is equal to or greater than a threshold value (S142).

연산에 의해 생성된 트리의 적합도가 임계치보다 더 작으면, GP 연산부(140)는 생성된 패치 트리를 모집단에 추가(S143)하고, 모집단의 트리 개수가 기 설정된 제2 개수 이상인지 판단(S144)한다. If the fitness of the tree generated by the operation is smaller than the threshold value, the GP operation unit 140 adds the generated patch tree to the population (S143) and determines whether the number of trees in the population is equal to or greater than a predetermined second number (S144) do.

모집단의 트리 개수가 기 설정된 제2 개수 미만이면, GP 연산부(140)는 다시 모집단에 대해 유전 프로그래밍 연산을 적용하여 새로운 패치 트리를 생성(S137 내지 S139)하고, 적합도를 계산(S141)하여 이를 평가(S142)할 수 있다.If the number of trees in the population is less than the predetermined second number, the GP operation unit 140 generates a new patch tree by applying a genetic programming operation to the population again (S137 to S139), calculates a fitness (S141) (S142).

모집단의 트리 개수가 기 설정된 제2 개수 이상이면, GP 연산부(140)는 해당 모집단이 마지막 세대 모집단인지 판단(S145)한다. If the number of trees in the population is equal to or greater than a predetermined second number, the GP computing unit 140 determines whether the population is the last-generation population (S145).

GP 연산부(140)는 해당 모집단이 마지막 세대 모집단이 아닌 경우, 다음 세대 모집단을 생성(S146)한다. 예를 들어, GP 연산부(140)는 현재 모집단에서 소정의 적합도 값 미만의 트리를 제거하여 다음 세대의 모집단을 생성한다. If the population is not the last-generation population, the GP computing unit 140 generates a next-generation population (S146). For example, the GP operation unit 140 generates a population of the next generation by removing a tree below a predetermined fitness value in the current population.

그리고, GP 연산부(140)는 다음 세대의 모집단에 대해 유전 프로그래밍 연산을 적용하여 새로운 패치 트리를 생성(S137 내지 S139)하고, 적합도를 계산(S141)하여 이를 평가(S142)할 수 있다. Then, the GP operation unit 140 generates a new patch tree by applying a genetic programming operation to the population of the next generation (S137 to S139), calculates fitness (S141), and evaluates the fitness (S142).

연산에 의해 생성된 트리의 적합도가 임계치 이상이면, 정정 코드 출력부(150)는 패치 트리로부터 패치 코드를 생성(S150)한다. 패치 코드와 관련하여 도 7을 함께 참조한다. If the fitness of the tree generated by the calculation is equal to or larger than the threshold value, the correction code output unit 150 generates a patch code from the patch tree (S150). Please refer to FIG. 7 together with the patch code.

도 7은 새로운 버그 코드의 정정 코드의 일례를 나타낸 도면이다. 7 is a diagram showing an example of a new bug code correcting code.

도 7에 도시된 바와 같이, 일 실시예에 따른 버그 정정 시스템(100) 및 버그 정정 방법에 의해, 도 4의 (a)에서의 버그 구문(B1)이 새로운 정정 구문(C2)으로 변경되었다. As shown in FIG. 7, the bug syntax B1 in FIG. 4A is changed to the new revision syntax C2 by the bug correction system 100 and the bug correction method according to the embodiment.

즉, 일 실시예에 따른 버그 정정 시스템(100) 및 버그 정정 방법에 따르면, 정정 대상이 되는 코드와 유사한 과거 버그의 정정 코드를 이용함으로써 대상 코드에 디버깅을 위한 정보가 전혀 포함되지 않았을 경우에도 올바른 패치를 생성하는 것이 가능하다.That is, according to the bug correction system 100 and the bug correction method according to the embodiment, by using the correction code of the past bug similar to the code to be corrected, even when no information for debugging is included in the target code at all, It is possible to create a patch.

또한 일 실시예에 따른 버그 정정 시스템(100) 및 버그 정정 방법에 따르면, 복잡한 사전 정의 작업이 필요하지 않고, 주어진 소스 코드와 유사한 버그를 판별해냄으로써 여러 유형의 버그에 대응할 수 있다.In addition, according to the bug correction system 100 and the bug correction method according to an embodiment, it is possible to deal with various types of bugs by determining a bug similar to a given source code without requiring a complicated predefined operation.

이상에서 본 발명의 실시예에 대하여 상세하게 설명하였지만 본 발명의 권리범위는 이에 한정되는 것은 아니고 다음의 청구범위에서 정의하고 있는 본 발명의 기본 개념을 이용한 당업자의 여러 변형 및 개량 형태 또한 본 발명의 권리범위에 속하는 것이다.While the present invention has been particularly shown and described with reference to exemplary embodiments thereof, it is to be understood that the invention is not limited to the disclosed exemplary embodiments, It belongs to the scope of right.

Claims (14)

새로운 버그 정보를 수신하고, 버그 저장소에 저장된 과거 버그 정보 중 상기 새로운 버그 정보와 유사한 과거 버그 정보를 탐색하는 탐색부,
상기 새로운 버그 정보의 버그 코드와 상기 유사한 과거 버그 정보의 버그 정정 코드를 각각 추상 구문 트리(AST: abstract syntax tree)로 변환하는 AST 변환부,
상기 추상 구문 트리들에 유전 프로그래밍(GP: genetic programming)을 적용하여 새로운 트리를 생성하고, 상기 새로운 트리의 적합도를 계산하며, 소정 임계치 이상의 적합도를 갖는 새로운 트리를 출력하는 GP 연산부, 그리고
상기 소정 임계치 이상의 적합도를 갖는 새로운 트리를 패치 코드로 출력하는 정정 코드 출력부
를 포함하는 버그 정정 시스템.
A search unit for receiving new bug information and searching past bug information similar to the new bug information among past bug information stored in the bug storage,
An AST conversion unit for converting the bug code of the new bug information and the bug correction code of the similar past bug information into an abstract syntax tree (AST)
A GP operation unit for generating a new tree by applying genetic programming to the abstract syntax trees, calculating a fitness of the new tree, and outputting a new tree having a fitness greater than or equal to a predetermined threshold;
A correction code output unit for outputting a new tree having a fitness value equal to or higher than the predetermined threshold value,
A bug correction system.
제1항에 있어서,
상기 탐색부는 상기 새로운 버그 정보로서 새로운 버그 리포트를 수신하면, 모델링된 토픽을 기반으로 수신한 상기 새로운 버그 리포트와 대응하는 토픽(topic)을 식별하고, 상기 버그 저장소에서 상기 식별된 토픽을 가진 과거 버그 리포트를 탐색하며, 상기 새로운 버그 리포트에 포함된 버그 코드와 상기 탐색된 과거 버그 리포트의 버그 정정 코드를 추출하여 코드 블록 유사도를 계산함으로써, 상기 새로운 버그 리포트에 포함된 버그 코드와 유사한 과거 버그 리포트의 버그 정정 코드를 결정하는,
버그 정정 시스템.
The method according to claim 1,
The search unit, when receiving a new bug report as the new bug information, identifies a topic corresponding to the new bug report received based on the modeled topic, and searches for a past bug with the identified topic in the bug repository Extracting a bug code included in the new bug report and a bug correction code of the searched past bug report to calculate a code block similarity so as to calculate a code block similarity of a past bug report similar to the bug code included in the new bug report To determine the bug correction code,
Bug Correction System.
제2항에 있어서,
상기 탐색부는,
[수학식 1]
Figure pat00013

을 이용하여 상기 코드 블록 유사도를 계산하고,
여기서 Src1, Src2는 각각 상기 새로운 버그 리포트에 포함된 버그 코드 및 과거 버그 리포트의 버그 정정 코드를 의미하는,
버그 정정 시스템.
3. The method of claim 2,
The searching unit searches,
[Equation 1]
Figure pat00013

To calculate the code block similarity,
Here, Src1 and Src2 denote the bug code included in the new bug report and the bug correction code of the past bug report, respectively.
Bug Correction System.
제1항에 있어서,
상기 탐색부는 상기 새로운 버그 정보로서 새로운 버그 코드를 수신하면, 상기 버그 저장소에서 상기 새로운 버그 코드와 유사한 과거 버그 코드를 탐색하는,
버그 정정 시스템.
The method according to claim 1,
Wherein the search unit searches the bug storage for a past bug code similar to the new bug code when receiving the new bug code as the new bug information,
Bug Correction System.
제1항에 있어서,
상기 GP 연산부는 상기 추상 구문 트리들을 이용하여 초기 모집단을 생성하고, 상기 초기 모집단에서 두 개의 연산 대상 트리를 선택하여 상기 유전 프로그래밍을 적용하는,
버그 정정 시스템.
The method according to claim 1,
Wherein the GP operation unit generates an initial population using the abstract syntax trees, selects two operation subject trees from the initial population, and applies the genetic programming,
Bug Correction System.
제5항에 있어서,
상기 GP 연산부는,
상기 추상 구문 트리들을 사용하여 교차 연산을 수행하고, 상기 교차 연산에 의해 생성된 제1 트리에 대해 변이 연산을 수행하며, 상기 변이 연산이 수행된 제1 트리의 적합도를 계산하고, 상기 변이 연산이 수행된 제1 트리를 상기 초기 모집단에 추가하며, 상기 초기 모집단의 트리 개수가 기 설정된 제1 개수 이상이면 상기 초기 모집단의 생성을 완료하는,
버그 정정 시스템.
6. The method of claim 5,
The GP operation unit,
Performing a crossover operation using the abstract syntax trees, performing a crossover operation on the first tree generated by the crossover operation, calculating a fitness of the first tree on which the crossover operation is performed, Adding the performed first tree to the initial population, and completing the generation of the initial population if the number of trees in the initial population is greater than or equal to a predetermined first number,
Bug Correction System.
제6항에 있어서,
상기 GP 연산부는,
상기 초기 모집단의 생성이 완료되면, 상기 초기 모집단으로부터 상기 적합도 값을 이용하여 상기 두 개의 연산 대상 트리를 선택하고, 상기 두 개의 연산 대상 트리를 사용하여 교차 연산을 수행하고, 상기 교차 연산에 의해 생성된 제2 트리에 대해 변이 연산을 수행하며, 상기 변이 연산이 수행된 제2 트리의 적합도를 계산하고, 상기 계산된 적합도가 임계치 이상이면, 상기 변이 연산이 수행된 제2 트리를 상기 패치 트리로서 출력하는,
버그 정정 시스템.
The method according to claim 6,
The GP operation unit,
When the generation of the initial population is completed, the two operation subject trees are selected from the initial population using the fitness value, the cross operation is performed using the two operation subject trees, and the cross- And calculating a fitness of the second tree in which the mutation operation is performed, and if the calculated fitness is greater than or equal to a threshold value, the second tree in which the mutation operation has been performed is performed as the patch tree Outputting,
Bug Correction System.
제6항에 있어서,
상기 GP 연산부는 상기 계산된 적합도가 임계치보다 더 작으면, 상기 변이 연산이 수행된 제2 트리를 상기 초기 모집단을 포함하는 모집단에 추가하고, 상기 모집단의 트리 개수가 기 설정된 제2 개수 이상인지 판단하며, 상기 모집단의 트리 개수가 기 설정된 제2 개수 이상이면, 상기 모집단이 마지막 세대 모집단인지를 판단하고, 상기 모집단이 마지막 세대 모집단이 아니면, 다음 세대 모집단을 생성하는,
버그 정정 시스템.
The method according to claim 6,
Wherein the GP operation unit adds the second tree in which the mutation operation is performed to the population including the initial population if the calculated fitness is smaller than the threshold value and determines whether the number of trees in the population is greater than or equal to a predetermined second number Determining if the population is a last-generation population if the number of trees in the population is greater than or equal to a predetermined second number; and if the population is not a last-generation population,
Bug Correction System.
제8항에 있어서,
상기 GP 연산부는 상기 모집단에서 소정의 적합도 미만의 트리를 제거하여 상기 다음 세대 모집단을 생성하는,
버그 정정 시스템.
9. The method of claim 8,
Wherein the GP operation unit removes a tree less than a predetermined fitness from the population to generate the next generation population,
Bug Correction System.
제6항에 있어서,
상기 GP 연산부는 상기 두 개의 연산 대상 트리에서 각각 대상 노드를 정한 후, 대상 노드로부터의 서브 트리들을 서로 뒤바꿔 상기 교차 연산을 수행하는,
버그 정정 시스템.
The method according to claim 6,
Wherein the GP operation unit sets the target nodes in the two operation subject trees and then performs the cross operation by rearranging the subtrees from the target node to each other,
Bug Correction System.
제6항에 있어서,
상기 변이 연산은,
(1) 하나의 트리에서 대상 노드를 결정한 후, 상기 대상 노드만을 삭제하거나, 또는 상기 대상 노드로부터의 하위 트리 전부를 삭제하는 삭제 연산,
(2) 하나의 트리에서 대상 노드를 결정한 후, 상기 대상 노드의 위치에 상기 하나의 트리의 일부 노드를 복사하여 삽입하는 삽입 연산, 및
(3) 하나의 트리에서 두 개의 대상 노드를 결정한 후, 상기 두 개의 대상 노드의 위치를 서로 뒤바꾸는 교환 연산을 포함하는,
버그 정정 시스템.
The method according to claim 6,
The shift operation may include:
(1) a deletion operation for deleting only the target node after determining the target node in one tree, or deleting all the subtrees from the target node,
(2) an insert operation for determining a target node in one tree and then copying and inserting some nodes of the one tree at the position of the target node; and
(3) an exchange operation of determining two target nodes in one tree and then reversing the positions of the two target nodes,
Bug Correction System.
새로운 버그 정보를 수신하고, 버그 저장소에 저장된 과거 버그 정보 중 상기 새로운 버그 정보와 유사한 과거 버그 정보를 탐색하는 단계,
상기 새로운 버그 정보의 버그 코드와 상기 유사한 과거 버그 정보의 버그 정정 코드를 각각 추상 구문 트리(AST: abstract syntax tree)로 변환하는 단계,
상기 추상 구문 트리들에 유전 프로그래밍(GP: genetic programming)을 적용하여 새로운 트리를 생성하는 단계,
상기 새로운 트리의 적합도를 계산하는 단계,
소정 임계치 이상의 적합도를 갖는 새로운 트리를 출력하는 단계, 그리고
상기 소정 임계치 이상의 적합도를 갖는 새로운 트리를 패치 코드로 출력하는 단계
를 포함하는 버그 정정 방법.
Receiving new bug information, searching past bug information similar to the new bug information from past bug information stored in the bug repository,
Transforming the bug code of the new bug information and the bug correction code of the similar past bug information into an abstract syntax tree (AST)
Generating a new tree by applying genetic programming to the abstract syntax trees,
Calculating a fitness of the new tree,
Outputting a new tree having a fitness greater than or equal to a predetermined threshold value, and
Outputting a new tree having a fitness level equal to or higher than the predetermined threshold value to a patch code
/ RTI >
제12항에 있어서,
상기 새로운 버그 정보와 유사한 과거 버그 정보를 탐색하는 단계는,
상기 새로운 버그 정보로서 새로운 버그 리포트를 수신하는 단계,
모델링된 토픽을 기반으로 수신한 상기 새로운 버그 리포트와 대응하는 토픽(topic)을 식별하는 단계,
상기 버그 저장소에서 상기 식별된 토픽을 가진 과거 버그 리포트를 탐색하는 단계, 그리고
상기 새로운 버그 리포트에 포함된 버그 코드와 상기 탐색된 과거 버그 리포트의 버그 정정 코드를 추출하여 코드 블록 유사도를 계산함으로써, 상기 새로운 버그 리포트에 포함된 버그 코드와 유사한 과거 버그 리포트의 버그 정정 코드를 결정하는 단계를 포함하는,
버그 정정 방법.
13. The method of claim 12,
Searching for past bug information similar to the new bug information,
Receiving a new bug report as the new bug information,
Identifying a topic corresponding to the new bug report received based on the modeled topic,
Searching past bug reports with the identified topic in the bug repository, and
A bug correction code of the past bug report similar to the bug code included in the new bug report is determined by extracting the bug code included in the new bug report and the bug correction code of the searched past bug report ≪ / RTI >
How to fix bugs.
제13항에 있어서,
상기 코드 블록 유사도를 계산하는 것은,
[수학식 1]
Figure pat00014

을 이용하여 상기 코드 블록 유사도를 계산하고,
여기서 Src1, Src2는 각각 상기 새로운 버그 리포트에 포함된 버그 코드 및 과거 버그 리포트의 버그 정정 코드를 의미하는 것인,
버그 정정 방법.
14. The method of claim 13,
Calculating the code block similarity,
[Equation 1]
Figure pat00014

To calculate the code block similarity,
Wherein Src1 and Src2 are respectively the bug code included in the new bug report and the bug correction code of the past bug report,
How to fix bugs.
KR1020180008380A 2018-01-23 2018-01-23 Bug fixing system and bug fixing method KR102160780B1 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
KR1020180008380A KR102160780B1 (en) 2018-01-23 2018-01-23 Bug fixing system and bug fixing method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
KR1020180008380A KR102160780B1 (en) 2018-01-23 2018-01-23 Bug fixing system and bug fixing method

Publications (2)

Publication Number Publication Date
KR20190089615A true KR20190089615A (en) 2019-07-31
KR102160780B1 KR102160780B1 (en) 2020-09-28

Family

ID=67473915

Family Applications (1)

Application Number Title Priority Date Filing Date
KR1020180008380A KR102160780B1 (en) 2018-01-23 2018-01-23 Bug fixing system and bug fixing method

Country Status (1)

Country Link
KR (1) KR102160780B1 (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20210084873A (en) * 2019-12-30 2021-07-08 한양대학교 에리카산학협력단 Method for constructing patched source code from assembly code and apparatus therefor
CN113407370A (en) * 2020-03-16 2021-09-17 中国移动通信有限公司研究院 Root cause error clustering method, device, equipment and computer readable storage medium
KR20220093760A (en) 2020-12-28 2022-07-05 서울시립대학교 산학협력단 Apparatus and method for repairing bug
KR20220135414A (en) 2021-03-30 2022-10-07 서울시립대학교 산학협력단 Apparatus and method for repairing bug source code for program
KR20230147282A (en) 2022-04-14 2023-10-23 서울시립대학교 산학협력단 Apparatus and method for repairing source code bug of program

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20140133032A (en) * 2013-05-09 2014-11-19 서울대학교산학협력단 A system and control method for a meta-heuristic algorithm utilizing similarity for performance enhancement
KR101642433B1 (en) * 2014-06-13 2016-07-25 주식회사 유비벨록스모바일 Method for providing intelligent contents recommendation service by considering user's preferences

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20140133032A (en) * 2013-05-09 2014-11-19 서울대학교산학협력단 A system and control method for a meta-heuristic algorithm utilizing similarity for performance enhancement
KR101642433B1 (en) * 2014-06-13 2016-07-25 주식회사 유비벨록스모바일 Method for providing intelligent contents recommendation service by considering user's preferences

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20210084873A (en) * 2019-12-30 2021-07-08 한양대학교 에리카산학협력단 Method for constructing patched source code from assembly code and apparatus therefor
CN113407370A (en) * 2020-03-16 2021-09-17 中国移动通信有限公司研究院 Root cause error clustering method, device, equipment and computer readable storage medium
KR20220093760A (en) 2020-12-28 2022-07-05 서울시립대학교 산학협력단 Apparatus and method for repairing bug
KR20220135414A (en) 2021-03-30 2022-10-07 서울시립대학교 산학협력단 Apparatus and method for repairing bug source code for program
KR20230147282A (en) 2022-04-14 2023-10-23 서울시립대학교 산학협력단 Apparatus and method for repairing source code bug of program

Also Published As

Publication number Publication date
KR102160780B1 (en) 2020-09-28

Similar Documents

Publication Publication Date Title
KR102160780B1 (en) Bug fixing system and bug fixing method
US10146532B2 (en) Apparatus and method for detecting code cloning of software
US11775414B2 (en) Automated bug fixing using deep learning
US8181163B2 (en) Program synthesis and debugging using machine learning techniques
CN102999318B (en) The method of aided programming and device
US20100333073A1 (en) Systems and methods for automated generation of software tests based on modeling the software test domain
US9043651B2 (en) Systematic failure remediation
WO2023010916A1 (en) Software automatic repair method and system, electronic device, and storage medium
CN116305158A (en) Vulnerability identification method based on slice code dependency graph semantic learning
JP6645955B2 (en) Test script correction device and test script correction program
CN113032548A (en) Information processing apparatus, storage medium, and information processing method
US11645192B2 (en) Graph-based method for inductive bug localization
JP6689734B2 (en) Test script correction device and test script correction program
CN110688368B (en) Component behavior model mining method and device
CN111190768B (en) Database execution error recovery method, database access method and device
CN115167868B (en) Code compiling method, device, equipment and computer storage medium
JP6451417B2 (en) Debug support device, debug support system, debug support method, and debug support program
US9396239B2 (en) Compiling method, storage medium and compiling apparatus
CN114153447B (en) Automatic AI training code generation method
Zheng et al. Automatic data structure repair using separation logic
CN114791865A (en) Method, system and medium for detecting self-consistency of configuration items based on relational graph
CN106844218A (en) A kind of evolution influence collection Forecasting Methodology based on section of developing
CN112733199A (en) Data processing method and device, electronic equipment and readable storage medium
CN112733517A (en) Method for checking requirement template conformity, electronic equipment and storage medium
US10417110B2 (en) Method for verifying traceability of first instructions in a procedural programming language generated from second instructions in a modelling language

Legal Events

Date Code Title Description
A201 Request for examination
E902 Notification of reason for refusal
E90F Notification of reason for final refusal
E701 Decision to grant or registration of patent right
GRNT Written decision to grant