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.

llvm-svn: 140788
This commit is contained in:
Greg Clayton 2011-09-29 16:58:15 +00:00
parent eec5c5bf6e
commit 4d01ace4fd
4 changed files with 46 additions and 13 deletions

View File

@ -458,6 +458,9 @@ protected:
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_

View File

@ -177,6 +177,7 @@ SymbolFileDWARF::SymbolFileDWARF(ObjectFile* objfile) :
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 @@ SymbolFileDWARF::SymbolFileDWARF(ObjectFile* objfile) :
m_ranges(),
m_unique_ast_type_map ()
{
get_apple_names_data();
m_apple_names.Initialize();
}
SymbolFileDWARF::~SymbolFileDWARF()
@ -252,6 +251,11 @@ SymbolFileDWARF::InitializeObject()
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 @@ SymbolFileDWARF::FindFunctions
// 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 @@ SymbolFileDWARF::FindFunctions
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;
}

View File

@ -388,6 +388,7 @@ protected:
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

View File

@ -1044,3 +1044,28 @@ SymbolContextList::NumLineEntriesWithLine (uint32_t line) const
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);
}