# SimFix **Repository Path**: hejy47/SimFix ## Basic Information - **Project Name**: SimFix - **Description**: No description available - **Primary Language**: Unknown - **License**: GPL-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2021-03-24 - **Last Updated**: 2022-07-12 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README README

SimFix

I. Introduction

SimFix is an automatic program repair technique, which leverages exisiting patches from other projects and similar code snippets in the same project to generate patches. The following figure is the workflow of our approach.

The workflow of this technique.\label{workflow}

Mining Stage

  1. mine repair patterns from existing open-source projects, after which we can obtain a set of frequent repair patterns. Those patterns can be reused for other repairing scenarios as well.

Repairing Stage

  1. Fault Localization : obtain a ranking list of candidate faulty statements and extract corresponding code snippets.
  2. Donor Snippet Identification : identify the similarity between faulty code snippet and each candidate similar code snippet by leveraging three similarity metrics, according to which we obtain a list of candidate similar snippets with decending order of similarity value.
  3. Variable Mapping : establish the mapping relationship between variables in faulty and similar code snippets by leveraging similarity metrics and then obtain a mapping table, based on which the variables in the donor code snippet will be replaced with the corresponding variables.
  4. Modification Extraction and Intersection : extract code modifications to faulty code snippet via AST (Abstract Syntax Tree) matching and differencing against the donor snippet, and then the frequent patterns from the mining stage will be used to take intersection with those modifications to further ruled out invalid ones.
  5. Patch Generation & Validation : generate repair patches by applying extracted code modifications to the faulty code snippet with combining and ranking whose modifications, then using the test suite to validate the correctness of candidate patches until a correct patch found or timeout.

II. Environment

 

III. How to run

SimFix was traditionally developed as an Eclipse Java project, you can simply import this project to your workspace and run it as a common Java program. The main class is cofix.main.Main, and for the running option please refer to the Running Options.

Before running

NOTE : the path of the buggy version of benchmark have to be set as:

…/projectName/projectName_id_buggy => Example: /home/user/chart/chart_1_buggy

Step 1, Build The Project

Originally, SimFix was developed as an Eclipse Java Project, you can simply import the project into your workspace and the class cofix.main.Main is the entry of the whole program.

Step 2, Running Options

Our prototype of SimFix needs three input options for running.

OPTION 1 : run within eclipse.

OPTION 2 : run using command line.

Step 3, Result Analysis

After finishing the repair, there will be two additional folders: log and patch.

IV. Evaluation Result

Totally, SimFix successfully repair 34 bugs among 357 bugs in Defects4j v1.0 benchmark with generating 22 plausible but incorrect patches. The following table and venn diagram are comparison with existing approaches. More details are presented in the sub-folder final.

The comparison with existing approaches.\label{compare}Intersection among different approaches.\label{venn}
The comparison with existing approaches.Intersections.

V. Structure of the project

 

ALL suggestions are welcomed.