Author: jmolenda Date: Fri Mar 10 00:38:19 2017 New Revision: 297441 URL: http://llvm.org/viewvc/llvm-project?rev=297441&view=rev Log: Add a distinction in an apple accelerator table between IsValid and HasContent. If we have a valid accelerator table which has no content, we want to depend on that (empty) table as the authoritative source instead of reading through all the debug info for lookups. <rdar://problem/30867462>
Modified: lldb/trunk/include/lldb/Core/MappedHash.h lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Modified: lldb/trunk/include/lldb/Core/MappedHash.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/MappedHash.h?rev=297441&r1=297440&r2=297441&view=diff ============================================================================== --- lldb/trunk/include/lldb/Core/MappedHash.h (original) +++ lldb/trunk/include/lldb/Core/MappedHash.h Fri Mar 10 00:38:19 2017 @@ -353,7 +353,11 @@ public: bool IsValid() const { return m_header.version == 1 && m_header.hash_function == eHashFunctionDJB && - m_header.bucket_count > 0 && m_header.hashes_count > 0; + m_header.bucket_count > 0; + } + + bool HasContent() const { + return IsValid() && m_header.hashes_count > 0; } uint32_t GetHashIndex(uint32_t bucket_idx) const { 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=297441&r1=297440&r2=297441&view=diff ============================================================================== --- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original) +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Fri Mar 10 00:38:19 2017 @@ -448,19 +448,19 @@ void SymbolFileDWARF::InitializeObject() if (m_data_apple_names.m_data.GetByteSize() > 0) { m_apple_names_ap.reset(new DWARFMappedHash::MemoryTable( m_data_apple_names.m_data, get_debug_str_data(), ".apple_names")); - if (m_apple_names_ap->IsValid()) - m_using_apple_tables = true; - else + if (!m_apple_names_ap->IsValid()) m_apple_names_ap.reset(); + if (m_apple_names_ap->HasContent()) + m_using_apple_tables = true; } get_apple_types_data(); if (m_data_apple_types.m_data.GetByteSize() > 0) { m_apple_types_ap.reset(new DWARFMappedHash::MemoryTable( m_data_apple_types.m_data, get_debug_str_data(), ".apple_types")); - if (m_apple_types_ap->IsValid()) - m_using_apple_tables = true; - else + if (!m_apple_types_ap->IsValid()) m_apple_types_ap.reset(); + if (m_apple_types_ap->HasContent()) + m_using_apple_tables = true; } get_apple_namespaces_data(); @@ -468,20 +468,20 @@ void SymbolFileDWARF::InitializeObject() m_apple_namespaces_ap.reset(new DWARFMappedHash::MemoryTable( m_data_apple_namespaces.m_data, get_debug_str_data(), ".apple_namespaces")); - if (m_apple_namespaces_ap->IsValid()) - m_using_apple_tables = true; - else + if (!m_apple_namespaces_ap->IsValid()) m_apple_namespaces_ap.reset(); + if (m_apple_namespaces_ap->HasContent()) + m_using_apple_tables = true; } get_apple_objc_data(); if (m_data_apple_objc.m_data.GetByteSize() > 0) { m_apple_objc_ap.reset(new DWARFMappedHash::MemoryTable( m_data_apple_objc.m_data, get_debug_str_data(), ".apple_objc")); - if (m_apple_objc_ap->IsValid()) - m_using_apple_tables = true; - else + if (!m_apple_objc_ap->IsValid()) m_apple_objc_ap.reset(); + if (m_apple_objc_ap->HasContent()) + m_using_apple_tables = true; } } _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits