[Lldb-commits] [lldb] r360565 - [DWARF] Use sequential integers for the IDs of the SymbolFileDWOs

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Mon May 13 01:58:35 PDT 2019


Author: labath
Date: Mon May 13 01:58:34 2019
New Revision: 360565

URL: http://llvm.org/viewvc/llvm-project?rev=360565&view=rev
Log:
[DWARF] Use sequential integers for the IDs of the SymbolFileDWOs

Summary:
Instead of using the offset of the contained compile unit, we use it's
ID. The goal of this change is two-fold:
- free up space in the user_id_t representation to enable storing the
  debug-info-carrying section (debug_types/debug_info) without
  decreasing the amount of debug info we can address (as would be the
  case with D61503).
- be a step towards supporting DWO files containing more than one unit
  (important for debug_types+dwo, but can also happen with regular
  dwo+lto). For this part to fully work we'd still need to add a way to
  lookup the SymbolFileDWO without going through GetCompileUnitAtIndex,
  but making sure things don't accidentally work because the SymbolFile
  ID is the same as compile unit offset is a step towards that.

Reviewers: JDevlieghere, clayborg, aprantl

Subscribers: mehdi_amini, dexonsmith, tberghammer, jankratochvil, lldb-commits

Differential Revision: https://reviews.llvm.org/D61783

Modified:
    lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
    lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.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=360565&r1=360564&r2=360565&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Mon May 13 01:58:34 2019
@@ -1259,7 +1259,20 @@ SymbolFileDWARF::DecodedUID SymbolFileDW
         debug_map->GetOSOIndexFromUserID(uid));
     return {dwarf, {DW_INVALID_OFFSET, dw_offset_t(uid)}};
   }
-  return {this, {dw_offset_t(uid >> 32), dw_offset_t(uid)}};
+  uint32_t dwarf_id = uid >> 32;
+  dw_offset_t die_offset = uid;
+
+  if (die_offset == DW_INVALID_OFFSET)
+    return {nullptr, DIERef()};
+
+  SymbolFileDWARF *dwarf = this;
+  if (DebugInfo()) {
+    if (DWARFUnit *unit = DebugInfo()->GetUnitAtIndex(dwarf_id)) {
+      if (unit->GetDwoSymbolFile())
+        dwarf = unit->GetDwoSymbolFile();
+    }
+  }
+  return {dwarf, {DW_INVALID_OFFSET, die_offset}};
 }
 
 DWARFDIE

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp?rev=360565&r1=360564&r2=360565&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp Mon May 13 01:58:34 2019
@@ -23,7 +23,7 @@ SymbolFileDWARFDwo::SymbolFileDWARFDwo(O
                                        DWARFUnit *dwarf_cu)
     : SymbolFileDWARF(objfile.get()), m_obj_file_sp(objfile),
       m_base_dwarf_cu(dwarf_cu) {
-  SetID(((lldb::user_id_t)dwarf_cu->GetOffset()) << 32);
+  SetID(((lldb::user_id_t)dwarf_cu->GetID()) << 32);
 }
 
 void SymbolFileDWARFDwo::LoadSectionData(lldb::SectionType sect_type,
@@ -158,6 +158,7 @@ SymbolFileDWARFDwo::GetTypeSystemForLang
 
 DWARFDIE
 SymbolFileDWARFDwo::GetDIE(const DIERef &die_ref) {
-  lldbassert(m_base_dwarf_cu->GetOffset() == die_ref.cu_offset);
+  lldbassert(die_ref.cu_offset == m_base_dwarf_cu->GetOffset() ||
+             die_ref.cu_offset == DW_INVALID_OFFSET);
   return DebugInfo()->GetDIEForDIEOffset(die_ref.die_offset);
 }




More information about the lldb-commits mailing list