From: Martin Storsjö Date: Fri, 6 Dec 2019 11:25:38 +0000 (+0200) Subject: [LLDB] [PECOFF] Make sure to set the address byte size in m_data after parsing headers X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a0f72441c8980c0d68c52f4e789a8c61dc4fd2e7;p=platform%2Fupstream%2Fllvm.git [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 --- 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,