On 8/27/07, François Magnan francois.magnan@licef.teluq.uqam.ca wrote:
Is there an easy way to access the debugging functions of the Gambit REPL in a programmatic way? I would like to call (for example) a function that would give me the equivalent of ",b" and ",e" inside my exception-catcher.
Here's a simple example for ##cmd-b :
(define (stack-to-string) (##continuation-capture (lambda (k) (call-with-output-string "" (lambda (port) (##cmd-b 0 k port))))))
If you use something like this inside an exception handler, I suggest you look into the ##display-exception-in-context procedure. It takes as arguments the exception object, the current continuation captured with ##continuation-capture and a port.
Note that you should install the handler using with-exception-handler (and *not* with-exception-catcher) if you want to do this.
Guillaume