[Openmcl-devel] Recursive tracing/advising?

Jared C. Davis jared at cs.utexas.edu
Tue Jul 24 15:39:53 PDT 2007


Hi,

Is there a way to get trace to show me recursive calls in addition to
the outermost call?  For example, if I try to trace fact as below, it
only prints the call of (FACT 10 1):

    ? (defun fact (x acc)
        (if (= x 0)
            acc
          (fact (- x 1) (* x acc))))
    FACT

    ? (trace fact)
    NIL

    ? (fact 10 1)
    0> Calling (FACT 10 1)
    <0 FACT returned 3628800

I'd like to be able to see the call of (FACT 10 1), (FACT 9 10), (FACT
8 90), etc., all the way down.

Right now the only way I know how to do this is to change the
definition of fact so it calls some new function, say fact-note, upon
each iteration with the relevant arguments.  I can then trace
fact-note instead of fact, to see all the calls.  But I don't like
this, because it makes my definition more complicated to support
tracing, and the function I'm actually interested in tracing is
already very complicated.

I've tried using both trace and CCL:advise with :when :after, but that
seems to give me the same trouble.

Thanks!
   Jared

-- 
Jared C. Davis <jared at cs.utexas.edu>
3600 Greystone Drive #604
Austin, TX 78731
http://www.cs.utexas.edu/users/jared/



More information about the Openmcl-devel mailing list