[Lldb-commits] [PATCH] D61783: [DWARF] Use sequential integers for the IDs of the SymbolFileDWOs

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon May 13 01:59:00 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rLLDB360565: [DWARF] Use sequential integers for the IDs of the SymbolFileDWOs (authored by labath, committed by ).
Herald added a project: LLDB.

Changed prior to commit:
  https://reviews.llvm.org/D61783?vs=199007&id=199222#toc

Repository:
  rLLDB LLDB

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D61783/new/

https://reviews.llvm.org/D61783

Files:
  source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp


Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
===================================================================
--- source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -1259,7 +1259,20 @@
         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
Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp
===================================================================
--- source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp
+++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp
@@ -23,7 +23,7 @@
                                        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 @@
 
 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);
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D61783.199222.patch
Type: text/x-patch
Size: 1817 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20190513/e48ab744/attachment.bin>


More information about the lldb-commits mailing list