[Lldb-commits] [lldb] r153361 - in /lldb/trunk/source/Plugins/SymbolFile/DWARF: SymbolFileDWARFDebugMap.cpp SymbolFileDWARFDebugMap.h

Sean Callanan scallanan at apple.com
Fri Mar 23 17:43:18 PDT 2012


Author: spyffe
Date: Fri Mar 23 19:43:18 2012
New Revision: 153361

URL: http://llvm.org/viewvc/llvm-project?rev=153361&view=rev
Log:
<rdar://problem/11101372>

We now reject binaries built with LTO and print
an error, rather than crashing later while trying
to parse them.

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

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=153361&r1=153360&r2=153361&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp Fri Mar 23 19:43:18 2012
@@ -162,7 +162,7 @@
 Module *
 SymbolFileDWARFDebugMap::GetModuleByCompUnitInfo (CompileUnitInfo *comp_unit_info)
 {
-    if (comp_unit_info->oso_module_sp.get() == NULL)
+    if (comp_unit_info->oso_module_sp.get() == NULL && comp_unit_info->symbol_file_supported)
     {
         Symbol *oso_symbol = comp_unit_info->oso_symbol;
         if (oso_symbol)
@@ -258,7 +258,7 @@
 SymbolFileDWARF *
 SymbolFileDWARFDebugMap::GetSymbolFileByCompUnitInfo (CompileUnitInfo *comp_unit_info)
 {
-    if (comp_unit_info->oso_symbol_vendor == NULL)
+    if (comp_unit_info->oso_symbol_vendor == NULL && comp_unit_info->symbol_file_supported)
     {
         ObjectFile *oso_objfile = GetObjectFileByCompUnitInfo (comp_unit_info);
 
@@ -273,6 +273,18 @@
                 // that the DWARF is being used along with a debug map and that
                 // it will have the remapped sections that we do below.
                 SymbolFileDWARF *oso_symfile = (SymbolFileDWARF *)comp_unit_info->oso_symbol_vendor->GetSymbolFile();
+                
+                if (oso_symfile->GetNumCompileUnits() != 1)
+                {
+                    oso_symfile->GetObjectFile()->GetModule()->ReportError ("DWARF for object file '%s' contains multiple translation units!",
+                                                                            oso_symfile->GetObjectFile()->GetFileSpec().GetFilename().AsCString());
+                    comp_unit_info->symbol_file_supported = false;
+                    comp_unit_info->oso_module_sp.reset();
+                    comp_unit_info->oso_compile_unit_sp.reset();
+                    comp_unit_info->oso_symbol_vendor = NULL;
+                    return NULL;
+                }
+                
                 oso_symfile->SetDebugMapSymfile(this);
                 // Set the ID of the symbol file DWARF to the index of the OSO
                 // shifted left by 32 bits to provide a unique prefix for any
@@ -469,7 +481,7 @@
 
     if (cu_idx < cu_count)
     {
-        if (m_compile_unit_infos[cu_idx].oso_compile_unit_sp.get() == NULL)
+        if (m_compile_unit_infos[cu_idx].oso_compile_unit_sp.get() == NULL && m_compile_unit_infos[cu_idx].symbol_file_supported)
         {
             SymbolFileDWARF *oso_dwarf = GetSymbolFileByOSOIndex (cu_idx);
             if (oso_dwarf)

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h?rev=153361&r1=153360&r2=153361&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h Fri Mar 23 19:43:18 2012
@@ -142,6 +142,7 @@
         std::vector<uint32_t> function_indexes;
         std::vector<uint32_t> static_indexes;
         STD_SHARED_PTR(lldb_private::SectionList) debug_map_sections_sp;
+        bool symbol_file_supported;
 
         CompileUnitInfo() :
             so_file (),
@@ -155,7 +156,8 @@
             oso_symbol_vendor (NULL),
             function_indexes (),
             static_indexes (),
-            debug_map_sections_sp ()
+            debug_map_sections_sp (),
+            symbol_file_supported (true)
         {
         }
     };





More information about the lldb-commits mailing list