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

NextPrevUpTopContentsIndex

5.4 Tracing methods

You can also trace methods (primary and auxiliary) within a generic function. The following example shows how to specify any qualifiers and specializers.

  1. Type the following methods into the listener:
  2. (defmethod foo (x) 
      (print 'there))
     
    (defmethod foo :before ((x integer))
      (print 'hello))
  3. Next, trace only the second of these methods by typing the following definition spec.
  4. (trace (method foo :before (integer)))
  5. Test that the trace has worked by calling the methods in the listener:
CL-USER 226 > (foo 'x)
 
THERE 
THERE
 
CL-USER 227 > (foo 4)
0 (METHOD FOO :BEFORE (INTEGER)) > (4)
 
HELLO 
0 (METHOD FOO :BEFORE (INTEGER)) < (HELLO)
 
THERE 
THERE
 
CL-USER 228 > 

LispWorks User Guide and Reference Manual - 13 Feb 2015

NextPrevUpTopContentsIndex