Author: spyffe Date: Thu Jan 14 12:59:49 2016 New Revision: 257786 URL: http://llvm.org/viewvc/llvm-project?rev=257786&view=rev Log: Fixed a crasher when dealing with table entries that have blank names.
This can happen with -gmodules tables when an anonymous struct is referred to. Modified: lldb/trunk/include/lldb/Core/MappedHash.h lldb/trunk/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.cpp 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=257786&r1=257785&r2=257786&view=diff ============================================================================== --- lldb/trunk/include/lldb/Core/MappedHash.h (original) +++ lldb/trunk/include/lldb/Core/MappedHash.h Thu Jan 14 12:59:49 2016 @@ -47,6 +47,9 @@ public: static uint32_t HashString (uint32_t hash_function, const char *s) { + if (!s) + return 0; + switch (hash_function) { case MappedHash::eHashFunctionDJB: @@ -434,6 +437,9 @@ public: bool Find (const char *name, Pair &pair) const { + if (!name || !name[0]) + return false; + if (IsValid ()) { const uint32_t bucket_count = m_header.bucket_count; Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.cpp?rev=257786&r1=257785&r2=257786&view=diff ============================================================================== --- lldb/trunk/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.cpp (original) +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.cpp Thu Jan 14 12:59:49 2016 @@ -671,6 +671,9 @@ DWARFMappedHash::MemoryTable::AppendAllD size_t DWARFMappedHash::MemoryTable::FindByName (const char *name, DIEArray &die_offsets) { + if (!name || !name[0]) + return 0; + DIEInfoArray die_info_array; if (FindByName(name, die_info_array)) DWARFMappedHash::ExtractDIEArray (die_info_array, die_offsets); @@ -736,6 +739,9 @@ DWARFMappedHash::MemoryTable::FindComple size_t DWARFMappedHash::MemoryTable::FindByName (const char *name, DIEInfoArray &die_info_array) { + if (!name || !name[0]) + return 0; + Pair kv_pair; size_t old_size = die_info_array.size(); if (Find (name, kv_pair)) 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=257786&r1=257785&r2=257786&view=diff ============================================================================== --- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original) +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Thu Jan 14 12:59:49 2016 @@ -3124,6 +3124,9 @@ SymbolFileDWARF::FindTypes (const std::v ConstString name = context.back().name; + if (!name) + return 0; + if (m_using_apple_tables) { if (m_apple_types_ap.get()) _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits