A Sketching-Based Approach for Debugging Using Test Cases

  • Jinru Hua
  • Sarfraz Khurshid
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 9938)


Manually locating and removing bugs in faulty code is often tedious and error-prone. Despite much progress in automated debugging, developing effective debugging techniques remains a challenge. This paper introduces a novel approach that uses a well-known program synthesis technique to automate debugging. As inputs, our approach takes a program and a test suite (with some passing and some failing tests), similar to various other recent techniques. Our key insight is to reduce the problem of finding a fix to the problem of program sketching. We translate the faulty program into a sketch of the correct program, and use off-the-shelf sketching technology to create a program that is correct with respect to the given test cases. The experimental evaluation using a suite of small, yet complex programs shows that our prototype embodiment of our approach is more effective than previous state-of-the-art.



We thank Armando Solar-Lezama and Rishabh Singh for helpful comments and encouragement. This work was funded in part by the National Science Foundation (NSF Grant No. CCF-1319688).


  1. 1.
    The Sketch Programmers Manual. Accessed 07 05 2016
  2. 2.
    Boyapati, C., Khurshid, S., Marinov, D.: Korat: automated testing based on Java predicates. In: ISSTA, pp. 123–133 (2002)Google Scholar
  3. 3.
    Chandra, S., Torlak, E., Barman, S., Bodík, R.: Angelic debugging. In: ICSE (2011)Google Scholar
  4. 4.
    Cormen, T.H., Leiserson, C.E., Rivest, R.L., Stein, C.: Introduction to Algorithms, 3rd edn. MIT Press, Cambridge (2009)zbMATHGoogle Scholar
  5. 5.
    Debroy, V., Wong, W.E.: Using mutation to automatically suggest fixes for faulty programs. ICST 2010, 65–74 (2010)Google Scholar
  6. 6.
    Demsky, B., Ernst, M.D., Guo, P.J., McCamant, S., Perkins, J.H., Rinard, M.C.: Inference and enforcement of data structure consistency specifications. ISSTA 2006, 233–244 (2006)CrossRefGoogle Scholar
  7. 7.
    Feser, J.K., Chaudhuri, S., Dillig, I.: Synthesizing data structure transformations from input-output examples. PLDI 2015, 229–239 (2015)Google Scholar
  8. 8.
    Gopinath, D.: Systematic techniques for more effective fault localization and program repair. Ph.D. thesis, University of Texas at Austin (2015)Google Scholar
  9. 9.
    Gopinath, D., Khurshid, S., Saha, D., Chandra, S.: Data-guided repair of selection statements. ICSE 2014, 243–253 (2014)Google Scholar
  10. 10.
    Gopinath, D., Malik, M.Z., Khurshid, S.: Specification-based program repair using SAT. TACAS 2011, 173–188 (2011)zbMATHGoogle Scholar
  11. 11.
    Jeon, J., Qiu, X., Foster, J.S., Solar-Lezama, A.: JSketch: sketching for Java. ESEC/FSE 2015, 934–937 (2015)Google Scholar
  12. 12.
    Jha, S., Gulwani, S., Seshia, S.A., Tiwari, A.: Oracle-guided component-based program synthesis. ICSE 2010, 215–224 (2010)Google Scholar
  13. 13.
    Jones, J.A., Harrold, M.J.: Empirical evaluation of the tarantula automatic fault-localization technique. In: (ASE 2005), pp. 273–282 (2005)Google Scholar
  14. 14.
    Kim, D., Nam, J., Song, J., Kim, S.: Automatic patch generation learned from human-written patches. ICSE 2013, 802–811 (2013)Google Scholar
  15. 15.
    Kneuss, E., Koukoutos, M., Kuncak, V.: Deductive program repair. In: Kroening, D., Păsăreanu, C.S. (eds.) CAV 2015. LNCS, vol. 9207, pp. 217–233. Springer, Heidelberg (2015)CrossRefGoogle Scholar
  16. 16.
    Le Goues, C., Nguyen, T., Forrest, S., Weimer, W.: GenProg: a generic method for automatic software repair. IEEE Trans. Softw. Eng. 38(1), 54–72 (2012)CrossRefGoogle Scholar
  17. 17.
    Long, F., Rinard, M.: Staged program repair with condition synthesis. ESEC/FSE 2015, 166–178 (2015)Google Scholar
  18. 18.
    Malik, M.Z., Ghori, K., Elkarablieh, B., Khurshid, S.: A case for automated debugging using data structure repair. In: ASE, pp. 620–624 (2009)Google Scholar
  19. 19.
    Mechtaev, S., Yi, J., Roychoudhury, A.: Angelix: scalable multiline program patch synthesis via symbolic analysis. In: ICSE 2016 (2016)Google Scholar
  20. 20.
    Nguyen, H.D.T., Qi, D., Roychoudhury, A., Chandra, S.: SemFix: program repair via semantic analysis. ICSE 2013, 772–781 (2013)Google Scholar
  21. 21.
    Pei, Y., Furia, C.A., Nordio, M., Wei, Y., Meyer, B., Zeller, A.: Automated fixing of programs with contracts. IEEE Trans. Softw. Eng. 40(5), 427–449 (2014)CrossRefGoogle Scholar
  22. 22.
    Qi, Z., Long, F., Achour, S., Rinard, M.C.: An analysis of patch plausibility and correctness for generate-and-validate patch generation systems. In: ISSTA (2015)Google Scholar
  23. 23.
    Saha, R.K., Lease, M., Khurshid, S., Perry, D.E.: Improving bug localization using structured information retrieval. ASE 2013, 345–355 (2013)Google Scholar
  24. 24.
    Singh, R., Gulwani, S., Solar-Lezama, A.: Automated feedback generation for introductory programming assignments. In: PLDI 2013, pp. 15–26 (2013)Google Scholar
  25. 25.
    Smith, E.K., Barr, E.T., Le Goues, C., Brun, Y.: Is the cure worse than the disease? overfitting in automated program repair. ESEC/FSE 2015, 532–543 (2015)Google Scholar
  26. 26.
    Solar-Lezama, A.: Program sketching. STTT 15(5–6), 475–495 (2013)CrossRefGoogle Scholar

Copyright information

© Springer International Publishing AG 2016

Authors and Affiliations

  1. 1.The University of Texas at AustinAustinUSA

Personalised recommendations