Skip to content

Commit 2301092

Browse files
Addressing comments 1
1 parent c4cf612 commit 2301092

File tree

2 files changed

+8
-23
lines changed

2 files changed

+8
-23
lines changed

lldb/source/Plugins/ObjectFile/XCOFF/ObjectFileXCOFF.cpp

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ bool ObjectFileXCOFF::CreateBinary() {
114114
LLDB_LOG(log, "this = {0}, module = {1} ({2}), file = {3}, binary = {4}",
115115
this, GetModule().get(), GetModule()->GetSpecificationDescription(),
116116
m_file.GetPath(), m_binary.get());
117+
117118
return true;
118119
}
119120

@@ -174,17 +175,8 @@ bool ObjectFileXCOFF::ParseHeader() {
174175
bool retVal = false;
175176
ModuleSP module_sp(GetModule());
176177
if (module_sp) {
177-
std::lock_guard<std::recursive_mutex> guard(module_sp->GetMutex());
178-
179-
const auto *fileHeaderPtr = m_binary->fileHeader64();
180-
m_xcoff_header = *fileHeaderPtr;
181-
if (m_xcoff_header.Magic != 0) {
182-
if (m_xcoff_header.AuxHeaderSize > 0) {
183-
const auto *fileAuxHeader = m_binary->auxiliaryHeader64();
184-
m_xcoff_aux_header = *fileAuxHeader;
185-
}
178+
if (m_binary->fileHeader64()->Magic == XCOFF::XCOFF64)
186179
retVal = true;
187-
}
188180
}
189181

190182
return retVal;
@@ -195,11 +187,10 @@ ByteOrder ObjectFileXCOFF::GetByteOrder() const { return eByteOrderBig; }
195187
bool ObjectFileXCOFF::IsExecutable() const { return true; }
196188

197189
uint32_t ObjectFileXCOFF::GetAddressByteSize() const {
198-
if (m_xcoff_header.Magic == XCOFF::XCOFF64)
199-
return 8;
200-
else if (m_xcoff_header.Magic == XCOFF::XCOFF32)
201-
return 4;
202-
return 4;
190+
191+
/* TODO: Need to handle 32-bit support, until then
192+
* return 8 for 64-bit XCOFF::XCOFF64 */
193+
return 8;
203194
}
204195

205196
AddressClass ObjectFileXCOFF::GetAddressClass(addr_t file_addr) {
@@ -225,9 +216,9 @@ UUID ObjectFileXCOFF::GetUUID() { return UUID(); }
225216
uint32_t ObjectFileXCOFF::GetDependentModules(FileSpecList &files) { return 0; }
226217

227218
ObjectFile::Type ObjectFileXCOFF::CalculateType() {
228-
if (m_xcoff_header.Flags & XCOFF::F_EXEC)
219+
if (m_binary->fileHeader64()->Flags & XCOFF::F_EXEC)
229220
return eTypeExecutable;
230-
else if (m_xcoff_header.Flags & XCOFF::F_SHROBJ)
221+
else if (m_binary->fileHeader64()->Flags & XCOFF::F_SHROBJ)
231222
return eTypeSharedLibrary;
232223
return eTypeUnknown;
233224
}

lldb/source/Plugins/ObjectFile/XCOFF/ObjectFileXCOFF.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -98,19 +98,13 @@ class ObjectFileXCOFF : public lldb_private::ObjectFile {
9898
const lldb::ProcessSP &process_sp, lldb::addr_t header_addr);
9999

100100
protected:
101-
typedef struct llvm::object::XCOFFFileHeader64 xcoff_header_t;
102-
103-
typedef struct llvm::object::XCOFFAuxiliaryHeader64 xcoff_aux_header_t;
104-
105101
static lldb::WritableDataBufferSP
106102
MapFileDataWritable(const lldb_private::FileSpec &file, uint64_t Size,
107103
uint64_t Offset);
108104

109105
private:
110106
bool CreateBinary();
111107

112-
xcoff_header_t m_xcoff_header = {};
113-
xcoff_aux_header_t m_xcoff_aux_header = {};
114108
std::unique_ptr<llvm::object::XCOFFObjectFile> m_binary;
115109
};
116110

0 commit comments

Comments
 (0)