The trap context is an object that caches information about the
low level trap call and the stack at the point of the trap, and is
passed as the only argument to all behaviour procedures. The
information in the trap context can be accessed through the procedures
beginning tc:
that are exported by the (ice-9 debugging
traps)
module1; the
most useful of these are as follows.
Indicates the type of the low level trap by returning one of the keywords
#:application
,#:evaluation
,#:return
or#:error
.
When
tc:type
gives#:return
, this provides the value that is being returned.
Provides the stack at the point of the trap (as computed by
make-stack
, but cached so that the lengthymake-stack
operation is not performed more than once for the same low level trap).
The innermost frame of the stack at the point of the trap.
The number of frames (including tail recursive non-real frames) in the stack at the point of the trap.
The number of real frames (that is, excluding the non-real frames that describe tail recursive calls) in the stack at the point of the trap.
[1] Plus of course any procedures that build on
these, such as the trace/...
procedures exported by
(ice-9 debugging trace)
(see Tracing Configuration).