1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-10 14:00:21 +02:00

fix backtraces with compiled boot-9

* module/ice-9/boot-9.scm (default-pre-unwind-handler): Since we were
  tail-called by pre-unwind-handler-dispatch, we can't use
  pre-unwind-handler-dispatch as a narrowing argument. Instead just
  narrow by one frame.
  (pre-unwind-handler-dispatch): Deprecate.
  (error-catching-loop): Remove crack comment and code, and just use
  default-pre-unwind-handler as our pre-unwind handler.

* module/ice-9/stack-catch.scm (stack-catch):
* module/system/repl/repl.scm (call-with-backtrace): Use
  default-pre-unwind-handler directly.
This commit is contained in:
Andy Wingo 2009-05-26 21:47:45 +02:00
parent 9d07bb7276
commit 1351c2dba5
3 changed files with 7 additions and 14 deletions

View file

@ -2443,11 +2443,12 @@ module '(ice-9 q) '(make-q q-length))}."
(define (set-repl-prompt! v) (set! scm-repl-prompt v))
(define (default-pre-unwind-handler key . args)
(save-stack pre-unwind-handler-dispatch)
(save-stack 1)
(apply throw key args))
(define (pre-unwind-handler-dispatch key . args)
(apply default-pre-unwind-handler key args))
(begin-deprecated
(define (pre-unwind-handler-dispatch key . args)
(apply default-pre-unwind-handler key args)))
(define abort-hook (make-hook))
@ -2524,15 +2525,7 @@ module '(ice-9 q) '(make-q q-length))}."
(else
(apply bad-throw key args)))))))
;; Note that having just `pre-unwind-handler-dispatch'
;; here is connected with the mechanism that
;; produces a nice backtrace upon error. If, for
;; example, this is replaced with (lambda args
;; (apply pre-unwind-handler-dispatch args)), the stack
;; cutting (in save-stack) goes wrong and ends up
;; saving no stack at all, so there is no
;; backtrace.
pre-unwind-handler-dispatch)))
default-pre-unwind-handler)))
(if next (loop next) status)))
(set! set-batch-mode?! (lambda (arg)

View file

@ -40,4 +40,4 @@ this call to @code{catch}."
(catch key
thunk
handler
pre-unwind-handler-dispatch))
default-pre-unwind-handler))

View file

@ -89,7 +89,7 @@
(catch #t
(lambda () (%start-stack #t thunk))
default-catch-handler
pre-unwind-handler-dispatch))
default-pre-unwind-handler))
(define-macro (with-backtrace form)
`(call-with-backtrace (lambda () ,form)))