Quoting Rob Antonishen <rob.antonis...@gmail.com>:

>>> Decent debugging facilities are missing. Only tracing is supported
>>> natively.
> Anyone know how?  Even that would be handy.

Call the 'tracing' function with an argument of "1" to enable tracing  
("0" to turn it off). The output from the trace doesn't appear until  
the script finishes (not sure if this is always true) and it is  
extremely detailed (even the convenience functions such as 'cadr' are  
traced into as '(car (cdr x))'). Nonetheless, one can generally figure  
out what the problem is from examining the tail end of the trace log.

My recollection is that 'tracing' had some problems early on in the  
GIMP 2.4 cycle but, thanks to the efforts of the GIMP developers, it  
now seems to be working fine.

Using the example from the ChezScheme guide:

(define buggy-remove
     (lambda (x ls)
       (if (null? x)
           (if (equal? (car ls) x)
               (buggy-remove x (cdr ls))
               (cons (car ls) (buggy-remove x (cdr ls)))))))

(tracing 1)
(buggy-remove 'a '(a b a c a))
... Lots of output!
Eval: (if (equal? (car ls) x) (buggy-remove x (cdr ls)) (cons (car ls)  
(buggy-remove x (cdr ls))))
Eval: (equal? (car ls) x)
Eval: equal?
Eval: (car ls)
Eval: car
Eval: ls
Apply to: (())
Eval: (#<CLOSURE> "car: argument 1 must be: pair")
Eval: #<CLOSURE>
Eval: "car: argument 1 must be: pair"
Apply to: ("car: argument 1 must be: pair")
Eval: (if (more-handlers?) (apply (pop-handler)) (apply error x))
Eval: (more-handlers?)
Eval: more-handlers?
Apply to: ()
Eval: (pair? *handlers*)
Eval: pair?
Eval: *handlers*
Apply to: (())
Eval: (apply error x)
Eval: apply
Eval: error
Eval: x
Apply to: (#<error PROCEDURE 134> ("car: argument 1 must be: pair"))
Apply to: ("car: argument 1 must be: pair")Error: car: argument 1 must  
be: pair

Gimp-developer mailing list

Reply via email to