summaryrefslogtreecommitdiffstats
path: root/lldb
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
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')
-rw-r--r--lldb/include/lldb/Symbol/Block.h5
-rw-r--r--lldb/include/lldb/Symbol/Declaration.h2
-rw-r--r--lldb/include/lldb/Symbol/LineEntry.h2
-rw-r--r--lldb/include/lldb/Symbol/SymbolContext.h1
-rw-r--r--lldb/include/lldb/Target/StackFrame.h2
-rw-r--r--lldb/include/lldb/Target/StackID.h25
-rw-r--r--lldb/source/API/SBThread.cpp2
-rw-r--r--lldb/source/Breakpoint/BreakpointLocation.cpp4
-rw-r--r--lldb/source/Commands/CommandObjectFrame.cpp2
-rw-r--r--lldb/source/Commands/CommandObjectImage.cpp2
-rw-r--r--lldb/source/Commands/CommandObjectThread.cpp2
-rw-r--r--lldb/source/Core/Address.cpp6
-rw-r--r--lldb/source/Core/Disassembler.cpp2
-rw-r--r--lldb/source/Symbol/Block.cpp26
-rw-r--r--lldb/source/Symbol/Declaration.cpp4
-rw-r--r--lldb/source/Symbol/LineEntry.cpp8
-rw-r--r--lldb/source/Symbol/SymbolContext.cpp14
-rw-r--r--lldb/source/Target/StackFrame.cpp53
-rw-r--r--lldb/source/Target/StackFrameList.cpp2
-rw-r--r--lldb/source/Target/StackID.cpp59
-rw-r--r--lldb/source/Target/Thread.cpp4
21 files changed, 132 insertions, 95 deletions
diff --git a/lldb/include/lldb/Symbol/Block.h b/lldb/include/lldb/Symbol/Block.h
index 3ac934968cb..f7a474b7322 100644
--- a/lldb/include/lldb/Symbol/Block.h
+++ b/lldb/include/lldb/Symbol/Block.h
@@ -133,6 +133,9 @@ public:
bool
Contains (const VMRange& range) const;
+ bool
+ Contains (const Block *block) const;
+
//------------------------------------------------------------------
/// Dump the block contents.
///
@@ -156,7 +159,7 @@ public:
Dump (Stream *s, lldb::addr_t base_addr, int32_t depth, bool show_context) const;
void
- DumpStopContext (Stream *s, const SymbolContext *sc);
+ DumpStopContext (Stream *s, const SymbolContext *sc, bool show_fullpaths);
//------------------------------------------------------------------
/// @copydoc SymbolContextScope::DumpSymbolContext(Stream*)
diff --git a/lldb/include/lldb/Symbol/Declaration.h b/lldb/include/lldb/Symbol/Declaration.h
index ba0c68d43e6..2cc61b0e077 100644
--- a/lldb/include/lldb/Symbol/Declaration.h
+++ b/lldb/include/lldb/Symbol/Declaration.h
@@ -103,7 +103,7 @@ public:
Dump (Stream *s) const;
void
- DumpStopContext (Stream *s) const;
+ DumpStopContext (Stream *s, bool show_fullpaths) const;
//------------------------------------------------------------------
/// Get accessor for the declaration column number.
///
diff --git a/lldb/include/lldb/Symbol/LineEntry.h b/lldb/include/lldb/Symbol/LineEntry.h
index f9e685ec056..709613f343c 100644
--- a/lldb/include/lldb/Symbol/LineEntry.h
+++ b/lldb/include/lldb/Symbol/LineEntry.h
@@ -110,7 +110,7 @@ struct LineEntry
/// \b false otherwise.
//------------------------------------------------------------------
bool
- DumpStopContext (Stream *s) const;
+ DumpStopContext (Stream *s, bool show_fullpaths) const;
//------------------------------------------------------------------
/// Check if a line entry object is valid.
diff --git a/lldb/include/lldb/Symbol/SymbolContext.h b/lldb/include/lldb/Symbol/SymbolContext.h
index 246a3fc5a6e..f9a0542f5e8 100644
--- a/lldb/include/lldb/Symbol/SymbolContext.h
+++ b/lldb/include/lldb/Symbol/SymbolContext.h
@@ -163,6 +163,7 @@ public:
DumpStopContext (Stream *s,
ExecutionContextScope *exe_scope,
const Address &so_addr,
+ bool show_fullpaths,
bool show_module,
bool show_inlined_frames) const;
diff --git a/lldb/include/lldb/Target/StackFrame.h b/lldb/include/lldb/Target/StackFrame.h
index c8b482aeea3..9389032c0c4 100644
--- a/lldb/include/lldb/Target/StackFrame.h
+++ b/lldb/include/lldb/Target/StackFrame.h
@@ -100,7 +100,7 @@ public:
Disassemble ();
void
- Dump (Stream *strm, bool show_frame_index);
+ Dump (Stream *strm, bool show_frame_index, bool show_fullpaths);
bool
IsInlined ();
diff --git a/lldb/include/lldb/Target/StackID.h b/lldb/include/lldb/Target/StackID.h
index 00f0a4f63fa..9f4ef16c25a 100644
--- a/lldb/include/lldb/Target/StackID.h
+++ b/lldb/include/lldb/Target/StackID.h
@@ -26,22 +26,22 @@ public:
// Constructors and Destructors
//------------------------------------------------------------------
StackID () :
- m_start_pc (LLDB_INVALID_ADDRESS),
+ m_pc (LLDB_INVALID_ADDRESS),
m_cfa (LLDB_INVALID_ADDRESS),
m_symbol_scope (NULL)
{
}
explicit
- StackID (lldb::addr_t start_pc, lldb::addr_t cfa, SymbolContextScope *symbol_scope) :
- m_start_pc (start_pc),
+ StackID (lldb::addr_t pc, lldb::addr_t cfa, SymbolContextScope *symbol_scope) :
+ m_pc (pc),
m_cfa (cfa),
m_symbol_scope (symbol_scope)
{
}
StackID (const StackID& rhs) :
- m_start_pc (rhs.m_start_pc),
+ m_pc (rhs.m_pc),
m_cfa (rhs.m_cfa),
m_symbol_scope (rhs.m_symbol_scope)
{
@@ -52,15 +52,9 @@ public:
}
const lldb::addr_t
- GetStartAddress() const
+ GetPC() const
{
- return m_start_pc;
- }
-
- void
- SetStartAddress(lldb::addr_t start_pc)
- {
- m_start_pc = start_pc;
+ return m_pc;
}
lldb::addr_t
@@ -92,7 +86,7 @@ public:
{
if (this != &rhs)
{
- m_start_pc = rhs.m_start_pc;
+ m_pc = rhs.m_pc;
m_cfa = rhs.m_cfa;
m_symbol_scope = rhs.m_symbol_scope;
}
@@ -103,7 +97,10 @@ protected:
//------------------------------------------------------------------
// Classes that inherit from StackID can see and modify these
//------------------------------------------------------------------
- lldb::addr_t m_start_pc; // The start address for the function/symbol for this frame
+ lldb::addr_t m_pc; // The pc value for the function/symbol for this frame. This will
+ // only get used if the symbol scope is NULL (the code where we are
+ // stopped is not represented by any function or symbol in any
+ // shared library).
lldb::addr_t m_cfa; // The call frame address (stack pointer) value
// at the beginning of the function that uniquely
// identifies this frame (along with m_symbol_scope below)
diff --git a/lldb/source/API/SBThread.cpp b/lldb/source/API/SBThread.cpp
index 49a215096fa..705f08ce6e4 100644
--- a/lldb/source/API/SBThread.cpp
+++ b/lldb/source/API/SBThread.cpp
@@ -288,7 +288,7 @@ SBThread::DisplaySingleFrameForSelectedContext (FILE *out,
frame_idx,
GetThreadID(),
(long long)pc);
- sc->DumpStopContext (&str, &m_opaque_sp->GetProcess(), *frame.GetPCAddress(), true, false);
+ sc->DumpStopContext (&str, &m_opaque_sp->GetProcess(), *frame.GetPCAddress(), false, true, false);
fprintf (out, "\n");
success = true;
}
diff --git a/lldb/source/Breakpoint/BreakpointLocation.cpp b/lldb/source/Breakpoint/BreakpointLocation.cpp
index f2e338c4587..7297f1e0891 100644
--- a/lldb/source/Breakpoint/BreakpointLocation.cpp
+++ b/lldb/source/Breakpoint/BreakpointLocation.cpp
@@ -285,7 +285,7 @@ BreakpointLocation::GetDescription (Stream *s, lldb::DescriptionLevel level)
if (level == lldb::eDescriptionLevelFull)
{
s->PutCString("where = ");
- sc.DumpStopContext (s, m_owner.GetTarget().GetProcessSP().get(), m_address, true, false);
+ sc.DumpStopContext (s, m_owner.GetTarget().GetProcessSP().get(), m_address, true, true, false);
}
else
{
@@ -313,7 +313,7 @@ BreakpointLocation::GetDescription (Stream *s, lldb::DescriptionLevel level)
{
s->EOL();
s->Indent("location = ");
- sc.line_entry.DumpStopContext (s);
+ sc.line_entry.DumpStopContext (s, true);
}
}
diff --git a/lldb/source/Commands/CommandObjectFrame.cpp b/lldb/source/Commands/CommandObjectFrame.cpp
index 30287e21210..ed36bf7022f 100644
--- a/lldb/source/Commands/CommandObjectFrame.cpp
+++ b/lldb/source/Commands/CommandObjectFrame.cpp
@@ -71,7 +71,7 @@ public:
ExecutionContext exe_ctx(interpreter.GetDebugger().GetExecutionContext());
if (exe_ctx.frame)
{
- exe_ctx.frame->Dump (&result.GetOutputStream(), true);
+ exe_ctx.frame->Dump (&result.GetOutputStream(), true, false);
result.GetOutputStream().EOL();
result.SetStatus (eReturnStatusSuccessFinishResult);
}
diff --git a/lldb/source/Commands/CommandObjectImage.cpp b/lldb/source/Commands/CommandObjectImage.cpp
index d28cbf9dd69..1b3c2262d10 100644
--- a/lldb/source/Commands/CommandObjectImage.cpp
+++ b/lldb/source/Commands/CommandObjectImage.cpp
@@ -341,7 +341,7 @@ DumpSymbolContextList (CommandInterpreter &interpreter, Stream &strm, SymbolCont
strm.PutCString(" in ");
}
}
- sc.DumpStopContext(&strm, interpreter.GetDebugger().GetExecutionContext().process, sc.line_entry.range.GetBaseAddress(), true, false);
+ sc.DumpStopContext(&strm, interpreter.GetDebugger().GetExecutionContext().process, sc.line_entry.range.GetBaseAddress(), true, true, false);
}
}
strm.IndentLess ();
diff --git a/lldb/source/Commands/CommandObjectThread.cpp b/lldb/source/Commands/CommandObjectThread.cpp
index 8d1737b6af7..f4cc35d1f48 100644
--- a/lldb/source/Commands/CommandObjectThread.cpp
+++ b/lldb/source/Commands/CommandObjectThread.cpp
@@ -224,7 +224,7 @@ lldb_private::DisplayFrameForExecutionContext
if (show_frame_info)
{
strm.Indent();
- frame->Dump (&strm, true);
+ frame->Dump (&strm, true, false);
strm.EOL();
}
diff --git a/lldb/source/Core/Address.cpp b/lldb/source/Core/Address.cpp
index 070e11d72ce..68b4b48bce2 100644
--- a/lldb/source/Core/Address.cpp
+++ b/lldb/source/Core/Address.cpp
@@ -503,7 +503,7 @@ Address::Dump (Stream *s, ExecutionContextScope *exe_scope, DumpStyle style, Dum
#endif
Address cstr_addr(*this);
cstr_addr.SetOffset(cstr_addr.GetOffset() + pointer_size);
- func_sc.DumpStopContext(s, exe_scope, so_addr, true, false);
+ func_sc.DumpStopContext(s, exe_scope, so_addr, true, true, false);
if (ReadAddress (exe_scope, cstr_addr, pointer_size, so_addr))
{
#if VERBOSE_OUTPUT
@@ -586,7 +586,7 @@ Address::Dump (Stream *s, ExecutionContextScope *exe_scope, DumpStyle style, Dum
if (pointer_sc.function || pointer_sc.symbol)
{
s->PutCString(": ");
- pointer_sc.DumpStopContext(s, exe_scope, so_addr, false, false);
+ pointer_sc.DumpStopContext(s, exe_scope, so_addr, true, false, false);
}
}
}
@@ -625,7 +625,7 @@ Address::Dump (Stream *s, ExecutionContextScope *exe_scope, DumpStyle style, Dum
{
// We have a function or a symbol from the same
// sections as this address.
- sc.DumpStopContext(s, exe_scope, *this, show_module, false);
+ sc.DumpStopContext(s, exe_scope, *this, true, show_module, false);
}
else
{
diff --git a/lldb/source/Core/Disassembler.cpp b/lldb/source/Core/Disassembler.cpp
index 22f6c06510d..73a35196667 100644
--- a/lldb/source/Core/Disassembler.cpp
+++ b/lldb/source/Core/Disassembler.cpp
@@ -238,7 +238,7 @@ Disassembler::Disassemble
if (offset != 0)
strm.EOL();
- sc.DumpStopContext(&strm, process, addr, true, false);
+ sc.DumpStopContext(&strm, process, addr, true, true, false);
if (sc.comp_unit && sc.line_entry.IsValid())
{
diff --git a/lldb/source/Symbol/Block.cpp b/lldb/source/Symbol/Block.cpp
index c0b9ac667e0..67b44901744 100644
--- a/lldb/source/Symbol/Block.cpp
+++ b/lldb/source/Symbol/Block.cpp
@@ -145,7 +145,7 @@ Block::CalculateSymbolContext (SymbolContext* sc)
}
void
-Block::DumpStopContext (Stream *s, const SymbolContext *sc)
+Block::DumpStopContext (Stream *s, const SymbolContext *sc, bool show_fullpaths)
{
Block* parent_block = GetParent();
@@ -170,7 +170,7 @@ Block::DumpStopContext (Stream *s, const SymbolContext *sc)
if (call_site.IsValid())
{
s->PutCString(" at ");
- call_site.DumpStopContext (s);
+ call_site.DumpStopContext (s, show_fullpaths);
}
}
}
@@ -182,11 +182,11 @@ Block::DumpStopContext (Stream *s, const SymbolContext *sc)
if (sc->line_entry.IsValid())
{
s->PutCString(" at ");
- sc->line_entry.DumpStopContext (s);
+ sc->line_entry.DumpStopContext (s, show_fullpaths);
}
}
if (parent_block)
- parent_block->Block::DumpStopContext (s, NULL);
+ parent_block->Block::DumpStopContext (s, NULL, show_fullpaths);
}
@@ -207,6 +207,24 @@ Block::Contains (addr_t range_offset) const
}
bool
+Block::Contains (const Block *block) const
+{
+ // Block objects can't contain themselves...
+ if (this == block)
+ return false;
+
+ const Block *block_parent;
+ for (block_parent = block->GetParent();
+ block_parent != NULL;
+ block_parent = block_parent->GetParent())
+ {
+ if (block_parent == block)
+ return true;
+ }
+ return false;
+}
+
+bool
Block::Contains (const VMRange& range) const
{
return VMRange::ContainsRange(m_ranges, range);
diff --git a/lldb/source/Symbol/Declaration.cpp b/lldb/source/Symbol/Declaration.cpp
index d53d90051c5..2f312d461c4 100644
--- a/lldb/source/Symbol/Declaration.cpp
+++ b/lldb/source/Symbol/Declaration.cpp
@@ -81,11 +81,11 @@ Declaration::Dump(Stream *s) const
}
void
-Declaration::DumpStopContext (Stream *s) const
+Declaration::DumpStopContext (Stream *s, bool show_fullpaths) const
{
if (m_file)
{
- if (s->GetVerbose())
+ if (show_fullpaths || s->GetVerbose())
*s << m_file;
else
m_file.GetFilename().Dump(s);
diff --git a/lldb/source/Symbol/LineEntry.cpp b/lldb/source/Symbol/LineEntry.cpp
index 83c50f231fa..5d9b27ecf9a 100644
--- a/lldb/source/Symbol/LineEntry.cpp
+++ b/lldb/source/Symbol/LineEntry.cpp
@@ -74,12 +74,16 @@ LineEntry::IsValid() const
}
bool
-LineEntry::DumpStopContext(Stream *s) const
+LineEntry::DumpStopContext(Stream *s, bool show_fullpaths) const
{
bool result = false;
if (file)
{
- file.Dump (s);
+ if (show_fullpaths)
+ file.Dump (s);
+ else
+ file.GetFilename().Dump (s);
+
if (line)
s->PutChar(':');
result = true;
diff --git a/lldb/source/Symbol/SymbolContext.cpp b/lldb/source/Symbol/SymbolContext.cpp
index ce65b91ad4f..f54d85681e3 100644
--- a/lldb/source/Symbol/SymbolContext.cpp
+++ b/lldb/source/Symbol/SymbolContext.cpp
@@ -114,13 +114,18 @@ SymbolContext::DumpStopContext
Stream *s,
ExecutionContextScope *exe_scope,
const Address &addr,
+ bool show_fullpaths,
bool show_module,
bool show_inlined_frames
) const
{
if (show_module && module_sp)
{
- *s << module_sp->GetFileSpec().GetFilename() << '`';
+ if (show_fullpaths)
+ *s << module_sp->GetFileSpec();
+ else
+ *s << module_sp->GetFileSpec().GetFilename();
+ s->PutChar('`');
}
if (function != NULL)
@@ -128,7 +133,6 @@ SymbolContext::DumpStopContext
if (function->GetMangled().GetName())
function->GetMangled().GetName().Dump(s);
-
if (show_inlined_frames && block)
{
const InlineFunctionInfo *inline_info = block->InlinedFunctionInfo();
@@ -147,7 +151,7 @@ SymbolContext::DumpStopContext
if (line_entry.IsValid())
{
s->PutCString(" at ");
- line_entry.DumpStopContext(s);
+ line_entry.DumpStopContext(s, show_fullpaths);
}
return;
}
@@ -159,7 +163,7 @@ SymbolContext::DumpStopContext
if (block != NULL)
{
s->IndentMore();
- block->DumpStopContext(s, this);
+ block->DumpStopContext(s, this, show_fullpaths);
s->IndentLess();
}
else
@@ -167,7 +171,7 @@ SymbolContext::DumpStopContext
if (line_entry.IsValid())
{
s->PutCString(" at ");
- if (line_entry.DumpStopContext(s))
+ if (line_entry.DumpStopContext(s, show_fullpaths))
return;
}
}
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
diff --git a/lldb/source/Target/StackFrameList.cpp b/lldb/source/Target/StackFrameList.cpp
index 75351ff4a2e..0b8b8bf3775 100644
--- a/lldb/source/Target/StackFrameList.cpp
+++ b/lldb/source/Target/StackFrameList.cpp
@@ -256,7 +256,7 @@ StackFrameList::Dump (Stream *s)
if (frame)
{
frame->GetStackID().Dump (s);
- frame->Dump(s, true);
+ frame->Dump(s, true, false);
}
else
s->Printf("frame #%u", std::distance (begin, pos));
diff --git a/lldb/source/Target/StackID.cpp b/lldb/source/Target/StackID.cpp
index 215e85e8fea..a1e45b147e5 100644
--- a/lldb/source/Target/StackID.cpp
+++ b/lldb/source/Target/StackID.cpp
@@ -24,7 +24,7 @@ using namespace lldb_private;
void
StackID::Dump (Stream *s)
{
- s->Printf("StackID (start_pc = 0x%16.16llx, cfa = 0x%16.16llx, symbol_scope = %p", (uint64_t)m_start_pc, (uint64_t)m_cfa, m_symbol_scope);
+ s->Printf("StackID (pc = 0x%16.16llx, cfa = 0x%16.16llx, symbol_scope = %p", (uint64_t)m_pc, (uint64_t)m_cfa, m_symbol_scope);
if (m_symbol_scope)
{
SymbolContext sc;
@@ -41,21 +41,64 @@ StackID::Dump (Stream *s)
bool
lldb_private::operator== (const StackID& lhs, const StackID& rhs)
{
- return lhs.GetCallFrameAddress() == rhs.GetCallFrameAddress() &&
- lhs.GetSymbolContextScope() == rhs.GetSymbolContextScope() &&
- lhs.GetStartAddress() == rhs.GetStartAddress();
+ if (lhs.GetCallFrameAddress() != rhs.GetCallFrameAddress())
+ return false;
+
+ SymbolContextScope *lhs_scope = lhs.GetSymbolContextScope();
+ SymbolContextScope *rhs_scope = rhs.GetSymbolContextScope();
+
+ // Only compare the PC values if both symbol context scopes are NULL
+ if (lhs_scope == NULL && rhs_scope == NULL)
+ return lhs.GetPC() == rhs.GetPC();
+
+ return lhs_scope == rhs_scope;
}
bool
lldb_private::operator!= (const StackID& lhs, const StackID& rhs)
{
- return lhs.GetCallFrameAddress() != rhs.GetCallFrameAddress() ||
- lhs.GetSymbolContextScope() != rhs.GetSymbolContextScope() ||
- lhs.GetStartAddress() != rhs.GetStartAddress();
+ if (lhs.GetCallFrameAddress() != rhs.GetCallFrameAddress())
+ return true;
+
+ SymbolContextScope *lhs_scope = lhs.GetSymbolContextScope();
+ SymbolContextScope *rhs_scope = rhs.GetSymbolContextScope();
+
+ if (lhs_scope == NULL && rhs_scope == NULL)
+ return lhs.GetPC() != rhs.GetPC();
+
+ return lhs_scope != rhs_scope;
}
bool
lldb_private::operator< (const StackID& lhs, const StackID& rhs)
{
- return lhs.GetCallFrameAddress() < rhs.GetCallFrameAddress();
+ const lldb::addr_t lhs_cfa = lhs.GetCallFrameAddress();
+ const lldb::addr_t rhs_cfa = rhs.GetCallFrameAddress();
+
+ if (lhs_cfa != rhs_cfa)
+ return lhs_cfa < rhs_cfa;
+
+ SymbolContextScope *lhs_scope = lhs.GetSymbolContextScope();
+ SymbolContextScope *rhs_scope = rhs.GetSymbolContextScope();
+
+ if (lhs_scope != NULL && rhs_scope != NULL)
+ {
+ // Same exact scope, lhs is not less than (younger than rhs)
+ if (lhs_scope == rhs_scope)
+ return false;
+
+ SymbolContext lhs_sc;
+ SymbolContext rhs_sc;
+ lhs_scope->CalculateSymbolContext (&lhs_sc);
+ rhs_scope->CalculateSymbolContext (&rhs_sc);
+
+ // Items with the same function can only be compared
+ if (lhs_sc.function == rhs_sc.function &&
+ lhs_sc.function != NULL && lhs_sc.block != NULL &&
+ rhs_sc.function != NULL && rhs_sc.block != NULL)
+ {
+ return rhs_sc.block->Contains (lhs_sc.block);
+ }
+ }
+ return false;
}
diff --git a/lldb/source/Target/Thread.cpp b/lldb/source/Target/Thread.cpp
index 5a1e1ddde88..1c8265add06 100644
--- a/lldb/source/Target/Thread.cpp
+++ b/lldb/source/Target/Thread.cpp
@@ -820,7 +820,7 @@ Thread::ClearStackFrames ()
lldb::StackFrameSP
Thread::GetStackFrameAtIndex (uint32_t idx)
{
- return StackFrameSP (GetStackFrameList().GetFrameAtIndex(idx));
+ return GetStackFrameList().GetFrameAtIndex(idx);
}
lldb::StackFrameSP
@@ -859,7 +859,7 @@ Thread::DumpInfo
if (frame_sp)
{
strm.PutCString(", ");
- frame_sp->Dump (&strm, false);
+ frame_sp->Dump (&strm, false, false);
}
}
OpenPOWER on IntegriCloud