tracef
tracef( [s_function|t_fileName... |t] ) =>g_result
Description
Turns on tracing of specified functions. Shows the functions called with their evaluated arguments and return values. This is an nlambda function.
The output port for tracing is ptport, which defaults to poport.
-
If
tis passed in, all functions are traced. However, this probably produces more information than you want and your program runs much more slowly. -
If you do not give
tracefan argument, it returns a list of all functions being traced. -
If the argument is a string,
tracefassumes it is a file name.tracefchecks to see if a file was loaded after debug mode was turned on and if so, traces all functions defined in that file. -
If the symbol
debugFilesis passed in, all functions in all files loaded since debug mode was turned on are traced.
If you want to force certain functions not to be traced even though you have turned on tracing for many or all functions, you can add the property notrace with a non-nil value on the name of the function. For example, to prevent plus from being traced use putprop('plus t 'notrace ) or plus.notrace = t.
Arguments
Value Returned
Examples
(defun f (x) (add1 x)) ; Defines a function f.
=> f
(tracef f ; Turns on tracing for f.
=> (f)
f(3)
|f(3)
|f --> 4
=> 4
(tracef t ; Turns on tracing for all functions.
|tracef --> t
=> t
f(3)
|f(3)
||add1(3)
||add1 --> 4
|f --> 4
=> 4
Suppose testfuns.il defines functions f1 and f2:
(defun f1 (x) x+1)
(defun f2 (y) f1(y)+1)
installDebugger ; debug was turned on before loading a file
=> t
1> load "testfuns.il"
=> t
1> tracef("testfuns.il")
; tracing for all functions in the file
("testfuns.il")
1> f2 3
|f2(3)
||f1(3)
||f1 --> 4
|f2 --> 5
5
Related Topics
Return to top