[Lldb-commits] [lldb] r221229 - After we've completed a full backtrace, we'll have one frame which
Jason Molenda
jmolenda at apple.com
Mon Nov 3 18:31:51 PST 2014
Author: jmolenda
Date: Mon Nov 3 20:31:50 2014
New Revision: 221229
URL: http://llvm.org/viewvc/llvm-project?rev=221229&view=rev
Log:
After we've completed a full backtrace, we'll have one frame which
is "invalid" -- it is past the end of the stack trace. Add a new
method IsCompletedStackWalk() so we can tell if an invalid stack
frame is from a complete backtrace or if it might be worth re-trying
the last unwind with a different method.
This fixes the unwinder problems Ryan Brown was having with go
programs. The unwinder can (under the right circumstances) still
destructively replace unwind plans permanently - I'll work on
that in a different patch.
<rdar://problem/18683658>
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=221229&r1=221228&r2=221229&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp Mon Nov 3 20:31:50 2014
@@ -62,7 +62,8 @@ RegisterContextLLDB::RegisterContextLLDB
m_sym_ctx_valid (false),
m_frame_number (frame_number),
m_registers(),
- m_parent_unwind (unwind_lldb)
+ m_parent_unwind (unwind_lldb),
+ m_completed_stack_walk (false)
{
m_sym_ctx.Clear(false);
m_sym_ctx_valid = false;
@@ -306,6 +307,7 @@ RegisterContextLLDB::InitializeNonZeroth
if (pc == 0)
{
m_frame_type = eNotAValidFrame;
+ m_completed_stack_walk = true;
UnwindLogMsg ("this frame has a pc of 0x0");
return;
}
@@ -386,6 +388,10 @@ RegisterContextLLDB::InitializeNonZeroth
{
UnwindLogMsg ("could not find a valid cfa address");
m_frame_type = eNotAValidFrame;
+ if (cfa_regval == 0 || cfa_regval == 1)
+ {
+ m_completed_stack_walk = true;
+ }
return;
}
@@ -582,6 +588,10 @@ RegisterContextLLDB::InitializeNonZeroth
{
UnwindLogMsg ("could not find a valid cfa address");
m_frame_type = eNotAValidFrame;
+ if (cfa_regval == 0 || cfa_regval == 1)
+ {
+ m_completed_stack_walk = true;
+ }
return;
}
@@ -1031,6 +1041,12 @@ RegisterContextLLDB::IsValid () const
}
bool
+RegisterContextLLDB::IsCompletedStackWalk () const
+{
+ return m_completed_stack_walk;
+}
+
+bool
RegisterContextLLDB::IsTrapHandlerFrame () const
{
return m_frame_type == eTrapHandlerFrame;
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=221229&r1=221228&r2=221229&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.h (original)
+++ lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.h Mon Nov 3 20:31:50 2014
@@ -73,6 +73,9 @@ public:
IsValid () const;
bool
+ IsCompletedStackWalk () const;
+
+ bool
IsTrapHandlerFrame () const;
bool
@@ -240,6 +243,10 @@ private:
lldb_private::UnwindLLDB& m_parent_unwind; // The UnwindLLDB that is creating this RegisterContextLLDB
+ bool m_completed_stack_walk; // indicates that we completed a full stack walk
+ // (this frame is likely eNotAValidFrame aka !IsValid())
+ // and we should not continue trying to unwind
+
//------------------------------------------------------------------
// For RegisterContextLLDB only
//------------------------------------------------------------------
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=221229&r1=221228&r2=221229&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.cpp Mon Nov 3 20:31:50 2014
@@ -174,7 +174,8 @@ UnwindLLDB::AddOneMoreFrame (ABI *abi)
{
// If the RegisterContextLLDB has a fallback UnwindPlan, it will switch to that and return
// true. Subsequent calls to TryFallbackUnwindPlan() will return false.
- if (m_frames[cur_idx - 1]->reg_ctx_lldb_sp->TryFallbackUnwindPlan())
+ if (reg_ctx_sp->IsCompletedStackWalk() == false
+ && m_frames[cur_idx - 1]->reg_ctx_lldb_sp->TryFallbackUnwindPlan())
{
return AddOneMoreFrame (abi);
}
More information about the lldb-commits
mailing list