[llvm] [TOOLS][DWARFDUMP][DWARF] Print full DIE offset for a CU or local TU (PR #121877)

Greg Clayton via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 10 11:12:27 PST 2025


================
@@ -732,7 +732,19 @@ void DWARFDebugNames::Entry::dump(ScopedPrinter &W) const {
       dumpParentIdx(W, FormValue);
     else
       FormValue.dump(W.getOStream());
-    W.getOStream() << '\n';
+
+    if (Index != dwarf::Index::DW_IDX_die_offset) {
+      W.getOStream() << '\n';
+      continue;
+    }
+
+    if (const std::optional<uint64_t> DieOfset = getDIEUnitOffset()) {
+      if (getForeignTUTypeSignature())
+        continue;
+      const std::optional<uint64_t> TUOffset = getLocalTUOffset();
+      const uint64_t CUTUOffset = TUOffset ? *TUOffset : *getRelatedCUOffset();
----------------
clayborg wrote:

This will display incorrect information for split DWARF as `getRelatedCUOffset()` will return the DIE offset of the skeleton compile unit, not the actual compile unit in the .dwo or .dwp file. So we will need to get the CU at `getRelatedCUOffset()` and check if it is a skeleton compile unit, and if it is, we can try to get the non skeleton compile unit, and get _its_ offset. We could do the same for foreign type units. So compile units that are in split DWARF are similar to foreign type units.

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


More information about the llvm-commits mailing list