diff options
author | Greg Clayton <gclayton@apple.com> | 2010-09-02 21:44:10 +0000 |
---|---|---|
committer | Greg Clayton <gclayton@apple.com> | 2010-09-02 21:44:10 +0000 |
commit | 6dadd508e7906cf994ee96806f4ec3f80a9c8a41 (patch) | |
tree | 4df4e34c3d6590a936f140d03be3039980d30c38 /lldb/source/Target/StackID.cpp | |
parent | fd81cea70cd6c893bb590c9b288875d1d29b8401 (diff) | |
download | bcm5719-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/StackID.cpp')
-rw-r--r-- | lldb/source/Target/StackID.cpp | 59 |
1 files changed, 51 insertions, 8 deletions
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; } |