diff options
author | emaste <emaste@FreeBSD.org> | 2014-02-18 16:23:10 +0000 |
---|---|---|
committer | emaste <emaste@FreeBSD.org> | 2014-02-18 16:23:10 +0000 |
commit | 6beac4fcf9e5327f07c0fefd527180124438096a (patch) | |
tree | 95cb16075f0af1b3a05b9b84eb18dda8e6c903e9 /source/Plugins/Process/Utility/UnwindLLDB.cpp | |
parent | f087960a1097db2a1ef14a88963f8785df239aaa (diff) | |
download | FreeBSD-src-6beac4fcf9e5327f07c0fefd527180124438096a.zip FreeBSD-src-6beac4fcf9e5327f07c0fefd527180124438096a.tar.gz |
Import lldb as of SVN r201577 (git 2bdc2f6)
(A number of files not required for the FreeBSD build have been removed.)
Sponsored by: DARPA, AFRL
Diffstat (limited to 'source/Plugins/Process/Utility/UnwindLLDB.cpp')
-rw-r--r-- | source/Plugins/Process/Utility/UnwindLLDB.cpp | 54 |
1 files changed, 49 insertions, 5 deletions
diff --git a/source/Plugins/Process/Utility/UnwindLLDB.cpp b/source/Plugins/Process/Utility/UnwindLLDB.cpp index 552ae50..a3a7002 100644 --- a/source/Plugins/Process/Utility/UnwindLLDB.cpp +++ b/source/Plugins/Process/Utility/UnwindLLDB.cpp @@ -26,8 +26,21 @@ using namespace lldb_private; UnwindLLDB::UnwindLLDB (Thread &thread) : Unwind (thread), m_frames(), - m_unwind_complete(false) + m_unwind_complete(false), + m_user_supplied_trap_handler_functions() { + ProcessSP process_sp(thread.GetProcess()); + if (process_sp) + { + Args args; + process_sp->GetTarget().GetUserSpecifiedTrapHandlerNames (args); + size_t count = args.GetArgumentCount(); + for (size_t i = 0; i < count; i++) + { + const char *func_name = args.GetArgumentAtIndex(i); + m_user_supplied_trap_handler_functions.push_back (ConstString (func_name)); + } + } } uint32_t @@ -95,7 +108,13 @@ UnwindLLDB::AddFirstFrame () first_cursor_sp->reg_ctx_lldb_sp = reg_ctx_sp; m_frames.push_back (first_cursor_sp); return true; + unwind_done: + Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_UNWIND)); + if (log) + { + log->Printf ("th%d Unwind of this thread is complete.", m_thread.GetIndexID()); + } m_unwind_complete = true; return false; } @@ -138,7 +157,12 @@ UnwindLLDB::AddOneMoreFrame (ABI *abi) } if (reg_ctx_sp.get() == NULL) + { + if (log) + log->Printf ("%*sFrame %d did not get a RegisterContext, stopping.", + cur_idx < 100 ? cur_idx : 100, "", cur_idx); goto unwind_done; + } if (!reg_ctx_sp->IsValid()) { @@ -160,12 +184,18 @@ UnwindLLDB::AddOneMoreFrame (ABI *abi) } if (abi && !abi->CallFrameAddressIsValid(cursor_sp->cfa)) { - if (log) + // On Mac OS X, the _sigtramp asynchronous signal trampoline frame may not have + // its (constructed) CFA aligned correctly -- don't do the abi alignment check for + // these. + if (reg_ctx_sp->IsTrapHandlerFrame() == false) { - log->Printf("%*sFrame %d did not get a valid CFA for this frame, stopping stack walk", - cur_idx < 100 ? cur_idx : 100, "", cur_idx); + if (log) + { + log->Printf("%*sFrame %d did not get a valid CFA for this frame, stopping stack walk", + cur_idx < 100 ? cur_idx : 100, "", cur_idx); + } + goto unwind_done; } - goto unwind_done; } if (!reg_ctx_sp->ReadPC (cursor_sp->start_pc)) { @@ -185,12 +215,26 @@ UnwindLLDB::AddOneMoreFrame (ABI *abi) } goto unwind_done; } + if (!m_frames.empty()) + { + // Infinite loop where the current cursor is the same as the previous one... + if (m_frames.back()->start_pc == cursor_sp->start_pc && m_frames.back()->cfa == cursor_sp->cfa) + { + if (log) + log->Printf ("th%d pc of this frame is the same as the previous frame and CFAs for both frames are identical -- stopping unwind", m_thread.GetIndexID()); + goto unwind_done; + } + } cursor_sp->reg_ctx_lldb_sp = reg_ctx_sp; m_frames.push_back (cursor_sp); return true; unwind_done: + if (log) + { + log->Printf ("th%d Unwind of this thread is complete.", m_thread.GetIndexID()); + } m_unwind_complete = true; return false; } |