1.0.42.42: hack around *AUTO-EVAL-IN-FRAME* issues
authorNikodemus Siivola <nikodemus@random-state.net>
Sun, 19 Sep 2010 19:09:21 +0000 (19:09 +0000)
committerNikodemus Siivola <nikodemus@random-state.net>
Sun, 19 Sep 2010 19:09:21 +0000 (19:09 +0000)
 When frame doesn't have sufficient debug information and
 *AUTO-EVAL-IN-FRAME* is true -- the default -- the debugger REPL
 becomes useless in the frame. Oops.

 So, in those cases punt to regular EVAL instead -- which is the right
 thing most of the time. To avoid confusion by DWIM, tell the user
 when punting to global context.

NEWS
src/code/debug.lisp
version.lisp-expr

diff --git a/NEWS b/NEWS
index 9e8ef2a..6f6d53e 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -46,9 +46,10 @@ changes relative to sbcl-1.0.42
   * bug fix: spurious ignore warnings even given (DECLARE IGNORE) in methods
     when parameter bindings mutated.  (reported by Faré Rideau; lp #611361)
   * bug fix: workaround for compiler hang in ORDER-UVL-SETS (lp#308914)
+  * bug fix: evaluation in debugger REPL works using the global context when
+    in frames that do not have sufficient debug information.
 
 changes in sbcl-1.0.42 relative to sbcl-1.0.41
-
   * build changes
     ** Cross-compilation host is now specified to make.sh using
        command-line argument --xc-host=<command> instead of a positional
index 05cef22..c89794b 100644 (file)
@@ -820,9 +820,14 @@ and LDB (the low-level debugger).  See also ENABLE-DEBUGGER."
    forms that explicitly control this kind of evaluation.")
 
 (defun debug-eval (expr)
-  (if (and (fboundp 'compile) *auto-eval-in-frame*)
-      (sb!di:eval-in-frame *current-frame* expr)
-      (eval expr)))
+  (cond ((not (and (fboundp 'compile) *auto-eval-in-frame*))
+         (eval expr))
+        ((frame-has-debug-vars-p *current-frame*)
+         (sb!di:eval-in-frame *current-frame* expr))
+        (t
+         (format *debug-io* "; No debug variables for current frame: ~
+                               using EVAL instead of EVAL-IN-FRAME.~%")
+         (eval expr))))
 
 (defun debug-eval-print (expr)
   (/noshow "entering DEBUG-EVAL-PRINT" expr)
@@ -1549,6 +1554,11 @@ and LDB (the low-level debugger).  See also ENABLE-DEBUGGER."
   #!-unwind-to-frame-and-call-vop
   (find 'sb!c:debug-catch-tag (sb!di::frame-catches frame) :key #'car))
 
+(defun frame-has-debug-vars-p (frame)
+  (sb!di:debug-var-info-available
+   (sb!di:code-location-debug-fun
+    (sb!di:frame-code-location frame))))
+
 ;; Hack: ensure that *U-T-F-F* has a tls index.
 #!+unwind-to-frame-and-call-vop
 (let ((sb!vm::*unwind-to-frame-function* (lambda ()))))
index a35679e..d2e8801 100644 (file)
@@ -17,4 +17,4 @@
 ;;; checkins which aren't released. (And occasionally for internal
 ;;; versions, especially for internal versions off the main CVS
 ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".)
-"1.0.42.41"
+"1.0.42.42"