robustify debugger against bogus lambda-lists
authorNikodemus Siivola <nikodemus@random-state.net>
Thu, 9 Jun 2011 20:23:23 +0000 (23:23 +0300)
committerNikodemus Siivola <nikodemus@random-state.net>
Thu, 9 Jun 2011 21:06:37 +0000 (00:06 +0300)
  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
src/code/debug.lisp
tests/debug.impure.lisp

diff --git a/NEWS b/NEWS
index 497858f..9221aa1 100644 (file)
--- 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
index adc28e0..deb0be9 100644 (file)
@@ -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")
index 308d3d6..c0c1d7b 100644 (file)
                                 (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)