Version: 5.2
7 Debugging
This module provides macros and functions for printing out debugging
information.
(debug options ... expr) |
|
options | | = | | #:name name-expr | | | | | | #:source srcloc-expr |
|
Writes debugging information about the evaluation of expr to the
current error port. The name and source location of the expression may be
overridden by keyword options; their defaults are the syntactic form of the
expression and its syntactic source location, respectively.
Examples: |
> (debug 0) | >> eval:2.0: 0 | result: 0 | << eval:2.0: 0 |
| 0 | > (debug #:name "one, two, three" (values 1 2 3)) | >> eval:3.0: "one, two, three" | results: (values 1 2 3) | << eval:3.0: "one, two, three" |
| 1 | 2 | 3 | | >> here:1.2: (error 'function "something went wrong") | raised exception: function: something went wrong | << here:1.2: (error 'function "something went wrong") |
| function: something went wrong |
|
Constructs a message in the same manner as
format and writes it to
(current-error-port), with indentation reflecting the number of nested
debug forms.
Examples: |
> (dprintf "level: ~a" 0) | level: 0 | > (debug (dprintf "level: ~a" 1)) | >> eval:6.0: (dprintf "level: ~a" 1) | level: 1 | result: #<void> | << eval:6.0: (dprintf "level: ~a" 1) |
| > (debug (debug (dprintf "level: ~a" 2))) | >> eval:7.0: (debug (dprintf "level: ~a" 2)) | >> eval:7.0: (dprintf "level: ~a" 2) | level: 2 | result: #<void> | << eval:7.0: (dprintf "level: ~a" 2) | result: #<void> | << eval:7.0: (debug (dprintf "level: ~a" 2)) |
|
|
(debugf function-expr argument ...) |
|
argument | | = | | argument-expr | | | | | | argument-keyword argument-expr |
|
Logs debugging information for
(#%app function-expr argument ...),
including the evaluation and results of the function and each argument.
Example: |
> (debugf + 1 2 3) | >> eval:8.0: debugf | >> eval:8.0: + | result: #<procedure:+> | << eval:8.0: + | >> eval:8.0: 1 | result: 1 | << eval:8.0: 1 | >> eval:8.0: 2 | result: 2 | << eval:8.0: 2 | >> eval:8.0: 3 | result: 3 | << eval:8.0: 3 | result: 6 | << eval:8.0: debugf |
| 6 |
|
|
|
|
|
|
|
(let/debug ([lhs-id rhs-expr] ...) body ...+) | (let/debug loop-id ([lhs-id rhs-expr] ...) body ...+) |
|
|
|
|
|
|
|
|
|
These macros add logging based on
debug to the evaluation of
expressions in
begin,
define,
define/private,
define/public,
define/override,
define/augment,
let,
let*,
letrec,
let-values,
let*-values,
letrec-values,
with-syntax,
with-syntax*, and
parameterize.