This is an archive of the discontinued LLVM Phabricator instance.

[Debug-Info] [llvm-dwarfdump] Don't use DW_FORM_data4/8 to encode the constants for DW_AT_data_member_location.
ClosedPublic

Authored by Esme on Jul 9 2021, 2:35 AM.

Details

Summary

This patch comes from D105469.
In DWARF2/3, the DW_FORM_data4/8 in DW_AT_data_member_location must be interpreted as location-list pointers.
In this patch, we use DW_FORM_udata instead of DW_FORM_data4/8 to encode the constants of DW_AT_data_member_location in DWARF3.

Diff Detail

Event Timeline

Esme created this revision.Jul 9 2021, 2:35 AM
Esme requested review of this revision.Jul 9 2021, 2:35 AM
Herald added a project: Restricted Project. · View Herald Transcript
probinson added a comment.EditedJul 21 2021, 7:57 AM

Sorry for the slow response, I will try to be better about it.

With the test case being an asm file, what it is actually testing is how llvm-dwarfdump displays the DWARF that is explicitly given in the .s file. However, your patch changes how the DWARF is emitted. Really what you should have here is an IR (.ll) file, which you compile to an object with llc. Then you can use llvm-dwarfdump to verify what the backend produces from now on, instead of what it produced one time (when the .s file was created).

Also the test should be in CodeGen, not tools/llvm-dwarfdump, because you are testing the code generator not dwarfdump.

llvm/test/tools/llvm-dwarfdump/ELF/formclass3-atmemloc.s
9 ↗(On Diff #357449)

Eliminate function foo() and replace it with e E; to make the test case much shorter.

14 ↗(On Diff #357449)

Add -v to the llvm-dwarfdump options, and that will allow you to verify the FORM directly.

probinson added inline comments.Jul 21 2021, 8:35 AM
llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
1622

We try to be consistent in how we refer to DWARF versions in commentary; so please replace DWARF3 with DWARF v3.

Esme updated this revision to Diff 360738.Jul 22 2021, 2:16 AM

Address comments.

probinson accepted this revision.Jul 22 2021, 6:25 AM

One comment tweak needed, and LGTM.

llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
1624

"Interpreting constants as pointers..."

This revision is now accepted and ready to land.Jul 22 2021, 6:25 AM
This revision was landed with ongoing or failed builds.Jul 25 2021, 8:47 PM
This revision was automatically updated to reflect the committed changes.