code/interr: Hook internal error contexts into the saved-fp-and-pc mechanism.
authorAlastair Bridgewater <nyef@kana.lisphacker.com>
Wed, 8 May 2013 01:46:43 +0000 (21:46 -0400)
committerAlastair Bridgewater <nyef@kana.lisphacker.com>
Fri, 10 May 2013 15:19:30 +0000 (11:19 -0400)
  * This covers the unfortunate case of a signal handler not
having an unbroken stack frame chain to the interrupted context,
which actually occurs on threaded x86-64 FreeBSD systems.

  * Use the existing saved-fp-and-pc mechanism, used for
ALIEN-FUNCALL to cover for code compiled -fomit-frame-pointer to
treat the internal error context as an alien funcall point.

src/code/interr.lisp

index 3e8f95f..b870da5 100644 (file)
   (/hexstr context)
   (infinite-error-protect
    (/show0 "about to bind ALIEN-CONTEXT")
-   (let ((alien-context (locally
-                            (declare (optimize (inhibit-warnings 3)))
-                          (sb!alien:sap-alien context (* os-context-t)))))
+   (let* ((alien-context (locally
+                             (declare (optimize (inhibit-warnings 3)))
+                           (sb!alien:sap-alien context (* os-context-t))))
+          #!+c-stack-is-control-stack
+          (*saved-fp-and-pcs*
+           (cons (cons (%make-lisp-obj (sb!vm:context-register
+                                        alien-context
+                                        sb!vm::cfp-offset))
+                       (sb!vm:context-pc alien-context))
+                 (when (boundp '*saved-fp-and-pcs*)
+                   *saved-fp-and-pcs*))))
+     (declare (truly-dynamic-extent *saved-fp-and-pcs*))
      (/show0 "about to bind ERROR-NUMBER and ARGUMENTS")
      (multiple-value-bind (error-number arguments)
          (sb!vm:internal-error-args alien-context)