Thank you both for your answers. Having access to the whole stack (all frames, even if it is long) would be a good addition to the API. It would help the development of some kind of stack inspector I will eventually try to add to the Schemeway plugin for use with Gambit.
Is there also an easy way to start a REPL in a separate terminal when an exception occurs in some thread. This would help debug Termite applications a lot.
I also take this opportunity to give all my gratitude to Marc for your wonderful Gambit-C Scheme System. Without it, I don't know how I could have done my work for the last three years. Cheers!
Thank you, Francois
On 28-Aug-07, at 9:47 AM, Marc Feeley wrote:
On 27-Aug-07, at 7:12 PM, Guillaume Germain wrote:
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))))))
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