Automatic bug fixing

From Infogalactic: the planetary knowledge core
Jump to: navigation, search

Lua error in package.lua at line 80: module 'strict' not found.

Automatic bug-fixing is the automatic repair of software bugs without the intervention of a human programmer [1] .[2] It is also commonly referred to as automatic bug repair or automatic patch generation.

Techniques for automatic bug-fixing are still in their infancy, but are broadly divided into two camps depending on the way the proposed repair is evaluated: those based on formal analysis, and those that use a generate-and-validate approach. The former uses formal methods to prove properties of a repair, whilst the latter relies on the availability of a high-quality test suite or similar artifact to validate the outcome of the repair process.

Techniques using Formal Verification

Verification-based program repair combines techniques from formal verification, program synthesis, and fault-localisation. Industrial application of these techniques is limited due to the computation cost involved; it is not clear how potentially scalable such methods are. To reduce the number of possible repairs and hence the computational cost, often only a small pre-defined class of bugs is considered. Examples of bug classes include off-by-one errors and memory leaks .[3]

Test-and-Validate Techniques

In Test-and-Validate approaches, program repair is performed with respect to an oracle, encompassing the desired functionality of the program, which is used for validation of the generated fix. A simple example is a test-suite - the input/output pairs specify the functionality of the program, possibly captured in assertions. This oracle can in fact be divided between the bug oracle that detects faulty behaviour, and the regression oracle, which encapsulates the functionality any program repair method must preserve.

A variety of tools are employed to generate a candidate repair, typically either deterministic approaches using solvers for Satisfiability Modulo Theories (SMT) ,[4] or stochastic algorithms such as Genetic Programming. Research on the application of Genetic Programming to repair bugs is part of a subfield known as Genetic improvement. Current automatic repair systems using Genetic Improvement are able to repair real bugs in C, C++, and Java [5] .

Repair Operators

Repair operators manipulate the original program, potentially via its abstract syntax tree representation, or a more coarse-grained representation such as operating at the line or block-level.

Typically, Genetic Improvement approaches operate at the line level and carry out simple delete/replace operations similar to those found in standard software patches. Verification-based methods are more likely to rely on template-based operators that match known patterns and have well-understood affects on program semantics.

Example Tools

Arguably the most well-known Genetic Improvement software repair tool is GenProg .[6] Examples of verification-based repair techniques are: the Semfix tool [7] , which relies on symbolic execution, and Gopinath et al.'s work that relies on Alloy specifications .[8]

Limitations of Automatic Repair

State-of-the-art approaches can currently repair only a very small proportion of bugs.[9] Although Genetic Improvement methods have arguably been shown to scale best, they usually do not provide correctness guarantees.

References

  1. Patching program errors (CACM 2008) http://dx.doi.org/doi:10.1145/1409360.1409381
  2. Automated Patching Techniques: The Fix Is In (CACM 2010) http://dx.doi.org/doi:10.1145/1735223.1735248
  3. Automatic Software Repair http://www.monperrus.net/martin/automatic-software-repair
  4. Automatic Repair of Buggy If Conditions and Missing Preconditions with SMT http://arxiv.org/abs/1404.3186
  5. Automatic program repair with evolutionary computation https://www.cs.virginia.edu/~weimer/p/p109-weimer.pdf
  6. GenProg: Evolutionary Program Repair http://dijkstra.cs.virginia.edu/genprog/
  7. SemFix: Program Repair via Semantic Analysis https://www.comp.nus.edu.sg/~abhik/pdf/ICSE13-SEMFIX.pdf
  8. Contract-based Data Structure Repair Using Alloy http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.182.4390&rep=rep1&type=pdf
  9. Automatic program repair with evolutionary computation http://dx.doi.org/doi:10.1145/1735223.1735249.