next up previous contents
Next: 3.5.1 How the Source Up: 3 The Debugger Previous: 3.4.2 Note On Lexical

3.5 Source Location Printing

   

One of CMU Common Lisp's unique capabilities is source level debugging of compiled code. These commands display the source location for the current frame:

source tex2html_wrap_inline17166contexttex2html_wrap_inline17168
This command displays the file that the current frame's function was defined from (if it was defined from a file), and then the source form responsible for generating the code that the current frame was executing. If context is specified, then it is an integer specifying the number of enclosing levels of list structure to print.

vsource tex2html_wrap_inline17166contexttex2html_wrap_inline17168
This command is identical to source, except that it uses the global values of *print-level* and *print-length* instead of the debugger printing control variables *debug-print-level* and *debug-print-length*.

The source form for a location in the code is the innermost list present in the original source that encloses the form responsible for generating that code. If the actual source form is not a list, then some enclosing list will be printed. For example, if the source form was a reference to the variable *some-random-special*, then the innermost enclosing evaluated form will be printed. Here are some possible enclosing forms:

(let ((a *some-random-special*))
  ...)

(+ *some-random-special* ...)

If the code at a location was generated from the expansion of a macro or a source-level compiler optimization, then the form in the original source that expanded into that code will be printed. Suppose the file `/usr/me/mystuff.lisp' looked like this:

(defmacro mymac ()
  '(myfun))

(defun foo () (mymac) ...)

If foo has called myfun, and is waiting for it to return, then the source command would print:
; File: /usr/me/mystuff.lisp

(MYMAC)

Note that the macro use was printed, not the actual function call form, (myfun).

If enclosing source is printed by giving an argument to source or vsource, then the actual source form is marked by wrapping it in a list whose first element is #:***HERE***. In the previous example, source 1 would print:

; File: /usr/me/mystuff.lisp

(DEFUN FOO () (#:***HERE*** (MYMAC)) ...)




next up previous contents
Next: 3.5.1 How the Source Up: 3 The Debugger Previous: 3.4.2 Note On Lexical

Raymond Toy
Mon Jul 14 09:11:27 EDT 1997