guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Entering the interactive debugger


From: Thompson, David
Subject: Re: Entering the interactive debugger
Date: Tue, 2 Sep 2014 15:20:12 -0400

On Tue, Sep 2, 2014 at 3:03 PM, Carlos Pita <address@hidden> 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]