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
This commit is contained in:
Pavel Labath
2019-02-18 11:06:57 +00:00
parent 9d723b8296
commit d1304bba34
5 changed files with 94 additions and 3 deletions

View File

@@ -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
//