diff options
author | Jason Molenda <jmolenda@apple.com> | 2013-01-19 03:53:42 +0000 |
---|---|---|
committer | Jason Molenda <jmolenda@apple.com> | 2013-01-19 03:53:42 +0000 |
commit | 4c781fd78a6477cb648ddff5f81cee9decf04950 (patch) | |
tree | 384e46ab1514645ca68a776b13b7d44a8055ffe5 /lldb/source/Plugins/Process/Utility/UnwindLLDB.cpp | |
parent | 1ac67d153033293a5e524e0dfb2e91ca4fa3c3e8 (diff) | |
download | bcm5719-llvm-4c781fd78a6477cb648ddff5f81cee9decf04950.tar.gz bcm5719-llvm-4c781fd78a6477cb648ddff5f81cee9decf04950.zip |
<rdar://problem/12350715>
Modify UnwindLLDB::SearchForSavedLocationForRegister so if the register
save locations for a register mid-stack is in another register (or in the
same register, indicating the reg wasn't modified in this frame), don't
return that as a found location. Keep iterating down the array of frames
until a concrete location/value for the register is found, or until we
get to frame 0 where the reg value can be used as-is.
If lldb was trying to backtrace a program that blew out its stack via
recursion and the unwind instructions had some kind of
this-reg-is-saved-in-that-reg instruction, lldb would revert to doing
a recursive search for a concrete value and blow out its own stack.
llvm-svn: 172887
Diffstat (limited to 'lldb/source/Plugins/Process/Utility/UnwindLLDB.cpp')
-rw-r--r-- | lldb/source/Plugins/Process/Utility/UnwindLLDB.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lldb/source/Plugins/Process/Utility/UnwindLLDB.cpp b/lldb/source/Plugins/Process/Utility/UnwindLLDB.cpp index 128dbf7b539..4f4d2182f25 100644 --- a/lldb/source/Plugins/Process/Utility/UnwindLLDB.cpp +++ b/lldb/source/Plugins/Process/Utility/UnwindLLDB.cpp @@ -283,6 +283,19 @@ UnwindLLDB::SearchForSavedLocationForRegister (uint32_t lldb_regnum, lldb_privat { UnwindLLDB::RegisterSearchResult result; result = m_frames[frame_num]->reg_ctx_lldb_sp->SavedLocationForRegister (lldb_regnum, regloc); + + // If we have unwind instructions saying that register N is saved in register M in the middle of + // the stack (and N can equal M here, meaning the register was not used in this function), then + // change the register number we're looking for to M and keep looking for a concrete location + // down the stack, or an actual value from a live RegisterContext at frame 0. + if (result == UnwindLLDB::RegisterSearchResult::eRegisterFound + && regloc.type == UnwindLLDB::RegisterLocation::eRegisterInRegister + && frame_num > 0) + { + result = UnwindLLDB::RegisterSearchResult::eRegisterNotFound; + lldb_regnum = regloc.location.register_number; + } + if (result == UnwindLLDB::RegisterSearchResult::eRegisterFound) return true; if (result == UnwindLLDB::RegisterSearchResult::eRegisterIsVolatile) |