Next: , Previous: , Up: The Debugger   [Contents][Index]


3.5 Source Location Printing

One of CMUCL’s unique capabilities is source level debugging of compiled code. These commands display the source location for the current frame:

source {context}

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 {context}

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: Compiler Policy Control, Previous: Variable Access, Up: The Debugger   [Contents][Index]