Edi Weitz | 9 Nov 2004 15:15
Picon
Favicon

Re: Access to backtraces

On Tue, 9 Nov 2004 15:18:53 +0200 (EET), Nikodemus Siivola <tsiivola <at> cc.hut.fi> wrote:

> In newer SBCL versions sb-debug:*debug-print-foo* variables have
> been replaced with sb-ext:*debug-print-variable-alist* -- you can
> check for existence of that symbol with FIND-SYMBOL and act
> accordingly, eg:
>
>   (let ((*debug-print-variable-alist*
>          (list* '(*print-level* . nil) '(*print-length* . nil)
>                 *debug-print-variable-alist*)))
>        ...)

Thanks, I'll add something like this.

> However, you might be better served by sb-debug:backtrace-as-list
> and something like
>
>   (defun print-backtrace (stream &optional (from 'print-backtrace))
>     (let* ((stack (sb-debug:backtrace-as-list))
>            (top (or (position from stack :key #'car) -1))
>            (count -1))
>       (with-standard-io-syntax
>        (dolist (frame (nthcdr (1+ top) stack))
>           (format stream "~D: ~A~%" (incf count) frame)))))
>
> ...as this should work equally well in both older and newer SBCL's,
> and is a bit more customizable to boot.

Yeah, but it doesn't look as nice... :)

Thanks again,
Edi.

-------------------------------------------------------
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE
LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click

Gmane