skip to main content
10.1145/3180155.3180233acmconferencesArticle/Chapter ViewAbstractPublication PagesicseConference Proceedingsconference-collections
research-article

Context-aware patch generation for better automated program repair

Authors Info & Claims
Published:27 May 2018Publication History

ABSTRACT

The effectiveness of search-based automated program repair is limited in the number of correct patches that can be successfully generated. There are two causes of such limitation. First, the search space does not contain the correct patch. Second, the search space is huge and therefore the correct patch cannot be generated (i.e., correct patches are either generated after incorrect plausible ones or not generated within the time budget).

To increase the likelihood of including the correct patches in the search space, we propose to work at a fine granularity in terms of AST nodes. This, however, will further enlarge the search space, increasing the challenge to find the correct patches. We address the challenge by devising a strategy to prioritize the candidate patches based on their likelihood of being correct. Specifically, we study the use of AST nodes' context information to estimate the likelihood.

In this paper, we propose CapGen, a context-aware patch generation technique. The novelty which allows CapGen to produce more correct patches lies in three aspects: (1) The fine-granularity design enables it to find more correct fixing ingredients; (2) The context-aware prioritization of mutation operators enables it to constrain the search space; (3) Three context-aware models enable it to rank correct patches at high positions before incorrect plausible ones. We evaluate CapGen on Defects4J and compare it with the state-of-the-art program repair techniques. Our evaluation shows that CapGen outperforms and complements existing techniques. CapGen achieves a high precision of 84.00% and can prioritize the correct patches before 98.78% of the incorrect plausible ones.

References

  1. 2017. https://github.com/xuanbachle/bugfixes. (2017). Accessed: 2017-03-22.Google ScholarGoogle Scholar
  2. 2017. http://www.gzoltar.com. (2017). Accessed: 2017-03-22.Google ScholarGoogle Scholar
  3. 2017. Understand. https://scitools.com. (2017). Accessed: 2017-03-22.Google ScholarGoogle Scholar
  4. Earl T Barr, Yuriy Brun, Premkumar Devanbu, Mark Harman, and Federica Sarro. 2014. The plastic surgery hypothesis. In FSE'14. ACM, 306--317. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. Marcel Böhme, Ezekiel Olamide Soremekun, Sudipta Chattopadhyay, Emamurho Ugherughe, and Andreas Zeller. 2017. Where is the Bug and How is it Fixed? An Experiment with Practitioners. In ESEC/FSE'2017 (ESEC/FSE 2017). 1--11.Google ScholarGoogle Scholar
  6. Tom Britton, Lisa Jeng, Graham Carver, Paul Cheak, and Tomer Katzenellenbogen. 2013. Reversible debugging software. Judge Bus. School, Univ. Cambridge, Cambridge, UK, Tech. Rep (2013).Google ScholarGoogle Scholar
  7. Loris DâĂŹAntoni, Roopsha Samanta, and Rishabh Singh. 2016. Qlose: Program repair with quantitative objectives. In International Conference on Computer Aided Verification. Springer, 383--401.Google ScholarGoogle Scholar
  8. Vidroha Debroy and WEric Wong. 2010. Using mutation to automatically suggest fixes for faulty programs. In 2010 Third International Conference on Software Testing, Verification and Validation. IEEE, 65--74. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. Favio DeMarco, Jifeng Xuan, Daniel Le Berre, and Martin Monperrus. 2014. Automatic repair of buggy if conditions and missing preconditions with smt. In Proceedings of the 6th International Workshop on Constraints in Software Testing, Verification, and Analysis. ACM, 30--39. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. Thomas Durieux and Martin Monperrus. 2016. IntroClassJava: A Benchmark of 297 Small and Buggy Java Programs. Ph.D. Dissertation. Universite Lille 1.Google ScholarGoogle Scholar
  11. Stephanie Forrest, ThanhVu Nguyen, Westley Weimer, and Claire Le Goues. 2009. A genetic programming approach to automated software repair. In GECCO'2009. ACM, 947--954. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. Mark Gabel and Zhendong Su. 2010. A study of the uniqueness of source code. In FSE'10. ACM, 147--156. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. Guoliang Jin, Linhai Song, Wei Zhang, Shan Lu, and Ben Liblit. 2011. Automated atomicity-violation fixing. In ACM SIGPLAN Notices, Vol. 46. ACM, 389--400. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. René Just, Darioush Jalali, and Michael D Ernst. 2014. Defects4J: A database of existing faults to enable controlled testing studies for Java programs. In ISSTA'2014. ACM, 437--440. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. Yalin Ke, Kathryn T Stolee, Claire Le Goues, and Yuriy Brun. 2015. Repairing programs with semantic code search (T). In ASE'2015. IEEE, 295--306.Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. Dongsun Kim, Jaechang Nam, Jaewoo Song, and Sunghun Kim. 2013. Automatic patch generation learned from human-written patches. In ICSE'2013. IEEE Press, 802--811. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. Xuan-Bach D Le. 2016. Towards efficient and effective automatic program repair. In ASE'2016. ACM, 876--879. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. Xuan-Bach D Le, Duc-Hiep Chu, David Lo, Claire Le Goues, and Willem Visser. 2017. JFIX: semantics-based repair of Java programs via symbolic PathFinder. In ISSTA'17. ACM, 376--379. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. Xuan Bach D Le, David Lo, and Claire Le Goues. 2016. History Driven Program Repair. In SANER'2016, Vol. 1. IEEE, 213--224.Google ScholarGoogle Scholar
  20. Claire Le Goues, Michael Dewey-Vogt, Stephanie Forrest, and Westley Weimer. 2012. A systematic study of automated program repair: Fixing 55 out of 105 bugs for 8 each. In ICSE'2012. IEEE, 3--13. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. Claire Le Goues, Stephanie Forrest, and Westley Weimer. 2013. Current challenges in automatic software repair. Software Quality Journal 21, 3 (2013), 421--443. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. Claire Le Goues, Neal Holtschulte, Edward K Smith, Yuriy Brun, Premkumar Devanbu, Stephanie Forrest, and Westley Weimer. 2015. The ManyBugs and IntroClass benchmarks for automated repair of C programs. IEEE Transactions on Software Engineering 41, 12 (2015), 1236--1256.Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. Fan Long and Martin Rinard. 2015. Staged program repair with condition synthesis. In FSE'2015. ACM, 166--178. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. Fan Long and Martin Rinard. 2016. An analysis of the search spaces for generate and validate patch generation systems. In ICSE'2016. ACM, 702--713. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. Fan Long and Martin Rinard. 2016. Automatic patch generation by learning correct code. In ACM SIGPLAN Notices, Vol. 51. ACM, 298--312. Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. Henry B Mann and Donald R Whitney. 1947. On a test of whether one of two random variables is stochastically larger than the other. The annals of mathematical statistics (1947), 50--60.Google ScholarGoogle Scholar
  27. Matias Martinez, Thomas Durieux, Romain Sommerard, Jifeng Xuan, and Martin Monperrus. 2016. Automatic repair of real bugs in Java: Alarge-scale experiment on the Defects4J dataset. Empirical Software Engineering (2016), 1--29. Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. Matias Martinez and Martin Monperrus. 2015. Mining software repair models for reasoning on the search space of automated program fixing. Empirical Software Engineering 20, 1 (2015), 176--205. Google ScholarGoogle ScholarDigital LibraryDigital Library
  29. Matias Martinez and Martin Monperrus. 2016. ASTOR: A Program Repair Library for Java. In Proceedings of ISSTA, Demonstration Track. Google ScholarGoogle ScholarDigital LibraryDigital Library
  30. Matias Martinez, Westley Weimer, and Martin Monperrus. 2014. Do the fix ingredients already exist? an empirical inquiry into the redundancy assumptions of program repair approaches. In Companion Proceedings of the 36th International Conference on Software Engineering. ACM, 492--495. Google ScholarGoogle ScholarDigital LibraryDigital Library
  31. Sergey Mechtaev, Jooyong Yi, and Abhik Roychoudhury. 2015. Directfix: Looking for simple program repairs. In ICSE'2015, Vol. 1. IEEE, 448--458. Google ScholarGoogle ScholarDigital LibraryDigital Library
  32. Sergey Mechtaev, Jooyong Yi, and Abhik Roychoudhury. 2016. Angelix: Scalable multiline program patch synthesis via symbolic analysis. In ICSE'2016. ACM, 691--701. Google ScholarGoogle ScholarDigital LibraryDigital Library
  33. Hoang Duong Thien Nguyen, Dawei Qi, Abhik Roychoudhury, and Satish Chandra. 2013. SemFix: program repair via semantic analysis. In ICSE'2013. IEEE Press, 772--781. Google ScholarGoogle ScholarDigital LibraryDigital Library
  34. Renaud Pawlak, Martin Monperrus, Nicolas Petitprez, Carlos Noguera, and Lionel Seinturier. 2015. Spoon: A Library for Implementing Analyses and Transformations of Java Source Code. Software: Practice and Experience 46 (2015), 1155--1179. Google ScholarGoogle ScholarDigital LibraryDigital Library
  35. Jeff H Perkins, Sunghun Kim, Sam Larsen, Saman Amarasinghe, Jonathan Bachrach, Michael Carbin, Carlos Pacheco, Frank Sherwood, Stelios Sidiroglou, Greg Sullivan, and others. 2009. Automatically patching errors in deployed software. In Proceedings of the ACM SIGOPS 22nd symposium on Operating systems principles. ACM, 87--102. Google ScholarGoogle ScholarDigital LibraryDigital Library
  36. Yuhua Qi, Xiaoguang Mao, Yan Lei, Ziying Dai, and Chengsong Wang. 2014. The strength of random search on automated program repair. In ICSE'2014. ACM, 254--265. Google ScholarGoogle ScholarDigital LibraryDigital Library
  37. Yuhua Qi, Xiaoguang Mao, Yan Lei, and Chengsong Wang. 2013. Using automated program repair for evaluating the effectiveness of fault localization techniques. In ISSTA'2013. ACM, 191--201. Google ScholarGoogle ScholarDigital LibraryDigital Library
  38. Zichao Qi, Fan Long, Sara Achour, and Martin Rinard. 2015. An analysis of patch plausibility and correctness for generate-and-validate patch generation systems. In ISSTA'2015. ACM, 24--36. Google ScholarGoogle ScholarDigital LibraryDigital Library
  39. Dong Qiu, Bixin Li, Earl T Barr, and Zhendong Su. 2017. Understanding the syntactic rule usage in java. Journal of Systems and Software 123 (2017), 160--172.Google ScholarGoogle ScholarCross RefCross Ref
  40. Sina Shamshiri, René Just, José Miguel Rojas, Gordon Fraser, Phil McMinn, and Andrea Arcuri. 2015. Do Automatically Generated Unit Tests Find Real Faults? An Empirical Study of Effectiveness and Challenges (T). In ASE'2015. IEEE, 201--211.Google ScholarGoogle ScholarDigital LibraryDigital Library
  41. Stelios Sidiroglou-Douskos, Eric Lahtinen, Fan Long, and Martin Rinard. 2015. Automatic error elimination by horizontal code transfer across multiple applications. In ACM SIGPLAN Notices, Vol. 50. ACM, 43--54. Google ScholarGoogle ScholarDigital LibraryDigital Library
  42. Edward K Smith, Earl T Barr, Claire Le Goues, and Yuriy Brun. 2015. Is the cure worse than the disease? overfitting in automated program repair. In Proceedings of the 2015 10th Joint Meeting on Foundations of Software Engineering. ACM, 532--543. Google ScholarGoogle ScholarDigital LibraryDigital Library
  43. Shin Hwei Tan and Abhik Roychoudhury. 2015. relifix: Automated repair of software regressions. In ICSE'2015. IEEE Press, 471--482. Google ScholarGoogle ScholarDigital LibraryDigital Library
  44. Yi Wei, Yu Pei, Carlo A Furia, Lucas S Silva, Stefan Buchholz, Bertrand Meyer, and Andreas Zeller. 2010. Automated fixing of programs with contracts. In ISSTA'2010. ACM, 61--72. Google ScholarGoogle ScholarDigital LibraryDigital Library
  45. Westley Weimer, Zachary P Fry, and Stephanie Forrest. 2013. Leveraging program equivalence for adaptive program repair: Models and first results. In ASE'2013. IEEE, 356--366. Google ScholarGoogle ScholarDigital LibraryDigital Library
  46. Westley Weimer, Thanh Vu Nguyen, Claire Le Goues, and Stephanie Forrest. 2009. Automatically finding patches using genetic programming. In ICSE'2009. IEEE Computer Society, 364--374. Google ScholarGoogle ScholarDigital LibraryDigital Library
  47. Mark Weiser. 1981. Program slicing. In ICSE'1981. IEEE Press, 439--449. Google ScholarGoogle ScholarDigital LibraryDigital Library
  48. Ming Wen, Junjie Chen, Rongxin Wu, Dan Hao, and Shing-Chi Cheung. 2017. An Empirical Analysis of the Influence of Fault Space on Search-Based Automated Program Repair. arXiv preprint arXiv: 1707.05172 (2017).Google ScholarGoogle Scholar
  49. Ming Wen, Rongxin Wu, and Shing-Chi Cheung. 2016. Locus: locating bugs from software changes. In ASE'2016. ACM, 262--273 Google ScholarGoogle ScholarDigital LibraryDigital Library
  50. W Eric Wong, Ruizhi Gao, Yihao Li, Rui Abreu, and Franz Wotawa. 2009. A survey on software fault localization. (2009).Google ScholarGoogle Scholar
  51. Rongxin Wu, Ming Wen, Shing-Chi Cheung, and Hongyu Zhang. 2017. Change-Locator: locate crash-inducing changes based on crash reports. Empirical Software Engineering (2017), 1--35.Google ScholarGoogle Scholar
  52. Qi Xin and Steven P Reiss. 2017. Identifying test-suite-overfitted patches through test case generation. In ISSTA, 17. ACM, 226--236. Google ScholarGoogle ScholarDigital LibraryDigital Library
  53. Yingfei Xiong, Jie Wang, Runfa Yan, Jiachen Zhang, Shi Han, Gang Huang, and Lu Zhang. 2017. Precise condition synthesis for program repair. In ICSE'17. IEEE Press, 416--426. Google ScholarGoogle ScholarDigital LibraryDigital Library
  54. Jifeng Xuan, Matias Martinez, Favio Demarco, Maxime Clément, Sebastian Lamelas Marcote, Thomas Durieux, Daniel Le Berre, and Martin Monperrus. 2016. Nopol: Automatic repair of conditional statement bugs in java programs. (2016).Google ScholarGoogle Scholar
  55. D Le Xuan-Bach, Chu Duc-Hiep, Lo David, Goues Claire, Le, and Willem Visser. 2017. S3: Syntax- and Semantic-Guided Repair Synthesis via Programming by Examples. In FSE'2017. ACM, to appear. Google ScholarGoogle ScholarDigital LibraryDigital Library
  56. Jinqiu Yang, Alexey Zhikhartsev, Yuefei Liu, and Lin Tan. 2017. Better test cases for better automated program repair. In FSE'17. ACM, 831--841. Google ScholarGoogle ScholarDigital LibraryDigital Library
  57. Luciano Zemín, Simón Gutiérrez Brida, Ariel Godio, César Cornejo, Renzo Degiovanni, Germán Regis, Nazareno Aguirre, and Marcelo Frias. 2017. An analysis of the suitability of test-based patch acceptance criteria. In Proceedings of the 10th International Workshop on Search-Based Software Testing. IEEE Press, 14--20. Google ScholarGoogle ScholarDigital LibraryDigital Library
  58. Hao Zhong and Zhendong Su. 2015. An empirical study on real bug fixes. In ICSE'15. IEEE Press, 913--923. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Context-aware patch generation for better automated program repair

      Recommendations

      Comments

      Login options

      Check if you have access through your login credentials or your institution to get full access on this article.

      Sign in
      • Published in

        cover image ACM Conferences
        ICSE '18: Proceedings of the 40th International Conference on Software Engineering
        May 2018
        1307 pages
        ISBN:9781450356381
        DOI:10.1145/3180155
        • Conference Chair:
        • Michel Chaudron,
        • General Chair:
        • Ivica Crnkovic,
        • Program Chairs:
        • Marsha Chechik,
        • Mark Harman

        Copyright © 2018 ACM

        Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

        Publisher

        Association for Computing Machinery

        New York, NY, United States

        Publication History

        • Published: 27 May 2018

        Permissions

        Request permissions about this article.

        Request Permissions

        Check for updates

        Qualifiers

        • research-article

        Acceptance Rates

        Overall Acceptance Rate276of1,856submissions,15%

        Upcoming Conference

        ICSE 2025

      PDF Format

      View or Download as a PDF file.

      PDF

      eReader

      View online with eReader.

      eReader