This is an archive of the discontinued LLVM Phabricator instance.

DWARFVerifier: validate information in name index entries
ClosedPublic

Authored by labath on Apr 5 2018, 7:44 AM.

Details

Summary

This patch add checks to verify that the information in the name index
entries is consistent with the debug_info section. Specifically, we
check that entries point to valid DIEs, and their names, tags, and
compile units match the information in the debug_info sections.

These checks are only run if the previous checks did not find any errors
in the name index headers. Attempting to proceed with the checks anyway
would likely produce a lot of spurious errors and the verification code
would need to be very careful to avoid crashing.

I also add a couple of more checks to the abbreviation-validation code
to verify that some attributes are always present (an index without a
DW_IDX_die_offset attribute is fairly useless).

The entry verification works only on indexes without any type units - I
haven't attempted to extend it to type units, as we don't even have a
DWARF v5-compatible type unit generator at the moment.

Diff Detail

Repository
rL LLVM

Event Timeline

labath created this revision.Apr 5 2018, 7:44 AM
JDevlieghere accepted this revision.Apr 6 2018, 5:54 AM

LGTM

lib/DebugInfo/DWARF/DWARFVerifier.cpp
1004 ↗(On Diff #141154)

Should we somehow inform the users of this? Either with a note or even a warning?

This revision is now accepted and ready to land.Apr 6 2018, 5:54 AM
labath added inline comments.Apr 6 2018, 6:29 AM
lib/DebugInfo/DWARF/DWARFVerifier.cpp
1004 ↗(On Diff #141154)

Good point. I'll add a warning.

This revision was automatically updated to reflect the committed changes.