Lazy algorithmic debugging: Ideas for practical implementation

  • Henrik Nilsson
  • Peter Fritzson
Debugging Functional Programs
Part of the Lecture Notes in Computer Science book series (LNCS, volume 749)

Abstract

Lazy functional languages have non-strict semantics and are purely declarative, i.e. they support the notion of referential transparency and are devoid of side effects. Traditional debugging techniques are, however, not suited for lazy functional languages since computations generally do not take place in the order one might expect. Since algorithmic debugging allows the user to concentrate on the declarative aspects of program semantics, and will semi-automatically find functions containing bugs, we propose to use this technique for debugging lazy functional programs. Our earlier work showed that this is a promising approach. However, the current version of our debugger has severe implementational problems, e.g. too large trace size and too many questions asked. This paper suggests a number of techniques for overcoming these problems, at least partially. The key techniques are immediate strictification and piecemeal tracing.

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. [1]
    Lennart Augustsson. A compiler for lazy ML. In Proceedings of the 1984 ACM Conference on LISP and Functional Programming, pages 218–227, August 1984.Google Scholar
  2. [2]
    Lennart Augustsson. Compiling Lazy Functional Languages part II. PhD thesis, Department of Computer Science, Chalmers University of Technology, December 1987.Google Scholar
  3. [3]
    Lennart Augustsson. Personal communication on the lack of suitable debugging tools for lazy functional languages, November 1991.Google Scholar
  4. [4]
    Peter Fritzson, Tibor Gyimothy, Mariam Kamkar, and Nahid Shahmehri. Generalized algorithmic debugging and testing. In Proceedings of the 1991 ACM SIGPLAN Conference, pages 317–26, Toronto, Canada, June 1991. A revised version to appear in ACMLOPLAS (Letters of Programming Languages and Systems).Google Scholar
  5. [5]
    Thomas Johnsson. Efficient compilation of lazy evaluation. In Proceedings of the 1984 ACM SIGPLAN Symposium on Compiler Construction, pages 58–69, June 1984. Proceedings published in SIGPLAN Notices, 19(6).Google Scholar
  6. [6]
    Thomas Johnsson. Compiling Lazy Functional Languages. PhD thesis, Department of Computer Science, Chalmers University of Technology, February 1987.Google Scholar
  7. [7]
    Mariam Kamkar. Interprocedural Dynamic Slicing with Applications to Debugging and Testing. PhD thesis. Department of Computer and Information Science, Linköping University, S-581 83, Linköping, Sweden, April 1993.Google Scholar
  8. [8]
    Mariam Kamkar, Nahid Shahmehri, and Peter Fritzson. Interprocedural dynamic slicing. In M. Bruynooghe and M. Wirsing, editors, Programming Language Implementation and Logic Programming, volume 631 of Lecture Notes in Computer Science, pages 370–384, Leuven, Belgium, August 1992.Google Scholar
  9. [9]
    Amir Shai Kishon. Theory and Art of Semantics Directed Program Execution Monitoring. PhD thesis, Yale University, May 1992.Google Scholar
  10. [10]
    Lee Naish. Declarative debugging of lazy functional programs. Research Report 92/6, Department of Computer Science, University of Melbourne, Australia, 1992.Google Scholar
  11. [11]
    Henrik Nilsson. Freja: A small non-strict, purely functional language. MSc dissertation, Department of Computer Science and Applied Mathematics, Aston University, Birmingham, England, September 1991.Google Scholar
  12. [12]
    Henrik Nilsson and Peter Fritzson. Algorithmic debugging for lazy functional languages. In M. Bruynooghe and M. Wirsing, editors, Programming Language Implementation and Logic Programming, volume 631 of Lecture Notes in Computer Science, pages 385–399, Leuven, Belgium, August 1992.Google Scholar
  13. [13]
    Simon L. Peyton Jones. The Implementation of Functional Programming Languages. Prentice Hall, 1987.Google Scholar
  14. [14]
    Rudolph E. Seviora. Knowledge-based program debugging systems. IEEE Software, 4(3):20–32, May 1987.Google Scholar
  15. [15]
    Nahid Shahmehri. Generalized Algorithmic Debugging. PhD thesis, Department of Computer and Information Science, Linköping University, S-581 83, Linköping, Sweden, 1991.Google Scholar
  16. [16]
    Ehud Y. Shapiro. Algorithmic Program Debugging. MIT Press, May 1982.Google Scholar
  17. [17]
    Robert Sturrock. Debugging systems for lazy functional programming languages. Honours dissertation, Department of Computer Science, University of Melbourne, Australia, November 1992.Google Scholar
  18. [18]
    David A. Turner. Miranda: A non-strict functional language with polymorphic types. In Proceedings of the IFIP International Conference on Functional Programming Languages and Computer Architecture, FPCA'85, number 201 in Lecture Notes in Computer Science, Nancy, 1985.Google Scholar
  19. [19]
    Mark Weiser. Programmers use slices when debugging. Communications of the ACM, 25(7):446–452, July 1982.Google Scholar
  20. [20]
    Mark Weiser. Program slicing. IEEE Transactions on Software Engineering, 10(4):352–357, July 1984.Google Scholar

Copyright information

© Springer-Verlag 1993

Authors and Affiliations

  • Henrik Nilsson
    • 1
  • Peter Fritzson
    • 1
  1. 1.Programming Environments Laboratory Department of Computer and Information ScienceLinköping UniversityLinköpingSweden

Personalised recommendations