[Lldb-commits] [PATCH] D42870: Correct recognition of NetBSD images

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Feb 5 04:33:24 PST 2018

labath added a comment.

Extending lldb-test's dumpModules() to also dump out the module's triple sounds like a reasonable thing to do (I am assuming that the Module class will do something reasonable when given an object file with no sections, like a core file -- if not we could make a separate command for dumping this out).

However, the tricky part here is the obj2yaml idea. Right now obj2yaml support for program headers is virtually non-existent. obj2yaml just ignores them, and yaml2obj only has basic support for PT_LOAD segments (and even here it assumes that their contents is backed by actual sections, which is not the case for core files). So, I don't think you can use yaml2obj here without some serious work to make it support this use case (which would be an awesome feature, but not exactly a trivial job...).

Comment at: source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp:1367
+      // Set the elf OS version to NetBSD.  Also clear the vendor.
+      arch_spec.GetTriple().setOSName(os_name);
+      arch_spec.GetTriple().setVendor(llvm::Triple::VendorType::UnknownVendor);
Let's avoid c string functions where possible. This could be `setOSName(llvm::formatv("netbsd{0}.{1}.{2}", major, minor, patch).str())`



More information about the lldb-commits mailing list