Chapter 18. Debugging in RScheme

Table of Contents
trace -- Trace function entry and exit.
break -- Break on function entry.
no-break -- Remove tracing or breakpoint on a function.
abt -- Print backtrace of function calls.
bt -- Print continuation chain (stack).

Debugging RScheme programs is in some ways both simpler and more difficult than debugging programs in a traditional language like C.

It is more difficult because the tools available are different than those that the typical C programmer is familiar with, such as gdb.

However, it is also easier, because RScheme is a much more dynamic system. Because RScheme is usually used (at least during program development) in an interactive mode, the developer can interact with the running program even more concretely than the most advanced features of a traditional debugger like gdb.

For example, in RScheme, you can redefine procedures interactively without having to reload your entire program.

(Unfortunately, not all kinds of objects can be redefined sans repurcussion. Class objects, for example, often have pointers to them stored in various places, such as superclass links and in functions and slots that have type restrictions on the class. Since redefining a class amounts to assigning a new value (a distinct class object) to the class variable of the given name, pointers to the old class will remain in the system, typically necessitating recompiling the definitions of many functions and any subclasses, as well as clearing out any data structures that may have instances of the old class)

In addition to the ability to interact with the target program directly, RScheme also provides some more traditional debugging facilities.