This is an archive of the discontinued LLVM Phabricator instance.

[llvm-dwarfdump] Hide .debug_str and die reference offsets in brief mode
ClosedPublic

Authored by JDevlieghere on Aug 17 2017, 8:44 AM.

Details

Summary
  • Hide .debug_str offset
  • Hide offset into the CU of a die reference

Before:

0x0000002a:   DW_TAG_subprogram
                DW_AT_low_pc    (0x0000000100000fb0)
                DW_AT_high_pc   (0x00000008)
                DW_AT_frame_base        (<0x1> 56 )
                DW_AT_name      ( .debug_str[0x00000056] = "main")
                DW_AT_decl_file ("/Users/jonas/llvm/brief/a.c")
                DW_AT_decl_line (1)
                DW_AT_type      (cu + 0x0043 => {0x00000043})
                DW_AT_external  (true)

After:

0x0000002a:   DW_TAG_subprogram
                DW_AT_low_pc    (0x0000000100000fb0)
                DW_AT_high_pc   (0x00000008)
                DW_AT_frame_base        (<0x1> 56 )
                DW_AT_name      ( .debug_str = "main")
                DW_AT_decl_file ("/Users/jonas/llvm/brief/a.c")
                DW_AT_decl_line (1)
                DW_AT_type      (cu + 0x0043)
                DW_AT_external  (true)

Diff Detail

Repository
rL LLVM

Event Timeline

JDevlieghere created this revision.Aug 17 2017, 8:44 AM
aprantl added inline comments.Aug 17 2017, 9:30 AM
llvm/lib/DebugInfo/DWARF/DWARFFormValue.cpp
487 ↗(On Diff #111524)

I think we might even want to drop the .debug_str = part. What does Darwin's dwarfdump do in comparison?

aprantl edited edge metadata.Aug 17 2017, 9:30 AM

Also, could you please add a testcase? You can probably reuse the input from one of the existing testcases.

JDevlieghere marked an inline comment as done.
  • Hide .debug_str = part as well
  • Update test case

I had to generate new assembly because the current test didn't have a DIE reference. I hope this is alright?

aprantl accepted this revision.Aug 18 2017, 2:28 PM
This revision is now accepted and ready to land.Aug 18 2017, 2:28 PM
This revision was automatically updated to reflect the committed changes.
dblaikie added inline comments.
llvm/trunk/test/tools/llvm-dwarfdump/X86/brief.s
7–10

It's probably worth having a positive test for what the string printing looks like in brief mode? I know it was mentioned in the patch description, but it was revised before committing & I was curious to see how it actually prints out now.

FWIW, I'd think we might want to drive towards printing something as simple as:

compile_unit
  name: "foo"

(ie: dropping as much of the ()[]{} sort of stuff as possible, and dropping the DW_*_ prefixes too - since they're unambiguous as to what's a DW_TAG, DW_AT, DW_OP, etc, based on context)

Hi Dave,

The positive tests have been committed as part of D37334 because I had to change the test anyway. Let me know if you think something is still missing!

With regards to dropping the prefixes, I talked to Adrian and he makes a pretty good argument in favor of keeping them. Maybe this is something to discuss on the mailing list as an NFC? I've had a look and implementing this should be relatively straightforward so it really boils down to whether we want to do this or not.