Index: source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h =================================================================== --- source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h +++ source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h @@ -144,8 +144,8 @@ uint32_t GetDependentModules(lldb_private::FileSpecList& files) override; -// virtual lldb_private::Address -// GetEntryPointAddress (); + virtual lldb_private::Address + GetEntryPointAddress () override; ObjectFile::Type CalculateType() override; @@ -301,6 +301,7 @@ coff_opt_header_t m_coff_header_opt; SectionHeaderColl m_sect_headers; lldb::addr_t m_image_base; + lldb_private::Address m_entry_point_address; }; #endif // liblldb_ObjectFilePECOFF_h_ Index: source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp =================================================================== --- source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp +++ source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp @@ -192,7 +192,8 @@ 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 @@ 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