Page MenuHomePhabricator

[DWARFYAML] Make the debug_aranges entry optional.
ClosedPublic

Authored by Higuoxing on Jul 30 2020, 2:08 AM.

Details

Summary

This patch makes the 'debug_aranges' entry optional. If the entry is
empty, yaml2obj will only emit the header for it.

Diff Detail

Event Timeline

Higuoxing created this revision.Jul 30 2020, 2:08 AM
Herald added a project: Restricted Project. · View Herald Transcript
Higuoxing requested review of this revision.Jul 30 2020, 2:08 AM
jhenderson added inline comments.Jul 30 2020, 2:23 AM
llvm/tools/obj2yaml/dwarf2yaml.cpp
67

It seems to me like you don't need this vector? Could you do Y.DebugAranges.emplace() to instantiate the vector in this case?

Higuoxing added inline comments.Jul 30 2020, 2:34 AM
llvm/tools/obj2yaml/dwarf2yaml.cpp
67

Actually I do it deliberately here. IMHO, if the parser encounters an error below, debug_aranges entry should keep empty.

In the implementation of adding DWARF support to elf2yaml, the basic idea is that firstly, we try to parse DWARF sections into the "DWARF:" entry, if the parser fails, elf2yaml will consume that error and continue to dump it as raw content. If we don't do it here, the "DWARF:" will have an incomplete section.

Shall we wait for the patch that adds DWARF support to elf2yaml to see if it works?

Seems that some bots are not happy with this patch, I'll look into it.

jhenderson added inline comments.Jul 30 2020, 2:43 AM
llvm/tools/obj2yaml/dwarf2yaml.cpp
67

Thanks for the explanation. What you say makes sense to me.

Higuoxing updated this revision to Diff 281957.Jul 30 2020, 9:24 AM

Add dependency to suppress errors.

This revision is now accepted and ready to land.Jul 31 2020, 1:52 AM
This revision was automatically updated to reflect the committed changes.