Skip to main content
Log in

A formal semantics for program debugging

  • Research Paper
  • Published:
Science China Information Sciences Aims and scope Submit manuscript

Abstract

This work aims to build a semantic framework for automated debugging. A debugging process consists of tracing, locating, and fixing processes consecutively. The first two processes are accomplished by a tracing procedure and a locating procedure, respectively. The tracing procedure reproduces the execution of the failed test case with well-designed data structures and saves necessary information for locating bugs. The locating procedure will use the information obtained from the tracing procedure to locate ill-designed statements and to generate a system of fix-equations, whose solution will be used to fix the bugs. A structural operational semantics is given to define the functions of the tracing and locating procedures. Both of them are proved to terminate. The main task of fixing process is to solve the fix-equations. It turns out that for a given failed test case, there exist four types of fix-equations and three different solutions: 1) The bug is solvable, i.e., there exists a solution of the system of fix-equations, and the program can be repaired. 2) There exists a structural design error in the program, i.e., the system of fix-equations generated at each round of the locating procedure is solvable, but a new bug will arise when the old bug is being fixed. 3) There exists a logical design error, and the system of fix-equations is not solvable.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Similar content being viewed by others

References

  1. Myers G J. The Art of Software Testing. 2nd ed. New York: John Wiley & Sons, Inc., 2004

    Google Scholar 

  2. Hailpern B, Santhanam P. Software debugging, testing and verification. IBM Syst J, 2002, 41: 4–12

    Article  Google Scholar 

  3. Zeller A. Why Programs Fail. 2nd ed. Oxford: Elsevier Inc., 2009

    Google Scholar 

  4. Zhang Y K. Software Debugging. Beijing: Publishing House of Electronics Industry, 2009

    Google Scholar 

  5. Lewis B. Debugging backward in time. In: Proceedings of the 5th International Workshop on Automated and Algorithmic Debugging, Ghent, Belgium, 2003

  6. Weiser M. Program slicing. IEEE Trans Softw Engineer, 1984, 10: 352–357

    Article  Google Scholar 

  7. Misherghi G, Su Z. HDD: hierarchical delta debugging. In: Proceedings of the 28th International Conference on Software Engineering, Shanghai, China, 2006

  8. Plotkin G D. A structural approach to operational semantics. Technical Report DAIMI FN-19. 1981

  9. Li W. R-calculus: An inference system for belief revision. Comput J, 2007, 50: 378–390

    Article  Google Scholar 

  10. Li W. Mathematical Logic: Foundations for Information Science, PCS 25. Basel: Birkhäuser Publisher, 2010

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Wei Li.

Rights and permissions

Reprints and permissions

About this article

Cite this article

Li, W., Li, N. A formal semantics for program debugging. Sci. China Inf. Sci. 55, 133–148 (2012). https://doi.org/10.1007/s11432-011-4530-2

Download citation

  • Received:

  • Accepted:

  • Published:

  • Issue Date:

  • DOI: https://doi.org/10.1007/s11432-011-4530-2

Keywords

Navigation