[PATCH] D137657: [DWARFLibrary] Add support to re-construct cu-index

David Blaikie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 8 18:18:32 PST 2022


dblaikie added inline comments.


================
Comment at: llvm/lib/DebugInfo/DWARF/DWARFContext.cpp:819-820
+      // to do anything.
+      if (Header.getVersion() == 4 && type == IndexType::TUIndex)
+        break;
+
----------------
I'm a bit more worried about implementing this for DWARFv4 due to needing to rebuild .debug_abbrev sections together, which is less reliable/guaranteed (there's no guarantee that the abbrev contributions are written in the same order as the .debug_info sections - though it's the case in reality I guess) than .debug_info parsing.

Any chance this workaround can be restricted to only DWARFv5?


================
Comment at: llvm/lib/DebugInfo/DWARF/DWARFUnitIndex.cpp:188-199
+  // Populating offsets and length for .debug-info.dwo section if we parsed it
+  // manually.
+  for (unsigned i = 0; !SignatureMap.empty() && i != Header.NumUnits; ++i) {
     auto *Contrib = Contribs[i];
-    for (unsigned i = 0; i != Header.NumColumns; ++i)
-      Contrib[i].Offset = IndexData.getU32(&Offset);
+    auto Iter = SignatureMap.find(Signatures[i]);
+    if (Iter == SignatureMap.end()) {
+      llvm::errs() << "Signature not found\n";
----------------
Could we put this after the old table reading code (& then the old code wouldn't need to be modified - yeah, it'd read the corrupted values, but they'd be overwritten afterwards anyway)? Might be a smaller change?


================
Comment at: llvm/lib/DebugInfo/DWARF/DWARFUnitIndex.cpp:202
+  auto PopulateField =
+      [&](uint32_t DWARFUnitIndex::Entry::SectionContribution::*Field) -> void {
+    for (unsigned i = 0; i != Header.NumUnits; ++i) {
----------------



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137657



More information about the llvm-commits mailing list