[gambit-list] Non-REPL Debugging in Gambit

Marc Feeley feeley at iro.umontreal.ca
Tue Aug 28 09:47:47 EDT 2007


On 27-Aug-07, at 7:12 PM, Guillaume Germain wrote:

> On 8/27/07, François Magnan <francois.magnan at 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))))))

Here is the set of procedures, defined in lib/_repl.scm, which
implement the REPL commands ,b ,y ,e and ,i:

   (##cmd-b depth cont port)
   (##cmd-y depth cont pinpoint? port)
   (##cmd-e cont port)
   (##cmd-i cont port)

If there is interest in having access to
the functionality of these procedures I can
make them easier to use by removing the ## prefix,
adding type checking, and changing the API.  Are
there any suggestions?  For example I could add
optional parameters to ##cmd-b for "max-head" and
"max-tail".

Marc




More information about the Gambit-list mailing list