当前的程序自动修复(automated program repair)工具介绍

前言

在此罗列出从2008年(即自动修复方向开始兴起时)起,到现在出现的软件自动修复工具,并附上一些解释,以便跟进软件自动修复领域的现状。

这篇博客会不断更新。

基本概念

Automated program repair
Automated software repair
Automated bug fixing
Automatic program repair
自动软件修复
软件自动修复
自动程序修复
程序自动修复

以上这几个术语都指的是一个概念,也就是:程序自动修复

参考文献

  • 王赞, 郜健, 陈翔, 等. 自动程序修复方法研究述评[J]. 计算机学报, 2018, 41(3): 588-610.
  • Gazzola L, Micucci D, Mariani L. Automatic software repair: A survey[J]. IEEE Transactions on Software Engineering, 2017.
  • Monperrus M. Automatic software repair: a bibliography[J]. ACM Computing Surveys (CSUR), 2018, 51(1): 17.

2008 co-evolutionary approach

文章:

  • Arcuri A, Yao X. A novel co-evolutionary approach to automatic software bug fixing[C]//2008 IEEE Congress on Evolutionary Computation (IEEE World Congress on Computational Intelligence). IEEE, 2008: 162-168.
  • Arcuri A, Yao X. Coevolving programs and unit tests from their specification[C]//Proceedings of the twenty-second IEEE/ACM international conference on Automated software engineering. ACM, 2007: 397-400.

方法:
缺陷程序和测试用例共同进化(类似于捕食者和被捕食者)

框架:

  • GP(遗传编程)
  • 从形式化规约得到的距离函数
  • 基于搜索的软件测试
  • 协同进化

在这里插入图片描述

2009 Genprog

文章:

  • Le Goues C, Nguyen T V, Forrest S, et al. Genprog: A generic method for automatic software repair[J]. Ieee transactions on software engineering, 2011, 38(1): 54-72.
  • Le Goues C, Dewey-Vogt M, Forrest S, et al. A systematic study of automated program repair: Fixing 55 out of 105 bugs for $8 each[C]//2012 34th International Conference on Software Engineering (ICSE). IEEE, 2012: 3-13.
  • Weimer W, Nguyen T V, Le Goues C, et al. Automatically finding patches using genetic programming[C]//Proceedings of the 31st International Conference on Software Engineering. IEEE Computer Society, 2009: 364-374.

方法:
1)把源程序转化为AST(抽象语法树);
2)迭代使用交叉算子和变异算子对 已有的抽象语法树中的节点进行随机删除、增加或 替换,以生成新的AST 并转换成对应的程序补丁;
3)补丁验证。

2010 MutRepair(基于变异操作的修复)

文章:

  • Debroy V, Wong W E. Using mutation to automatically suggest fixes for faulty programs[C]//2010 Third International Conference on Software Testing, Verification and Validation. IEEE, 2010: 65-74.

方法:
借助变异测试(Mutation Testing) 中的变异算子(Mutation Operator)来尝试生成程序补丁。

2011 JAFF

文章:

  • Arcuri A. Evolutionary repair of faulty software[J]. Applied soft computing, 2011, 11(4): 3494-3514.

方法:
主要是用了搜索算子(也叫mutation operator),然后还用了随机搜索(random search)这种。

实验:

  • Different types of search algorithms could be used. In this initial investigation, we consider
    and compare three search algorithms. We use a random search as baseline. Then we consider a
    single individual algorithm (i.e., a variant of a Hill Climbing) and a population based algorithm
    (i.e., Genetic Programming [52]).

很严谨。

2011 基于Alloy规约语言、CFG控制流图的修复工具

文章:

  • Gopinath D, Malik M Z, Khurshid S. Specification-based program repair using SAT[C]//International Conference on Tools and Algorithms for the Construction and Analysis of Systems. Springer, Berlin, Heidelberg, 2011: 173-188.

方法:

他们首先使用缺 陷定位方法对程序中可能存在缺陷的位置排序,然 后通过生成程序对应的参数化的控制流图(Control Flow Graph,CFG),基于 Alloy 语言[61]的程序规格 描述产生一系列的代码约束公式。最后将程序的前 置状态、代码约束和后置条件代入到约束求解器中 求解,得到满足所有约束条件的参数值。如果具体 化后的CFG能够通过所有的输入并产生正确结果, 则将该 CFG 转化成最终的补丁程序。该方法能够 识别并解决绝大部分的赋值语句错误和分支条件 错误,但是对语句缺失引起的错误的修复效果较 差,并且修复过程中需要人工参与进行程序的规格 描述。
在这里插入图片描述

2013 AE

文章:

  • Weimer W, Fry Z P, Forrest S. Leveraging program equivalence for adaptive program repair: Models and first results[C]//2013 28th IEEE/ACM International Conference on Automated Software Engineering (ASE). IEEE, 2013: 356-366.

方法:
AE(Adaptive Equivalence)

  • 该方法基于近似语义等价关系来识别出语义等价 的候选补丁,从而可以有效减少需要评估的候选补丁数;
  • AE和RSRepair考虑的搜索空间一样,即所有的程序变体都能够通过单个Genprog修复操作来得到;
  • AE是确定性算法,因为是从缺陷定位最可疑的语句开始遍历修复。

2013 SemFix

文章:

  • Nguyen H D T, Qi D, Roychoudhury A, et al. Semfix: Program repair via semantic analysis[C]//2013 35th International Conference on Software Engineering (ICSE). IEEE, 2013: 772-781.

方法:

  • 测试用例被转换成约束;用符号执行去生成修复约束,用程序综合去生成表达式(expression)
  • 该工具基于:符号执行,约束求解,程序综合
  • 先约束求解,把使得所有失败用例通过的约束给找出来,然后就是用程序综合技术(以常亮,加号减号等)去做综合,直到满足约束为止。

实验:

  • We compare our method with recently proposed genetic programming based repair on SIR programs with seeded bugs, as well as fragments of GNU Coreutils with real bugs.

2013 PAR

文章:

  • Kim D, Nam J, Song J, et al. Automatic patch generation learned from human-written patches[C]//Proceedings of the 2013 International Conference on Software Engineering. IEEE Press, 2013: 802-811.

方法:

在这里插入图片描述

  • 在应用修复模板时,需要:1)AST分析;2)上下文检查;3)程序修改。
  • We adopt this evolutionary computing process, because it is effective in automatic patch generation [8] by efficiently exploring a large number of program variants. Applying an evolutionary computing process to program repair was pio- neered by Weimer et al. [7] and Arcuri et al. [5]. 意思就是这里也用了进化算法。

2014 RSRepair

文章:

  • Qi Y, Mao X, Lei Y, et al. The strength of random search on automated program repair[C]//Proceedings of the 36th International Conference on Software Engineering. ACM, 2014: 254-265.

方法:
不用遗传算法,用随机搜索(random search),达到更快的修复,执行更少的测试用例。

2014 SearchRepair

文章:

  • Stolee K T, Elbaum S, Dobos D. Solving the search for source code[J]. ACM Transactions on Software Engineering and Methodology (TOSEM), 2014, 23(3): 26.

方法:
首先将开源项目中 大量人工编写的代码段编码为基于输入输出行为 的 SMT 约束,并存储到数据库中。其次借助软件 缺陷定位方法定位到可能含有缺陷的代码,并分析 出其预期的输入输出行为。接着借助最新的约束求 解器,从数据库中搜索出可满足预期行为的代码 段,并尝试将之嵌入到缺陷代码中(例如通过变量 重新命名等),并生成补丁。最后通过测试用例的 执行结果来验证补丁是否正确。

2014 Minthint

文章:

  • Kaleeswaran S, Tulsian V, Kanade A, et al. Minthint: Automated synthesis of repair hints[C]//Proceedings of the 36th International Conference on Software Engineering. ACM, 2014: 266-276.

方法:
首先借助软件缺陷定位方法 识别出含有缺陷可能性高的语句,并依次借助 Minthint 方法尝试得到修复提示。

针对某个可疑语句,该方法首先借助动态符号执行得出一个状态转化,其本质是一个函数,输入是每个测试用例在执行到该语句前的程序状态,输出是执行完该语句后 的预期正确程序状态。针对程序的修补空间,借助统计相关分析,计算出每个表达式可修复该语句的概率并进行排序。随后将概率高的表达式与缺陷代码进行模式匹配并生成代码修改提示。

  • 我感觉有点像基于模板的技术。

2015 DirectFix

文章:

  • Mechtaev S, Yi J, Roychoudhury A. Directfix: Looking for simple program repairs[C]//Proceedings of the 37th International Conference on Software Engineering-Volume 1. IEEE Press, 2015: 448-458.

方法:

  • 和SemFix出自一个实验室,在其基础上,进一步考虑了补丁的可读性和可理解性;为此尝试生成最小改动的(simplest)补丁
  • We do so by leveraging partial MaxSAT constraint solving and component-based program synthesis.

实验:

  • In our experiments with SIR programs and GNU Coreutils, DirectFix generates repairs that are simpler than those generated by SemFix.
  • 有趣的地方:引入了没有驱动修复的测试用例(额外的、不参与修复的)来进行回归测试。

2015 QACrashFix

文章:

  • Gao Q, Zhang H, Wang J, et al. Fixing recurring crash bugs via analyzing q&a sites (T)[C]//2015 30th IEEE/ACM International Conference on Automated Software Engineering (ASE). IEEE, 2015: 307-318.

方法:
他们首先搜集缺陷程序执行时的崩溃踪迹 (Crash Trace),随后他们利用崩溃踪迹信息去问答 网站进行搜索并得到相关网页。通过分析从问题贴 和答案贴中抽取出的错误代码和修复代码,来生成 编辑脚本。

2015 Infinitel

文章:

  • Marcote S R L, Monperrus M. Automatic repair of infinite loops[J]. arXiv preprint arXiv:1504.05078, 2015.

方法:
他们首先通过代码变换对循环代 码插桩,随后设置一个循环次数的最大值来探测程 序中可能存在的无穷循环代码,接着枚举得到能使程序通过测试用例的循环次数作为天使值。最后使 用与Nopol 同样的方法,基于收集的程序信息和程 序合成方法生成潜在的循环修复补丁。

2015 Kali

文章:

  • Qi Z, Long F, Achour S, et al. An analysis of patch plausibility and correctness for generate-and-validate patch generation systems[C]//Proceedings of the 2015 International Symposium on Software Testing and Analysis. ACM, 2015: 24-36.

方法:
纯粹移除代码。

2015 SPR

文章:
Long F, Rinard M. Staged program repair with condition synthesis[C]//Proceedings of the 2015 10th Joint Meeting on Foundations of Software Engineering. ACM, 2015: 166-178.

方法:

SPR 方法首先对参数 化补丁模式(其借助抽象取值来表示分支条件)进 行选择。对于某一个模式,SPR 方法会预先判断实 例化该模式是否存在可以使得所有测试用例都执行通过的可能性。若存在,则通过对模式中的抽象 取值进行实例化来生成候选补丁并进行验证。该方 法可以有效减少需要生成的候选补丁数。

2015 NEPfix(运行时修复)

文章:

  • Cornu B, Durieux T, Seinturier L, et al. Npefix: Automatic runtime repair of null pointer exceptions in java[J]. arXiv preprint arXiv:1512.07423, 2015.

2016 Prophet

文章:

  • Long F, Rinard M. Automatic patch generation by learning correct code[C]//ACM SIGPLAN Notices. ACM, 2016, 51(1): 298-312.

方法:
根据代码特征对候选补丁进 行优化排序。该方法通过机器学习的模式对开源项 目中正确代码的特征进行学习,为多种可用于识别 补丁的特征赋以权值形成概率模型。针对搜索空间 的候选补丁,分析补丁自身的特征和补丁与周围代 码的交互,从而为每个补丁形成二进制特征向量。 通过概率模型的计算得出候选补丁可能正确修复 程序的概率值。最后根据概率值排序以优先验证正 确补丁

2016 Nopol

文章:

  • Xuan J, Martinez M, Demarco F, et al. Nopol: Automatic repair of conditional statement bugs in java programs[J]. IEEE Transactions on Software Engineering, 2016, 43(1): 34-55.
  • DeMarco F, Xuan J, Le Berre D, et al. Automatic repair of buggy if conditions and missing preconditions with SMT[C]//Proceedings of the 6th international workshop on constraints in software testing, verification, and analysis. ACM, 2014: 30-39.

方法:

  • angelic fix localization 天使修复定位技术去找条件语句需要满足的值;
  • 收集变量以及它们的值(准备条件语句合成);
  • 将变量放进一个SMT问题,进行求解,解出来之后转换成补丁。

2016 Anti-patterns

文章:

  • Tan S H, Yoshida H, Prasad M R, et al. Anti-patterns in search-based program repair[C]//Proceedings of the 2016 24th ACM SIGSOFT International Symposium on Foundations of Software Engineering. ACM, 2016: 727-738.

方法:
不提供修改模板来指导修复搜索,因为这会对搜索空间产生限制,并使得修复更加倾向于采用预先提供的修复模板。因此他们建议使用反模式(Anti-patterns)来禁止一系列转换操作。为避免验证疑似正确补丁,他们通过人工审查确认疑似补丁的共同特点,并基于遗传规划算法定义了一系列禁止的修改操作,这些操作大多处于控制流图的层面。即便采用这种修改操作可使补丁通过测试用例集,也并不认为是正确的补丁。

ASTOR

2016 Angelix

文章:

  • Mechtaev S, Yi J, Roychoudhury A. Angelix: Scalable multiline program patch synthesis via symbolic analysis[C]//Proceedings of the 38th international conference on software engineering. ACM, 2016: 691-701.

方法:

  • 支持多点修复;支持大型程序的修复(突破以往基于语义方法的局限)
  • 1)程序转换;
  • 2)缺陷定位,是在表达式的层面,而不是语句层面
  • 3)提取修复约束,使用符号执行来提取约束(用的是KLEE);这里还使用了angelic forest的概念,我感觉就是测试用例执行路径上的条件语句约束提取,相对来说工作量要小一点。
  • 4)补丁综合

实验:

  • Angelix generated repairs from large-scale real-world software such as wireshark and php, and these generated repairs include multi-location repairs.

2016 Historicalfix(HDRepair)

文章:

  • Le X B D, Lo D, Le Goues C. History driven program repair[C]//2016 IEEE 23rd International Conference on Software Analysis, Evolution, and Reengineering (SANER). IEEE, 2016, 1: 213-224.
  • Le X B D. Towards efficient and effective automatic program repair[C]//Proceedings of the 31st IEEE/ACM International Conference on Automated Software Engineering. ACM, 2016: 876-879.

方法:

  • Note that History-driven repair, although it automatically mines information for guiding the evolution of the candidate solutions from historical data, actually uses a simple pre-defined set of atomic operators and exampled-based templates as change operators.
  • History-driven repair [118], [122] exploits information extracted from the history of several software projects to guide the generation of candidate fixes. The technique uses the same evolutionary approach of GenProg, but without a crossover operator and with 12 mutation operators derived from GenProg [20], PAR [22], and mutation testing [123]. The information mined from the projects is used to syn- thesize bug fix patterns that represent sets of AST-level changes that have been useful to fix bugs in the past. The bug fix patterns are used to guide the selection process, that is, the candidate solutions that are most likely evolved in each iteration are the ones that incorporate a set of changes similar to the ones represented in the bug fix patterns.

2016 Boa(数据集)

文章:

  • Soto M, Thung F, Wong C P, et al. A deeper look into bug fixes: patterns, replacements, deletions, and additions[C]//Proceedings of the 13th International Conference on Mining Software Repositories. ACM, 2016: 512-515.

方法:
对数据集的研究。

2016 BanditRepair(运行时修复,即runtime repair)

文章:

  • Durieux T, Hamadi Y, Monperrus M. BanditRepair: Speculative Exploration of Runtime Patches[J]. arXiv preprint arXiv:1603.07631, 2016.

LeakFix

VEJOVIS

vfix

2018 Prophet+

文章:

  • Van Thuy H, Anh P V, Hoai N X. Automated Large Program Repair based on Big Code[C]//Proceedings of the Ninth International Symposium on Information and Communication Technology. ACM, 2018: 375-381.

方法:

This paper presents several methods to improve the automated program repair system Prophet, called Prophet+. Our approach
contributes three improvements over Prophet: 1) extract twelve relations of statements and blocks for Bi-gram model using Big code, 2) prune the search space, 3) develop an algorithm to re-rank candidate patches in the search space.

主要是对prophet的修改。

  • 6
    点赞
  • 17
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值