diff options
-rw-r--r-- | lldb/source/Plugins/DynamicLoader/Linux-DYLD/DynamicLoaderLinuxDYLD.cpp | 2 | ||||
-rw-r--r-- | lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp | 36 |
2 files changed, 19 insertions, 19 deletions
diff --git a/lldb/source/Plugins/DynamicLoader/Linux-DYLD/DynamicLoaderLinuxDYLD.cpp b/lldb/source/Plugins/DynamicLoader/Linux-DYLD/DynamicLoaderLinuxDYLD.cpp index 78ebe4db0ca..4a72696393d 100644 --- a/lldb/source/Plugins/DynamicLoader/Linux-DYLD/DynamicLoaderLinuxDYLD.cpp +++ b/lldb/source/Plugins/DynamicLoader/Linux-DYLD/DynamicLoaderLinuxDYLD.cpp @@ -353,7 +353,7 @@ DynamicLoaderLinuxDYLD::ComputeLoadOffset() ModuleSP module = m_process->GetTarget().GetExecutableModule(); ObjectFile *exe = module->GetObjectFile(); - Address file_entry = exe->GetEntryPoint(); + Address file_entry = exe->GetEntryPointAddress(); if (!file_entry.IsValid()) return LLDB_INVALID_ADDRESS; diff --git a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp index 03541b4faf4..2d5471d3a7f 100644 --- a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp +++ b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp @@ -272,27 +272,27 @@ ObjectFileELF::GetImageInfoAddress() lldb_private::Address ObjectFileELF::GetEntryPointAddress () { - // If the object file is not an executable it can't hold the entry point. m_entry_point_address - // is initialized to an invalid address, so we can just return that. - // If m_entry_point_address is valid it means we've found it already, so return the cached value. - - if (!IsExecutable() || m_entry_point_address.IsValid()) + SectionList *sections; + addr_t offset; + + if (m_entry_point_address.IsValid()) return m_entry_point_address; - - // FIXME: This is just looking for the "start" symbol, but that will fail if "start" is stripped. - // There's probably a better way in ELF to find the start address of an executable module. - - SymbolContextList contexts; - SymbolContext context; - if (!m_module->FindSymbolsWithNameAndType(ConstString ("start"), lldb::eSymbolTypeCode, contexts)) + + if (!ParseHeader() || !IsExecutable()) return m_entry_point_address; - - contexts.GetContextAtIndex(0, context); - - m_entry_point_address = context.symbol->GetValue(); - - return m_entry_point_address; + sections = GetSectionList(); + offset = m_header.e_entry; + + if (!sections) + { + m_entry_point_address.SetOffset(offset); + return m_entry_point_address; + } + + m_entry_point_address.ResolveAddressUsingFileSections(offset, sections); + + return m_entry_point_address; } //---------------------------------------------------------------------- |