[Lldb-commits] [lldb] r228264 - Keep the user data for compile units up to date since we often create lldb_private::CompileUnit objects without creating the DWARFCompileUnit objects when we do DWARF in .o files.

Greg Clayton gclayton at apple.com
Wed Feb 4 18:10:29 PST 2015


Author: gclayton
Date: Wed Feb  4 20:10:29 2015
New Revision: 228264

URL: http://llvm.org/viewvc/llvm-project?rev=228264&view=rev
Log:
Keep the user data for compile units up to date since we often create lldb_private::CompileUnit objects without creating the DWARFCompileUnit objects when we do DWARF in .o files.

Now we make sure to update our DWARFCompileUnit -> lldb_private::CompileUnit user data when it isn't set to ensure quick transitions between the two.

<rdar://problem/18371367>

Modified:
    lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp

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=228264&r1=228263&r2=228264&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Wed Feb  4 20:10:29 2015
@@ -893,13 +893,22 @@ SymbolFileDWARF::GetDWARFCompileUnit(lld
             // only 1 compile unit which is at offset zero in the DWARF.
             // TODO: modify to support LTO .o files where each .o file might
             // have multiple DW_TAG_compile_unit tags.
-            return info->GetCompileUnit(0).get();
+            
+            DWARFCompileUnit *dwarf_cu = info->GetCompileUnit(0).get();
+            if (dwarf_cu && dwarf_cu->GetUserData() == NULL)
+                dwarf_cu->SetUserData(comp_unit);
+            return dwarf_cu;
         }
         else
         {
             // Just a normal DWARF file whose user ID for the compile unit is
             // the DWARF offset itself
-            return info->GetCompileUnit((dw_offset_t)comp_unit->GetID()).get();
+
+            DWARFCompileUnit *dwarf_cu = info->GetCompileUnit((dw_offset_t)comp_unit->GetID()).get();
+            if (dwarf_cu && dwarf_cu->GetUserData() == NULL)
+                dwarf_cu->SetUserData(comp_unit);
+            return dwarf_cu;
+
         }
     }
     return NULL;





More information about the lldb-commits mailing list