[Lldb-commits] [lldb] r264173 - Implement ObjectFilePECOFF::GetEntryPointAddress.
Stephane Sezer via lldb-commits
lldb-commits at lists.llvm.org
Wed Mar 23 11:00:13 PDT 2016
Author: sas
Date: Wed Mar 23 13:00:13 2016
New Revision: 264173
URL: http://llvm.org/viewvc/llvm-project?rev=264173&view=rev
Log:
Implement ObjectFilePECOFF::GetEntryPointAddress.
Reviewers: zturner, clayborg
Subscribers: lldb-commits
Differential Revision: http://reviews.llvm.org/D17970
Modified:
lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h
Modified: lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp?rev=264173&r1=264172&r2=264173&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp (original)
+++ lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp Wed Mar 23 13:00:13 2016
@@ -192,7 +192,8 @@ ObjectFilePECOFF::ObjectFilePECOFF (cons
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 (F
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
Modified: lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h?rev=264173&r1=264172&r2=264173&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h (original)
+++ lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h Wed Mar 23 13:00:13 2016
@@ -144,8 +144,8 @@ public:
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 @@ private:
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_
More information about the lldb-commits
mailing list