diff options
author | Zachary Turner <zturner@google.com> | 2015-04-06 16:23:30 +0000 |
---|---|---|
committer | Zachary Turner <zturner@google.com> | 2015-04-06 16:23:30 +0000 |
commit | 6f21907a89d279c1ca54aa65aeaff09e39f38d50 (patch) | |
tree | 4dd714d9ffab6c2e5c34c9cdd483b0d5c4e7d9e5 /lldb/source/Plugins/Process/Utility/RegisterContextLLDB.cpp | |
parent | 16ab5e698f80358bdcc296a1180466912f7810d1 (diff) | |
download | bcm5719-llvm-6f21907a89d279c1ca54aa65aeaff09e39f38d50.tar.gz bcm5719-llvm-6f21907a89d279c1ca54aa65aeaff09e39f38d50.zip |
Fix printing of function names during unwind logging.
llvm-svn: 234172
Diffstat (limited to 'lldb/source/Plugins/Process/Utility/RegisterContextLLDB.cpp')
-rw-r--r-- | lldb/source/Plugins/Process/Utility/RegisterContextLLDB.cpp | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/lldb/source/Plugins/Process/Utility/RegisterContextLLDB.cpp b/lldb/source/Plugins/Process/Utility/RegisterContextLLDB.cpp index a889d29a234..22058ce0833 100644 --- a/lldb/source/Plugins/Process/Utility/RegisterContextLLDB.cpp +++ b/lldb/source/Plugins/Process/Utility/RegisterContextLLDB.cpp @@ -38,6 +38,15 @@ using namespace lldb; using namespace lldb_private; +static ConstString GetSymbolOrFunctionName(const SymbolContext &sym_ctx) +{ + if (sym_ctx.symbol) + return sym_ctx.symbol->GetName(); + else if (sym_ctx.function) + return sym_ctx.function->GetName(); + return ConstString(); +} + RegisterContextLLDB::RegisterContextLLDB ( Thread& thread, @@ -175,12 +184,12 @@ RegisterContextLLDB::InitializeZerothFrame() if (m_sym_ctx.symbol) { UnwindLogMsg ("with pc value of 0x%" PRIx64 ", symbol name is '%s'", - current_pc, m_sym_ctx.symbol == NULL ? "" : m_sym_ctx.symbol->GetName().AsCString()); + current_pc, GetSymbolOrFunctionName(m_sym_ctx).AsCString("")); } else if (m_sym_ctx.function) { UnwindLogMsg ("with pc value of 0x%" PRIx64 ", function name is '%s'", - current_pc, m_sym_ctx.symbol == NULL ? "" : m_sym_ctx.function->GetName().AsCString()); + current_pc, GetSymbolOrFunctionName(m_sym_ctx).AsCString("")); } else { @@ -457,12 +466,12 @@ RegisterContextLLDB::InitializeNonZerothFrame() if (m_sym_ctx.symbol) { UnwindLogMsg ("with pc value of 0x%" PRIx64 ", symbol name is '%s'", - pc, m_sym_ctx.symbol == NULL ? "" : m_sym_ctx.symbol->GetName().AsCString()); + pc, GetSymbolOrFunctionName(m_sym_ctx).AsCString("")); } else if (m_sym_ctx.function) { UnwindLogMsg ("with pc value of 0x%" PRIx64 ", function name is '%s'", - pc, m_sym_ctx.symbol == NULL ? "" : m_sym_ctx.function->GetName().AsCString()); + pc, GetSymbolOrFunctionName(m_sym_ctx).AsCString("")); } else { @@ -500,7 +509,7 @@ RegisterContextLLDB::InitializeNonZerothFrame() if (decr_pc_and_recompute_addr_range) { UnwindLogMsg ("Backing up the pc value of 0x%" PRIx64 " by 1 and re-doing symbol lookup; old symbol was %s", - pc, m_sym_ctx.symbol == NULL ? "" : m_sym_ctx.symbol->GetName().AsCString()); + pc, GetSymbolOrFunctionName(m_sym_ctx).AsCString("")); Address temporary_pc; temporary_pc.SetLoadAddress (pc - 1, &process->GetTarget()); m_sym_ctx.Clear (false); @@ -514,7 +523,7 @@ RegisterContextLLDB::InitializeNonZerothFrame() if (m_sym_ctx.GetAddressRange (resolve_scope, 0, false, addr_range)) m_sym_ctx_valid = true; } - UnwindLogMsg ("Symbol is now %s", m_sym_ctx.symbol == NULL ? "" : m_sym_ctx.symbol->GetName().AsCString()); + UnwindLogMsg ("Symbol is now %s", GetSymbolOrFunctionName(m_sym_ctx).AsCString("")); } // If we were able to find a symbol/function, set addr_range_ptr to the bounds of that symbol/function. |