This is an archive of the discontinued LLVM Phabricator instance.

[ObjectYAML][ELF] Add support for emitting the .debug_info section.
ClosedPublic

Authored by Higuoxing on Jun 18 2020, 1:15 AM.

Details

Summary

This patch helps add support for emitting the .debug_info section to yaml2elf.

Diff Detail

Event Timeline

Higuoxing created this revision.Jun 18 2020, 1:15 AM
Higuoxing marked an inline comment as done.Jun 18 2020, 1:25 AM
Higuoxing added inline comments.
llvm/test/tools/yaml2obj/ELF/DWARF/debug-info.yaml
457

In order not to bring too much difficulty. The common tests are very similar to the tests in other DWARF sections, except this one. The property of the .debug_abbrev section is overridden as well in this test.

jhenderson added inline comments.Jun 18 2020, 2:28 AM
llvm/test/tools/yaml2obj/ELF/DWARF/debug-info.yaml
191–192

You probably also want Version 4 and testing for different UnitType values.

198

To ensure there are no truncation issues, all these values probably should be the same width as their permissable data could be (e.g. 8 bytes for DW_FORM_data8, 4 for DW_FORM_data4 etc, so 0x1234567890abcdef, 0x12345678 etc).

232

FWIW, DW_FORM_flag_present doesn't have a corresponding value in .debug_info, so maybe you can omit it from here. It probably needs leaving in the .debug_abbrev table though.

457

I'm not sure I follow. What's the point of overriding .debug_abbrev too? It will at least need explaining in a comment.

Higuoxing marked an inline comment as done.Jun 18 2020, 3:23 AM
Higuoxing added inline comments.
llvm/test/tools/yaml2obj/ELF/DWARF/debug-info.yaml
457

I want to test that yaml2obj is still able to overwrite the section header fields of the .debug_abbrev section when the .debug_info section exists. Does it make sense here?

jhenderson added inline comments.Jun 18 2020, 3:54 AM
llvm/test/tools/yaml2obj/ELF/DWARF/debug-info.yaml
457

Is there actually any interaction in the code between the .debug_abbrev and .debug_info header writing? If not, I don't think you need to test the combination.

Higuoxing updated this revision to Diff 271653.Jun 18 2020, 4:07 AM
Higuoxing marked 4 inline comments as done.

Address comments.

Thanks for reviewing!

llvm/test/tools/yaml2obj/ELF/DWARF/debug-info.yaml
457

There is not interaction between the .debug_abbrev and .debug_info except for reading forms from debug_abbrev when generating values. Thanks :-)

jhenderson accepted this revision.Jun 18 2020, 4:23 AM

Thanks, LGTM, but please give a chance for someone else to look.

This revision is now accepted and ready to land.Jun 18 2020, 4:23 AM
grimar accepted this revision.Jun 18 2020, 5:02 AM

I have nothing to add. LGTM.

MaskRay accepted this revision.Jun 18 2020, 3:08 PM
Higuoxing updated this revision to Diff 271896.Jun 18 2020, 7:52 PM

Trying to make pre-merge check bots happy (Seems that there is an index-out-of-range error).

Harbormaster completed remote builds in B60929: Diff 271901.
Higuoxing updated this revision to Diff 272008.Jun 19 2020, 4:27 AM

Add one empty entry to fallible compilation units.
Let's see if pre-merge bots are happy with this change.

This revision was automatically updated to reflect the committed changes.