diff options
| author | Pavel Labath <pavel@labath.sk> | 2019-02-18 11:06:57 +0000 |
|---|---|---|
| committer | Pavel Labath <pavel@labath.sk> | 2019-02-18 11:06:57 +0000 |
| commit | d1304bba343f8c318e879e29dc29bb5e5039c874 (patch) | |
| tree | 0619267cbe0fd17ef3e1c14673d98c57d1d70c50 /lldb/source/Plugins/ObjectFile | |
| parent | 9d723b8296d7524544fe7829439226217bf50698 (diff) | |
| download | bcm5719-llvm-d1304bba343f8c318e879e29dc29bb5e5039c874.tar.gz bcm5719-llvm-d1304bba343f8c318e879e29dc29bb5e5039c874.zip | |
PECOFF: Implement GetBaseAddress
COFF files are modelled in lldb as having one big container section
spanning the entire module image, with the actual sections being
subsections of that. In this model, the base address is simply the
address of the first byte of that section.
This also removes the hack where ObjectFilePECOFF was using the
m_file_offset field to communicate this information. Using file offset
for this purpose is completely wrong, as that is supposed to indicate
where is this ObjectFile located in the file on disk. This field is only
meaningful for fat binaries, and should normally be 0.
Both PDB plugins have been updated to use GetBaseAddress instead of
GetFileOffset.
llvm-svn: 354258
Diffstat (limited to 'lldb/source/Plugins/ObjectFile')
| -rw-r--r-- | lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp | 5 | ||||
| -rw-r--r-- | lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h | 2 |
2 files changed, 6 insertions, 1 deletions
diff --git a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp index 0b5da9e06a3..91ed1a59671 100644 --- a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp +++ b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp @@ -457,7 +457,6 @@ bool ObjectFilePECOFF::ParseCOFFOptionalHeader(lldb::offset_t *offset_ptr) { m_coff_header_opt.data_dirs[i].vmsize = m_data.GetU32(offset_ptr); } - m_file_offset = m_coff_header_opt.image_base; m_image_base = m_coff_header_opt.image_base; } } @@ -927,6 +926,10 @@ lldb_private::Address ObjectFilePECOFF::GetEntryPointAddress() { return m_entry_point_address; } +Address ObjectFilePECOFF::GetBaseAddress() { + return Address(GetSectionList()->GetSectionAtIndex(0), 0); +} + //---------------------------------------------------------------------- // Dump // diff --git a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h index 17f5f4de2d1..d6cc14e4f22 100644 --- a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h +++ b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h @@ -117,6 +117,8 @@ public: virtual lldb_private::Address GetEntryPointAddress() override; + lldb_private::Address GetBaseAddress() override; + ObjectFile::Type CalculateType() override; ObjectFile::Strata CalculateStrata() override; |

