forked from OSchip/llvm-project
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
This commit is contained in:
parent
fd81cea70c
commit
6dadd508e7
|
@ -133,6 +133,9 @@ public:
|
||||||
bool
|
bool
|
||||||
Contains (const VMRange& range) const;
|
Contains (const VMRange& range) const;
|
||||||
|
|
||||||
|
bool
|
||||||
|
Contains (const Block *block) const;
|
||||||
|
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
/// Dump the block contents.
|
/// Dump the block contents.
|
||||||
///
|
///
|
||||||
|
@ -156,7 +159,7 @@ public:
|
||||||
Dump (Stream *s, lldb::addr_t base_addr, int32_t depth, bool show_context) const;
|
Dump (Stream *s, lldb::addr_t base_addr, int32_t depth, bool show_context) const;
|
||||||
|
|
||||||
void
|
void
|
||||||
DumpStopContext (Stream *s, const SymbolContext *sc);
|
DumpStopContext (Stream *s, const SymbolContext *sc, bool show_fullpaths);
|
||||||
|
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
/// @copydoc SymbolContextScope::DumpSymbolContext(Stream*)
|
/// @copydoc SymbolContextScope::DumpSymbolContext(Stream*)
|
||||||
|
|
|
@ -103,7 +103,7 @@ public:
|
||||||
Dump (Stream *s) const;
|
Dump (Stream *s) const;
|
||||||
|
|
||||||
void
|
void
|
||||||
DumpStopContext (Stream *s) const;
|
DumpStopContext (Stream *s, bool show_fullpaths) const;
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
/// Get accessor for the declaration column number.
|
/// Get accessor for the declaration column number.
|
||||||
///
|
///
|
||||||
|
|
|
@ -110,7 +110,7 @@ struct LineEntry
|
||||||
/// \b false otherwise.
|
/// \b false otherwise.
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
bool
|
bool
|
||||||
DumpStopContext (Stream *s) const;
|
DumpStopContext (Stream *s, bool show_fullpaths) const;
|
||||||
|
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
/// Check if a line entry object is valid.
|
/// Check if a line entry object is valid.
|
||||||
|
|
|
@ -163,6 +163,7 @@ public:
|
||||||
DumpStopContext (Stream *s,
|
DumpStopContext (Stream *s,
|
||||||
ExecutionContextScope *exe_scope,
|
ExecutionContextScope *exe_scope,
|
||||||
const Address &so_addr,
|
const Address &so_addr,
|
||||||
|
bool show_fullpaths,
|
||||||
bool show_module,
|
bool show_module,
|
||||||
bool show_inlined_frames) const;
|
bool show_inlined_frames) const;
|
||||||
|
|
||||||
|
|
|
@ -100,7 +100,7 @@ public:
|
||||||
Disassemble ();
|
Disassemble ();
|
||||||
|
|
||||||
void
|
void
|
||||||
Dump (Stream *strm, bool show_frame_index);
|
Dump (Stream *strm, bool show_frame_index, bool show_fullpaths);
|
||||||
|
|
||||||
bool
|
bool
|
||||||
IsInlined ();
|
IsInlined ();
|
||||||
|
|
|
@ -26,22 +26,22 @@ public:
|
||||||
// Constructors and Destructors
|
// Constructors and Destructors
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
StackID () :
|
StackID () :
|
||||||
m_start_pc (LLDB_INVALID_ADDRESS),
|
m_pc (LLDB_INVALID_ADDRESS),
|
||||||
m_cfa (LLDB_INVALID_ADDRESS),
|
m_cfa (LLDB_INVALID_ADDRESS),
|
||||||
m_symbol_scope (NULL)
|
m_symbol_scope (NULL)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
explicit
|
explicit
|
||||||
StackID (lldb::addr_t start_pc, lldb::addr_t cfa, SymbolContextScope *symbol_scope) :
|
StackID (lldb::addr_t pc, lldb::addr_t cfa, SymbolContextScope *symbol_scope) :
|
||||||
m_start_pc (start_pc),
|
m_pc (pc),
|
||||||
m_cfa (cfa),
|
m_cfa (cfa),
|
||||||
m_symbol_scope (symbol_scope)
|
m_symbol_scope (symbol_scope)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
StackID (const StackID& rhs) :
|
StackID (const StackID& rhs) :
|
||||||
m_start_pc (rhs.m_start_pc),
|
m_pc (rhs.m_pc),
|
||||||
m_cfa (rhs.m_cfa),
|
m_cfa (rhs.m_cfa),
|
||||||
m_symbol_scope (rhs.m_symbol_scope)
|
m_symbol_scope (rhs.m_symbol_scope)
|
||||||
{
|
{
|
||||||
|
@ -52,15 +52,9 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
const lldb::addr_t
|
const lldb::addr_t
|
||||||
GetStartAddress() const
|
GetPC() const
|
||||||
{
|
{
|
||||||
return m_start_pc;
|
return m_pc;
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
SetStartAddress(lldb::addr_t start_pc)
|
|
||||||
{
|
|
||||||
m_start_pc = start_pc;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
lldb::addr_t
|
lldb::addr_t
|
||||||
|
@ -92,7 +86,7 @@ public:
|
||||||
{
|
{
|
||||||
if (this != &rhs)
|
if (this != &rhs)
|
||||||
{
|
{
|
||||||
m_start_pc = rhs.m_start_pc;
|
m_pc = rhs.m_pc;
|
||||||
m_cfa = rhs.m_cfa;
|
m_cfa = rhs.m_cfa;
|
||||||
m_symbol_scope = rhs.m_symbol_scope;
|
m_symbol_scope = rhs.m_symbol_scope;
|
||||||
}
|
}
|
||||||
|
@ -103,7 +97,10 @@ protected:
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
// Classes that inherit from StackID can see and modify these
|
// 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
|
lldb::addr_t m_cfa; // The call frame address (stack pointer) value
|
||||||
// at the beginning of the function that uniquely
|
// at the beginning of the function that uniquely
|
||||||
// identifies this frame (along with m_symbol_scope below)
|
// identifies this frame (along with m_symbol_scope below)
|
||||||
|
|
|
@ -288,7 +288,7 @@ SBThread::DisplaySingleFrameForSelectedContext (FILE *out,
|
||||||
frame_idx,
|
frame_idx,
|
||||||
GetThreadID(),
|
GetThreadID(),
|
||||||
(long long)pc);
|
(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");
|
fprintf (out, "\n");
|
||||||
success = true;
|
success = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -285,7 +285,7 @@ BreakpointLocation::GetDescription (Stream *s, lldb::DescriptionLevel level)
|
||||||
if (level == lldb::eDescriptionLevelFull)
|
if (level == lldb::eDescriptionLevelFull)
|
||||||
{
|
{
|
||||||
s->PutCString("where = ");
|
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
|
else
|
||||||
{
|
{
|
||||||
|
@ -313,7 +313,7 @@ BreakpointLocation::GetDescription (Stream *s, lldb::DescriptionLevel level)
|
||||||
{
|
{
|
||||||
s->EOL();
|
s->EOL();
|
||||||
s->Indent("location = ");
|
s->Indent("location = ");
|
||||||
sc.line_entry.DumpStopContext (s);
|
sc.line_entry.DumpStopContext (s, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,7 +71,7 @@ public:
|
||||||
ExecutionContext exe_ctx(interpreter.GetDebugger().GetExecutionContext());
|
ExecutionContext exe_ctx(interpreter.GetDebugger().GetExecutionContext());
|
||||||
if (exe_ctx.frame)
|
if (exe_ctx.frame)
|
||||||
{
|
{
|
||||||
exe_ctx.frame->Dump (&result.GetOutputStream(), true);
|
exe_ctx.frame->Dump (&result.GetOutputStream(), true, false);
|
||||||
result.GetOutputStream().EOL();
|
result.GetOutputStream().EOL();
|
||||||
result.SetStatus (eReturnStatusSuccessFinishResult);
|
result.SetStatus (eReturnStatusSuccessFinishResult);
|
||||||
}
|
}
|
||||||
|
|
|
@ -341,7 +341,7 @@ DumpSymbolContextList (CommandInterpreter &interpreter, Stream &strm, SymbolCont
|
||||||
strm.PutCString(" in ");
|
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 ();
|
strm.IndentLess ();
|
||||||
|
|
|
@ -224,7 +224,7 @@ lldb_private::DisplayFrameForExecutionContext
|
||||||
if (show_frame_info)
|
if (show_frame_info)
|
||||||
{
|
{
|
||||||
strm.Indent();
|
strm.Indent();
|
||||||
frame->Dump (&strm, true);
|
frame->Dump (&strm, true, false);
|
||||||
strm.EOL();
|
strm.EOL();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -503,7 +503,7 @@ Address::Dump (Stream *s, ExecutionContextScope *exe_scope, DumpStyle style, Dum
|
||||||
#endif
|
#endif
|
||||||
Address cstr_addr(*this);
|
Address cstr_addr(*this);
|
||||||
cstr_addr.SetOffset(cstr_addr.GetOffset() + pointer_size);
|
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 (ReadAddress (exe_scope, cstr_addr, pointer_size, so_addr))
|
||||||
{
|
{
|
||||||
#if VERBOSE_OUTPUT
|
#if VERBOSE_OUTPUT
|
||||||
|
@ -586,7 +586,7 @@ Address::Dump (Stream *s, ExecutionContextScope *exe_scope, DumpStyle style, Dum
|
||||||
if (pointer_sc.function || pointer_sc.symbol)
|
if (pointer_sc.function || pointer_sc.symbol)
|
||||||
{
|
{
|
||||||
s->PutCString(": ");
|
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
|
// We have a function or a symbol from the same
|
||||||
// sections as this address.
|
// sections as this address.
|
||||||
sc.DumpStopContext(s, exe_scope, *this, show_module, false);
|
sc.DumpStopContext(s, exe_scope, *this, true, show_module, false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -238,7 +238,7 @@ Disassembler::Disassemble
|
||||||
if (offset != 0)
|
if (offset != 0)
|
||||||
strm.EOL();
|
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())
|
if (sc.comp_unit && sc.line_entry.IsValid())
|
||||||
{
|
{
|
||||||
|
|
|
@ -145,7 +145,7 @@ Block::CalculateSymbolContext (SymbolContext* sc)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Block::DumpStopContext (Stream *s, const SymbolContext *sc)
|
Block::DumpStopContext (Stream *s, const SymbolContext *sc, bool show_fullpaths)
|
||||||
{
|
{
|
||||||
Block* parent_block = GetParent();
|
Block* parent_block = GetParent();
|
||||||
|
|
||||||
|
@ -170,7 +170,7 @@ Block::DumpStopContext (Stream *s, const SymbolContext *sc)
|
||||||
if (call_site.IsValid())
|
if (call_site.IsValid())
|
||||||
{
|
{
|
||||||
s->PutCString(" at ");
|
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())
|
if (sc->line_entry.IsValid())
|
||||||
{
|
{
|
||||||
s->PutCString(" at ");
|
s->PutCString(" at ");
|
||||||
sc->line_entry.DumpStopContext (s);
|
sc->line_entry.DumpStopContext (s, show_fullpaths);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (parent_block)
|
if (parent_block)
|
||||||
parent_block->Block::DumpStopContext (s, NULL);
|
parent_block->Block::DumpStopContext (s, NULL, show_fullpaths);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -206,6 +206,24 @@ Block::Contains (addr_t range_offset) const
|
||||||
return VMRange::ContainsValue(m_ranges, range_offset);
|
return VMRange::ContainsValue(m_ranges, range_offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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
|
bool
|
||||||
Block::Contains (const VMRange& range) const
|
Block::Contains (const VMRange& range) const
|
||||||
{
|
{
|
||||||
|
|
|
@ -81,11 +81,11 @@ Declaration::Dump(Stream *s) const
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Declaration::DumpStopContext (Stream *s) const
|
Declaration::DumpStopContext (Stream *s, bool show_fullpaths) const
|
||||||
{
|
{
|
||||||
if (m_file)
|
if (m_file)
|
||||||
{
|
{
|
||||||
if (s->GetVerbose())
|
if (show_fullpaths || s->GetVerbose())
|
||||||
*s << m_file;
|
*s << m_file;
|
||||||
else
|
else
|
||||||
m_file.GetFilename().Dump(s);
|
m_file.GetFilename().Dump(s);
|
||||||
|
|
|
@ -74,12 +74,16 @@ LineEntry::IsValid() const
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
LineEntry::DumpStopContext(Stream *s) const
|
LineEntry::DumpStopContext(Stream *s, bool show_fullpaths) const
|
||||||
{
|
{
|
||||||
bool result = false;
|
bool result = false;
|
||||||
if (file)
|
if (file)
|
||||||
{
|
{
|
||||||
file.Dump (s);
|
if (show_fullpaths)
|
||||||
|
file.Dump (s);
|
||||||
|
else
|
||||||
|
file.GetFilename().Dump (s);
|
||||||
|
|
||||||
if (line)
|
if (line)
|
||||||
s->PutChar(':');
|
s->PutChar(':');
|
||||||
result = true;
|
result = true;
|
||||||
|
|
|
@ -114,13 +114,18 @@ SymbolContext::DumpStopContext
|
||||||
Stream *s,
|
Stream *s,
|
||||||
ExecutionContextScope *exe_scope,
|
ExecutionContextScope *exe_scope,
|
||||||
const Address &addr,
|
const Address &addr,
|
||||||
|
bool show_fullpaths,
|
||||||
bool show_module,
|
bool show_module,
|
||||||
bool show_inlined_frames
|
bool show_inlined_frames
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
if (show_module && module_sp)
|
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)
|
if (function != NULL)
|
||||||
|
@ -128,7 +133,6 @@ SymbolContext::DumpStopContext
|
||||||
if (function->GetMangled().GetName())
|
if (function->GetMangled().GetName())
|
||||||
function->GetMangled().GetName().Dump(s);
|
function->GetMangled().GetName().Dump(s);
|
||||||
|
|
||||||
|
|
||||||
if (show_inlined_frames && block)
|
if (show_inlined_frames && block)
|
||||||
{
|
{
|
||||||
const InlineFunctionInfo *inline_info = block->InlinedFunctionInfo();
|
const InlineFunctionInfo *inline_info = block->InlinedFunctionInfo();
|
||||||
|
@ -147,7 +151,7 @@ SymbolContext::DumpStopContext
|
||||||
if (line_entry.IsValid())
|
if (line_entry.IsValid())
|
||||||
{
|
{
|
||||||
s->PutCString(" at ");
|
s->PutCString(" at ");
|
||||||
line_entry.DumpStopContext(s);
|
line_entry.DumpStopContext(s, show_fullpaths);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -159,7 +163,7 @@ SymbolContext::DumpStopContext
|
||||||
if (block != NULL)
|
if (block != NULL)
|
||||||
{
|
{
|
||||||
s->IndentMore();
|
s->IndentMore();
|
||||||
block->DumpStopContext(s, this);
|
block->DumpStopContext(s, this, show_fullpaths);
|
||||||
s->IndentLess();
|
s->IndentLess();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -167,7 +171,7 @@ SymbolContext::DumpStopContext
|
||||||
if (line_entry.IsValid())
|
if (line_entry.IsValid())
|
||||||
{
|
{
|
||||||
s->PutCString(" at ");
|
s->PutCString(" at ");
|
||||||
if (line_entry.DumpStopContext(s))
|
if (line_entry.DumpStopContext(s, show_fullpaths))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,8 +32,7 @@ using namespace lldb_private;
|
||||||
// so we know if we have tried to look up information in our internal symbol
|
// so we know if we have tried to look up information in our internal symbol
|
||||||
// context (m_sc) already.
|
// context (m_sc) already.
|
||||||
#define RESOLVED_FRAME_CODE_ADDR (uint32_t(eSymbolContextEverything + 1))
|
#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_CODE_ADDR << 1)
|
||||||
#define RESOLVED_FRAME_ID_SYMBOL_SCOPE (RESOLVED_FRAME_ID_START_ADDR << 1)
|
|
||||||
#define GOT_FRAME_BASE (RESOLVED_FRAME_ID_SYMBOL_SCOPE << 1)
|
#define GOT_FRAME_BASE (RESOLVED_FRAME_ID_SYMBOL_SCOPE << 1)
|
||||||
#define RESOLVED_VARIABLES (GOT_FRAME_BASE << 1)
|
#define RESOLVED_VARIABLES (GOT_FRAME_BASE << 1)
|
||||||
|
|
||||||
|
@ -50,7 +49,7 @@ StackFrame::StackFrame
|
||||||
m_unwind_frame_index (unwind_frame_index),
|
m_unwind_frame_index (unwind_frame_index),
|
||||||
m_thread (thread),
|
m_thread (thread),
|
||||||
m_reg_context_sp (),
|
m_reg_context_sp (),
|
||||||
m_id (LLDB_INVALID_ADDRESS, cfa, NULL),
|
m_id (pc, cfa, NULL),
|
||||||
m_frame_code_addr (NULL, pc),
|
m_frame_code_addr (NULL, pc),
|
||||||
m_sc (),
|
m_sc (),
|
||||||
m_flags (),
|
m_flags (),
|
||||||
|
@ -80,7 +79,7 @@ StackFrame::StackFrame
|
||||||
m_unwind_frame_index (unwind_frame_index),
|
m_unwind_frame_index (unwind_frame_index),
|
||||||
m_thread (thread),
|
m_thread (thread),
|
||||||
m_reg_context_sp (reg_context_sp),
|
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_frame_code_addr (NULL, pc),
|
||||||
m_sc (),
|
m_sc (),
|
||||||
m_flags (),
|
m_flags (),
|
||||||
|
@ -116,7 +115,7 @@ StackFrame::StackFrame
|
||||||
m_unwind_frame_index (unwind_frame_index),
|
m_unwind_frame_index (unwind_frame_index),
|
||||||
m_thread (thread),
|
m_thread (thread),
|
||||||
m_reg_context_sp (reg_context_sp),
|
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_frame_code_addr (pc_addr),
|
||||||
m_sc (),
|
m_sc (),
|
||||||
m_flags (),
|
m_flags (),
|
||||||
|
@ -159,42 +158,12 @@ StackFrame::~StackFrame()
|
||||||
StackID&
|
StackID&
|
||||||
StackFrame::GetStackID()
|
StackFrame::GetStackID()
|
||||||
{
|
{
|
||||||
// Make sure we have resolved our stack ID's start PC before we give
|
// Make sure we have resolved the StackID object's symbol context scope if
|
||||||
// it out to any external clients. This allows us to not have to lookup
|
// we already haven't looked it up.
|
||||||
// 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();
|
|
||||||
|
|
||||||
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_flags.IsClear (RESOLVED_FRAME_ID_SYMBOL_SCOPE))
|
||||||
{
|
{
|
||||||
if (m_id.GetSymbolContextScope ())
|
if (m_id.GetSymbolContextScope () == NULL)
|
||||||
{
|
{
|
||||||
m_flags.Set (RESOLVED_FRAME_ID_SYMBOL_SCOPE);
|
m_flags.Set (RESOLVED_FRAME_ID_SYMBOL_SCOPE);
|
||||||
}
|
}
|
||||||
|
@ -627,20 +596,18 @@ StackFrame::Calculate (ExecutionContext &exe_ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
StackFrame::Dump (Stream *strm, bool show_frame_index)
|
StackFrame::Dump (Stream *strm, bool show_frame_index, bool show_fullpaths)
|
||||||
{
|
{
|
||||||
if (strm == NULL)
|
if (strm == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (show_frame_index)
|
if (show_frame_index)
|
||||||
strm->Printf("frame #%u: ", m_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);
|
GetSymbolContext(eSymbolContextEverything);
|
||||||
strm->PutCString(", where = ");
|
|
||||||
// TODO: need to get the
|
|
||||||
const bool show_module = true;
|
const bool show_module = true;
|
||||||
const bool show_inline = 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
|
void
|
||||||
|
|
|
@ -256,7 +256,7 @@ StackFrameList::Dump (Stream *s)
|
||||||
if (frame)
|
if (frame)
|
||||||
{
|
{
|
||||||
frame->GetStackID().Dump (s);
|
frame->GetStackID().Dump (s);
|
||||||
frame->Dump(s, true);
|
frame->Dump(s, true, false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
s->Printf("frame #%u", std::distance (begin, pos));
|
s->Printf("frame #%u", std::distance (begin, pos));
|
||||||
|
|
|
@ -24,7 +24,7 @@ using namespace lldb_private;
|
||||||
void
|
void
|
||||||
StackID::Dump (Stream *s)
|
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)
|
if (m_symbol_scope)
|
||||||
{
|
{
|
||||||
SymbolContext sc;
|
SymbolContext sc;
|
||||||
|
@ -41,21 +41,64 @@ StackID::Dump (Stream *s)
|
||||||
bool
|
bool
|
||||||
lldb_private::operator== (const StackID& lhs, const StackID& rhs)
|
lldb_private::operator== (const StackID& lhs, const StackID& rhs)
|
||||||
{
|
{
|
||||||
return lhs.GetCallFrameAddress() == rhs.GetCallFrameAddress() &&
|
if (lhs.GetCallFrameAddress() != rhs.GetCallFrameAddress())
|
||||||
lhs.GetSymbolContextScope() == rhs.GetSymbolContextScope() &&
|
return false;
|
||||||
lhs.GetStartAddress() == rhs.GetStartAddress();
|
|
||||||
|
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
|
bool
|
||||||
lldb_private::operator!= (const StackID& lhs, const StackID& rhs)
|
lldb_private::operator!= (const StackID& lhs, const StackID& rhs)
|
||||||
{
|
{
|
||||||
return lhs.GetCallFrameAddress() != rhs.GetCallFrameAddress() ||
|
if (lhs.GetCallFrameAddress() != rhs.GetCallFrameAddress())
|
||||||
lhs.GetSymbolContextScope() != rhs.GetSymbolContextScope() ||
|
return true;
|
||||||
lhs.GetStartAddress() != rhs.GetStartAddress();
|
|
||||||
|
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
|
bool
|
||||||
lldb_private::operator< (const StackID& lhs, const StackID& rhs)
|
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;
|
||||||
}
|
}
|
||||||
|
|
|
@ -820,7 +820,7 @@ Thread::ClearStackFrames ()
|
||||||
lldb::StackFrameSP
|
lldb::StackFrameSP
|
||||||
Thread::GetStackFrameAtIndex (uint32_t idx)
|
Thread::GetStackFrameAtIndex (uint32_t idx)
|
||||||
{
|
{
|
||||||
return StackFrameSP (GetStackFrameList().GetFrameAtIndex(idx));
|
return GetStackFrameList().GetFrameAtIndex(idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
lldb::StackFrameSP
|
lldb::StackFrameSP
|
||||||
|
@ -859,7 +859,7 @@ Thread::DumpInfo
|
||||||
if (frame_sp)
|
if (frame_sp)
|
||||||
{
|
{
|
||||||
strm.PutCString(", ");
|
strm.PutCString(", ");
|
||||||
frame_sp->Dump (&strm, false);
|
frame_sp->Dump (&strm, false, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue