All Manuals > LispWorks® User Guide and Reference Manual > 5 The Trace Facility

5.7 Troubleshooting tracing

This section describes some of the common problems seen when tracing, with suggestions to overcome these.

5.7.1 Excessive output

In general it is not useful to trace cl:length and other base-level functions unconditionally because they are called too frequently by LispWorks itself.

It may be useful to trace these functions in a limited fashion, using the trace options :inside or :when.

5.7.2 Missing output

There are two common reasons for not seeing calls you expect in trace output.

5.7.2.1 Compiled code may not call the functions you expect

There are many other optimizations built-in to the LispWorks compiler, which affect code generated according to the compiler qualities in effect at compile-time. For example if the compiler was set to inline structure accessors, then tracing structure accessors in code compiled with that setting will produce no output.

While debugging, you could re-compile the code at higher safety or run it interpreted, to obtain the trace output.

5.7.2.2 trace works on function names, not function objects

trace works by tracing function names, not function objects.

Therefore tracing function objects, for example by:

(trace #'foo)

will not yield any trace output. Instead you need to do:

(trace foo)

Also, if the symbol foo is traced, then code which invokes foo by:

(funcall (symbol-function 'foo) ...)

or equivalently:

(funcall #'foo ...)

will not produce any trace output.

The correct approach is to use (funcall 'foo ...) instead of (funcall #'foo ...).


LispWorks® User Guide and Reference Manual - 01 Dec 2021 19:30:18