aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Storsjö <martin@martin.st>2019-12-06 13:25:38 +0200
committerMartin Storsjö <martin@martin.st>2019-12-10 13:55:38 +0200
commita0f72441c8980c0d68c52f4e789a8c61dc4fd2e7 (patch)
tree3f2e48cdc3b56d57fcaf0a0315a65f88329d8db3
parent965ed1e974e80e0b96ac3921e8a915e8e46baa5c (diff)
downloadllvm-a0f72441c8980c0d68c52f4e789a8c61dc4fd2e7.zip
llvm-a0f72441c8980c0d68c52f4e789a8c61dc4fd2e7.tar.gz
llvm-a0f72441c8980c0d68c52f4e789a8c61dc4fd2e7.tar.bz2
[LLDB] [PECOFF] Make sure to set the address byte size in m_data after parsing headers
If not set, the address byte size was implied to be the one of the host process. This allows reverting the functional change from 31087b2ae9154, since now PECOFF does the same as ELF and MachO wrt setting both byte order and address size on m_data within ParseHeader. Differential Revision: https://reviews.llvm.org/D71108
-rw-r--r--lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp1
-rw-r--r--lldb/source/Symbol/ObjectFile.cpp8
2 files changed, 2 insertions, 7 deletions
diff --git a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
index b0ce967..2e62e32 100644
--- a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
+++ b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
@@ -315,6 +315,7 @@ bool ObjectFilePECOFF::ParseHeader() {
ParseCOFFOptionalHeader(&offset);
ParseSectionHeaders(offset);
}
+ m_data.SetAddressByteSize(GetAddressByteSize());
return true;
}
}
diff --git a/lldb/source/Symbol/ObjectFile.cpp b/lldb/source/Symbol/ObjectFile.cpp
index 812c6de..4f6d74b 100644
--- a/lldb/source/Symbol/ObjectFile.cpp
+++ b/lldb/source/Symbol/ObjectFile.cpp
@@ -477,13 +477,7 @@ size_t ObjectFile::GetData(lldb::offset_t offset, size_t length,
DataExtractor &data) const {
// The entire file has already been mmap'ed into m_data, so just copy from
// there as the back mmap buffer will be shared with shared pointers.
- size_t ret = data.SetData(m_data, offset, length);
- // DataExtractor::SetData copies the address byte size from m_data, but
- // m_data's address byte size is only set from sizeof(void*), and we can't
- // access subclasses GetAddressByteSize() when setting up m_data in the
- // constructor.
- data.SetAddressByteSize(GetAddressByteSize());
- return ret;
+ return data.SetData(m_data, offset, length);
}
size_t ObjectFile::CopyData(lldb::offset_t offset, size_t length,