[Lldb-commits] [lldb] r140788 - in /lldb/trunk: include/lldb/Symbol/SymbolContext.h source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h source/Symbol/SymbolContext.cpp

Greg Clayton gclayton at apple.com
Thu Sep 29 09:58:16 PDT 2011


Author: gclayton
Date: Thu Sep 29 11:58:15 2011
New Revision: 140788

URL: http://llvm.org/viewvc/llvm-project?rev=140788&view=rev
Log:
If the new .apple_names and .apple_types DWARF accelerator tables
are available, we currently will still index the DWARF ourselves
and assert if the name lookups differ. This will help us transition
to the new accelerator tables and make sure they are workng before
we switch over entirely.


Modified:
    lldb/trunk/include/lldb/Symbol/SymbolContext.h
    lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
    lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
    lldb/trunk/source/Symbol/SymbolContext.cpp

Modified: lldb/trunk/include/lldb/Symbol/SymbolContext.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/SymbolContext.h?rev=140788&r1=140787&r2=140788&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/SymbolContext.h (original)
+++ lldb/trunk/include/lldb/Symbol/SymbolContext.h Thu Sep 29 11:58:15 2011
@@ -458,6 +458,9 @@
 bool operator== (const SymbolContext& lhs, const SymbolContext& rhs);
 bool operator!= (const SymbolContext& lhs, const SymbolContext& rhs);
 
+bool operator== (const SymbolContextList& lhs, const SymbolContextList& rhs);
+bool operator!= (const SymbolContextList& lhs, const SymbolContextList& rhs);
+
 } // namespace lldb_private
 
 #endif  // liblldb_SymbolContext_h_

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=140788&r1=140787&r2=140788&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Thu Sep 29 11:58:15 2011
@@ -177,6 +177,7 @@
     m_info(),
     m_line(),
     m_apple_names (this, m_data_apple_names, true),
+    m_apple_types (this, m_data_apple_types, true),
     m_function_basename_index(),
     m_function_fullname_index(),
     m_function_method_index(),
@@ -190,8 +191,6 @@
     m_ranges(),
     m_unique_ast_type_map ()
 {
-    get_apple_names_data();
-    m_apple_names.Initialize();
 }
 
 SymbolFileDWARF::~SymbolFileDWARF()
@@ -252,6 +251,11 @@
         if (section)
             section->MemoryMapSectionDataFromObjectFile(m_obj_file, m_dwarf_data);
     }
+    get_apple_names_data();
+    get_apple_types_data();
+    m_apple_names.Initialize();
+    m_apple_types.Initialize();
+
 }
 
 bool
@@ -2293,17 +2297,6 @@
     // Remember how many sc_list are in the list before we search in case
     // we are appending the results to a variable list.
 
-    if (m_apple_names.IsValid())
-    {
-        DIEArray die_offsets;
-        const uint32_t num_matches = m_apple_names.Find(name.GetCString(), die_offsets);
-        if (num_matches > 0)
-        {
-            return ResolveFunctions (die_offsets, sc_list);
-        }
-        return 0;
-    }
-
     const uint32_t original_size = sc_list.GetSize();
 
     // Index the DWARF if we haven't already
@@ -2322,6 +2315,17 @@
     if (name_type_mask & eFunctionNameTypeSelector)
         FindFunctions (name, m_function_selector_index, sc_list);
 
+    if (m_apple_names.IsValid())
+    {
+        SymbolContextList sc_list_apple;
+        DIEArray die_offsets;
+        const uint32_t num_matches = m_apple_names.Find(name.GetCString(), die_offsets);
+        if (num_matches > 0)
+            ResolveFunctions (die_offsets, sc_list_apple);
+        if (sc_list != sc_list_apple)
+            assert (!"__apple_names results differ from DWARF index results");
+    }
+
     // Return the number of variable that were appended to the list
     return sc_list.GetSize() - original_size;
 }

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h?rev=140788&r1=140787&r2=140788&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h Thu Sep 29 11:58:15 2011
@@ -388,6 +388,7 @@
     std::auto_ptr<DWARFDebugInfo>       m_info;
     std::auto_ptr<DWARFDebugLine>       m_line;
     HashedNameToDIE::MemoryTable        m_apple_names;
+    HashedNameToDIE::MemoryTable        m_apple_types;
     NameToDIE                           m_function_basename_index;  // All concrete functions
     NameToDIE                           m_function_fullname_index;  // All concrete functions
     NameToDIE                           m_function_method_index;    // All inlined functions

Modified: lldb/trunk/source/Symbol/SymbolContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/SymbolContext.cpp?rev=140788&r1=140787&r2=140788&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/SymbolContext.cpp (original)
+++ lldb/trunk/source/Symbol/SymbolContext.cpp Thu Sep 29 11:58:15 2011
@@ -1044,3 +1044,28 @@
     return match_count;
 }
 
+bool
+lldb_private::operator== (const SymbolContextList& lhs, const SymbolContextList& rhs)
+{
+    const uint32_t size = lhs.GetSize();
+    if (size != rhs.GetSize())
+        return false;
+    
+    SymbolContext lhs_sc;
+    SymbolContext rhs_sc;
+    for (uint32_t i=0; i<size; ++i)
+    {
+        lhs.GetContextAtIndex(i, lhs_sc);
+        rhs.GetContextAtIndex(i, rhs_sc);
+        if (lhs_sc != rhs_sc)
+            return false;
+    }
+    return true;
+}
+
+bool
+lldb_private::operator!= (const SymbolContextList& lhs, const SymbolContextList& rhs)
+{
+    return !(lhs == rhs);
+}
+





More information about the lldb-commits mailing list