[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
Tue Dec 10 04:27:53 PST 2024
================
@@ -98,9 +98,20 @@ class ObjectFileXCOFF : public lldb_private::ObjectFile {
const lldb::ProcessSP &process_sp, lldb::addr_t header_addr);
protected:
+ typedef struct llvm::object::XCOFFFileHeader64 xcoff_header_t;
+
+ typedef struct llvm::object::XCOFFAuxiliaryHeader64 xcoff_aux_header_t;
+
static lldb::WritableDataBufferSP
MapFileDataWritable(const lldb_private::FileSpec &file, uint64_t Size,
uint64_t Offset);
+
+private:
+ bool CreateBinary();
+
+ xcoff_header_t m_xcoff_header = {};
+ xcoff_aux_header_t m_xcoff_aux_header = {};
----------------
labath wrote:
What's the issue with calling those functions? It can't be performance, as these functions merely return a pointer the the member inside the llvm object file. If you find too `m_binary->auxiliaryHeader64()` long/repetitive, I'd suggest wrapping that in an accessor functions -- though that will only save a few chars, so I'm not sure if its worth it (it may be better to have an accessor for the fields of the header that are used often -- that would also be a way to abstract the 64/32 difference). And if you're worried about the `m_binary` pointer being null, then I'd suggest setting up the code in a way that its non-nullness is guaranteed (for example, by creating the XCOFFObjectFile in the CreateInstance function and passing it to the constructor.
Bottom line: I still believe there's no need for this member and there's a better way to achieve what you're trying to do. I'm not sure what it is, because I'm don't know what exactly you are trying to achieve.
https://github.com/llvm/llvm-project/pull/116338
More information about the lldb-commits
mailing list