summaryrefslogtreecommitdiffstats
path: root/lldb/source/Symbol/ObjectFile.cpp
diff options
context:
space:
mode:
authorMartin Storsjö <martin@martin.st>2019-11-29 13:28:25 +0200
committerMartin Storsjö <martin@martin.st>2019-12-02 22:42:00 +0200
commit7d019d1a3be252a885e8db1ee7af11c90b450d38 (patch)
tree42724473f8feba2e6af38b6d60a57bfa0563663c /lldb/source/Symbol/ObjectFile.cpp
parentafd5d912812e6f2ea99c8890676d47a01bbcfbb1 (diff)
downloadbcm5719-llvm-7d019d1a3be252a885e8db1ee7af11c90b450d38.tar.gz
bcm5719-llvm-7d019d1a3be252a885e8db1ee7af11c90b450d38.zip
[LLDB] Set the right address size on output DataExtractors from ObjectFile
If filling in a DataExtractor from an ObjectFile, e.g. via the ReadSectionData method, the output DataExtractor gets the address size from the m_data member. ObjectFile's m_data member is initialized without knowledge about the address size (so the address size is set based on the host's sizeof(void*), and at that point within ObjectFile's constructor, virtual methods implemented in subclasses (like GetAddressByteSize()) can't be called, therefore fix it up when filling in external DataExtractors. This makes sure that line tables from executables with a different address size are parsed properly; previously this tripped up DWARFDebugLine::LineTable::parse for 32 bit executables on a 64 bit host, as the address size in the line table (4) didn't match the one set in the DWARFDataExtractor. Differential Revision: https://reviews.llvm.org/D70848
Diffstat (limited to 'lldb/source/Symbol/ObjectFile.cpp')
-rw-r--r--lldb/source/Symbol/ObjectFile.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/lldb/source/Symbol/ObjectFile.cpp b/lldb/source/Symbol/ObjectFile.cpp
index 4f6d74bbc75..812c6de4da5 100644
--- a/lldb/source/Symbol/ObjectFile.cpp
+++ b/lldb/source/Symbol/ObjectFile.cpp
@@ -477,7 +477,13 @@ 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.
- return data.SetData(m_data, offset, length);
+ 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;
}
size_t ObjectFile::CopyData(lldb::offset_t offset, size_t length,
OpenPOWER on IntegriCloud