Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

LSRepair: Live Search of Fix Ingredients for Automated Program Repair

23 views

Published on

Automated program repair (APR) has extensively been developed by leveraging search-based techniques, in which fix ingredients are explored and identified in different granular- ities from a specific search space. State-of-the approaches often find fix ingredients by using mutation operators or leveraging manually-crafted templates. We argue that the fix ingredients can be searched in an online mode, leveraging code search techniques to find potentially-fixed versions of buggy code fragments from which repair actions can be extracted. In this study, we present an APR tool, LSRepair, that automatically explores code repositories to search for fix ingredients at the method-level granularity with three strategies of similar code search. Our preliminary evaluation shows that code search can drive a faster fix process (some bugs are fixed in a few seconds). LSRepair helps repair 19 bugs from the Defects4J benchmark successfully. We expect our approach to open new directions for fixing multiple-lines bugs.

Published in: Technology
  • Be the first to comment

  • Be the first to like this

LSRepair: Live Search of Fix Ingredients for Automated Program Repair

  1. 1. LSRepair: Live Search of Fix Ingredients for Automated Program Repair Kui Liu, Anil Koyuncu, Kisub Kim, Dongsun Kim, and Tegawendé F. Bissyandé SnT, University of Luxembourg, Luxembourg @ Nara Japan, 25th APSEC 2018December 7, 2018
  2. 2. 1 > Basic Process of Automated Program Repair (APR) Fault Localization Test Pass Fail Patch Candidate APR Tools Suspicious buggy code Where is the code to be fixed? How to generate patches? Is the patch correct? passing tests Passing tests Failing tests State-of-the-art APR tools for Java bugs: jGenProg [9], jKali [9], jMutRepair [9], HDRepair [10], Nopol [28], ACS [29], ssFix [54], ELIXIR [55], SketchFix [56], CapGen [13], and SimFix1. 1. Jiang, Jiajun, et al. "Shaping Program Repair Space with Existing Patches and Similar Code." ISSTA 2018. Plausible Patch
  3. 3. 2 > Statement Level Bug Fixing Class name Line No. Suspiciousness …..….. Suspicious statements of bug Chart-1 in Defects4J reported by GZoltar 0.1.1. …..….. Bug Chart_1 in Defects4J fixed by jMutRepair, ELIXIR, ssFix, JAID, SketchFix, CapGen, SimFix. org/jfree/chart/renderer/category/AbstractCategoryItemRenderer.java
  4. 4. 3 > Search Space Issues P P P P P P P P P P PP P P P P P PP P P P P P P P P P P P PP P P P P P Incorrect patch. P Correct patch. P Plausible but incorrect patch. P P (1) The search space could be too small to include correct patches. (2) The search space could be too big to include more plausible but incorrect patches. P P Search space: a set of patches generated by APR tools.
  5. 5. 4 > Suspicious but non-buggy statements in one method
  6. 6. 5 > Question Could we fix bugs at method declaration level to reduce the search space of fix ingredients for incorrect patches and purify the search space for correct patches?
  7. 7. 6 > Intuition Developers write code or clone code to address similar tasks. program1 program2 program3 DesignsDeveloping Routine Our intuition is that while some code may be buggy, the similar code may have been fixed.
  8. 8. 7 > LSRepair Approach Live Search of fix ingredients in real-world code bases to repair bugs automatically. Overview of LSRepair Suspicious methods Fault localization Search similar methods Generate and Validate patches
  9. 9. 8 LSRepair DESIGN
  10. 10. 9 > Fault Localization passing tests Passing tests Failing tests Gzoltar 0.1.1 Suspicious statement list Suspicious method list … ... … ... … ... …..….. Bug Chart_1 in Defects4J. org/jfree/chart/renderer/category/AbstractCategoryItemRenderer.java
  11. 11. 10 > Search Strategies for Similar Methods …….. ... Suspicious method Search similar methods S1. Signature-similar methods. S2. Syntactically similar methods. S3. Semantically similar methods. Method Signature (MS): MS = (rt, mn, Args), rt: return type. mn: method name. Args: a set of parameter types. Method code  search syntactic-similar methods with deep learning technique in our previous study [52] (TSE’18). Method code  search semantic-similar methods with FaCoY [50] (ICSE’18).
  12. 12. 11 > Patch Generation 1. Signature-similar methods. Replacing the buggy method with signature-similar methods directly.
  13. 13. 12 > Patch Generation 1. Signature-similar methods. Replacing the buggy method with signature-similar methods directly. 2. Syntactically similar methods. 3. Semantically similar methods. Pivot statements (buggy code and patch candidate): IfStatement, ExpressionStatement, VariableDeclaration, and ReturnStatement [53]. if (dataset != null) { …… } if (element == null) { …… } IfStatement: Modify its conditional expression by checking their differences on non-variable code. Others: 1) Insert an IfStatement. 2) Delete the IfStatement. 3) Modify the IfStatement. Buggy Code Code in similar methods if (dataset == null) { …… } Patch Code Type var = var2.get(); Buggy code if (var_ != null) { Type var = var_.get(); } Code in similar methods Type var = var2.get(); Buggy code if (var_ != null) { Type var = var_.get(); } Code in similar methods if (var2 == null) { Type var = var2.get(); } Buggy code if (var_ == null) { Type var = var_.get(); } Code in similar methods
  14. 14. 13 ASSESSMENT
  15. 15. 14 > Real World Code Bases 10,449 GitHub Java projects used in FaCoy (11,043,044 methods). Search space of similar methods: • Signature-similar methods: all similar methods in our data set. • Syntactically similar methods: top-10 most similar methods. • Semantically similar methods: top-10 most similar methods.
  16. 16. 15 > RQ: to what extent real-world bugs can be fixed by LSRepair? Project # Bugs kLoC # Tests Chart 26 96 2,205 Closure 133 90 7,927 Lang 65 22 2,245 Math 106 85 3,602 Mockito 38 11 1,457 Time 27 28 4,130 Total 395 332 22,954 Defects4J [57] Dataset Information.
  17. 17. 16 > Bugs correctly fixed by LSRepair Bugs in Defects4J are correctly fixed by LSRepair. S1. Signature-similar methods. S2. Syntactically similar methods. S3. Semantically similar methods.
  18. 18. 17 > Quantitative Comparison with State-of-the-art APR Tools APR Tool # plausibly fixed bugs # correctly fixed bugs LSRepair 38 19 jGenProg [9] 29 5 HDRepair [10] 16 13 Nopol [28] 35 5 ACS [29] 21 18 ssFix [54] 60 20 ELIXIR [55] 41 26 SketchFix [56] 26 19 CapGen [13] 25 21 Chart-4, Lang-29,46,48, 52, 54. Math-91, 94. Mockito-13. Bugs are firstly and correctly fixed by LSRepair. LSRepair can be complementary to the state-of-the-art automated program repair techniques.
  19. 19. 18 > Limitation and Discussion 3. Method level granularity. It cannot fix the bugs located in TypeDeclaration or FieldDeclaration. 2. Code Transformation. Our prototype uses straightforward heuristics to transform the ingredients. 1. Syntactically or Semantically Similar Code Search Problem. We use naive heuristics to prioritize code, based on the cosine similarity (e.g., syntactic and semantic) with a given buggy code.
  20. 20. 19 > Summary 13 > Bugs correctly fixed by LSRepair Bugs in Defects4J are correctly fixed by LSRepair. 10 > Search Strategies …….. ... Suspicious method Search similar methods 1. Signature-similar methods. 2. Syntactically similar methods. 3. Semantically similar methods. 5 > Motivation Developers write code to address similar tasks, or clone code. program1 program2 program3 DesignsDeveloping Routine Our intuition is that while some code may be buggy, the similar code may have been fixed . 6 > LSRepair Approach Live Search of fix ingredients in real-world code bases to repair bugs automatically. Fault Localization to identify faulty methods Generate patches By code transform Validate and check correctness Selection of code search strategy Program https://github.com/AutoProRepair/LSRepair

×