[Lldb-commits] [lldb] r112867 - in /lldb/trunk: include/lldb/Symbol/ include/lldb/Target/ source/API/ source/Breakpoint/ source/Commands/ source/Core/ source/Symbol/ source/Target/

Greg Clayton gclayton at apple.com
Thu Sep 2 14:44:10 PDT 2010


Author: gclayton
Date: Thu Sep  2 16:44:10 2010
New Revision: 112867

URL: http://llvm.org/viewvc/llvm-project?rev=112867&view=rev
Log:
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.


Modified:
    lldb/trunk/include/lldb/Symbol/Block.h
    lldb/trunk/include/lldb/Symbol/Declaration.h
    lldb/trunk/include/lldb/Symbol/LineEntry.h
    lldb/trunk/include/lldb/Symbol/SymbolContext.h
    lldb/trunk/include/lldb/Target/StackFrame.h
    lldb/trunk/include/lldb/Target/StackID.h
    lldb/trunk/source/API/SBThread.cpp
    lldb/trunk/source/Breakpoint/BreakpointLocation.cpp
    lldb/trunk/source/Commands/CommandObjectFrame.cpp
    lldb/trunk/source/Commands/CommandObjectImage.cpp
    lldb/trunk/source/Commands/CommandObjectThread.cpp
    lldb/trunk/source/Core/Address.cpp
    lldb/trunk/source/Core/Disassembler.cpp
    lldb/trunk/source/Symbol/Block.cpp
    lldb/trunk/source/Symbol/Declaration.cpp
    lldb/trunk/source/Symbol/LineEntry.cpp
    lldb/trunk/source/Symbol/SymbolContext.cpp
    lldb/trunk/source/Target/StackFrame.cpp
    lldb/trunk/source/Target/StackFrameList.cpp
    lldb/trunk/source/Target/StackID.cpp
    lldb/trunk/source/Target/Thread.cpp

Modified: lldb/trunk/include/lldb/Symbol/Block.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/Block.h?rev=112867&r1=112866&r2=112867&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/Block.h (original)
+++ lldb/trunk/include/lldb/Symbol/Block.h Thu Sep  2 16:44:10 2010
@@ -133,6 +133,9 @@
     bool
     Contains (const VMRange& range) const;
 
+    bool
+    Contains (const Block *block) const;
+
     //------------------------------------------------------------------
     /// Dump the block contents.
     ///
@@ -156,7 +159,7 @@
     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*)

Modified: lldb/trunk/include/lldb/Symbol/Declaration.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/Declaration.h?rev=112867&r1=112866&r2=112867&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/Declaration.h (original)
+++ lldb/trunk/include/lldb/Symbol/Declaration.h Thu Sep  2 16:44:10 2010
@@ -103,7 +103,7 @@
     Dump (Stream *s) const;
 
     void
-    DumpStopContext (Stream *s) const;
+    DumpStopContext (Stream *s, bool show_fullpaths) const;
     //------------------------------------------------------------------
     /// Get accessor for the declaration column number.
     ///

Modified: lldb/trunk/include/lldb/Symbol/LineEntry.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/LineEntry.h?rev=112867&r1=112866&r2=112867&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/LineEntry.h (original)
+++ lldb/trunk/include/lldb/Symbol/LineEntry.h Thu Sep  2 16:44:10 2010
@@ -110,7 +110,7 @@
     ///     \b false otherwise.
     //------------------------------------------------------------------
     bool
-    DumpStopContext (Stream *s) const;
+    DumpStopContext (Stream *s, bool show_fullpaths) const;
 
     //------------------------------------------------------------------
     /// Check if a line entry object is valid.

Modified: lldb/trunk/include/lldb/Symbol/SymbolContext.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/SymbolContext.h?rev=112867&r1=112866&r2=112867&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/SymbolContext.h (original)
+++ lldb/trunk/include/lldb/Symbol/SymbolContext.h Thu Sep  2 16:44:10 2010
@@ -163,6 +163,7 @@
     DumpStopContext (Stream *s,
                      ExecutionContextScope *exe_scope,
                      const Address &so_addr,
+                     bool show_fullpaths,
                      bool show_module,
                      bool show_inlined_frames) const;
 

Modified: lldb/trunk/include/lldb/Target/StackFrame.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/StackFrame.h?rev=112867&r1=112866&r2=112867&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/StackFrame.h (original)
+++ lldb/trunk/include/lldb/Target/StackFrame.h Thu Sep  2 16:44:10 2010
@@ -100,7 +100,7 @@
     Disassemble ();
 
     void
-    Dump (Stream *strm, bool show_frame_index);
+    Dump (Stream *strm, bool show_frame_index, bool show_fullpaths);
     
     bool
     IsInlined ();

Modified: lldb/trunk/include/lldb/Target/StackID.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/StackID.h?rev=112867&r1=112866&r2=112867&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/StackID.h (original)
+++ lldb/trunk/include/lldb/Target/StackID.h Thu Sep  2 16:44:10 2010
@@ -26,22 +26,22 @@
     // 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 @@
     }
 
     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 @@
     {
         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 @@
     //------------------------------------------------------------------
     // 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)

Modified: lldb/trunk/source/API/SBThread.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBThread.cpp?rev=112867&r1=112866&r2=112867&view=diff
==============================================================================
--- lldb/trunk/source/API/SBThread.cpp (original)
+++ lldb/trunk/source/API/SBThread.cpp Thu Sep  2 16:44:10 2010
@@ -288,7 +288,7 @@
                        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;
         }

Modified: lldb/trunk/source/Breakpoint/BreakpointLocation.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointLocation.cpp?rev=112867&r1=112866&r2=112867&view=diff
==============================================================================
--- lldb/trunk/source/Breakpoint/BreakpointLocation.cpp (original)
+++ lldb/trunk/source/Breakpoint/BreakpointLocation.cpp Thu Sep  2 16:44:10 2010
@@ -285,7 +285,7 @@
         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 @@
                 {
                     s->EOL();
                     s->Indent("location = ");
-                    sc.line_entry.DumpStopContext (s);
+                    sc.line_entry.DumpStopContext (s, true);
                 }
 
             }

Modified: lldb/trunk/source/Commands/CommandObjectFrame.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectFrame.cpp?rev=112867&r1=112866&r2=112867&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectFrame.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectFrame.cpp Thu Sep  2 16:44:10 2010
@@ -71,7 +71,7 @@
         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);
         }

Modified: lldb/trunk/source/Commands/CommandObjectImage.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectImage.cpp?rev=112867&r1=112866&r2=112867&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectImage.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectImage.cpp Thu Sep  2 16:44:10 2010
@@ -341,7 +341,7 @@
                     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 ();

Modified: lldb/trunk/source/Commands/CommandObjectThread.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectThread.cpp?rev=112867&r1=112866&r2=112867&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectThread.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectThread.cpp Thu Sep  2 16:44:10 2010
@@ -224,7 +224,7 @@
         if (show_frame_info)
         {
             strm.Indent();
-            frame->Dump (&strm, true);
+            frame->Dump (&strm, true, false);
             strm.EOL();
         }
 

Modified: lldb/trunk/source/Core/Address.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Address.cpp?rev=112867&r1=112866&r2=112867&view=diff
==============================================================================
--- lldb/trunk/source/Core/Address.cpp (original)
+++ lldb/trunk/source/Core/Address.cpp Thu Sep  2 16:44:10 2010
@@ -503,7 +503,7 @@
 #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 @@
                                     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 @@
                         {
                             // 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
                         {

Modified: lldb/trunk/source/Core/Disassembler.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Disassembler.cpp?rev=112867&r1=112866&r2=112867&view=diff
==============================================================================
--- lldb/trunk/source/Core/Disassembler.cpp (original)
+++ lldb/trunk/source/Core/Disassembler.cpp Thu Sep  2 16:44:10 2010
@@ -238,7 +238,7 @@
                                         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())
                                         {

Modified: lldb/trunk/source/Symbol/Block.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/Block.cpp?rev=112867&r1=112866&r2=112867&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/Block.cpp (original)
+++ lldb/trunk/source/Symbol/Block.cpp Thu Sep  2 16:44:10 2010
@@ -145,7 +145,7 @@
 }
 
 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 @@
             if (call_site.IsValid())
             {
                 s->PutCString(" at ");
-                call_site.DumpStopContext (s);
+                call_site.DumpStopContext (s, show_fullpaths);
             }
         }
     }
@@ -182,11 +182,11 @@
         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 @@
 }
 
 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);

Modified: lldb/trunk/source/Symbol/Declaration.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/Declaration.cpp?rev=112867&r1=112866&r2=112867&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/Declaration.cpp (original)
+++ lldb/trunk/source/Symbol/Declaration.cpp Thu Sep  2 16:44:10 2010
@@ -81,11 +81,11 @@
 }
 
 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);

Modified: lldb/trunk/source/Symbol/LineEntry.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/LineEntry.cpp?rev=112867&r1=112866&r2=112867&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/LineEntry.cpp (original)
+++ lldb/trunk/source/Symbol/LineEntry.cpp Thu Sep  2 16:44:10 2010
@@ -74,12 +74,16 @@
 }
 
 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;

Modified: lldb/trunk/source/Symbol/SymbolContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/SymbolContext.cpp?rev=112867&r1=112866&r2=112867&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/SymbolContext.cpp (original)
+++ lldb/trunk/source/Symbol/SymbolContext.cpp Thu Sep  2 16:44:10 2010
@@ -114,13 +114,18 @@
     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 @@
         if (function->GetMangled().GetName())
             function->GetMangled().GetName().Dump(s);
 
-
         if (show_inlined_frames && block)
         {
             const InlineFunctionInfo *inline_info = block->InlinedFunctionInfo();
@@ -147,7 +151,7 @@
                 if (line_entry.IsValid())
                 {
                     s->PutCString(" at ");
-                    line_entry.DumpStopContext(s);
+                    line_entry.DumpStopContext(s, show_fullpaths);
                 }
                 return;
             }
@@ -159,7 +163,7 @@
         if (block != NULL)
         {
             s->IndentMore();
-            block->DumpStopContext(s, this);
+            block->DumpStopContext(s, this, show_fullpaths);
             s->IndentLess();
         }
         else
@@ -167,7 +171,7 @@
             if (line_entry.IsValid())
             {
                 s->PutCString(" at ");
-                if (line_entry.DumpStopContext(s))
+                if (line_entry.DumpStopContext(s, show_fullpaths))
                     return;
             }
         }

Modified: lldb/trunk/source/Target/StackFrame.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/StackFrame.cpp?rev=112867&r1=112866&r2=112867&view=diff
==============================================================================
--- lldb/trunk/source/Target/StackFrame.cpp (original)
+++ lldb/trunk/source/Target/StackFrame.cpp Thu Sep  2 16:44:10 2010
@@ -32,8 +32,7 @@
 // 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 @@
     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 @@
     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 @@
     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 @@
 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 @@
 }
 
 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

Modified: lldb/trunk/source/Target/StackFrameList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/StackFrameList.cpp?rev=112867&r1=112866&r2=112867&view=diff
==============================================================================
--- lldb/trunk/source/Target/StackFrameList.cpp (original)
+++ lldb/trunk/source/Target/StackFrameList.cpp Thu Sep  2 16:44:10 2010
@@ -256,7 +256,7 @@
         if (frame)
         {
             frame->GetStackID().Dump (s);
-            frame->Dump(s, true);
+            frame->Dump(s, true, false);
         }
         else
             s->Printf("frame #%u", std::distance (begin, pos));

Modified: lldb/trunk/source/Target/StackID.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/StackID.cpp?rev=112867&r1=112866&r2=112867&view=diff
==============================================================================
--- lldb/trunk/source/Target/StackID.cpp (original)
+++ lldb/trunk/source/Target/StackID.cpp Thu Sep  2 16:44:10 2010
@@ -24,7 +24,7 @@
 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 @@
 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;
 }

Modified: lldb/trunk/source/Target/Thread.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Thread.cpp?rev=112867&r1=112866&r2=112867&view=diff
==============================================================================
--- lldb/trunk/source/Target/Thread.cpp (original)
+++ lldb/trunk/source/Target/Thread.cpp Thu Sep  2 16:44:10 2010
@@ -820,7 +820,7 @@
 lldb::StackFrameSP
 Thread::GetStackFrameAtIndex (uint32_t idx)
 {
-    return StackFrameSP (GetStackFrameList().GetFrameAtIndex(idx));
+    return GetStackFrameList().GetFrameAtIndex(idx);
 }
 
 lldb::StackFrameSP
@@ -859,7 +859,7 @@
         if (frame_sp)
         {
             strm.PutCString(", ");
-            frame_sp->Dump (&strm, false);
+            frame_sp->Dump (&strm, false, false);
         }
     }
 





More information about the lldb-commits mailing list