This is an archive of the discontinued LLVM Phabricator instance.

[llvm-dwarfdump] Display DW_AT_high_pc as absolute value
ClosedPublic

Authored by JDevlieghere on Nov 21 2017, 9:58 AM.

Details

Summary

DWARF4 relative DW_AT_high_pc values are now displayed as their absolute
address. The relative value is only shown when displayed with
-show-form (-F).

DW_AT_low_pc	(0x0000000000000049)
DW_AT_high_pc	(0x00000019)

becomes

DW_AT_low_pc	(0x0000000000000049)
DW_AT_high_pc	(0x0000000000000062)

Diff Detail

Repository
rL LLVM

Event Timeline

JDevlieghere created this revision.Nov 21 2017, 9:58 AM
probinson edited edge metadata.Nov 21 2017, 6:42 PM

I'm not seeing a test that -show-form actually affects how DW_AT_high_pc is displayed.

test/tools/llvm-dwarfdump/X86/verify_debug_info.s
13

So, the DIE that has the error gets printed with forms, but not in -show-form mode? Is that why high_pc is still displayed as 8 bytes instead of 4?

  • Don't print address with -verbose
JDevlieghere marked an inline comment as done.Nov 22 2017, 5:44 AM
JDevlieghere added inline comments.
test/tools/llvm-dwarfdump/X86/verify_debug_info.s
13

I didn't account for the fact that the form encoding was also printed in -verbose mode. I've updated the diff and test to make this consistent with -show-form mode, so that if the form is printed we get the 4-byte offset rather than the 8-byte address.

Still needs a test demonstrating that -F affects the display of the high_pc value. This is probably the only case where -F does more than display the form.

JDevlieghere marked an inline comment as done.
  • Update form.test to check we don't print the address in verbose and show-form mode.
dblaikie accepted this revision.Nov 25 2017, 12:12 PM

Happy to hear from Adrian and Paul if this doesn't seem like the right direction - but can be handled post-commit too.

Just the change from getHighAndLow to getHigh, I think.

lib/DebugInfo/DWARF/DWARFDie.cpp
241

It seems unfortunate that this searches for the low pc when we already have the form/attribute in formValue.

What happens if a buggy DIE has two LowPCs? This might erroneously print the same one twice? (I assume DWARF supports, in general, multiple instances of the same attribute in a DIE? or is that buggy enough to have been detected earlier?)

This revision is now accepted and ready to land.Nov 25 2017, 12:12 PM

Happy to hear from Adrian and Paul if this doesn't seem like the right direction - but can be handled post-commit too.

Just the change from getHighAndLow to getHigh, I think.

My comments here were a bit out of date, wrote them before this had been reviewed/signed off by others.

Also before I thought about it and realized getHigh needs the low first, etc...

probinson added inline comments.Nov 27 2017, 8:11 AM
lib/DebugInfo/DWARF/DWARFDie.cpp
241

You can't repeat the same attribute in the same DIE, that's invalid DWARF. I don't know whether the verifier checks for that.

This revision was automatically updated to reflect the committed changes.