1.0.48.6: %SIMPLE-EVAL and backtraces
authorNikodemus Siivola <nikodemus@random-state.net>
Tue, 10 May 2011 19:16:53 +0000 (19:16 +0000)
committerNikodemus Siivola <nikodemus@random-state.net>
Tue, 10 May 2011 19:16:53 +0000 (19:16 +0000)
  Functions from %SIMPLE-EVAL have names such as (EVAL (DEFMACRO FOO)),
  which looks pretty confusing in the backtrace.

  Replace that with #:EVAL-THUNK, which is more descriptive and
  less head-scratchy.

  Also, calls to SIMPLE-EVAL-IN-LEXENV and EVAL -- when they show
  up in backtraces -- have lisp forms as arguments. This causes
  pretty-printing to try and split things onto multiple lines,
  but *PRINT-LINES* tends to be 1 during backtracing.

  ...so bind *PRINT-PRETTY* to NIL when printing eval-frame
  arguments iff *PRINT-LINES* is 1 in order to have something
  useful show up the backtrace.

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

diff --git a/NEWS b/NEWS
index 627b5e0..6fb5ce4 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -6,6 +6,8 @@ changes relative to sbcl-1.0.48:
     virtual source-file information, eg. overriding input-file of COMPILE-FILE
     when a temporary file is used for compilation.
   * enhancement: ASDF has been updated to version 2.015.1.
+  * enhancement: backtraces involving frames from the default evaluator
+    are more readable.
 
 changes in sbcl-1.0.48 relative to sbcl-1.0.47:
   * incompatible change: SB!KERNEL:INSTANCE-LAMBDA, deprecated for over five
index ec41b0d..cca2e62 100644 (file)
@@ -343,6 +343,12 @@ thread, NIL otherwise."
                  ;; &AUX-BINDINGS appear in backtraces, so they are
                  ;; left alone for now. --NS 2005-02-28
                  (case (first name)
+                   ((eval)
+                    ;; The name of an evaluator thunk contains
+                    ;; the source context -- but that makes for a
+                    ;; confusing frame name, since it can look like an
+                    ;; EVAL call with a bogus argument.
+                    (values '#:eval-thunk nil))
                    ((sb!c::xep sb!c::tl-xep)
                     (clean-xep name args))
                    ((sb!c::&more-processor)
@@ -397,10 +403,17 @@ thread, NIL otherwise."
           ;; If we hit a &REST arg, then print as many of the values as
           ;; possible, punting the loop over lambda-list variables since any
           ;; other arguments will be in the &REST arg's list of values.
-          (let ((args (ensure-printable-object args)))
-            (if (listp args)
-                (format stream "~{ ~_~S~}" args)
-                (format stream " ~S" args))))
+          (let ((print-args (ensure-printable-object args))
+                ;; Special case *PRINT-PRETTY* for eval frames: if
+                ;; *PRINT-LINES* is 1, turn off pretty-printing.
+                (*print-pretty*
+                 (if (and (eql 1 *print-lines*)
+                          (member name '(eval simple-eval-in-lexenv)))
+                     nil
+                     *print-pretty*)))
+            (if (listp print-args)
+                (format stream "~{ ~_~S~}" print-args)
+                (format stream " ~S" print-args))))
         (when kind
           (format stream "[~S]" kind))))
   (when (>= verbosity 2)
index 2ac7701..2e2f4de 100644 (file)
@@ -20,4 +20,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.48.5"
+"1.0.48.6"