This is an archive of the discontinued LLVM Phabricator instance.

DebugInfo: Rebuild dwp debug_info index column from v5 indexes more robustly
ClosedPublic

Authored by dblaikie on Mar 22 2023, 2:32 PM.

Details

Summary

the v4 rebuilding is a best-effort because it's not possible to reliably
parse the DWO ID as it requires the abbrev section (& if the index isn't
trustworthy then there's no way to find the associated abbrev section
contribution for a given info section contribution)

But in v5 the DWO ID/type signature is in the header and can be rebuilt
losslessly (only at the cost of performance of rescanning/parsing the
headers of all the units), so let's implement that.

the testing isn't /ideal/ - I think the testing should've been
implemented as a hardcoded dwp file with a corrupted/incorrect index,
then the test could've demonstrated that reparsing the index produces
the right answer - but this is a quick port of the existing v5 test back
to v4 so that we don't lose coverage on the v4 codepath now that it's
separated from the v5 codepath.

Diff Detail

Event Timeline

dblaikie created this revision.Mar 22 2023, 2:32 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 22 2023, 2:32 PM
dblaikie requested review of this revision.Mar 22 2023, 2:32 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 22 2023, 2:32 PM
ayermolo added inline comments.Mar 22 2023, 3:59 PM
llvm/test/tools/llvm-dwp/X86/cu_tu_units_manual_v4.s
2

should this be DWARF4?

dblaikie updated this revision to Diff 507886.Mar 23 2023, 2:35 PM

fix DWARF5 reference to DWARF4 for the test case

dblaikie marked an inline comment as done.Mar 23 2023, 2:36 PM
dblaikie added inline comments.
llvm/test/tools/llvm-dwp/X86/cu_tu_units_manual_v4.s
2

Yep, done - thanks!

ayermolo accepted this revision.Mar 28 2023, 11:49 AM

Sorry missed update.
Minor question, but LGTM.
Thank you for adding DWARF5 handling.

llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
880

Would printing out signature make it easier to find offending entry?

This revision is now accepted and ready to land.Mar 28 2023, 11:49 AM
This revision was landed with ongoing or failed builds.Mar 28 2023, 1:47 PM
This revision was automatically updated to reflect the committed changes.
dblaikie marked an inline comment as done.
dblaikie added inline comments.Mar 28 2023, 1:47 PM
llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
880

Yeah, thanks for the catch! & rephrased a couple of the errors to say "unit" rather than "CU" since this applies to type units too.