This is an archive of the discontinued LLVM Phabricator instance.

[DWARF5] Added support for DW_MACRO_import form in llvm-dwarfdump..
ClosedPublic

Authored by SouraVX on Apr 13 2020, 12:25 AM.

Details

Summary

GCC emits this new form along with others forms(supported in llvm-dwardump) and since it's support was missing in llvm-dwarfdump, it was not able to correctly dump the content a debug_macro section for GCC generated binaries.

This patch extends llvm-dwarfdump to support this form, now GCC generated debug_macro section can be correctly dumped using llvm-dwarfdump.

Diff Detail

Event Timeline

SouraVX created this revision.Apr 13 2020, 12:25 AM
dblaikie accepted this revision.Apr 14 2020, 9:42 AM

Sounds good - though I'm curious: under what conditions does GCC use this feature?

llvm/lib/DebugInfo/DWARF/DWARFDebugMacro.cpp
73

Use lowercase to match the other/surrounding format

This revision is now accepted and ready to land.Apr 14 2020, 9:42 AM
SouraVX marked an inline comment as done.Apr 14 2020, 11:28 AM

Seems like GCC packs up the compiler(CU unit defined macros) defined in a macro unit then import it -- I'll check if there's any benefit from this, probably put a patch or two in llvm.
.debug_macro contents:
0x00000000:
macro header: version = 0x0005, flags = 0x02, debug_line_offset = 0x0000
DW_MACRO_import - import offset: 0x0000001a
0x0000001a:
macro header: version = 0x0005, flags = 0x00
DW_MACRO_define_strp - lineno: 0 macro: STDC 1
DW_MACRO_define_strp - lineno: 0 macro: STDC_VERSION 201112L
DW_MACRO_define_strp - lineno: 0 macro: STDC_UTF_16 1
DW_MACRO_define_strp - lineno: 0 macro: STDC_UTF_32 1

This revision was automatically updated to reflect the committed changes.