This is an archive of the discontinued LLVM Phabricator instance.

llvm-dwarf-dump: include type name for AT_containing_type
ClosedPublic

Authored by fdeazeve on Jun 5 2022, 8:13 PM.

Details

Summary

Type attributes are currently printed as:

DW_AT_type    (<address> "<name>")

For example:

DW_AT_type    (0x00000086 "double")

However, containing_type attributes omit the name, for example:

DW_AT_containing_type    (0x00000086)

In order to make the dwarf dumps easier to read, and to have consistency
between the type-like attributes, this commit changes the way
DW_AT_containing_type is printed so that it includes the name of the
type it refers to:

DW_AT_containing_type    (0x00000086 "double")

Diff Detail

Unit TestsFailed

Event Timeline

fdeazeve created this revision.Jun 5 2022, 8:13 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 5 2022, 8:13 PM
Herald added a subscriber: hiraditya. · View Herald Transcript
fdeazeve requested review of this revision.Jun 5 2022, 8:13 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 5 2022, 8:13 PM

Is this something desirable? I did it because, while learning about DWARF, I found myself constantly having to bounce between nodes when inspecting these containing_type attributes.
I'd be happy to drop this if others don't feel it is needed.

W.r.t. testing I was a bit surprised that no tests under test/tools/llvm-dwarfdump failed, but this seems to be covered by DebugInfo tests. Please let me know if I missed a more appropriate test.

fdeazeve added a reviewer: dblaikie.

The test timeouts seem to be happening on unrelated tests. Has anyone seen this before?

dblaikie accepted this revision.Jun 6 2022, 4:45 PM

Sounds good to me - is there any canonical list in the DWARF spec of attributes that are types that we should consider? Or should we change this to work based on the type of the DIE being referenced, instead of the attribute doing the referencing?

This revision is now accepted and ready to land.Jun 6 2022, 4:45 PM

Sounds good to me - is there any canonical list in the DWARF spec of attributes that are types that we should consider?

I'm not aware of any list of "attributes that point to types" and I think DW_AT_type/DW_AT_containing_type covers the interesting cases. I skimmed the list of all attributes (DWARF v5 section 7.5.4) and nothing obvious caught my eye.

Or should we change this to work based on the type of the DIE being referenced, instead of the attribute doing the referencing?

That would catch cases like DW_AT_sibling, if the sibling just happened to be a type, and I don't think that's really useful. (I know LLVM doesn't emit DW_AT_sibling, but it's still out there in the wild and the dumper needs to handle it.)

I'm fine with this patch as is.

I'm not aware of any list of "attributes that point to types" and I think DW_AT_type/DW_AT_containing_type covers the interesting cases. I skimmed the list of all attributes (DWARF v5 section 7.5.4) and nothing obvious caught my eye.

That was my conclusion as well!

Or should we change this to work based on the type of the DIE being referenced, instead of the attribute doing the referencing?

That would catch cases like DW_AT_sibling, if the sibling just happened to be a type, and I don't think that's really useful. (I know LLVM doesn't emit DW_AT_sibling, but it's still out there in the wild and the dumper needs to handle it.)

Thanks for the checking, this is all new to me and I wasn't sure about the answer here.

I'll rebase and give these tests that timeout another try. If nobody else comments in a few days, would one of you be able to help me land this? I don't have commit privileges.

This revision was landed with ongoing or failed builds.Jun 17 2022, 5:52 PM
This revision was automatically updated to reflect the committed changes.

The failures above have shown up in the build bots. I'll try to reproduce again with a different build config

The subsequent build passed and I couldn't reproduce the timeouts locally, so I am assuming there is something intermittent going on?

Failing: https://lab.llvm.org/buildbot/#/builders/8/builds/3159
Passed: https://lab.llvm.org/buildbot/#/builders/8/builds/3160

The subsequent build passed and I couldn't reproduce the timeouts locally, so I am assuming there is something intermittent going on?

Failing: https://lab.llvm.org/buildbot/#/builders/8/builds/3159
Passed: https://lab.llvm.org/buildbot/#/builders/8/builds/3160

Timeout failures for environmental reasons are not uncommon, if the next run passes there is nothing to worry about.