We make another assault on the longstanding problem of debugging. After exploring why debuggers are not used as widely as one might expect, especially in functional programming environments, we define the characteristics of a debugger which make it usable and thus widely used. We present initial work towards a new debugger for OCaml which operates by direct interpretation of the program source, allowing the printing out of individual steps of the program's evaluation. We present OCamli, a standalone interpreter, and propose a mechanism by which the interpreter could be integrated into compiled executables, allowing part of a program to be interpreted in the same fashion as OCamli whilst the rest of the program runs natively. We show how such a mechanism might create a sourcelevel debugging system that has the characteristics of a usable debugger (such as being independent of its environment) and so may eventually be expected to be suitable for widespread adoption.
Direct Interpretation of Functional Programs for Debuggingall bugs except those so glaring as to leap to the first fresh eye cast on the program. . . . An unfriendly behaviorist studying programmers might conclude that we deliberately elaborate our tasks so as to keep the bug rate constant." [22]. Balzer, in his 1969 description of the Rand Corporation's EXDAMS debugger [2], explains that this surprise was widespread in the industry, at a time when more and more large programs were being written in modern compiled languages: "With the advent of the higher-level algebraic languages, the computer industry expected to be relieved of the detailed programming required at the assembly-language level. This expectation has largely been realised. Many systems are now being built in higher-level languages (most notably MULTICS). . . . However, the ability to debug programs has advanced but little with the increased use of these high-level languages." [2]. Hamlet, writing in 1983, gives a possible reason -the lack of attendant progress in debugging paradigms, suggesting that high level languages might require different kinds of debugging tools rather than mere analogs of existing ones: "Debugging techniques originated with low-level programming languages, where the memory dump and interactive word-by-word examination of memory were the primary tools. 'High-level' debugging is often no more than low-level techniques adapted to high-level languages." [24]. It is fascinating to see Halpern, quoted earlier, writing on the same topic forty years later, in 2005: "The most remarkable thing about debugging today is how little it differs from debugging at the dawn of modern computing age, half a century ago. . . . We've made little progress in debugging methods in half a century, with the result that projects everywhere are bogged down because of buggy software." [23] Debuggers are still not as widely used as one might expect, even in difficult domains. In a paper on debugging practices for complex legacy systems, Regelson and Anderson write: "The major item noted by surve...