diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp index 4b18d5860936..1c6d9ac6d896 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp @@ -367,7 +367,13 @@ SymbolFileDWARFDebugMap::InitOSO() { const Symbol *symbol = symtab->SymbolAtIndex(sym_idx); lldb::addr_t file_addr = symbol->GetAddress().GetFileAddress(); - lldb::addr_t byte_size = symbol->GetByteSize(); + // The N_GSYM and N_STSYM symbols have a byte size and calling + // symbol->GetByteSize() can cause an infinite loop where + // InitOSO() gets called over and over if we are in the process + // of getting the symbol vendor (module->SymbolVendor()). So + // use a safer call for now until we can fix this. This is related + // to the unified section/symtab changes that just went in. + lldb::addr_t byte_size = symtab->CalculateSymbolSize(const_cast(symbol)); DebugMap::Entry debug_map_entry(file_addr, byte_size, OSOEntry(sym_idx, LLDB_INVALID_ADDRESS)); m_debug_map.Append(debug_map_entry); } diff --git a/lldb/source/Symbol/Symtab.cpp b/lldb/source/Symbol/Symtab.cpp index f934c63d0bf2..b16340b75d6d 100644 --- a/lldb/source/Symbol/Symtab.cpp +++ b/lldb/source/Symbol/Symtab.cpp @@ -972,15 +972,8 @@ Symtab::CalculateSymbolSize (Symbol *symbol) if (symbol < &m_symbols.front() || symbol > &m_symbols.back()) return 0; - // See if this symbol already has a byte size? - size_t byte_size = symbol->GetByteSize(); - - if (byte_size) - { - // It does, just return it - return byte_size; - } - + size_t byte_size = 0; + // Else if this is an address based symbol, figure out the delta between // it and the next address based symbol if (symbol->ValueIsAddress())