summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard M Kreuter <kreuter@users.sourceforge.net>2009-04-22 18:51:21 +0000
committerRichard M Kreuter <kreuter@users.sourceforge.net>2009-04-22 18:51:21 +0000
commitdb97ea04895820f70c90bdeb0399aa0229410b5d (patch)
tree8061af5120472c8519c673e080ee0eeaefde24a2
parent76f3e23c8ad6f98d60ff97233e11082a41faf894 (diff)
1.0.27.19: Restore variable access in debugger REPL.
* Contributed by Alex Plotnick <plotnick@cs.brandeis.edu>
-rw-r--r--NEWS2
-rw-r--r--package-data-list.lisp-expr2
-rw-r--r--src/code/debug-int.lisp9
-rw-r--r--src/code/debug.lisp14
-rw-r--r--src/code/toplevel.lisp4
-rw-r--r--version.lisp-expr2
6 files changed, 28 insertions, 5 deletions
diff --git a/NEWS b/NEWS
index 92cdbf8aa..27172f606 100644
--- 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)
diff --git a/package-data-list.lisp-expr b/package-data-list.lisp-expr
index 5615e2b42..45cde2053 100644
--- a/package-data-list.lisp-expr
+++ b/package-data-list.lisp-expr
@@ -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"))
diff --git a/src/code/debug-int.lisp b/src/code/debug-int.lisp
index d0034253d..234bcbf9a 100644
--- a/src/code/debug-int.lisp
+++ b/src/code/debug-int.lisp
@@ -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))
;;;; breakpoints
diff --git a/src/code/debug.lisp b/src/code/debug.lisp
index ecbf3e8e8..165a874c8 100644
--- a/src/code/debug.lisp
+++ b/src/code/debug.lisp
@@ -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*)
diff --git a/src/code/toplevel.lisp b/src/code/toplevel.lisp
index 95cd0ec62..607113183 100644
--- a/src/code/toplevel.lisp
+++ b/src/code/toplevel.lisp
@@ -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
diff --git a/version.lisp-expr b/version.lisp-expr
index 2a4f2d071..da4f452f7 100644
--- a/version.lisp-expr
+++ b/version.lisp-expr
@@ -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"