[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 9 07:14:05 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:

```suggestion
  auto binary = llvm::object::XCOFFObjectFile::create(
```

And then you don't need the dyn_cast below. (You do need to make the create function public, but I don't think that should be controversial given that it's already public for all other object file types)

https://github.com/llvm/llvm-project/pull/116338


More information about the lldb-commits mailing list