[Lldb-commits] [lldb] [lldb] Tolerate multiple compile units with the same DWO ID (PR #100577)

Greg Clayton via lldb-commits lldb-commits at lists.llvm.org
Fri Jul 26 10:34:19 PDT 2024


================
@@ -97,12 +97,14 @@ void DWARFUnit::ExtractUnitDIEIfNeeded() {
         *m_dwo_id, m_first_die.GetOffset()));
     return; // Can't fetch the compile unit from the dwo file.
   }
-  // If the skeleton compile unit gets its unit DIE parsed first, then this
-  // will fill in the DWO file's back pointer to this skeleton compile unit.
-  // If the DWO files get parsed on their own first the skeleton back link
-  // can be done manually in DWARFUnit::GetSkeletonCompileUnit() which will
-  // do a reverse lookup and cache the result.
-  dwo_cu->SetSkeletonUnit(this);
+
+  // Link the DWO unit to this object, if it hasn't been linked already (this
+  // can happen when we have an index, and the DWO unit is parsed first).
+  if (!dwo_cu->LinkToSkeletonUnit(*this)) {
+    SetDwoError(Status::createWithFormat(
+        "multiple compile units with Dwo ID {0:x16}", *m_dwo_id));
----------------
clayborg wrote:

Can we detect these empty .dwo files and not warn if they contain no data? Detection would probably need to be done in `LinkToSkeletonUnit(...)` and it can return true if it detects two .dwo files being linked that are both empty?  Not sure if this will help stop errors from being displayed in cases where it doesn't matter?

https://github.com/llvm/llvm-project/pull/100577


More information about the lldb-commits mailing list