This is an archive of the discontinued LLVM Phabricator instance.

[DebugInfo] Allow GNU macro extension to be read
ClosedPublic

Authored by dstenb on Jul 1 2020, 8:53 AM.

Details

Summary

Allow the GNU .debug_macro extension to be parsed and printed by
llvm-dwarfdump. In an upcoming patch support will be added for emitting
that format also.

Diff Detail

Event Timeline

dstenb created this revision.Jul 1 2020, 8:53 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 1 2020, 8:53 AM
dblaikie accepted this revision.Jul 1 2020, 1:37 PM
dblaikie added inline comments.
llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
3055–3059 ↗(On Diff #274832)

I'd probably inline the lambda into the call expression - it's short/simple enough.

llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h
535 ↗(On Diff #274832)

Probably llvm::function_ref here, since the functor doesn't escape the callee

This revision is now accepted and ready to land.Jul 1 2020, 1:37 PM
ikudrin added inline comments.Jul 2 2020, 12:10 AM
llvm/lib/DebugInfo/DWARF/DWARFDebugMacro.cpp
57

If this is written like

<< (Macros.Header.Version < 5 ? GnuMacroString(E.type) : MacroString(E.type)) ;

then llvm::dwarf::MacroString() can be left as is and most of the changes are not needed.

dstenb updated this revision to Diff 275749.Jul 6 2020, 9:56 AM
dstenb marked 3 inline comments as done.

Address comments.

llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
3055–3059 ↗(On Diff #274832)

This change is now removed. I'll inline the expression in the follow-up patch.

llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h
535 ↗(On Diff #274832)

Yes, thanks! Since I moved out the GNU defines to a separate GnuMacroString() function this change is done in the patch which introduces emission of the extension.

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

Yes, thanks! Since there are so few uses where we conditionally want to select either the DWARF or GNU defines that seems cleaner.

This revision was automatically updated to reflect the committed changes.