[Lldb-commits] [lldb] r146330 - in /lldb/trunk: include/lldb/Core/Address.h source/Core/Address.cpp source/Core/SourceManager.cpp source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp

Greg Clayton gclayton at apple.com
Sat Dec 10 13:05:27 PST 2011


Author: gclayton
Date: Sat Dec 10 15:05:26 2011
New Revision: 146330

URL: http://llvm.org/viewvc/llvm-project?rev=146330&view=rev
Log:
<rdar://problem/9958446>
<rdar://problem/10561406>

Stopped the SymbolFileDWARF::FindFunctions (...) from always calculating
the line table entry for all functions that were found. This can slow down
the expression parser if it ends up finding a bunch of matches. Fixed the 
places that were relying on the line table entry being filled in.

Discovered a recursive stack blowout that happened when "main" didn't have
line info for it and there was no line information for "main"


Modified:
    lldb/trunk/include/lldb/Core/Address.h
    lldb/trunk/source/Core/Address.cpp
    lldb/trunk/source/Core/SourceManager.cpp
    lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp

Modified: lldb/trunk/include/lldb/Core/Address.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Address.h?rev=146330&r1=146329&r2=146330&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/Address.h (original)
+++ lldb/trunk/include/lldb/Core/Address.h Sat Dec 10 15:05:26 2011
@@ -498,25 +498,25 @@
     //------------------------------------------------------------------
     uint32_t
     CalculateSymbolContext (SymbolContext *sc, 
-                            uint32_t resolve_scope = lldb::eSymbolContextEverything);
+                            uint32_t resolve_scope = lldb::eSymbolContextEverything) const;
 
     Module *
-    CalculateSymbolContextModule ();
+    CalculateSymbolContextModule () const;
     
     CompileUnit *
-    CalculateSymbolContextCompileUnit ();
+    CalculateSymbolContextCompileUnit () const;
     
     Function *
-    CalculateSymbolContextFunction ();
+    CalculateSymbolContextFunction () const;
     
     Block *
-    CalculateSymbolContextBlock ();
+    CalculateSymbolContextBlock () const;
 
     Symbol *
-    CalculateSymbolContextSymbol ();
+    CalculateSymbolContextSymbol () const;
 
     bool
-    CalculateSymbolContextLineEntry (LineEntry &line_entry);
+    CalculateSymbolContextLineEntry (LineEntry &line_entry) const;
 
 protected:
     //------------------------------------------------------------------

Modified: lldb/trunk/source/Core/Address.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Address.cpp?rev=146330&r1=146329&r2=146330&view=diff
==============================================================================
--- lldb/trunk/source/Core/Address.cpp (original)
+++ lldb/trunk/source/Core/Address.cpp Sat Dec 10 15:05:26 2011
@@ -729,7 +729,7 @@
 }
 
 uint32_t
-Address::CalculateSymbolContext (SymbolContext *sc, uint32_t resolve_scope)
+Address::CalculateSymbolContext (SymbolContext *sc, uint32_t resolve_scope) const
 {
     sc->Clear();
     // Absolute addresses don't have enough information to reconstruct even their target.
@@ -747,7 +747,7 @@
 }
 
 Module *
-Address::CalculateSymbolContextModule ()
+Address::CalculateSymbolContextModule () const
 {
     if (m_section)
         return m_section->GetModule();
@@ -755,7 +755,7 @@
 }
 
 CompileUnit *
-Address::CalculateSymbolContextCompileUnit ()
+Address::CalculateSymbolContextCompileUnit () const
 {
     if (m_section)
     {
@@ -771,7 +771,7 @@
 }
 
 Function *
-Address::CalculateSymbolContextFunction ()
+Address::CalculateSymbolContextFunction () const
 {
     if (m_section)
     {
@@ -787,7 +787,7 @@
 }
 
 Block *
-Address::CalculateSymbolContextBlock ()
+Address::CalculateSymbolContextBlock () const
 {
     if (m_section)
     {
@@ -803,7 +803,7 @@
 }
 
 Symbol *
-Address::CalculateSymbolContextSymbol ()
+Address::CalculateSymbolContextSymbol () const
 {
     if (m_section)
     {
@@ -819,7 +819,7 @@
 }
 
 bool
-Address::CalculateSymbolContextLineEntry (LineEntry &line_entry)
+Address::CalculateSymbolContextLineEntry (LineEntry &line_entry) const
 {
     if (m_section)
     {

Modified: lldb/trunk/source/Core/SourceManager.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/SourceManager.cpp?rev=146330&r1=146329&r2=146330&view=diff
==============================================================================
--- lldb/trunk/source/Core/SourceManager.cpp (original)
+++ lldb/trunk/source/Core/SourceManager.cpp Sat Dec 10 15:05:26 2011
@@ -250,19 +250,22 @@
             {
                 SymbolContext sc;
                 sc_list.GetContextAtIndex(idx, sc);
-                if (sc.line_entry.file)
+                if (sc.function)
                 {
-                    SetDefaultFileAndLine(sc.line_entry.file, sc.line_entry.line);
-                    break;
+                    lldb_private::LineEntry line_entry;
+                    if (sc.function->GetAddressRange().GetBaseAddress().CalculateSymbolContextLineEntry (line_entry))
+                    {
+                        SetDefaultFileAndLine (line_entry.file, 
+                                               line_entry.line);
+                        file_spec = m_last_file_sp->GetFileSpec();
+                        line = m_last_file_line;
+                        return true;
+                    }
                 }
             }
-            return GetDefaultFileAndLine (file_spec, line);
         }
-        else
-            return false;
     }
-    else
-        return false;
+    return false;
 }
 
 void

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp?rev=146330&r1=146329&r2=146330&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Sat Dec 10 15:05:26 2011
@@ -1997,11 +1997,6 @@
                     if (resolve_scope & eSymbolContextLineEntry)
                     {
                         LineTable *line_table = sc.comp_unit->GetLineTable();
-                        if (line_table == NULL)
-                        {
-                            if (ParseCompileUnitLineTable(sc))
-                                line_table = sc.comp_unit->GetLineTable();
-                        }
                         if (line_table != NULL)
                         {
                             if (so_addr.IsLinkedAddress())
@@ -2560,18 +2555,6 @@
 
         if (addr.IsValid())
         {
-        
-            // We found the function, so we should find the line table
-            // and line table entry as well
-            LineTable *line_table = sc.comp_unit->GetLineTable();
-            if (line_table == NULL)
-            {
-                if (ParseCompileUnitLineTable(sc))
-                    line_table = sc.comp_unit->GetLineTable();
-            }
-            if (line_table != NULL)
-                line_table->FindLineEntryByAddress (addr, sc.line_entry);
-
             sc_list.Append(sc);
             return true;
         }





More information about the lldb-commits mailing list