Debugging

Syntax: trace procedure

Cause procedure to be "traced", that is debugging output will be written to the standard error port every time procedure is called, with the parameters and return value.

Note that Kawa will normally assume that a procedure defined with the procedure-defining variant of define is constant, and so it might be inlined:

(define (ff x) (list x x))
(trace ff) ;; probably won't work
(ff 3)     ;; not traced

It works if you specify the --no-inline flag to Kawa. Alternatively, you can use the variable-defining variant of define:

#|kawa:1|# (define ff (lambda (x) name: 'ff (list x x)))
#|kawa:2|# (trace ff) ;; works
#|kawa:3|# (ff 3)
call to ff (3)
return from ff => (3 3)
(3 3)

Note the use of the name: procedure property to give the anonymous lambda a name.

Syntax: untrace procedure

Turn off tracing (debugging output) of procedure.

Procedure: disassemble procedure

Returns a string representation of the disassembled bytecode for procedure, when known.