This is an archive of the discontinued LLVM Phabricator instance.

[llvm-dwarfdump] dump link to the immediate parent.
ClosedPublic

Authored by avl on Nov 8 2021, 8:18 AM.

Details

Summary

It is often useful to know which die is the parent of the current die.
This patch adds information about parent offset into the dump:

0x0000000b: DW_TAG_compile_unit
              DW_AT_producer    ("by_hand")

0x00000014:   DW_TAG_base_type (0x0000000b)  <<<<<<<<<<<<<<
                DW_AT_name      ("int")

Now it is easy to see which die is the parent of the current die.
This patch makes that behaviour to be default.
We can make it to be opt-in if neccessary.

This functionality differs from already existed "--show-parents"
in that sence that parent information is shown for all dies and
only link to the immediate parent is shown.

Diff Detail

Event Timeline

avl created this revision.Nov 8 2021, 8:18 AM
avl requested review of this revision.Nov 8 2021, 8:18 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 8 2021, 8:18 AM
avl edited the summary of this revision. (Show Details)Nov 8 2021, 8:20 AM

I'd rather see this as part of Verbose. The DIEs are indented to show nesting already, so the explicit parent offset is really additional information.

avl updated this revision to Diff 385602.Nov 8 2021, 12:51 PM

addressed comment(move dumping under Verbose).

This revision is now accepted and ready to land.Nov 8 2021, 2:03 PM
jhenderson added inline comments.Nov 9 2021, 12:25 AM
llvm/test/tools/llvm-dwarfdump/X86/parent_link.s
1 ↗(On Diff #385602)

Perhaps call the test parent-offset.test or parent-offset.yaml.

  1. Underscores are annoying to type - prefer - where possible.
  2. This test doesn't contain assembly, so use .test or .yaml instead.
  3. offset in the name is more explicit. I might even suggest tag-parent-offset.yaml might be especially clear.
4–7 ↗(On Diff #385602)

Personal preference: use ## for comments in new tests, to distinguish the comments from the lit and FileCheck directives.

11 ↗(On Diff #385602)

I'd suggest adding one sibling and one additional child tag (child of DW_TAG_base_type or the new sibling), to show the variation in the parent offset.

avl updated this revision to Diff 385722.Nov 9 2021, 12:42 AM

addressed comments(renamed test, added child)

avl updated this revision to Diff 385723.Nov 9 2021, 12:46 AM

addressed comments(renamed test, added child)

This revision was automatically updated to reflect the committed changes.