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>

llvm-svn: 228264
This commit is contained in:
Greg Clayton 2015-02-05 02:10:29 +00:00
parent 17177d1e84
commit 68c00bd205
1 changed files with 11 additions and 2 deletions

View File

@ -893,13 +893,22 @@ SymbolFileDWARF::GetDWARFCompileUnit(lldb_private::CompileUnit *comp_unit)
// 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;