[Lldb-commits] [lldb] r185491 - Workaround for infinite recursion in InitOSO->GetByteSize->GetSymbolVendor.

Jim Ingham jingham at apple.com
Tue Jul 2 18:21:47 PDT 2013


Author: jingham
Date: Tue Jul  2 20:21:46 2013
New Revision: 185491

URL: http://llvm.org/viewvc/llvm-project?rev=185491&view=rev
Log:
Workaround for infinite recursion in InitOSO->GetByteSize->GetSymbolVendor.

Modified:
    lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
    lldb/trunk/source/Symbol/Symtab.cpp

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp?rev=185491&r1=185490&r2=185491&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp Tue Jul  2 20:21:46 2013
@@ -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 *>(symbol));
                 DebugMap::Entry debug_map_entry(file_addr, byte_size, OSOEntry(sym_idx, LLDB_INVALID_ADDRESS));
                 m_debug_map.Append(debug_map_entry);
             }

Modified: lldb/trunk/source/Symbol/Symtab.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/Symtab.cpp?rev=185491&r1=185490&r2=185491&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/Symtab.cpp (original)
+++ lldb/trunk/source/Symbol/Symtab.cpp Tue Jul  2 20:21:46 2013
@@ -972,15 +972,8 @@ Symtab::CalculateSymbolSize (Symbol *sym
     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())





More information about the lldb-commits mailing list