Skip to main content

Augmenting Trace-based Functional Debugging

Alastair Penney, Augmenting Trace-based Functional Debugging. PhD thesis. Department of Computer Science, University of Bristol. September 1999. PDF, 3009 Kbytes.

Abstract

Traditionally, tracing is a method by which one can see the sequence of steps corresponding to the program execution model. Tracing for procedural or strict functional languages is commonly presented by stepping a highlight through the program source. The order of evaluation and the values of selected arguments or variables are used for finding program errors. In this thesis, we focus on the implications of using tracing for debugging in the lazy functional paradigm. We present a tracer-debugger called FIT, the Functional Interactive Tracer, which traces the lazy functional language Haskell. The lazy evaluation model implies an order of evaluation which is non-intuitive to new users and confuses "expert" programmers too. A suitable tracing aid can therefore help teaching and learning as well as debugging. Laziness results in the accumulation of large program expressions in run-time data-structures. The context of these is vital for debugging and explaining the lazy paradigm; it cannot be conveyed by simply highlighting a line in the source. We argue that the way to trace a lazy program is by constructing a textual representation from these run-time data structures, namely the return stack and the heap. A sequence of run-time transformations of these structures corresponds to the evaluation of the program. We use these transformations to present a sequence of textual images to the user as one per trace step. We present novel techniques for summarising the vast quantity of information that each textual image may represent : we describe reactive and shadow zooms, hierarchical closing and a mechanism for supporting trusted code. Tracing is a general and flexible debugging method, but is somewhat unguided when used alone. To overcome this, we augment the tracing domain with powerful techniques that support both forwards and backwards reasoning. The techniques adapted for our tracing model include slicing, algorithmic debugging and profiling. As well as being a debugging technique in its own right, slicing also supports forwards and backwards reasoning in combination with our other trace-based techniques, improving bug localisation.

Bibtex entry.

Publication Admin