[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: debug, break, single-step



At 5:25 PM -0400 9/21/01, Masoud Pirnazar wrote:
>except for the student-level stepper, is there any kind of debugger 
>for mzscheme?
>
>if not, any good strategies for debugging code?  (i've been using printf's)
>
>i've been unable to use "psd", the portable-scheme-debugger.  if 
>anyone has used this successfully, please let me know.
>
>(please reply to my email address as well as the mailing list. thanks.)

1) There are plans for a full-featured debugger.  This is not 
scheduled for inclusion in version 200.

2) The "errortrace" library displays the program text of the 
expressions that make up the continuation.  This is very much like 
gdb's "backtrace" facility.  (Except that it's less likely to be 
wrong.)

To use errortrace, you must require the errortrace library.  An 
example follows:

Welcome to MzScheme version 199.22, Copyright (c) 1995-2001 PLT
>  (require (lib "errortrace.ss" "errortrace"))
>  (define (faulty-map p l)
      (cons (p (car l)) (faulty-map p (cdr l))))
>  (faulty-map (lambda (x) (+ x 1)) (list 3 4 5 6))
car: expects argument of type <pair>; given ()
STDIN::177: (car l)
STDIN::174: (p (car l))
STDIN::168: (cons (p (car l)) (faulty-map p (cdr l)))
STDIN::168: (cons (p (car l)) (faulty-map p (cdr l)))
STDIN::168: (cons (p (car l)) (faulty-map p (cdr l)))
STDIN::168: (cons (p (car l)) (faulty-map p (cdr l)))
STDIN::168: (cons (p (car l)) (faulty-map p (cdr l)))

... so we can see that we're nested five deep in recursive calls, but 
we can't see the values of the variables at each point.

The example shown uses the "new", version-200 syntax.  In version 
103, you would write
(require-library "errortrace.ss" "errortrace")
rather than the require form shown above.

HTH,

john clements