From 7d27567a0ba8906127b4257d12ef62c5c7a01197 Mon Sep 17 00:00:00 2001 From: Stas Boukarev Date: Mon, 11 Jan 2016 19:11:45 +0300 Subject: [PATCH] Fix backtraces on OS X. FIND-INTERRUPTED-FRAME tries to walk the frames and return the one matching an interrupt context. But on OS X _sigtramp doesn't have the return address saved and the frame chain is broken. Use the frame pointer saved in the most recent interrupt context as a starting point instead. --- src/code/interr.lisp | 25 +++++-------------------- 1 file changed, 5 insertions(+), 20 deletions(-) diff --git a/src/code/interr.lisp b/src/code/interr.lisp index 1fcc47a09..939c98636 100644 --- a/src/code/interr.lisp +++ b/src/code/interr.lisp @@ -177,27 +177,12 @@ ((or error sb!di:debug-condition) ())))) (defun find-interrupted-frame () - (/show0 "entering FIND-INTERRUPTED-FRAME") - (unless *finding-frame* + (when (plusp *free-interrupt-context-index*) (handler-case - (let ((*finding-frame* t)) - (/show0 "in ordinary case") - (do ((frame (sb!di:top-frame) (sb!di:frame-down frame))) - ((null frame) - (/show0 "null frame") - nil) - (/noshow0 "at head of DO loop") - (when (and (sb!di::compiled-frame-p frame) - (sb!di::compiled-frame-escaped frame)) - (sb!di:flush-frames-above frame) - (/show0 "returning from within DO loop") - (return frame)))) - (error () - (/show0 "trapped ERROR") - nil) - (sb!di:debug-condition () - (/show0 "trapped DEBUG-CONDITION") - nil)))) + (sb!di::signal-context-frame (sb!alien::alien-sap + (sb!di::nth-interrupt-context + (1- *free-interrupt-context-index*)))) + ((or error sb!di:debug-condition) ())))) (defun find-caller-of-named-frame (name) (unless *finding-frame* -- 2.11.4.GIT