[Lldb-commits] [lldb] [lldb][AIX] Header Parsing for XCOFF Object File in AIX (PR #116338)
Pavel Labath via lldb-commits
lldb-commits at lists.llvm.org
Mon Dec 16 03:21:11 PST 2024
================
@@ -81,9 +79,44 @@ ObjectFile *ObjectFileXCOFF::CreateInstance(const lldb::ModuleSP &module_sp,
if (!objfile_up)
return nullptr;
+ // Cache xcoff binary.
+ if (!objfile_up->CreateBinary())
+ return nullptr;
+
+ if (!objfile_up->ParseHeader())
+ return nullptr;
+
return objfile_up.release();
}
+bool ObjectFileXCOFF::CreateBinary() {
+ if (m_binary)
+ return true;
+
+ Log *log = GetLog(LLDBLog::Object);
+
+ auto binary = llvm::object::XCOFFObjectFile::createObjectFile(
----------------
labath wrote:
Ok, I see the problem now. I probably wouldn't go about this by changing the general `Binary` class, but rather `XCOFFObjectFile`. There are a couple of options, but I'd probably go with splitting the `create` function into two `create32|64` -- and then have that pass the right constant internally. This should also line up well with how the rest of this class is implemented (separate accessors for different bitwidths and all).
This is something we could consult with the maintainer of the llvm class. Do you know who that is? It seems @diggerlin wrote most of the code -- do you have any thoughts on this?
If that doesn't pan out for some reason, then I'd at least change this code to `llvm::object::ObjectFile::createObjectFile` -- as that's the function you're really calling. (The whole reason why I started looking into this is because I was wondering why *XCOFF*ObjectFile::createObjectFile does not return an result of type XCOFFObjectFile)
https://github.com/llvm/llvm-project/pull/116338
More information about the lldb-commits
mailing list