# 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
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.

OS: Linux (Tested on Ubuntu 16.04.2 LTS)
Download and configure Defects4J running environment.
Configure the following path.
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.
unzip file sbfl/data.zip to sbfl/data : used for fault localization
using the command line provided by Defects4J to checkout a buggy version of benchmark for testing.
Example: defects4j checkout -p Chart -v 1b -w ${buggy_program_path}/chart/chart_1_buggy
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
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.
Our prototype of SimFix needs three input options for running.
--proj_home : the home of buggy program of benchmark. (${buggy_program_path} for the example)
--proj_name : the project name of buggy program of benchmark. (chart for the example)
--bug_id : the identifier of the buggy program. (1 for the example)
the option of --bugy_id supports multiple formats:
single_id : repair single bug, e.g., 1.
startId-endId : repair a series of bugs with consecutive identifiers, e.g., 1-3.
single_id,single_id,single_id : repair any bugs for the specific program, e.g., 1,5,9.
all : repair all buggy versions of a specific project, i.e., all.
xxxxxxxxxxUsage: --proj_home=${proj_home} --proj_name=${proj_name} --bug_id=${bug_id}Example: --proj_home=/home/user --proj_name=chart --bug_id=1Another: --proj_home=/home/user --proj_name=chart --bug_id=1,4,8OPTION 1 : run within eclipse.
From the Main class:
Run As→Run Configurations… →Arguments : set the above arguments as Program Arguments.
OPTION 2 : run using command line.
We also provide runnable jar file of SimFix in the home folder of the project i.e., simfix.jar.
set the home directory of the SimFix project as your correct path and then run as:
java -jar simfix.jar --proj_home=/home/user --proj_name=chart --bug_id=1
After finishing the repair, there will be two additional folders: log and patch.
log : debug output, including buggy statements already tried, patches and reference code snippet for correct patch generation.
patch : a single source file repaired by SimFix that can pass the test suite. In the source file, you can find the patch, which is formatted as (example of Chart_1):
xxxxxxxxxx// start of generated patchint index=this.plot.getIndexOf(this);CategoryDataset dataset=this.plot.getDataset(index);if(dataset==null){return result;}// end of generated patch/* start of original code int index = this.plot.getIndexOf(this); CategoryDataset dataset = this.plot.getDataset(index); if (dataset != null) { return result; } end of original code*/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. | Intersections. |
xxxxxxxxxx |--- README.md : user guidance |--- bin : binary code |--- d4j-info : defects4j information |--- doc : document |--- final : evaluation result |--- lib : dependent libraries |--- sbfl : fault localization tool |--- src : source code |--- test : test suiteALL suggestions are welcomed.