[PATCH] D85506: [macho2yaml] Refactor the DWARF section dumpers.
Xing GUO via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 7 03:03:20 PDT 2020
Higuoxing added inline comments.
================
Comment at: llvm/tools/obj2yaml/macho2yaml.cpp:153
+ return createStringError(errc::not_supported,
+ "dumping " + SecName + " section is not supported");
+}
----------------
grimar wrote:
> Perhaps we need a test for an unknown debug section to test this?
> E.g. a test for an arbitrary "__debug_foo" that shows that we are able to and actually emit a raw content for it.
The implementation of `yaml2macho` is buggy, we cannot specify the content of a section whose segname is `__DWARF`.
```
if (Sec.segname == "__DWARF") {
if (Sec.sectname == "__debug_str")
Err = emitDebugStr();
else if (Sec.sectname == "__debug_info")
Err = emitDebugInfo();
...
else if (Sec.sectname == "__debug_line")
Err = emitDebugLine();
if (Err)
return Err;
continue; // Emitting the custom content is unreachable.
}
if (Sec.content)
emitContent();
```
So I create a section whose segname is `__FOO` and sectname is `__debug_foo` to bypass the `ec.segname == "__DWARF"` checking.
I also add a test case e) to test dumping a `__debug_aranges` section whose segname is `__FOO`. This is to prove that when the segname isn't `__DWARF` but the sectname starts with `__debug_`, `dumpDebugSection()` is still called.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D85506/new/
https://reviews.llvm.org/D85506
More information about the llvm-commits
mailing list