Improved undefined-function backtrace on x86oids.
authorAlastair Bridgewater <nyef@kana.lisphacker.com>
Wed, 30 Nov 2011 15:32:40 +0000 (10:32 -0500)
committerAlastair Bridgewater <nyef@arisu.lisphacker.com>
Mon, 5 Dec 2011 22:56:19 +0000 (17:56 -0500)
  * Instead of "bogus stack frame", present undefined function
frames as "undefined function".

  * Implement this by checking specifically for escaped frames
with the program counter within the range between the start of
undefined_tramp and the start of whichever function follows it
in $ARCH-assem.S.

NEWS
src/code/debug-int.lisp
src/runtime/x86-64-assem.S
src/runtime/x86-assem.S
tests/debug.impure.lisp

diff --git a/NEWS b/NEWS
index e416553..8156f78 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -24,6 +24,8 @@ changes relative to sbcl-1.0.54:
   * enhancement: the test runner now takes a --report-skipped-tests argument
     to report the individual tests skipped as well as the number of skipped
     tests.
+  * enhancement: undefined functions now appear in backtraces as ("undefined
+    function") instead of ("bogus stack frame") on x86oids.
   * optimization: the compiler is smarter about representation selection for
     floating point constants used in full calls.
   * optimization: the compiler no longer refuses to coerce large fixnums to
index d5dd4c7..592c75f 100644 (file)
                          (component-from-component-ptr component-ptr))))
             (/noshow0 "got CODE")
             (when (null code)
-              (return (values code 0 context)))
+              ;; KLUDGE: Detect undefined functions by a range-check
+              ;; against the trampoline address and the following
+              ;; function in the runtime.
+              (if (< (foreign-symbol-address "undefined_tramp")
+                     (sap-int (sb!vm:context-pc context))
+                     (foreign-symbol-address #!+x86 "closure_tramp"
+                                             #!+x86-64 "alloc_tramp"))
+                  (return (values :undefined-function 0 context))
+                  (return (values code 0 context))))
             (let* ((code-header-len (* (get-header-data code)
                                        sb!vm:n-word-bytes))
                    (pc-offset
index 1fb7b00..34b9df5 100644 (file)
@@ -275,6 +275,9 @@ GNAME(undefined_tramp):
        ret
        SIZE(GNAME(undefined_tramp))
 
+/* KLUDGE: FIND-ESCAPED-FRAME (SYS:SRC;CODE;DEBUG-INT.LISP) needs
+ * to know the name of the function immediately following the
+ * undefined-function trampoline. */
 
        .text
        .align  align_16byte,0x90
index d6dd52b..d04e194 100644 (file)
@@ -347,6 +347,10 @@ GNAME(undefined_tramp):
        ret
        SIZE(GNAME(undefined_tramp))
 
+/* KLUDGE: FIND-ESCAPED-FRAME (SYS:SRC;CODE;DEBUG-INT.LISP) needs
+ * to know the name of the function immediately following the
+ * undefined-function trampoline. */
+
 /*
  * the closure trampoline
  */
index 3520c9a..b72317b 100644 (file)
 
 (defvar *undefined-function-frame*
   ;; bug 353
-  '(#+(or x86 x86-64) "bogus stack frame"
-    #-(or x86 x86-64) "undefined function"))
+  '("undefined function"))
 
 ;;; Test for "undefined function" (undefined_tramp) working properly.
 ;;; Try it with and without tail call elimination, since they can have