Lisp HUG Maillist Archive

backtraces

Does anyone know what command is invoked
when you type :BB from the debugger?

Is there a way to invoke this programmatically,
capturing the output to a string?  (i.e. what
stream does the command print to?  I'm _guessing_
*debug-io*, but you never know...)

I want to basically wrap a handler which gets
the current stacktrace to report errors "back home"
when our app unexpectedly raises an error.

Thanks.


Re: backtraces

Alain,

On Sunday, November 16, 2003, at 10:52 PM, Alain.Picard@memetrics.com 
wrote:

> Is there a way to invoke this programmatically,
> capturing the output to a string?  (i.e. what
> stream does the command print to?  I'm _guessing_
> *debug-io*, but you never know...)

This is what I use:

(defmethod print-stack-backtrace ((error error) stream)
   (declare (ignore error))
   (let ((*debug-io* stream))
     (dbg:with-debugger-stack ()
       (dbg:bug-backtrace nil))))

Best,


John DeSoi, Ph.D.



Re: backtraces

* Alain Picard wrote:
> Does anyone know what command is invoked
> when you type :BB from the debugger?

> Is there a way to invoke this programmatically,
> capturing the output to a string?  (i.e. what
> stream does the command print to?  I'm _guessing_
> *debug-io*, but you never know...)

I use MP:MAP-PROCESS-BACKTRACE, to which you can pass a function to
print or collect things.  If you want to find out the actual bindings
of things on colon commands you can look at the EXTRA-COMMANDS KW arg
to SYS::%TOP-LEVEL.  This is obviously very undocumented, but it seems
to work (for instance my lw-commands hack uses this knowledge + advice
on that function to add extra commands).

For anyone at Xanalys: it would be cool to expose this interface.

--tim



Updated at: 2020-12-10 08:58 UTC