diff options
| author | Jason Molenda <jmolenda@apple.com> | 2014-02-14 05:06:49 +0000 |
|---|---|---|
| committer | Jason Molenda <jmolenda@apple.com> | 2014-02-14 05:06:49 +0000 |
| commit | a4bea72ee72a8e477e9f6fd139ad24754efeac02 (patch) | |
| tree | a561e13249c1d23f9504d6106199ad824a88ce20 /lldb/source/Plugins/Process/Utility/RegisterContextLLDB.cpp | |
| parent | 293349e4d786d5f1561bd057f94d54cd90c00aed (diff) | |
| download | bcm5719-llvm-a4bea72ee72a8e477e9f6fd139ad24754efeac02.tar.gz bcm5719-llvm-a4bea72ee72a8e477e9f6fd139ad24754efeac02.zip | |
Add a new target setting, trap-handler-names, where a user can
specify a list of functions which should be treated as trap handlers.
This will be primarily useful to people working in non-user-level
process debugging - kernels and other standalone environments.
For most people, the trap handler functions provided by the Platform
plugin will be sufficient.
<rdar://problem/15835846>, <rdar://problem/15982682>
llvm-svn: 201386
Diffstat (limited to 'lldb/source/Plugins/Process/Utility/RegisterContextLLDB.cpp')
| -rw-r--r-- | lldb/source/Plugins/Process/Utility/RegisterContextLLDB.cpp | 69 |
1 files changed, 43 insertions, 26 deletions
diff --git a/lldb/source/Plugins/Process/Utility/RegisterContextLLDB.cpp b/lldb/source/Plugins/Process/Utility/RegisterContextLLDB.cpp index 3f4c6609a52..f87db581074 100644 --- a/lldb/source/Plugins/Process/Utility/RegisterContextLLDB.cpp +++ b/lldb/source/Plugins/Process/Utility/RegisterContextLLDB.cpp @@ -172,21 +172,15 @@ RegisterContextLLDB::InitializeZerothFrame() AddressRange addr_range; m_sym_ctx.GetAddressRange (eSymbolContextFunction | eSymbolContextSymbol, 0, false, addr_range); - m_frame_type = eNormalFrame; - PlatformSP platform_sp (process->GetTarget().GetPlatform()); - if (platform_sp) + if (IsTrapHandlerSymbol (process, m_sym_ctx)) { - const std::vector<ConstString> trap_handler_names (platform_sp->GetTrapHandlerSymbolNames()); - for (ConstString name : trap_handler_names) - { - if ((m_sym_ctx.function && m_sym_ctx.function->GetName() == name) || - (m_sym_ctx.symbol && m_sym_ctx.symbol->GetName() == name)) - { - m_frame_type = eTrapHandlerFrame; - } - } + m_frame_type = eTrapHandlerFrame; + } + else + { + // FIXME: Detect eDebuggerFrame here. + m_frame_type = eNormalFrame; } - // FIXME: Detect eDebuggerFrame here. // If we were able to find a symbol/function, set addr_range to the bounds of that symbol/function. // else treat the current pc value as the start_pc and record no offset. @@ -497,25 +491,18 @@ RegisterContextLLDB::InitializeNonZerothFrame() m_current_offset_backed_up_one = -1; } - if (m_frame_type != eSkipFrame) // don't override eSkipFrame + if (IsTrapHandlerSymbol (process, m_sym_ctx)) { - m_frame_type = eNormalFrame; + m_frame_type = eTrapHandlerFrame; } - PlatformSP platform_sp (process->GetTarget().GetPlatform()); - if (platform_sp) + else { - const std::vector<ConstString> trap_handler_names (platform_sp->GetTrapHandlerSymbolNames()); - for (ConstString name : trap_handler_names) + // FIXME: Detect eDebuggerFrame here. + if (m_frame_type != eSkipFrame) // don't override eSkipFrame { - if ((m_sym_ctx.function && m_sym_ctx.function->GetName() == name) || - (m_sym_ctx.symbol && m_sym_ctx.symbol->GetName() == name)) - { - m_frame_type = eTrapHandlerFrame; - } + m_frame_type = eNormalFrame; } } - // FIXME: Detect eDebuggerFrame here. - // We've set m_frame_type and m_sym_ctx before this call. m_fast_unwind_plan_sp = GetFastUnwindPlanForFrame (); @@ -1010,6 +997,35 @@ RegisterContextLLDB::IsSkipFrame () const return m_frame_type == eSkipFrame; } +bool +RegisterContextLLDB::IsTrapHandlerSymbol (lldb_private::Process *process, const lldb_private::SymbolContext &m_sym_ctx) const +{ + PlatformSP platform_sp (process->GetTarget().GetPlatform()); + if (platform_sp) + { + const std::vector<ConstString> trap_handler_names (platform_sp->GetTrapHandlerSymbolNames()); + for (ConstString name : trap_handler_names) + { + if ((m_sym_ctx.function && m_sym_ctx.function->GetName() == name) || + (m_sym_ctx.symbol && m_sym_ctx.symbol->GetName() == name)) + { + return true; + } + } + } + const std::vector<ConstString> user_specified_trap_handler_names (m_parent_unwind.GetUserSpecifiedTrapHandlerFunctionNames()); + for (ConstString name : user_specified_trap_handler_names) + { + if ((m_sym_ctx.function && m_sym_ctx.function->GetName() == name) || + (m_sym_ctx.symbol && m_sym_ctx.symbol->GetName() == name)) + { + return true; + } + } + + return false; +} + // Answer the question: Where did THIS frame save the CALLER frame ("previous" frame)'s register value? enum UnwindLLDB::RegisterSearchResult @@ -1633,3 +1649,4 @@ RegisterContextLLDB::UnwindLogMsgVerbose (const char *fmt, ...) } } + |

