This patch adds support for dumping DWARF sections to obj2yaml. The
.debug_aranges section is used to illustrate the basic idea.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Unit Tests
Event Timeline
llvm/tools/obj2yaml/elf2yaml.cpp | ||
---|---|---|
411 | I want to hear suggestions on handling the parsing error here. I think it would be good if we can
$ obj2yaml a.out ... obj2yaml warning: obj2yaml doesn't support parsing the address range table whose segment selector size is not 0.
Sections: - Name: '.debug_aranges' Type: SHT_PROGBITS Content: '01234567890abcdef' Comment: 'obj2yaml doesn't support parsing the address range table whose segment selector size is not 0.' |
llvm/tools/obj2yaml/elf2yaml.cpp | ||
---|---|---|
411 |
I do not think we are emiting warnings when unable to parse a section, but this
I am not sure this is a useful thing to have. At least if it is going to be a comment, it can probably be a real ## 'obj2yaml doesn't support parsing the address range table whose segment selector size is not Content: '01234567890abcdef' but I think it is probably too much and emiting a warning is enough. |
llvm/test/tools/obj2yaml/ELF/DWARF/debug-aranges.yaml | ||
---|---|---|
5 | ||
66 | As the relevant if is an "or" mechanism, we should probably test each field individually, since any one of them should cause the section header to be emitted. You might want to use the -D option combined with the new =<none> default value. | |
155–168 | Seems like with appropriate -D options, you should be able to share this YAML (and maybe the CHECK directives too)? | |
llvm/tools/obj2yaml/elf2yaml.cpp | ||
408–409 | I find this comment a little confusing as is. I have made a suggestion. | |
411 | So for regular ELF sections, we don't emit a warning or print a comment, I believe, so this as-is is probably fine. I could be persuaded that a warning is okay, but I think that's the only thing I'd suggest. @grimar - thoughts? | |
411 |
(Never mind, I wrote this before seeing you'd posted...) |
LGTM. If you want to emit a warning for unparseable contents, you migth want to do it more widely for other sections too, but in a separate patch. Up to you.
llvm/tools/obj2yaml/elf2yaml.cpp | ||
---|---|---|
409 | Always check what I wrote makes sense - I make typos too :) |
Address comments.
llvm/tools/obj2yaml/elf2yaml.cpp | ||
---|---|---|
409 | Oh, I didn't notice it 🤣. Thanks a lot! |