a racket meta-language for debugging
Go to file
2017-01-22 03:15:36 +01:00
debug Noted in the documentation that debugging information is needed in order to access local variables 2017-01-22 03:15:36 +01:00
.gitignore add .gitignore 2015-10-11 14:09:59 -04:00
.travis.yml this doesn't support 6.6 and earlier 2017-01-12 17:45:29 -05:00
info.rkt add dependency on variable-reference->namespace top-level mode 2017-01-13 12:45:08 -05:00
README.md use list instead of quote in debug-repl example 2016-07-19 19:30:20 -04:00

debug Build Status

A lang-extension for debugging, based on sugar/debug from mbutterick/sugar

documentation: http://pkg-build.racket-lang.org/doc/debug/index.html

#lang debug

To debug the value of an expression, simply put debug in front of the language at the top of the file (for instance #lang debug racket), and put #R, #RR or #RRR in front of the expression.

  • #R reports the value and returns it
  • #RR reports the value with a line number and returns it
  • #RRR reports the value with the file and line number, and returns it
#lang debug racket
#R(+ 1 2)

Shows the output:

(+ 1 2) = 3
3
#lang debug racket
(+ 1 2 #R(* 3 4))

Shows the output:

(* 3 4) = 12
15

debug-repl

> (require debug/repl)
> (define (f x y)
    (debug-repl))
> (f 1 2)
-> ; in the debug-repl now
   x
1
-> y
2
-> (+ x y)
3
-> ; exit the debug-repl by pressing ctrl-D
> ; back in the normal repl
  (f (λ (g a) (g a)) (list add1 4))
-> ; a new debug-repl
   x
#<procedure>
-> y
(list #<procedure:add1> 4)
-> (x string->number "3")
3
-> (x (first y) (second y))
5
-> ; exit this debug-repl by pressing ctrl-D