5 Debugging
(require unstable/debug) | package: unstable-debug-lib |
This module provides macros and functions for printing out debugging information.
syntax
(debug options ... expr)
options = #:name name-expr | #:source srcloc-expr
> (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
> (debug #:source (make-srcloc 'here 1 2 3 4) (error 'function "something went wrong"))
>> 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
> (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))
syntax
(debugf function-expr argument ...)
argument = argument-expr | argument-keyword argument-expr
> (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
syntax
(begin/debug expr ...)
syntax
(define/debug id expr)
(define/debug (head args) body ...+)
syntax
(define/private/debug id expr)
(define/private/debug (head args) body ...+)
syntax
(define/public/debug id expr)
(define/public/debug (head args) body ...+)
syntax
(define/override/debug id expr)
(define/override/debug (head args) body ...+)
syntax
(define/augment/debug id expr)
(define/augment/debug (head args) body ...+)
syntax
(let/debug ([lhs-id rhs-expr] ...) body ...+)
(let/debug loop-id ([lhs-id rhs-expr] ...) body ...+)
syntax
(let*/debug ([lhs-id rhs-expr] ...) body ...+)
syntax
(letrec/debug ([lhs-id rhs-expr] ...) body ...+)
syntax
(let-values/debug ([(lhs-id ...) rhs-expr] ...) body ...+)
syntax
(let*-values/debug ([(lhs-id ...) rhs-expr] ...) body ...+)
syntax
(letrec-values/debug ([(lhs-id ...) rhs-expr] ...) body ...+)
syntax
(with-syntax/debug ([pattern stx-expr] ...) body ...+)
syntax
(with-syntax*/debug ([pattern stx-expr] ...) body ...+)
syntax
(parameterize/debug ([param-expr value-expr] ...) body ...+)