diff options
3 files changed, 26 insertions, 2 deletions
diff --git a/lldb/source/Plugins/Process/Utility/RegisterContextLLDB.cpp b/lldb/source/Plugins/Process/Utility/RegisterContextLLDB.cpp index 5071b1aa578..88bb608ea9e 100644 --- a/lldb/source/Plugins/Process/Utility/RegisterContextLLDB.cpp +++ b/lldb/source/Plugins/Process/Utility/RegisterContextLLDB.cpp @@ -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::InitializeNonZerothFrame() 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::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; } @@ -582,6 +588,10 @@ 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; } @@ -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; diff --git a/lldb/source/Plugins/Process/Utility/RegisterContextLLDB.h b/lldb/source/Plugins/Process/Utility/RegisterContextLLDB.h index ff0b77488eb..d272073de55 100644 --- a/lldb/source/Plugins/Process/Utility/RegisterContextLLDB.h +++ b/lldb/source/Plugins/Process/Utility/RegisterContextLLDB.h @@ -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 //------------------------------------------------------------------ diff --git a/lldb/source/Plugins/Process/Utility/UnwindLLDB.cpp b/lldb/source/Plugins/Process/Utility/UnwindLLDB.cpp index 37fd4f48955..b61819af0d8 100644 --- a/lldb/source/Plugins/Process/Utility/UnwindLLDB.cpp +++ b/lldb/source/Plugins/Process/Utility/UnwindLLDB.cpp @@ -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); } |

