This section describes functions and variables used internally by the debugger.
debug
.
The first argument that Lisp hands to the function indicates why it
was called. The convention for arguments is detailed in the description
of debug
.
debug
to fill up the
`*Backtrace*' buffer. It is written in C, since it must have access
to the stack to determine which function calls are active. The return
value is always nil
.
In the following example, a Lisp expression calls backtrace
explicitly. This prints the backtrace to the stream
standard-output
: in this case, to the buffer
`backtrace-output'. Each line of the backtrace represents one
function call. The line shows the values of the function's arguments if
they are all known. If they are still being computed, the line says so.
The arguments of special forms are elided.
(with-output-to-temp-buffer "backtrace-output" (let ((var 1)) (save-excursion (setq var (eval '(progn (1+ var) (list 'testing (backtrace)))))))) => nil ----------- Buffer: backtrace-output ------------ backtrace() (list ...computing arguments...) (progn ...) eval((progn (1+ var) (list (quote testing) (backtrace)))) (setq ...) (save-excursion ...) (let ...) (with-output-to-temp-buffer ...) eval-region(1973 2142 #<buffer *scratch*>) byte-code("... for eval-print-last-sexp ...") eval-print-last-sexp(nil) * call-interactively(eval-print-last-sexp) ----------- Buffer: backtrace-output ------------
The character `*' indicates a frame whose debug-on-exit flag is set.
nil
, it says to call the debugger before
the next eval
, apply
or funcall
. Entering the
debugger sets debug-on-next-call
to nil
.
The d command in the debugger works by setting this variable.
nil
, this will cause the debugger to be entered when that
frame later exits. Even a nonlocal exit through that frame will enter
the debugger.
This function is used only by the debugger.
nil
. The debugger can set this variable to leave
information for future debugger invocations during the same command
invocation.
The advantage, for the debugger, of using this variable rather than an ordinary global variable is that the data will never carry over to a subsequent command invocation.
backtrace-frame
is intended for use in Lisp
debuggers. It returns information about what computation is happening
in the stack frame frame-number levels down.
If that frame has not evaluated the arguments yet (or is a special
form), the value is (nil function arg-forms...)
.
If that frame has evaluated its arguments and called its function
already, the value is (t function
arg-values...)
.
In the return value, function is whatever was supplied as the
CAR of the evaluated list, or a lambda
expression in the
case of a macro call. If the function has a &rest
argument, that
is represented as the tail of the list arg-values.
If frame-number is out of range, backtrace-frame
returns
nil
.
Go to the first, previous, next, last section, table of contents.