Implement ObjectFilePECOFF::GetEntryPointAddress.

Reviewers: zturner, clayborg

Subscribers: lldb-commits

Differential Revision: http://reviews.llvm.org/D17970

llvm-svn: 264173
This commit is contained in:
Stephane Sezer
2016-03-23 18:00:13 +00:00
parent e82f3a099f
commit 8e38c66645
2 changed files with 24 additions and 3 deletions

View File

@@ -192,7 +192,8 @@ ObjectFilePECOFF::ObjectFilePECOFF (const lldb::ModuleSP &module_sp,
m_dos_header (),
m_coff_header (),
m_coff_header_opt (),
m_sect_headers ()
m_sect_headers (),
m_entry_point_address ()
{
::memset (&m_dos_header, 0, sizeof(m_dos_header));
::memset (&m_coff_header, 0, sizeof(m_coff_header));
@@ -814,6 +815,25 @@ ObjectFilePECOFF::GetDependentModules (FileSpecList& files)
return 0;
}
lldb_private::Address
ObjectFilePECOFF::GetEntryPointAddress ()
{
if (m_entry_point_address.IsValid())
return m_entry_point_address;
if (!ParseHeader() || !IsExecutable())
return m_entry_point_address;
SectionList *section_list = GetSectionList();
addr_t offset = m_coff_header_opt.entry;
if (!section_list)
m_entry_point_address.SetOffset(offset);
else
m_entry_point_address.ResolveAddressUsingFileSections(offset, section_list);
return m_entry_point_address;
}
//----------------------------------------------------------------------
// Dump