Skip to content

Commit 1aef260

Browse files
Added clang-format changes
1 parent 5f6083a commit 1aef260

File tree

3 files changed

+7
-69
lines changed

3 files changed

+7
-69
lines changed

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

Lines changed: 6 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -79,45 +79,9 @@ ObjectFile *ObjectFileXCOFF::CreateInstance(const lldb::ModuleSP &module_sp,
7979
if (!objfile_up)
8080
return nullptr;
8181

82-
// Cache xcoff binary.
83-
if (!objfile_up->CreateBinary())
84-
return nullptr;
85-
86-
if (!objfile_up->ParseHeader())
87-
return nullptr;
88-
8982
return objfile_up.release();
9083
}
9184

92-
bool ObjectFileXCOFF::CreateBinary() {
93-
if (m_binary)
94-
return true;
95-
96-
Log *log = GetLog(LLDBLog::Object);
97-
98-
auto binary = llvm::object::XCOFFObjectFile::createObjectFile(
99-
llvm::MemoryBufferRef(toStringRef(m_data.GetData()),
100-
m_file.GetFilename().GetStringRef()),
101-
file_magic::xcoff_object_64);
102-
if (!binary) {
103-
LLDB_LOG_ERROR(log, binary.takeError(),
104-
"Failed to create binary for file ({1}): {0}", m_file);
105-
return false;
106-
}
107-
108-
// Make sure we only handle XCOFF format.
109-
m_binary =
110-
llvm::unique_dyn_cast<llvm::object::XCOFFObjectFile>(std::move(*binary));
111-
if (!m_binary)
112-
return false;
113-
114-
LLDB_LOG(log, "this = {0}, module = {1} ({2}), file = {3}, binary = {4}",
115-
this, GetModule().get(), GetModule()->GetSpecificationDescription(),
116-
m_file.GetPath(), m_binary.get());
117-
118-
return true;
119-
}
120-
12185
ObjectFile *ObjectFileXCOFF::CreateMemoryInstance(
12286
const lldb::ModuleSP &module_sp, WritableDataBufferSP data_sp,
12387
const lldb::ProcessSP &process_sp, lldb::addr_t header_addr) {
@@ -144,10 +108,9 @@ size_t ObjectFileXCOFF::GetModuleSpecifications(
144108

145109
static uint32_t XCOFFHeaderSizeFromMagic(uint32_t magic) {
146110
switch (magic) {
147-
/* TODO: 32bit not supported yet
148-
case XCOFF::XCOFF32:
149-
return sizeof(struct llvm::object::XCOFFFileHeader32);
150-
*/
111+
// TODO: 32bit not supported yet
112+
// case XCOFF::XCOFF32:
113+
// return sizeof(struct llvm::object::XCOFFFileHeader32);
151114

152115
case XCOFF::XCOFF64:
153116
return sizeof(struct llvm::object::XCOFFFileHeader64);
@@ -172,27 +135,15 @@ bool ObjectFileXCOFF::MagicBytesMatch(DataBufferSP &data_sp,
172135
return XCOFFHeaderSizeFromMagic(magic) != 0;
173136
}
174137

175-
bool ObjectFileXCOFF::ParseHeader() {
176-
177-
bool retVal = false;
178-
ModuleSP module_sp(GetModule());
179-
if (module_sp) {
180-
// Only 64-bit is supported for now
181-
if (m_binary->fileHeader64()->Magic == XCOFF::XCOFF64)
182-
retVal = true;
183-
}
184-
185-
return retVal;
186-
}
138+
bool ObjectFileXCOFF::ParseHeader() { return false; }
187139

188140
ByteOrder ObjectFileXCOFF::GetByteOrder() const { return eByteOrderBig; }
189141

190142
bool ObjectFileXCOFF::IsExecutable() const { return true; }
191143

192144
uint32_t ObjectFileXCOFF::GetAddressByteSize() const {
193145

194-
/* TODO: Need to handle 32-bit support, until then
195-
* return 8 for 64-bit XCOFF::XCOFF64 */
146+
// 32-bit not supprted. return 8 for 64-bit XCOFF::XCOFF64
196147
return 8;
197148
}
198149

@@ -218,13 +169,7 @@ UUID ObjectFileXCOFF::GetUUID() { return UUID(); }
218169

219170
uint32_t ObjectFileXCOFF::GetDependentModules(FileSpecList &files) { return 0; }
220171

221-
ObjectFile::Type ObjectFileXCOFF::CalculateType() {
222-
if (m_binary->fileHeader64()->Flags & XCOFF::F_EXEC)
223-
return eTypeExecutable;
224-
else if (m_binary->fileHeader64()->Flags & XCOFF::F_SHROBJ)
225-
return eTypeSharedLibrary;
226-
return eTypeUnknown;
227-
}
172+
ObjectFile::Type ObjectFileXCOFF::CalculateType() { return eTypeExecutable; }
228173

229174
ObjectFile::Strata ObjectFileXCOFF::CalculateStrata() { return eStrataUnknown; }
230175

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

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,6 @@ class ObjectFileXCOFF : public lldb_private::ObjectFile {
6868

6969
uint32_t GetAddressByteSize() const override;
7070

71-
lldb_private::AddressClass GetAddressClass(lldb::addr_t file_addr) override;
72-
7371
void ParseSymtab(lldb_private::Symtab &symtab) override;
7472

7573
bool IsStripped() override;
@@ -101,11 +99,6 @@ class ObjectFileXCOFF : public lldb_private::ObjectFile {
10199
static lldb::WritableDataBufferSP
102100
MapFileDataWritable(const lldb_private::FileSpec &file, uint64_t Size,
103101
uint64_t Offset);
104-
105-
private:
106-
bool CreateBinary();
107-
108-
std::unique_ptr<llvm::object::XCOFFObjectFile> m_binary;
109102
};
110103

111104
#endif // LLDB_SOURCE_PLUGINS_OBJECTFILE_XCOFF_OBJECTFILE_H

lldb/test/Shell/ObjectFile/XCOFF/basic-info.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ FileHeader:
1313
MagicNumber: 0x1F7
1414
NumberOfSections: 1
1515
CreationTime: 000000000
16-
Flags: 0x0002
16+
Flags: 0x0000
1717
Sections:
1818
- Name: .text
1919
Address: 0x100000438

0 commit comments

Comments
 (0)