This is an archive of the discontinued LLVM Phabricator instance.

[DWARF] Added verification check for die ranges. If highPC is an address, then it should be greater or equal to lowPC for each range.
ClosedPublic

Authored by sgravani on Jul 21 2017, 1:30 PM.

Event Timeline

sgravani created this revision.Jul 21 2017, 1:30 PM
aprantl accepted this revision.Jul 21 2017, 3:19 PM

Seems reasonable, thanks!

lib/DebugInfo/DWARF/DWARFVerifier.cpp
148

extra whitespace

This revision is now accepted and ready to land.Jul 21 2017, 3:19 PM
dblaikie added inline comments.Jul 21 2017, 3:30 PM
lib/DebugInfo/DWARF/DWARFVerifier.cpp
218

Should this be >=? Or is it intentional that empty ranges are allowed to account for things like comdat functions being omitted by the linker & resolving the addresses to zero? (I forget exactly how those work)

aprantl added inline comments.Jul 21 2017, 3:39 PM
lib/DebugInfo/DWARF/DWARFVerifier.cpp
218

I assume that this is just copying darwin-dwarfdump behavior, but it also looks like DWARF allows a single DW_AT_low_pc to be attached to a DW_TAG_label, which would then show up as an entity of size 0. (cf. 2.17.1 Single Address)

aprantl added inline comments.Jul 21 2017, 3:42 PM
lib/DebugInfo/DWARF/DWARFVerifier.cpp
218

... and DW_TAG_label is commonly generated from assembler sources.

This revision was automatically updated to reflect the committed changes.
sgravani marked 2 inline comments as done.
sgravani added inline comments.Jul 24 2017, 2:06 PM
lib/DebugInfo/DWARF/DWARFVerifier.cpp
218

Yes, it should be >= since the case that Adrian describes won't have a highPC attribute to start with.
Thanks!