From 23399d765cea1b0f7e3ec8e63c1390a1f992a950 Mon Sep 17 00:00:00 2001 From: Jason Molenda Date: Wed, 5 Jun 2013 00:12:50 +0000 Subject: [PATCH] Change UnwindLLDB::SearchForSavedLocationForRegister so that it will allow for the link register save location being in the link register - in which case we should iterate down the stack, not recursively try to find the lr in the current frame over and over. llvm-svn: 183282 --- .../Plugins/Process/Utility/RegisterContextLLDB.cpp | 13 ++++++------- lldb/source/Plugins/Process/Utility/UnwindLLDB.cpp | 4 ++-- lldb/source/Plugins/Process/Utility/UnwindLLDB.h | 2 +- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/lldb/source/Plugins/Process/Utility/RegisterContextLLDB.cpp b/lldb/source/Plugins/Process/Utility/RegisterContextLLDB.cpp index 5382489aa6a0..84343b924259 100644 --- a/lldb/source/Plugins/Process/Utility/RegisterContextLLDB.cpp +++ b/lldb/source/Plugins/Process/Utility/RegisterContextLLDB.cpp @@ -1305,21 +1305,20 @@ RegisterContextLLDB::ReadGPRValue (int register_kind, uint32_t regnum, addr_t &v return false; } - bool pc_or_return_address = false; + bool pc_register = false; uint32_t generic_regnum; - if (register_kind == eRegisterKindGeneric - && (regnum == LLDB_REGNUM_GENERIC_PC || regnum == LLDB_REGNUM_GENERIC_RA)) + if (register_kind == eRegisterKindGeneric && regnum == LLDB_REGNUM_GENERIC_PC) { - pc_or_return_address = true; + pc_register = true; } else if (m_thread.GetRegisterContext()->ConvertBetweenRegisterKinds (register_kind, regnum, eRegisterKindGeneric, generic_regnum) - && (generic_regnum == LLDB_REGNUM_GENERIC_PC || generic_regnum == LLDB_REGNUM_GENERIC_RA)) + && generic_regnum == LLDB_REGNUM_GENERIC_PC) { - pc_or_return_address = true; + pc_register = true; } lldb_private::UnwindLLDB::RegisterLocation regloc; - if (!m_parent_unwind.SearchForSavedLocationForRegister (lldb_regnum, regloc, m_frame_number - 1, pc_or_return_address)) + if (!m_parent_unwind.SearchForSavedLocationForRegister (lldb_regnum, regloc, m_frame_number - 1, pc_register)) { return false; } diff --git a/lldb/source/Plugins/Process/Utility/UnwindLLDB.cpp b/lldb/source/Plugins/Process/Utility/UnwindLLDB.cpp index 9056a3ffb9d4..0eea00363498 100644 --- a/lldb/source/Plugins/Process/Utility/UnwindLLDB.cpp +++ b/lldb/source/Plugins/Process/Utility/UnwindLLDB.cpp @@ -278,7 +278,7 @@ UnwindLLDB::GetRegisterContextForFrameNum (uint32_t frame_num) } bool -UnwindLLDB::SearchForSavedLocationForRegister (uint32_t lldb_regnum, lldb_private::UnwindLLDB::RegisterLocation ®loc, uint32_t starting_frame_num, bool pc_or_return_address_reg) +UnwindLLDB::SearchForSavedLocationForRegister (uint32_t lldb_regnum, lldb_private::UnwindLLDB::RegisterLocation ®loc, uint32_t starting_frame_num, bool pc_reg) { int64_t frame_num = starting_frame_num; if (frame_num >= m_frames.size()) @@ -286,7 +286,7 @@ UnwindLLDB::SearchForSavedLocationForRegister (uint32_t lldb_regnum, lldb_privat // Never interrogate more than one level while looking for the saved pc value. If the value // isn't saved by frame_num, none of the frames lower on the stack will have a useful value. - if (pc_or_return_address_reg) + if (pc_reg) { UnwindLLDB::RegisterSearchResult result; result = m_frames[frame_num]->reg_ctx_lldb_sp->SavedLocationForRegister (lldb_regnum, regloc); diff --git a/lldb/source/Plugins/Process/Utility/UnwindLLDB.h b/lldb/source/Plugins/Process/Utility/UnwindLLDB.h index 051e6c9cd453..5725654a6869 100644 --- a/lldb/source/Plugins/Process/Utility/UnwindLLDB.h +++ b/lldb/source/Plugins/Process/Utility/UnwindLLDB.h @@ -87,7 +87,7 @@ protected: // Iterate over the RegisterContextLLDB's in our m_frames vector, look for the first one that // has a saved location for this reg. bool - SearchForSavedLocationForRegister (uint32_t lldb_regnum, lldb_private::UnwindLLDB::RegisterLocation ®loc, uint32_t starting_frame_num, bool pc_or_return_address_reg); + SearchForSavedLocationForRegister (uint32_t lldb_regnum, lldb_private::UnwindLLDB::RegisterLocation ®loc, uint32_t starting_frame_num, bool pc_register); private: