diff options
author | Jason Molenda <jmolenda@apple.com> | 2014-11-04 05:28:40 +0000 |
---|---|---|
committer | Jason Molenda <jmolenda@apple.com> | 2014-11-04 05:28:40 +0000 |
commit | 4b0089324344946ce033859d1cb3e031ae5fadd0 (patch) | |
tree | 9ac3b0a04fa3033f43e2542c5f81f1cb86f8653a /lldb/source/Plugins/Process/Utility | |
parent | d28edfea031b06f36e61e58093b39f37f14270d9 (diff) | |
download | bcm5719-llvm-4b0089324344946ce033859d1cb3e031ae5fadd0.tar.gz bcm5719-llvm-4b0089324344946ce033859d1cb3e031ae5fadd0.zip |
Back out r221229 -- instead of trying to identify the end of the unwind,
let's let lldb try the arch default unwind every time but not destructively --
it doesn't permanently replace the main unwind method for that function from
now on.
This fix is for <rdar://problem/18683658>.
I tested it against Ryan Brown's go program test case and also a
collection of core files of tricky unwind scenarios
<rdar://problem/15664282> <rdar://problem/15835846>
<rdar://problem/15982682> <rdar://problem/16099440>
<rdar://problem/17364005> <rdar://problem/18556719>
that I've fixed over the last 6-9 months.
llvm-svn: 221238
Diffstat (limited to 'lldb/source/Plugins/Process/Utility')
3 files changed, 9 insertions, 36 deletions
diff --git a/lldb/source/Plugins/Process/Utility/RegisterContextLLDB.cpp b/lldb/source/Plugins/Process/Utility/RegisterContextLLDB.cpp index 88bb608ea9e..92e378979be 100644 --- a/lldb/source/Plugins/Process/Utility/RegisterContextLLDB.cpp +++ b/lldb/source/Plugins/Process/Utility/RegisterContextLLDB.cpp @@ -62,8 +62,7 @@ RegisterContextLLDB::RegisterContextLLDB m_sym_ctx_valid (false), m_frame_number (frame_number), m_registers(), - m_parent_unwind (unwind_lldb), - m_completed_stack_walk (false) + m_parent_unwind (unwind_lldb) { m_sym_ctx.Clear(false); m_sym_ctx_valid = false; @@ -307,7 +306,6 @@ RegisterContextLLDB::InitializeNonZerothFrame() if (pc == 0) { m_frame_type = eNotAValidFrame; - m_completed_stack_walk = true; UnwindLogMsg ("this frame has a pc of 0x0"); return; } @@ -388,10 +386,6 @@ RegisterContextLLDB::InitializeNonZerothFrame() { 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; } @@ -588,10 +582,6 @@ RegisterContextLLDB::InitializeNonZerothFrame() { 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; } @@ -1040,11 +1030,10 @@ RegisterContextLLDB::IsValid () const return m_frame_type != eNotAValidFrame; } -bool -RegisterContextLLDB::IsCompletedStackWalk () const -{ - return m_completed_stack_walk; -} +// After the final stack frame in a stack walk we'll get one invalid (eNotAValidFrame) stack frame -- +// one past the end of the stack walk. But higher-level code will need to tell the differnece between +// "the unwind plan below this frame failed" versus "we successfully completed the stack walk" so +// this method helps to disambiguate that. bool RegisterContextLLDB::IsTrapHandlerFrame () const @@ -1420,15 +1409,6 @@ RegisterContextLLDB::TryFallbackUnwindPlan () if (active_row && active_row->GetCFARegister() != LLDB_INVALID_REGNUM) { - FuncUnwindersSP func_unwinders_sp; - if (m_sym_ctx_valid && m_current_pc.IsValid() && m_current_pc.GetModule()) - { - func_unwinders_sp = m_current_pc.GetModule()->GetObjectFile()->GetUnwindTable().GetFuncUnwindersContainingAddress (m_current_pc, m_sym_ctx); - if (func_unwinders_sp) - { - func_unwinders_sp->InvalidateNonCallSiteUnwindPlan (m_thread); - } - } m_registers.clear(); m_full_unwind_plan_sp = m_fallback_unwind_plan_sp; addr_t cfa_regval = LLDB_INVALID_ADDRESS; @@ -1437,8 +1417,9 @@ RegisterContextLLDB::TryFallbackUnwindPlan () m_cfa = cfa_regval + active_row->GetCFAOffset (); } - UnwindLogMsg ("full unwind plan '%s' has been replaced by architecture default unwind plan '%s' for this function from now on.", - original_full_unwind_plan_sp->GetSourceName().GetCString(), m_fallback_unwind_plan_sp->GetSourceName().GetCString()); + UnwindLogMsg ("trying to unwind from this function with the UnwindPlan '%s' because UnwindPlan '%s' failed.", + m_fallback_unwind_plan_sp->GetSourceName().GetCString(), + original_full_unwind_plan_sp->GetSourceName().GetCString()); m_fallback_unwind_plan_sp.reset(); } diff --git a/lldb/source/Plugins/Process/Utility/RegisterContextLLDB.h b/lldb/source/Plugins/Process/Utility/RegisterContextLLDB.h index d272073de55..ff0b77488eb 100644 --- a/lldb/source/Plugins/Process/Utility/RegisterContextLLDB.h +++ b/lldb/source/Plugins/Process/Utility/RegisterContextLLDB.h @@ -73,9 +73,6 @@ public: IsValid () const; bool - IsCompletedStackWalk () const; - - bool IsTrapHandlerFrame () const; bool @@ -243,10 +240,6 @@ 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 //------------------------------------------------------------------ diff --git a/lldb/source/Plugins/Process/Utility/UnwindLLDB.cpp b/lldb/source/Plugins/Process/Utility/UnwindLLDB.cpp index b61819af0d8..37fd4f48955 100644 --- a/lldb/source/Plugins/Process/Utility/UnwindLLDB.cpp +++ b/lldb/source/Plugins/Process/Utility/UnwindLLDB.cpp @@ -174,8 +174,7 @@ 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 (reg_ctx_sp->IsCompletedStackWalk() == false - && m_frames[cur_idx - 1]->reg_ctx_lldb_sp->TryFallbackUnwindPlan()) + if (m_frames[cur_idx - 1]->reg_ctx_lldb_sp->TryFallbackUnwindPlan()) { return AddOneMoreFrame (abi); } |