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.

<rdar://problem/13932954>

llvm-svn: 183282
This commit is contained in:
Jason Molenda 2013-06-05 00:12:50 +00:00
parent 912a710a8a
commit 23399d765c
3 changed files with 9 additions and 10 deletions

View File

@ -1305,21 +1305,20 @@ RegisterContextLLDB::ReadGPRValue (int register_kind, uint32_t regnum, addr_t &v
return false; return false;
} }
bool pc_or_return_address = false; bool pc_register = false;
uint32_t generic_regnum; uint32_t generic_regnum;
if (register_kind == eRegisterKindGeneric if (register_kind == eRegisterKindGeneric && regnum == LLDB_REGNUM_GENERIC_PC)
&& (regnum == LLDB_REGNUM_GENERIC_PC || regnum == LLDB_REGNUM_GENERIC_RA))
{ {
pc_or_return_address = true; pc_register = true;
} }
else if (m_thread.GetRegisterContext()->ConvertBetweenRegisterKinds (register_kind, regnum, eRegisterKindGeneric, generic_regnum) 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; 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; return false;
} }

View File

@ -278,7 +278,7 @@ UnwindLLDB::GetRegisterContextForFrameNum (uint32_t frame_num)
} }
bool bool
UnwindLLDB::SearchForSavedLocationForRegister (uint32_t lldb_regnum, lldb_private::UnwindLLDB::RegisterLocation &regloc, uint32_t starting_frame_num, bool pc_or_return_address_reg) UnwindLLDB::SearchForSavedLocationForRegister (uint32_t lldb_regnum, lldb_private::UnwindLLDB::RegisterLocation &regloc, uint32_t starting_frame_num, bool pc_reg)
{ {
int64_t frame_num = starting_frame_num; int64_t frame_num = starting_frame_num;
if (frame_num >= m_frames.size()) 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 // 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. // 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; UnwindLLDB::RegisterSearchResult result;
result = m_frames[frame_num]->reg_ctx_lldb_sp->SavedLocationForRegister (lldb_regnum, regloc); result = m_frames[frame_num]->reg_ctx_lldb_sp->SavedLocationForRegister (lldb_regnum, regloc);

View File

@ -87,7 +87,7 @@ protected:
// Iterate over the RegisterContextLLDB's in our m_frames vector, look for the first one that // Iterate over the RegisterContextLLDB's in our m_frames vector, look for the first one that
// has a saved location for this reg. // has a saved location for this reg.
bool bool
SearchForSavedLocationForRegister (uint32_t lldb_regnum, lldb_private::UnwindLLDB::RegisterLocation &regloc, uint32_t starting_frame_num, bool pc_or_return_address_reg); SearchForSavedLocationForRegister (uint32_t lldb_regnum, lldb_private::UnwindLLDB::RegisterLocation &regloc, uint32_t starting_frame_num, bool pc_register);
private: private: