BSD 3 development
[unix-history] / usr / doc / lisp / tracedoc
CommitLineData
42a7fd3e
JF
1 I have added a few things to the trace package and gotten some of the old
2features to work. There are still some loose ends to tie up however.
3
4 You can now say
5 (trace (append break)) which means that when append is called, first
6 the trace enter line is printed, then you enter a break loop.
7 In this break loop you can test the value of the arguments to
8 the called function using (arg n) where n is the arg number
9 you want to test. of course you can also type in any lisp
10 expression and it will be evaluated and its result printed.
11 To exit this break loop, type ^D . At that point, the function
12 will be evaluated and the trace exit line will be printed.
13 This should work if append is compiled or interpreted.
14
15You can also say
16 (trace (append if (equal '(a b c) (arg 1))))
17 will cause the trace enter and exit message to be printed only if
18 the predicate is true.
19
20You can also say
21 (trace (append ifnot (equal 2 (arg nil))))
22 which traces all calls to append which dont have two arguments.
23
24you can even say
25 (trace (append eval (print '"hi mom")))
26
27 you can even use combinations of if, ifnot, eval and break if
28 you dare but I havent quite fixed up their precedence.
29
30 BUGS: the tricky stuff doesnt work if you trace nlambdas, and
31 apply seems to fail on interpreted lambdas. trace should
32 complain if you try to trace an already trace function.
33 All of these bugs are minor and should disappear soon.
34