summaryrefslogtreecommitdiffstats
path: root/lldb/source/Target/StackFrame.cpp
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2010-09-02 21:44:10 +0000
committerGreg Clayton <gclayton@apple.com>2010-09-02 21:44:10 +0000
commit6dadd508e7906cf994ee96806f4ec3f80a9c8a41 (patch)
tree4df4e34c3d6590a936f140d03be3039980d30c38 /lldb/source/Target/StackFrame.cpp
parentfd81cea70cd6c893bb590c9b288875d1d29b8401 (diff)
downloadbcm5719-llvm-6dadd508e7906cf994ee96806f4ec3f80a9c8a41.tar.gz
bcm5719-llvm-6dadd508e7906cf994ee96806f4ec3f80a9c8a41.zip
Added a new bool parameter to many of the DumpStopContext() methods that
might dump file paths that allows the dumping of full paths or just the basenames. Switched the stack frame dumping code to use just the basenames for the files instead of the full path. Modified the StackID class to no rely on needing the start PC for the current function/symbol since we can use the SymbolContextScope to uniquely identify that, unless there is no symbol context scope. In that case we can rely upon the current PC value. This saves the StackID from having to calculate the start PC when the StackFrame::GetStackID() accessor is called. Also improved the StackID less than operator to correctly handle inlined stack frames in the same stack. llvm-svn: 112867
Diffstat (limited to 'lldb/source/Target/StackFrame.cpp')
-rw-r--r--lldb/source/Target/StackFrame.cpp53
1 files changed, 10 insertions, 43 deletions
diff --git a/lldb/source/Target/StackFrame.cpp b/lldb/source/Target/StackFrame.cpp
index f812285e775..b310f25e995 100644
--- a/lldb/source/Target/StackFrame.cpp
+++ b/lldb/source/Target/StackFrame.cpp
@@ -32,8 +32,7 @@ using namespace lldb_private;
// so we know if we have tried to look up information in our internal symbol
// context (m_sc) already.
#define RESOLVED_FRAME_CODE_ADDR (uint32_t(eSymbolContextEverything + 1))
-#define RESOLVED_FRAME_ID_START_ADDR (RESOLVED_FRAME_CODE_ADDR << 1)
-#define RESOLVED_FRAME_ID_SYMBOL_SCOPE (RESOLVED_FRAME_ID_START_ADDR << 1)
+#define RESOLVED_FRAME_ID_SYMBOL_SCOPE (RESOLVED_FRAME_CODE_ADDR << 1)
#define GOT_FRAME_BASE (RESOLVED_FRAME_ID_SYMBOL_SCOPE << 1)
#define RESOLVED_VARIABLES (GOT_FRAME_BASE << 1)
@@ -50,7 +49,7 @@ StackFrame::StackFrame
m_unwind_frame_index (unwind_frame_index),
m_thread (thread),
m_reg_context_sp (),
- m_id (LLDB_INVALID_ADDRESS, cfa, NULL),
+ m_id (pc, cfa, NULL),
m_frame_code_addr (NULL, pc),
m_sc (),
m_flags (),
@@ -80,7 +79,7 @@ StackFrame::StackFrame
m_unwind_frame_index (unwind_frame_index),
m_thread (thread),
m_reg_context_sp (reg_context_sp),
- m_id (LLDB_INVALID_ADDRESS, cfa, NULL),
+ m_id (pc, cfa, NULL),
m_frame_code_addr (NULL, pc),
m_sc (),
m_flags (),
@@ -116,7 +115,7 @@ StackFrame::StackFrame
m_unwind_frame_index (unwind_frame_index),
m_thread (thread),
m_reg_context_sp (reg_context_sp),
- m_id (LLDB_INVALID_ADDRESS, cfa, NULL),
+ m_id (pc_addr.GetLoadAddress (&thread.GetProcess()), cfa, NULL),
m_frame_code_addr (pc_addr),
m_sc (),
m_flags (),
@@ -159,42 +158,12 @@ StackFrame::~StackFrame()
StackID&
StackFrame::GetStackID()
{
- // Make sure we have resolved our stack ID's start PC before we give
- // it out to any external clients. This allows us to not have to lookup
- // this information if it is never asked for.
- if (m_flags.IsClear(RESOLVED_FRAME_ID_START_ADDR))
- {
- m_flags.Set (RESOLVED_FRAME_ID_START_ADDR);
-
- if (m_id.GetStartAddress() == LLDB_INVALID_ADDRESS)
- {
- // Resolve our PC to section offset if we haven't alreday done so
- // and if we don't have a module. The resolved address section will
- // contain the module to which it belongs.
- if (!m_sc.module_sp && m_flags.IsClear(RESOLVED_FRAME_CODE_ADDR))
- GetFrameCodeAddress();
+ // Make sure we have resolved the StackID object's symbol context scope if
+ // we already haven't looked it up.
- if (GetSymbolContext (eSymbolContextFunction).function)
- {
- m_id.SetStartAddress (m_sc.function->GetAddressRange().GetBaseAddress().GetLoadAddress (&m_thread.GetProcess()));
- }
- else if (GetSymbolContext (eSymbolContextSymbol).symbol)
- {
- AddressRange *symbol_range_ptr = m_sc.symbol->GetAddressRangePtr();
- if (symbol_range_ptr)
- m_id.SetStartAddress(symbol_range_ptr->GetBaseAddress().GetLoadAddress (&m_thread.GetProcess()));
- }
-
- // We didn't find a function or symbol, just use the frame code address
- // which will be the same as the PC in the frame.
- if (m_id.GetStartAddress() == LLDB_INVALID_ADDRESS)
- m_id.SetStartAddress (m_frame_code_addr.GetLoadAddress (&m_thread.GetProcess()));
- }
- }
-
if (m_flags.IsClear (RESOLVED_FRAME_ID_SYMBOL_SCOPE))
{
- if (m_id.GetSymbolContextScope ())
+ if (m_id.GetSymbolContextScope () == NULL)
{
m_flags.Set (RESOLVED_FRAME_ID_SYMBOL_SCOPE);
}
@@ -627,20 +596,18 @@ StackFrame::Calculate (ExecutionContext &exe_ctx)
}
void
-StackFrame::Dump (Stream *strm, bool show_frame_index)
+StackFrame::Dump (Stream *strm, bool show_frame_index, bool show_fullpaths)
{
if (strm == NULL)
return;
if (show_frame_index)
strm->Printf("frame #%u: ", m_frame_index);
- strm->Printf("0x%0*llx", m_thread.GetProcess().GetAddressByteSize() * 2, GetFrameCodeAddress().GetLoadAddress(&m_thread.GetProcess()));
+ strm->Printf("0x%0*llx ", m_thread.GetProcess().GetAddressByteSize() * 2, GetFrameCodeAddress().GetLoadAddress(&m_thread.GetProcess()));
GetSymbolContext(eSymbolContextEverything);
- strm->PutCString(", where = ");
- // TODO: need to get the
const bool show_module = true;
const bool show_inline = true;
- m_sc.DumpStopContext(strm, &m_thread.GetProcess(), GetFrameCodeAddress(), show_module, show_inline);
+ m_sc.DumpStopContext(strm, &m_thread.GetProcess(), GetFrameCodeAddress(), show_fullpaths, show_module, show_inline);
}
void
OpenPOWER on IntegriCloud