Next: Inspector, Previous: SRFI 7, Up: Command processor
There are a number of commands useful for debugging, along with a continuation inspector, all of which composes a convenient debugger.
,bound? prints out binding information about name, if it is bound in the interaction environment, or `Not bound' if name is unbound. ,where prints out information about what file and package its procedure argument was created in. If procedure is not passed, ,where uses the focus value. If ,where's argument is not a procedure, it informs the user of this fact. If ,where cannot find the location of its argument's creation, it prints `Source file not recorded.'
,expand prints out a macro-expansion of exp, or the focus value if exp is not provided. The expression to be expanded should be an ordinary S-expression. The expansion may contain `generated names' and `qualified names.' These merely contain lexical context information that allow one to differentiate between identifiers with the same name. Generated names look like
#{Generated
name unique-numeric-id}
. Qualified names appear to be vectors; they look like#(>>
introducer-macro name unique-numeric-id)
, where introducer-macro is the macro that introduced the name.,dis prints out a disassembly of its procedure, continuation, or template argument. If proc is passed, it is evaluated in the interaction environment; if not, ,dis disassembles the focus value. The disassembly is of Scheme48's virtual machine's byte code.1
For the descriptions of these commands, see Command levels. These are mentioned here because they are relevant in the context of debugging.
Traced procedures will print out information about when they are entered and when they exit. `,trace' lists all of the traced procedures' bindings. `,trace name ...' sets each name in the interaction environment, which should be bound to a procedure, to be a traced procedure over the original procedure. `,untrace' resets all traced procedures to their original, untraced procedures. `,untrace name ...' untraces each individual traced procedure of name ... in the interaction environment.
Prints a trace of the previous command level's suspended continuation. This is analogous with stack traces in many debuggers.
Invokes the debugger: runs the inspector on the previous command level's saved continuation. For more details, see Inspector.
Returns to the continuation of the condition signalling of the previous command level. Only certain kinds of conditions will push a new command level, however — breakpoints, errors, and interrupts, and, if the
break-on-warnings
switch is on, warnings —; also, certain kinds of errors that do push new command levels do not permit being proceeded from. In particular, only with a few VM primitives may the ,proceed command be used. If exp is passed, it is evaluated in the interaction environment to produce the values to return; if it is not passed, zero values are returned.
[1] A description of the byte code is forthcoming, although it does not have much priority to this manual's author. For now, users can read the rudimentary descriptions of the Scheme48 virtual machine's byte code instruction set in vm/interp/arch.scm of Scheme48's Scheme source.