[Top][All Lists]

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

Re: Displaying a backtrace?

From: Helmut Eller
Subject: Re: Displaying a backtrace?
Date: Fri, 26 Jan 2001 23:26:39 +0100

> From: address@hidden (Bill Gribble)
> Date: Thu, 25 Jan 2001 09:13:24 -0600
> For debugging purposes I want to be able to print a backtrace in a
> (catch) handler while continuing to run... basically
> false-if-exception except printing a backtrace in addition to
> returning false.
> However, I can't ascertain how to print out a backtrace from within my
> catch handler.  (backtrace) displays the message "No backtrace
> available", even if I have explicitly done (debug-enable 'backtrace).
> (display-backtrace (fluid-ref the-last-stack) (current-output-port))
> prints nothing.  I'm just guessing that the-last-stack is the stack I
> want to print.
> Any thoughts? 

I use something like this:

(debug-enable 'debug)

(define (dumper key . args)
  (let ((stack (make-stack #t dumper)))
    (display-backtrace stack (current-error-port))
    (apply display-error stack (current-error-port) args)
    (throw 'ignore-this)))
(catch 'ignore-this
         (lambda ()
           (lazy-catch #t
                       (lambda () (/ 1 0))
         (lambda ignore

This works for me, but I don't understand why.  There is also an entry
`Custom Catch' in the old FAQ:


reply via email to

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