[Lldb-commits] [lldb] r198450 - Don't enforce ABI stack alignment rules on the sigtramp frame --

Jason Molenda jmolenda at apple.com
Fri Jan 3 14:06:26 PST 2014


Author: jmolenda
Date: Fri Jan  3 16:06:25 2014
New Revision: 198450

URL: http://llvm.org/viewvc/llvm-project?rev=198450&view=rev
Log:
Don't enforce ABI stack alignment rules on the sigtramp frame --
its stack frame is a constructed, fake thing that may not conform
correctly to these rules.  This fixes a problem where lldb couldn't
backtrace past an asynchronous signal handler (_sigtramp) frame on
a stack on Mac OS X.
<rdar://problem/15035673> 

Modified:
    lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp
    lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.h
    lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.cpp

Modified: lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp?rev=198450&r1=198449&r2=198450&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp Fri Jan  3 16:06:25 2014
@@ -949,6 +949,12 @@ RegisterContextLLDB::IsValid () const
     return m_frame_type != eNotAValidFrame;
 }
 
+bool
+RegisterContextLLDB::IsSigtrampFrame () const
+{
+    return m_frame_type == eSigtrampFrame;
+}
+
 // A skip frame is a bogus frame on the stack -- but one where we're likely to find a real frame farther
 // up the stack if we keep looking.  It's always the second frame in an unwind (i.e. the first frame after
 // frame zero) where unwinding can be the trickiest.  Ideally we'll mark up this frame in some way so the

Modified: lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.h?rev=198450&r1=198449&r2=198450&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.h (original)
+++ lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.h Fri Jan  3 16:06:25 2014
@@ -73,6 +73,9 @@ public:
     IsValid () const;
 
     bool
+    IsSigtrampFrame () const;
+
+    bool
     GetCFA (lldb::addr_t& cfa);
 
     bool

Modified: lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.cpp?rev=198450&r1=198449&r2=198450&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.cpp Fri Jan  3 16:06:25 2014
@@ -171,12 +171,18 @@ UnwindLLDB::AddOneMoreFrame (ABI *abi)
     }
     if (abi && !abi->CallFrameAddressIsValid(cursor_sp->cfa))
     {
-        if (log)
+        // On Mac OS X, the _sigtramp asynchronous signal trampoline frame may not have
+        // its (constructed) CFA aligned correctly -- don't do the abi alignment check for
+        // these.
+        if (reg_ctx_sp->IsSigtrampFrame() == false)
         {
-            log->Printf("%*sFrame %d did not get a valid CFA for this frame, stopping stack walk",
-                        cur_idx < 100 ? cur_idx : 100, "", cur_idx);
+            if (log)
+            {
+                log->Printf("%*sFrame %d did not get a valid CFA for this frame, stopping stack walk",
+                            cur_idx < 100 ? cur_idx : 100, "", cur_idx);
+            }
+            goto unwind_done;
         }
-        goto unwind_done;
     }
     if (!reg_ctx_sp->ReadPC (cursor_sp->start_pc))
     {





More information about the lldb-commits mailing list