On Tue, Sep 2, 2014 at 3:03 PM, Carlos Pita <carlosjosep...@gmail.com> wrote: > Hi all, although I have some experience with lisps, I'm still new to > guile and I'm having some trouble figuring out how to invoke the > interactive debugger at some arbitrary point in my code. Something like: > > ; code here > (debug) > ; more code here > > The closer solution I could find in the manual is: > > add-trap-at-source-location! file user-line > > Any suggestion?
I don't know of any straightforward solution, but I would also like such a feature. I don't think it would be too difficult to write a 'debug' procedure using the 'debug-trap-handler' procedure in (system repl error-handling) as inspiration. Basically, you'd need to capture the current stack and spawn a new REPL in debug mode that uses that stack. Additionally, I noticed that the (system repl debug) module has this at the bottom of the file: ;; (define (debug) ;; (run-debugger ;; (narrow-stack->vector ;; (make-stack #t) ;; ;; Narrow the `make-stack' frame and the `debug' frame ;; 2 ;; ;; Narrow the end of the stack to the most recent start-stack. ;; (and (pair? (fluid-ref %stacks)) ;; (cdar (fluid-ref %stacks)))))) I'm guess it no longer functions, but maybe it will help you! - Dave