This is an archive of the discontinued LLVM Phabricator instance.

[llvm-dwarfdump] - Teach tool about few GNU call_sites constants.
ClosedPublic

Authored by grimar on Oct 20 2017, 5:24 AM.

Details

Summary

This teaches tool about following consants: DW_TAG_GNU_call_site, DW_TAG_GNU_call_site_parameter,
DW_AT_GNU_call_site_value, DW_AT_GNU_all_call_sites.

We faced them during investigation of objects produced by GCC in PR34852.
Constants documented here: https://sourceware.org/elfutils/DwarfExtensions

Diff Detail

Event Timeline

grimar created this revision.Oct 20 2017, 5:24 AM
grimar updated this revision to Diff 119649.Oct 20 2017, 5:43 AM
  • Updated to dump DW_AT_GNU_call_site_value exprloc.
aprantl accepted this revision.Oct 20 2017, 10:00 AM

Could you also teach the DWARFVerifier about these attributes?
You might also want to add support for the standardized DWARF 5 version of DW_AT_call_site & friends.

This revision is now accepted and ready to land.Oct 20 2017, 10:00 AM

Could you also teach the DWARFVerifier about these attributes?

Will take a look.

You might also want to add support for the standardized DWARF 5 version of DW_AT_call_site & friends.

I see Dwarf.def file already contains something about this:

HANDLE_DW_TAG(0x0048, call_site, 5, DWARF)
HANDLE_DW_TAG(0x0049, call_site_parameter, 5, DWARF)

I'll take a look if something is missing there.

Thanks !

This revision was automatically updated to reflect the committed changes.
grimar added a comment.EditedOct 24 2017, 5:18 AM

Could you also teach the DWARFVerifier about these attributes?

I committed cleanup for testcase (rL316428). Now it passes -verify without errors.

And tried to investigate what can be needed for DWARFVerifier.
This attributes has following forms:

  1. DW_AT_GNU_all_call_sites, DW_FORM_flag_present
  2. DW_AT_GNU_call_site_value, DW_FORM_exprloc

First one seems does not need anything. DW_FORM_exprloc seems
need some verification, but DW_AT_GNU_call_site_value is already proccessed here (implemented in current patch):
https://github.com/llvm-mirror/llvm/blob/master/lib/DebugInfo/DWARF/DWARFDie.cpp#L238
together with another location expressions. And errors are reported:
https://github.com/llvm-mirror/llvm/blob/master/lib/DebugInfo/DWARF/DWARFExpression.cpp#L259.

Though that happens with -v and not with -verify for some reason. So if I break the expression,
with verbose option I get:

DW_AT_GNU_call_site_value [DW_FORM_exprloc] (DW_OP_lit4, decoding error. 00 00 00 00 00)

But with -verify it reports no any errors. Is it correct ? I would expect verify to report failture.
Its unrelative to my changes though.

Aside from this issue with DW_FORM_exprloc above, It seems nothing else should be done for
these 2 GNU all_call_sites attributes on DWARFVerifier side, am I right ? Should I check something else here ?

Could you also teach the DWARFVerifier about these attributes?

I committed cleanup for testcase (rL316428). Now it passes -verify without errors.

And tried to investigate what can be needed for DWARFVerifier.
This attributes has following forms:

  1. DW_AT_GNU_all_call_sites, DW_FORM_flag_present
  2. DW_AT_GNU_call_site_value, DW_FORM_exprloc

First one seems does not need anything. DW_FORM_exprloc seems
need some verification, but DW_AT_GNU_call_site_value is already proccessed here (implemented in current patch):
https://github.com/llvm-mirror/llvm/blob/master/lib/DebugInfo/DWARF/DWARFDie.cpp#L238
together with another location expressions. And errors are reported:
https://github.com/llvm-mirror/llvm/blob/master/lib/DebugInfo/DWARF/DWARFExpression.cpp#L259.

Though that happens with -v and not with -verify for some reason. So if I break the expression,
with verbose option I get:

DW_AT_GNU_call_site_value [DW_FORM_exprloc] (DW_OP_lit4, decoding error. 00 00 00 00 00)

But with -verify it reports no any errors. Is it correct ? I would expect verify to report failture.
Its unrelative to my changes though.

Aside from this issue with DW_FORM_exprloc above, It seems nothing else should be done for
these 2 GNU all_call_sites attributes on DWARFVerifier side, am I right ? Should I check something else here ?

@JDevlieghere: could you perhaps help @grimar to figure out what is missing here?

@JDevlieghere: could you perhaps help @grimar to figure out what is missing here?

The verifier currently doesn't consider DWARF expressions. I think this should be fairly easy to extend: just iterate over its iterations (as the print function does) and check DWARFExpression::Operation::isError().