From bddb383d464b924f1066f1733fe8e2407e7d9283 Mon Sep 17 00:00:00 2001 From: Nikodemus Siivola Date: Thu, 9 Jun 2011 23:23:23 +0300 Subject: [PATCH] robustify debugger against bogus lambda-lists If we don't find a list where we expect a rest-list to be, substitute a dummy unprintable object. Provides a workaround for lp#795245. --- NEWS | 2 ++ src/code/debug.lisp | 10 +++++----- tests/debug.impure.lisp | 15 +++++++++++++++ 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/NEWS b/NEWS index 497858f..9221aa1 100644 --- a/NEWS +++ b/NEWS @@ -6,6 +6,8 @@ changes relative to sbcl-1.0.49: careful about rounding possibly closing open bounds. (lp#793771) * bug fix: SB-POSIX:SYSCALL-ERROR's argument is now optional. (accidental backwards incompatible change in 1.0.48.27) + * bug fix: occasional debugger errors in when a type-error occured in a + function with dynamic-extent &rest list. changes in sbcl-1.0.49 relative to sbcl-1.0.48: * minor incompatible change: WITH-LOCKED-HASH-TABLE no longer disables diff --git a/src/code/debug.lisp b/src/code/debug.lisp index adc28e0..deb0be9 100644 --- a/src/code/debug.lisp +++ b/src/code/debug.lisp @@ -295,11 +295,11 @@ thread, NIL otherwise." :deleted ((push (frame-call-arg element location frame) reversed-result)) :rest ((lambda-var-dispatch (second element) location nil - (progn - (setf reversed-result - (append (reverse (sb!di:debug-var-value - (second element) frame)) - reversed-result)) + (let ((rest (sb!di:debug-var-value (second element) frame))) + (if (listp rest) + (setf reversed-result (append (reverse rest) reversed-result)) + (push (make-unprintable-object "unavailable &REST argument") + reversed-result)) (return-from enumerating)) (push (make-unprintable-object "unavailable &REST argument") diff --git a/tests/debug.impure.lisp b/tests/debug.impure.lisp index 308d3d6..c0c1d7b 100644 --- a/tests/debug.impure.lisp +++ b/tests/debug.impure.lisp @@ -477,6 +477,21 @@ (notany #'sb-debug::stack-allocated-p (cdr frame)))) (dx-arg-backtrace dx-arg)))))) +(with-test (:name :bug-795245) + (assert + (eq :ok + (catch 'done + (handler-bind + ((error (lambda (e) + (declare (ignore e)) + (handler-case + (sb-debug:backtrace 100 (make-broadcast-stream)) + (error () + (throw 'done :error)) + (:no-error () + (throw 'done :ok)))))) + (apply '/= nil 1 2 nil)))))) + ;;;; test infinite error protection (defmacro nest-errors (n-levels error-form) -- 1.7.10.4