1.0.27.19: Restore variable access in debugger REPL.
authorRichard M Kreuter <kreuter@users.sourceforge.net>
Wed, 22 Apr 2009 18:51:21 +0000 (18:51 +0000)
committerRichard M Kreuter <kreuter@users.sourceforge.net>
Wed, 22 Apr 2009 18:51:21 +0000 (18:51 +0000)
* Contributed by Alex Plotnick <plotnick@cs.brandeis.edu>

NEWS
package-data-list.lisp-expr
src/code/debug-int.lisp
src/code/debug.lisp
src/code/toplevel.lisp
version.lisp-expr

diff --git a/NEWS b/NEWS
index 92cdbf8..27172f6 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -11,6 +11,8 @@ changes in sbcl-1.0.28 relative to 1.0.27:
   * minor incompatible changes: echo-streams now propagate unread-char to the
     underlying input stream, and no longer permit unreading more than one
     character.
+  * improvement: the debugger REPL can now reference lexical variables
+    by name directly for code compiled with (DEBUG 3).
 
 changes in sbcl-1.0.27 relative to 1.0.26:
   * new port: support added for x86-64 OpenBSD. (thanks to Josh Elsasser)
index 5615e2b..45cde20 100644 (file)
@@ -455,7 +455,7 @@ like *STACK-TOP-HINT* and unsupported stuff like *TRACED-FUN-LIST*."
                "INVALID-CONTROL-STACK-POINTER" "INVALID-VALUE"
                "LAMBDA-LIST-UNAVAILABLE" "MAKE-BREAKPOINT" "NO-DEBUG-BLOCKS"
                "NO-DEBUG-FUN-RETURNS" "NO-DEBUG-INFO" "PREPROCESS-FOR-EVAL"
-               "RETURN-FROM-FRAME" "SOURCE-PATH-CONTEXT"
+               "EVAL-IN-FRAME" "RETURN-FROM-FRAME" "SOURCE-PATH-CONTEXT"
                "TOP-FRAME" "UNHANDLED-DEBUG-CONDITION" "UNKNOWN-CODE-LOCATION"
                "UNKNOWN-CODE-LOCATION-P" "UNKNOWN-DEBUG-VAR"
                "CODE-LOCATION-KIND" "FLUSH-FRAMES-ABOVE"))
index d003425..234bcbf 100644 (file)
@@ -2565,6 +2565,15 @@ register."
             (debug-signal 'frame-fun-mismatch
                           :code-location loc :form form :frame frame))
           (funcall res frame))))))
+
+;;; EVAL-IN-FRAME
+
+(defun eval-in-frame (frame form)
+  (declare (type frame frame))
+  #!+sb-doc
+  "Evaluate FORM in the lexical context of FRAME's current code location,
+   returning the results of the evaluation."
+  (funcall (preprocess-for-eval form (frame-code-location frame)) frame))
 \f
 ;;;; breakpoints
 
index ecbf3e8..165a874 100644 (file)
@@ -806,9 +806,21 @@ reset to ~S."
                        (t
                         (funcall cmd-fun))))))))))))
 
+(defvar *auto-eval-in-frame* t
+  #!+sb-doc
+  "When set (the default), evaluations in the debugger's command loop occur
+   relative to the current frame's environment without the need of 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)))
+
 (defun debug-eval-print (expr)
   (/noshow "entering DEBUG-EVAL-PRINT" expr)
-  (let ((values (multiple-value-list (interactive-eval expr))))
+  (let ((values (multiple-value-list
+                 (interactive-eval expr :eval #'debug-eval))))
     (/noshow "done with EVAL in DEBUG-EVAL-PRINT")
     (dolist (value values)
       (fresh-line *debug-io*)
index 95cd0ec..6071131 100644 (file)
@@ -291,13 +291,13 @@ command-line.")
 (defvar +++ nil #!+sb-doc "the previous value of ++")
 (defvar -   nil #!+sb-doc "the form currently being evaluated")
 
-(defun interactive-eval (form)
+(defun interactive-eval (form &key (eval #'eval))
   #!+sb-doc
   "Evaluate FORM, returning whatever it returns and adjusting ***, **, *,
 +++, ++, +, ///, //, /, and -."
   (setf - form)
   (unwind-protect
-       (let ((results (multiple-value-list (eval form))))
+       (let ((results (multiple-value-list (funcall eval form))))
          (setf /// //
                // /
                / results
index 2a4f2d0..da4f452 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.27.18"
+"1.0.27.19"