LLDB mainline
|
Generic COFF object file reader. More...
#include <ObjectFileELF.h>
Classes | |
struct | ELFDynamicWithName |
struct | ELFSectionHeaderInfo |
Public Member Functions | |
llvm::StringRef | GetPluginName () override |
bool | isA (const void *ClassID) const override |
bool | ParseHeader () override |
Attempts to parse the object header. | |
bool | SetLoadAddress (lldb_private::Target &target, lldb::addr_t value, bool value_is_offset) override |
Sets the load address for an entire module, assuming a rigid slide of sections, if possible in the implementation. | |
lldb::ByteOrder | GetByteOrder () const override |
Gets whether endian swapping should occur when extracting data from this object file. | |
bool | IsExecutable () const override |
Tells whether this object file is capable of being the main executable for a process. | |
uint32_t | GetAddressByteSize () const override |
Gets the address size in bytes for the current object file. | |
lldb_private::AddressClass | GetAddressClass (lldb::addr_t file_addr) override |
Get the address type given a file address in an object file. | |
void | ParseSymtab (lldb_private::Symtab &symtab) override |
Parse the symbol table into the provides symbol table object. | |
bool | IsStripped () override |
Detect if this object file has been stripped of local symbols. | |
void | CreateSections (lldb_private::SectionList &unified_section_list) override |
void | Dump (lldb_private::Stream *s) override |
Dump a description of this object to a Stream. | |
lldb_private::ArchSpec | GetArchitecture () override |
Get the ArchSpec for this object file. | |
lldb_private::UUID | GetUUID () override |
Gets the UUID for this object file. | |
std::optional< lldb_private::FileSpec > | GetDebugLink () |
Return the contents of the .gnu_debuglink section, if the object file contains it. | |
uint32_t | GetDependentModules (lldb_private::FileSpecList &files) override |
Extract the dependent modules from an object file. | |
lldb_private::Address | GetImageInfoAddress (lldb_private::Target *target) override |
Similar to Process::GetImageInfoAddress(). | |
lldb_private::Address | GetEntryPointAddress () override |
Returns the address of the Entry Point in this object file - if the object file doesn't have an entry point (because it is not an executable file) then an invalid address is returned. | |
lldb_private::Address | GetBaseAddress () override |
Returns base address of this object file. | |
ObjectFile::Type | CalculateType () override |
The object file should be able to calculate its type by looking at its file header and possibly the sections or other data in the object file. | |
ObjectFile::Strata | CalculateStrata () override |
The object file should be able to calculate the strata of the object file. | |
size_t | ReadSectionData (lldb_private::Section *section, lldb::offset_t section_offset, void *dst, size_t dst_len) override |
size_t | ReadSectionData (lldb_private::Section *section, lldb_private::DataExtractor §ion_data) override |
llvm::ArrayRef< elf::ELFProgramHeader > | ProgramHeaders () |
lldb_private::DataExtractor | GetSegmentData (const elf::ELFProgramHeader &H) |
llvm::StringRef | StripLinkerSymbolAnnotations (llvm::StringRef symbol_name) const override |
void | RelocateSection (lldb_private::Section *section) override |
Perform relocations on the section if necessary. | |
Public Member Functions inherited from lldb_private::ObjectFile | |
ObjectFile (const lldb::ModuleSP &module_sp, const FileSpec *file_spec_ptr, lldb::offset_t file_offset, lldb::offset_t length, lldb::DataBufferSP data_sp, lldb::offset_t data_offset) | |
Construct with a parent module, offset, and header data. | |
ObjectFile (const lldb::ModuleSP &module_sp, const lldb::ProcessSP &process_sp, lldb::addr_t header_addr, lldb::DataBufferSP data_sp) | |
~ObjectFile () override | |
Destructor. | |
virtual void | Dump (Stream *s)=0 |
Dump a description of this object to a Stream. | |
virtual bool | isA (const void *ClassID) const |
virtual uint32_t | GetAddressByteSize () const =0 |
Gets the address size in bytes for the current object file. | |
virtual AddressClass | GetAddressClass (lldb::addr_t file_addr) |
Get the address type given a file address in an object file. | |
virtual uint32_t | GetDependentModules (FileSpecList &file_list)=0 |
Extract the dependent modules from an object file. | |
virtual bool | IsExecutable () const =0 |
Tells whether this object file is capable of being the main executable for a process. | |
virtual lldb::addr_t | GetFileOffset () const |
Returns the offset into a file at which this object resides. | |
virtual lldb::addr_t | GetByteSize () const |
virtual FileSpec & | GetFileSpec () |
Get accessor to the object file specification. | |
virtual const FileSpec & | GetFileSpec () const |
Get const accessor to the object file specification. | |
virtual ArchSpec | GetArchitecture ()=0 |
Get the ArchSpec for this object file. | |
virtual SectionList * | GetSectionList (bool update_module_section_list=true) |
Gets the section list for the currently selected architecture (and object for archives). | |
virtual void | CreateSections (SectionList &unified_section_list)=0 |
virtual void | SectionFileAddressesChanged () |
Notify the ObjectFile that the file addresses in the Sections for this module have been changed. | |
Symtab * | GetSymtab () |
Gets the symbol table for the currently selected architecture (and object for archives). | |
virtual void | ParseSymtab (Symtab &symtab)=0 |
Parse the symbol table into the provides symbol table object. | |
virtual void | RelocateSection (lldb_private::Section *section) |
Perform relocations on the section if necessary. | |
virtual Symbol * | ResolveSymbolForAddress (const Address &so_addr, bool verify_unique) |
Appends a Symbol for the specified so_addr to the symbol table. | |
virtual bool | IsStripped ()=0 |
Detect if this object file has been stripped of local symbols. | |
virtual void | ClearSymtab () |
Frees the symbol table. | |
virtual UUID | GetUUID ()=0 |
Gets the UUID for this object file. | |
virtual lldb_private::FileSpecList | GetReExportedLibraries () |
Gets the file spec list of libraries re-exported by this object file. | |
virtual bool | SetLoadAddress (Target &target, lldb::addr_t value, bool value_is_offset) |
Sets the load address for an entire module, assuming a rigid slide of sections, if possible in the implementation. | |
virtual lldb::ByteOrder | GetByteOrder () const =0 |
Gets whether endian swapping should occur when extracting data from this object file. | |
virtual bool | ParseHeader ()=0 |
Attempts to parse the object header. | |
virtual bool | AllowAssemblyEmulationUnwindPlans () |
Returns if the function bounds for symbols in this symbol file are likely accurate. | |
virtual lldb_private::Address | GetImageInfoAddress (Target *target) |
Similar to Process::GetImageInfoAddress(). | |
virtual lldb_private::Address | GetEntryPointAddress () |
Returns the address of the Entry Point in this object file - if the object file doesn't have an entry point (because it is not an executable file) then an invalid address is returned. | |
virtual lldb_private::Address | GetBaseAddress () |
Returns base address of this object file. | |
virtual uint32_t | GetNumThreadContexts () |
virtual std::string | GetIdentifierString () |
Some object files may have an identifier string embedded in them, e.g. | |
virtual lldb_private::AddressableBits | GetAddressableBits () |
Some object files may have the number of bits used for addressing embedded in them, e.g. | |
virtual bool | GetCorefileMainBinaryInfo (lldb::addr_t &value, bool &value_is_offset, UUID &uuid, ObjectFile::BinaryType &type) |
When the ObjectFile is a core file, lldb needs to locate the "binary" in the core file. | |
virtual bool | GetCorefileThreadExtraInfos (std::vector< lldb::tid_t > &tids) |
Get metadata about threads from the corefile. | |
virtual lldb::RegisterContextSP | GetThreadContextAtIndex (uint32_t idx, lldb_private::Thread &thread) |
virtual Type | CalculateType ()=0 |
The object file should be able to calculate its type by looking at its file header and possibly the sections or other data in the object file. | |
virtual void | SetType (Type type) |
In cases where the type can't be calculated (elf files), this routine allows someone to explicitly set it. | |
virtual Strata | CalculateStrata ()=0 |
The object file should be able to calculate the strata of the object file. | |
virtual llvm::VersionTuple | GetVersion () |
Get the object file version numbers. | |
virtual llvm::VersionTuple | GetMinimumOSVersion () |
Get the minimum OS version this object file can run on. | |
virtual llvm::VersionTuple | GetSDKVersion () |
Get the SDK OS version this object file was built with. | |
virtual bool | GetIsDynamicLinkEditor () |
Return true if this file is a dynamic link editor (dyld) | |
Type | GetType () |
Strata | GetStrata () |
size_t | GetData (lldb::offset_t offset, size_t length, DataExtractor &data) const |
size_t | CopyData (lldb::offset_t offset, size_t length, void *dst) const |
virtual size_t | ReadSectionData (Section *section, lldb::offset_t section_offset, void *dst, size_t dst_len) |
virtual size_t | ReadSectionData (Section *section, DataExtractor §ion_data) |
virtual size_t | GetSectionDataSize (Section *section) |
bool | IsInMemory () const |
Returns true if the object file exists only in memory. | |
virtual llvm::StringRef | StripLinkerSymbolAnnotations (llvm::StringRef symbol_name) const |
virtual bool | CanTrustAddressRanges () |
Can we trust the address ranges accelerator associated with this object file to be complete. | |
virtual std::vector< LoadableData > | GetLoadableData (Target &target) |
Loads this objfile to memory. | |
virtual std::unique_ptr< CallFrameInfo > | CreateCallFrameInfo () |
Creates a plugin-specific call frame info. | |
virtual bool | LoadCoreFileImages (lldb_private::Process &process) |
Load binaries listed in a corefile. | |
uint32_t | GetCacheHash () |
Get a hash that can be used for caching object file releated information. | |
Public Member Functions inherited from lldb_private::PluginInterface | |
PluginInterface ()=default | |
virtual | ~PluginInterface ()=default |
virtual llvm::StringRef | GetPluginName ()=0 |
PluginInterface (const PluginInterface &)=delete | |
PluginInterface & | operator= (const PluginInterface &)=delete |
Public Member Functions inherited from lldb_private::ModuleChild | |
ModuleChild (const lldb::ModuleSP &module_sp) | |
Construct with owning module. | |
~ModuleChild () | |
Destructor. | |
const ModuleChild & | operator= (const ModuleChild &rhs) |
Assignment operator. | |
lldb::ModuleSP | GetModule () const |
Get const accessor for the module pointer. | |
void | SetModule (const lldb::ModuleSP &module_sp) |
Set accessor for the module pointer. | |
Static Public Attributes | |
static char | ID |
Static Public Attributes inherited from lldb_private::ObjectFile | |
static char | ID |
Protected Member Functions | |
std::vector< LoadableData > | GetLoadableData (lldb_private::Target &target) override |
Loads this objfile to memory. | |
Protected Member Functions inherited from lldb_private::ObjectFile | |
bool | SetModulesArchitecture (const ArchSpec &new_arch) |
Sets the architecture for a module. | |
Static Protected Member Functions | |
static lldb::WritableDataBufferSP | MapFileDataWritable (const lldb_private::FileSpec &file, uint64_t Size, uint64_t Offset) |
Private Types | |
typedef std::vector< elf::ELFProgramHeader > | ProgramHeaderColl |
typedef std::vector< ELFSectionHeaderInfo > | SectionHeaderColl |
typedef SectionHeaderColl::iterator | SectionHeaderCollIter |
typedef SectionHeaderColl::const_iterator | SectionHeaderCollConstIter |
typedef std::vector< ELFDynamicWithName > | DynamicSymbolColl |
typedef DynamicSymbolColl::iterator | DynamicSymbolCollIter |
typedef DynamicSymbolColl::const_iterator | DynamicSymbolCollConstIter |
typedef std::map< lldb::addr_t, lldb_private::AddressClass > | FileAddressToAddressClassMap |
An ordered map of file address to address class. | |
Private Member Functions | |
ObjectFileELF (const lldb::ModuleSP &module_sp, lldb::DataBufferSP data_sp, lldb::offset_t data_offset, const lldb_private::FileSpec *file, lldb::offset_t offset, lldb::offset_t length) | |
ObjectFileELF (const lldb::ModuleSP &module_sp, lldb::DataBufferSP header_data_sp, const lldb::ProcessSP &process_sp, lldb::addr_t header_addr) | |
size_t | SectionIndex (const SectionHeaderCollIter &I) |
Returns the index of the given section header. | |
size_t | SectionIndex (const SectionHeaderCollConstIter &I) const |
Returns the index of the given section header. | |
bool | ParseProgramHeaders () |
Parses all section headers present in this object file and populates m_program_headers. | |
size_t | ParseSectionHeaders () |
Parses all section headers present in this object file and populates m_section_headers. | |
lldb::SectionType | GetSectionType (const ELFSectionHeaderInfo &H) const |
size_t | ParseDependentModules () |
Scans the dynamic section and locates all dependent modules (shared libraries) populating m_filespec_up. | |
size_t | ParseDynamicSymbols () |
Parses the dynamic symbol table and populates m_dynamic_symbols. | |
std::pair< unsigned, FileAddressToAddressClassMap > | ParseSymbolTable (lldb_private::Symtab *symbol_table, lldb::user_id_t start_id, lldb_private::Section *symtab) |
Populates the symbol table with all non-dynamic linker symbols. | |
std::pair< unsigned, FileAddressToAddressClassMap > | ParseSymbols (lldb_private::Symtab *symbol_table, lldb::user_id_t start_id, lldb_private::SectionList *section_list, const size_t num_symbols, const lldb_private::DataExtractor &symtab_data, const lldb_private::DataExtractor &strtab_data) |
Helper routine for ParseSymbolTable(). | |
unsigned | ParseTrampolineSymbols (lldb_private::Symtab *symbol_table, lldb::user_id_t start_id, const ELFSectionHeaderInfo *rela_hdr, lldb::user_id_t section_id) |
Scans the relocation entries and adds a set of artificial symbols to the given symbol table for each PLT slot. | |
void | ParseUnwindSymbols (lldb_private::Symtab *symbol_table, lldb_private::DWARFCallFrameInfo *eh_frame) |
unsigned | RelocateDebugSections (const elf::ELFSectionHeader *rel_hdr, lldb::user_id_t rel_id, lldb_private::Symtab *thetab) |
Relocates debug sections. | |
unsigned | ApplyRelocations (lldb_private::Symtab *symtab, const elf::ELFHeader *hdr, const elf::ELFSectionHeader *rel_hdr, const elf::ELFSectionHeader *symtab_hdr, const elf::ELFSectionHeader *debug_hdr, lldb_private::DataExtractor &rel_data, lldb_private::DataExtractor &symtab_data, lldb_private::DataExtractor &debug_data, lldb_private::Section *rel_section) |
size_t | GetSectionHeaderStringTable () |
Loads the section name string table into m_shstr_data. | |
lldb::user_id_t | GetSectionIndexByName (const char *name) |
Utility method for looking up a section given its name. | |
const ELFSectionHeaderInfo * | GetSectionHeaderByIndex (lldb::user_id_t id) |
Returns the section header with the given id or NULL. | |
Static Private Member Functions | |
static size_t | GetProgramHeaderInfo (ProgramHeaderColl &program_headers, lldb_private::DataExtractor &object_data, const elf::ELFHeader &header) |
static uint32_t | CalculateELFNotesSegmentsCRC32 (const ProgramHeaderColl &program_headers, lldb_private::DataExtractor &data) |
static void | ParseARMAttributes (lldb_private::DataExtractor &data, uint64_t length, lldb_private::ArchSpec &arch_spec) |
static size_t | GetSectionHeaderInfo (SectionHeaderColl §ion_headers, lldb_private::DataExtractor &object_data, const elf::ELFHeader &header, lldb_private::UUID &uuid, std::string &gnu_debuglink_file, uint32_t &gnu_debuglink_crc, lldb_private::ArchSpec &arch_spec) |
Parses the elf section headers and returns the uuid, debug link name, crc, archspec. | |
ELF header dump routines | |
static void | DumpELFHeader (lldb_private::Stream *s, const elf::ELFHeader &header) |
static void | DumpELFHeader_e_ident_EI_DATA (lldb_private::Stream *s, unsigned char ei_data) |
static void | DumpELFHeader_e_type (lldb_private::Stream *s, elf::elf_half e_type) |
Private Attributes | |
elf::ELFHeader | m_header |
ELF file header. | |
lldb_private::UUID | m_uuid |
ELF build ID. | |
std::string | m_gnu_debuglink_file |
ELF .gnu_debuglink file and crc data if available. | |
uint32_t | m_gnu_debuglink_crc = 0 |
ProgramHeaderColl | m_program_headers |
Collection of program headers. | |
SectionHeaderColl | m_section_headers |
Collection of section headers. | |
lldb::addr_t | m_dynamic_base_addr = LLDB_INVALID_ADDRESS |
The file address of the .dynamic section. | |
DynamicSymbolColl | m_dynamic_symbols |
Collection of symbols from the dynamic table. | |
std::shared_ptr< ObjectFileELF > | m_gnu_debug_data_object_file |
Object file parsed from .gnu_debugdata section (. | |
std::unique_ptr< lldb_private::FileSpecList > | m_filespec_up |
List of file specifications corresponding to the modules (shared libraries) on which this object file depends. | |
lldb_private::Address | m_entry_point_address |
Cached value of the entry point for this module. | |
lldb_private::ArchSpec | m_arch_spec |
The architecture detected from parsing elf file contents. | |
FileAddressToAddressClassMap | m_address_class_map |
The address class for each symbol in the elf file. | |
Static Private Attributes | |
static const uint32_t | m_plugin_version = 1 |
Version of this reader common to all plugins based on this class. | |
static const uint32_t | g_core_uuid_magic |
ELF program header dump routines | |
void | DumpELFProgramHeaders (lldb_private::Stream *s) |
static void | DumpELFProgramHeader (lldb_private::Stream *s, const elf::ELFProgramHeader &ph) |
static void | DumpELFProgramHeader_p_type (lldb_private::Stream *s, elf::elf_word p_type) |
static void | DumpELFProgramHeader_p_flags (lldb_private::Stream *s, elf::elf_word p_flags) |
Additional Inherited Members | |
Public Types inherited from lldb_private::ObjectFile | |
enum | Type { eTypeInvalid = 0 , eTypeCoreFile , eTypeExecutable , eTypeDebugInfo , eTypeDynamicLinker , eTypeObjectFile , eTypeSharedLibrary , eTypeStubLibrary , eTypeJIT , eTypeUnknown } |
enum | Strata { eStrataInvalid = 0 , eStrataUnknown , eStrataUser , eStrataKernel , eStrataRawImage , eStrataJIT } |
enum | BinaryType { eBinaryTypeInvalid = 0 , eBinaryTypeUnknown , eBinaryTypeKernel , eBinaryTypeUser , eBinaryTypeStandalone } |
If we have a corefile binary hint, this enum specifies the binary type which we can use to select the correct DynamicLoader plugin. More... | |
Protected Attributes inherited from lldb_private::ObjectFile | |
FileSpec | m_file |
Type | m_type |
Strata | m_strata |
lldb::addr_t | m_file_offset |
The offset in bytes into the file, or the address in memory. | |
lldb::addr_t | m_length |
The length of this object file if it is known (can be zero if length is unknown or can't be determined). | |
DataExtractor | m_data |
The data for this object file so things can be parsed lazily. | |
lldb::ProcessWP | m_process_wp |
const lldb::addr_t | m_memory_addr |
Set if the object file only exists in memory. | |
std::unique_ptr< lldb_private::SectionList > | m_sections_up |
std::unique_ptr< lldb_private::Symtab > | m_symtab_up |
std::unique_ptr< llvm::once_flag > | m_symtab_once_up |
We need a llvm::once_flag that we can use to avoid locking the module lock and deadlocking LLDB. | |
std::optional< uint32_t > | m_cache_hash |
Protected Attributes inherited from lldb_private::ModuleChild | |
lldb::ModuleWP | m_module_wp |
The Module that owns the object that inherits from this class. | |
Static Protected Attributes inherited from lldb_private::ObjectFile | |
static size_t | g_initial_bytes_to_read = 512 |
The number of bytes to read when going through the plugins. | |
Generic COFF object file reader.
Generic ELF object file reader.
This class provides a generic COFF reader plugin implementing the ObjectFile protocol. Assumes that the COFF object format is a Microsoft style COFF rather than the full generality afforded by it.
This class provides a generic ELF (32/64 bit) reader plugin implementing the ObjectFile protocol.
Definition at line 58 of file ObjectFileELF.h.
|
private |
Definition at line 190 of file ObjectFileELF.h.
|
private |
Definition at line 192 of file ObjectFileELF.h.
|
private |
Definition at line 191 of file ObjectFileELF.h.
|
private |
An ordered map of file address to address class.
Used on architectures like Arm where there is an alternative ISA mode like Thumb. The container is ordered so that it can be binary searched.
Definition at line 198 of file ObjectFileELF.h.
|
private |
Definition at line 176 of file ObjectFileELF.h.
|
private |
Definition at line 182 of file ObjectFileELF.h.
|
private |
Definition at line 184 of file ObjectFileELF.h.
|
private |
Definition at line 183 of file ObjectFileELF.h.
|
private |
Definition at line 696 of file ObjectFileELF.cpp.
References lldb_private::ObjectFile::m_file.
|
private |
Definition at line 705 of file ObjectFileELF.cpp.
|
private |
Definition at line 3771 of file ObjectFileELF.cpp.
References ProgramHeaders().
Referenced by GetLoadableData().
|
private |
Definition at line 2759 of file ObjectFileELF.cpp.
References ApplyELF32ABS32RelRelocation(), ApplyELF64ABS32Relocation(), ApplyELF64ABS64Relocation(), lldb_private::ConstString::AsCString(), elf::ELFHeader::e_machine, lldb_private::Symtab::FindSymbolByID(), lldb_private::Symbol::GetAddressRef(), lldb_private::WritableDataBuffer::GetBytes(), lldb_private::Address::GetFileAddress(), lldb_private::Section::GetFileOffset(), lldb_private::ModuleChild::GetModule(), lldb_private::Section::GetName(), lldb_private::DataExtractor::GetSharedDataBuffer(), elf::ELFHeader::Is32Bit(), elf::ELFSectionHeader::sh_entsize, elf::ELFSectionHeader::sh_size, and elf::ELFSectionHeader::sh_type.
Referenced by RelocateDebugSections().
|
staticprivate |
Definition at line 470 of file ObjectFileELF.cpp.
References calc_crc32(), and lldb_private::DataExtractor::SetData().
Referenced by GetModuleSpecifications(), and GetUUID().
|
overridevirtual |
The object file should be able to calculate the strata of the object file.
Many object files for platforms might be for either user space debugging or for kernel debugging. If your object file subclass can figure this out, it will help with debugger plug-in selection when it comes time to debug.
Implements lldb_private::ObjectFile.
Definition at line 3633 of file ObjectFileELF.cpp.
References elf::ELFHeader::e_type, lldb_private::ObjectFile::eStrataKernel, lldb_private::ObjectFile::eStrataUnknown, lldb_private::ObjectFile::eStrataUser, lldb_private::SectionList::FindSectionByName(), lldb_private::ObjectFile::GetSectionList(), m_header, and ReadSectionData().
|
overridevirtual |
The object file should be able to calculate its type by looking at its file header and possibly the sections or other data in the object file.
The file type is used in the debugger to help select the correct plug- ins for the job at hand, so this is important to get right. If any eTypeXXX definitions do not match up with the type of file you are loading, please feel free to add a new enumeration value.
Implements lldb_private::ObjectFile.
Definition at line 3605 of file ObjectFileELF.cpp.
References elf::ELFHeader::e_type, lldb_private::ObjectFile::eTypeCoreFile, lldb_private::ObjectFile::eTypeExecutable, lldb_private::ObjectFile::eTypeObjectFile, lldb_private::ObjectFile::eTypeSharedLibrary, lldb_private::ObjectFile::eTypeUnknown, and m_header.
Referenced by GetArchitecture(), ParseSymbols(), ParseSymtab(), and RelocateSection().
|
inlinestatic |
|
static |
Definition at line 365 of file ObjectFileELF.cpp.
References elf::ELFHeader::AddressSizeInBytes(), elf::ELFHeader::MagicBytesMatch(), and MapFileDataWritable().
Referenced by Initialize(), and Terminate().
|
static |
Definition at line 419 of file ObjectFileELF.cpp.
References elf::ELFHeader::e_phentsize, elf::ELFHeader::e_phnum, elf::ELFHeader::e_phoff, elf::ELFHeader::Is32Bit(), elf::ELFHeader::Is64Bit(), elf::ELFHeader::MagicBytesMatch(), elf::ELFHeader::Parse(), lldb_private::ObjectFile::ReadMemory(), and lldb_private::DataExtractor::SetData().
Referenced by Initialize().
|
overridevirtual |
Implements lldb_private::ObjectFile.
Definition at line 1878 of file ObjectFileELF.cpp.
References lldb_private::SectionList::AddSection(), lldb::eSectionTypeContainer, lldb::eSectionTypeELFSymbolTable, lldb_private::ObjectFile::eTypeDebugInfo, lldb_private::SectionList::FindSectionByType(), GetGnuDebugDataObjectFile(), lldb_private::ModuleChild::GetModule(), GetPermissions(), GetSectionType(), GetTargetByteSize(), lldb_private::ObjectFile::GetType(), m_arch_spec, m_section_headers, lldb_private::ObjectFile::m_sections_up, elf::ELFProgramHeader::p_align, elf::ELFProgramHeader::p_filesz, elf::ELFProgramHeader::p_offset, elf::ELFProgramHeader::p_type, ParseSectionHeaders(), ProgramHeaders(), lldb_private::SectionList::ReplaceSection(), SectionIndex(), SegmentID(), elf::ELFSectionHeader::sh_addralign, elf::ELFSectionHeader::sh_flags, elf::ELFSectionHeader::sh_offset, elf::ELFSectionHeader::sh_size, and elf::ELFSectionHeader::sh_type.
|
overridevirtual |
Dump a description of this object to a Stream.
Dump a description of the current contents of this object to the supplied stream s. The dumping should include the section list if it has been parsed, and the symbol table if it has been parsed.
[in] | s | The stream to which to dump the object description. |
Implements lldb_private::ObjectFile.
Definition at line 3189 of file ObjectFileELF.cpp.
References lldb_private::Stream::AsRawOstream(), lldb_private::SectionList::Dump(), lldb_private::Symtab::Dump(), DumpDependentModules(), DumpELFDynamic(), DumpELFHeader(), DumpELFProgramHeaders(), DumpELFSectionHeaders(), lldb_private::Stream::EOL(), lldb_private::eSortOrderNone, GetArchitecture(), lldb_private::ArchSpec::GetArchitectureName(), lldb_private::Address::GetFileAddress(), GetImageInfoAddress(), lldb_private::Stream::GetIndentLevel(), lldb_private::ModuleChild::GetModule(), lldb_private::ObjectFile::GetSectionList(), lldb_private::ObjectFile::GetSymtab(), lldb_private::Stream::Indent(), lldb_private::Address::IsValid(), LLDB_INVALID_ADDRESS, lldb_private::ObjectFile::m_file, m_header, lldb_private::ObjectFile::m_memory_addr, lldb_private::Stream::Printf(), lldb_private::Stream::PutCString(), and UINT32_MAX.
|
private |
ELF dependent module dump routine.
Definition at line 3462 of file ObjectFileELF.cpp.
References lldb_private::ConstString::GetCString(), lldb_private::FileSpec::GetFilename(), m_filespec_up, ParseDependentModules(), lldb_private::Stream::Printf(), and lldb_private::Stream::PutCString().
Referenced by Dump().
|
private |
ELF dump the .dynamic section.
Definition at line 3558 of file ObjectFileELF.cpp.
References elf::ELFHeader::e_machine, lldb_private::Stream::EOL(), getDynamicTagAsString(), m_dynamic_symbols, m_header, ParseDynamicSymbols(), lldb_private::Stream::Printf(), and lldb_private::Stream::PutCString().
Referenced by Dump().
|
staticprivate |
Definition at line 3235 of file ObjectFileELF.cpp.
References DumpELFHeader_e_ident_EI_DATA(), DumpELFHeader_e_type(), elf::ELFHeader::e_ehsize, elf::ELFHeader::e_entry, elf::ELFHeader::e_flags, elf::ELFHeader::e_ident, elf::ELFHeader::e_machine, elf::ELFHeader::e_phentsize, elf::ELFHeader::e_phnum, elf::ELFHeader::e_phoff, elf::ELFHeader::e_shentsize, elf::ELFHeader::e_shnum, elf::ELFHeader::e_shoff, elf::ELFHeader::e_shstrndx, elf::ELFHeader::e_type, elf::ELFHeader::e_version, lldb_private::Stream::Printf(), and lldb_private::Stream::PutCString().
Referenced by Dump().
|
staticprivate |
Definition at line 3295 of file ObjectFileELF.cpp.
Referenced by DumpELFHeader().
|
staticprivate |
Definition at line 3270 of file ObjectFileELF.cpp.
Referenced by DumpELFHeader().
|
staticprivate |
Definition at line 3315 of file ObjectFileELF.cpp.
References DumpELFProgramHeader_p_flags(), DumpELFProgramHeader_p_type(), elf::ELFProgramHeader::p_align, elf::ELFProgramHeader::p_filesz, elf::ELFProgramHeader::p_flags, elf::ELFProgramHeader::p_memsz, elf::ELFProgramHeader::p_offset, elf::ELFProgramHeader::p_paddr, elf::ELFProgramHeader::p_type, elf::ELFProgramHeader::p_vaddr, and lldb_private::Stream::Printf().
Referenced by DumpELFProgramHeaders().
|
staticprivate |
Definition at line 3352 of file ObjectFileELF.cpp.
Referenced by DumpELFProgramHeader().
|
staticprivate |
Definition at line 3331 of file ObjectFileELF.cpp.
References CASE_AND_STREAM, and lldb_private::Stream::Printf().
Referenced by DumpELFProgramHeader().
|
private |
Definition at line 3363 of file ObjectFileELF.cpp.
References DumpELFProgramHeader(), lldb_private::Stream::EOL(), lldb_private::Stream::Format(), m_program_headers, ParseProgramHeaders(), and lldb_private::Stream::PutCString().
Referenced by Dump().
|
staticprivate |
Definition at line 3383 of file ObjectFileELF.cpp.
References DumpELFSectionHeader_sh_flags(), DumpELFSectionHeader_sh_type(), lldb_private::Stream::Printf(), elf::ELFSectionHeader::sh_addr, elf::ELFSectionHeader::sh_addralign, elf::ELFSectionHeader::sh_entsize, elf::ELFSectionHeader::sh_flags, elf::ELFSectionHeader::sh_info, elf::ELFSectionHeader::sh_link, elf::ELFSectionHeader::sh_name, elf::ELFSectionHeader::sh_offset, elf::ELFSectionHeader::sh_size, and elf::ELFSectionHeader::sh_type.
Referenced by DumpELFSectionHeaders().
|
staticprivate |
Definition at line 3427 of file ObjectFileELF.cpp.
Referenced by DumpELFSectionHeader().
|
staticprivate |
Definition at line 3399 of file ObjectFileELF.cpp.
References CASE_AND_STREAM, and lldb_private::Stream::Printf().
Referenced by DumpELFSectionHeader().
|
private |
Definition at line 3439 of file ObjectFileELF.cpp.
References DumpELFSectionHeader(), m_section_headers, ParseSectionHeaders(), lldb_private::Stream::Printf(), and lldb_private::Stream::PutCString().
Referenced by Dump().
|
private |
Definition at line 2480 of file ObjectFileELF.cpp.
References m_dynamic_symbols, and ParseDynamicSymbols().
Referenced by GetDynstrData(), ParseSymtab(), and PLTRelocationType().
|
overridevirtual |
Gets the address size in bytes for the current object file.
Implements lldb_private::ObjectFile.
Definition at line 783 of file ObjectFileELF.cpp.
References lldb_private::DataExtractor::GetAddressByteSize(), and lldb_private::ObjectFile::m_data.
Referenced by GetDynstrData(), GetImageInfoAddress(), GetSegmentData(), ReadSectionData(), and SetLoadAddress().
|
overridevirtual |
Get the address type given a file address in an object file.
Many binary file formats know what kinds This is primarily for ARM binaries, though it can be applied to any executable file format that supports different opcode types within the same binary. ARM binaries support having both ARM and Thumb within the same executable container. We need to be able to get
Reimplemented from lldb_private::ObjectFile.
Definition at line 787 of file ObjectFileELF.cpp.
References lldb_private::ObjectFile::GetAddressClass(), lldb_private::Symtab::GetObjectFile(), lldb_private::ObjectFile::GetSymtab(), and m_address_class_map.
|
overridevirtual |
Get the ArchSpec for this object file.
Implements lldb_private::ObjectFile.
Definition at line 3579 of file ObjectFileELF.cpp.
References CalculateType(), lldb_private::ObjectFile::eTypeCoreFile, m_arch_spec, lldb_private::ObjectFile::m_data, m_section_headers, ParseHeader(), ParseSectionHeaders(), ProgramHeaders(), RefineModuleDetailsFromNote(), lldb_private::DataExtractor::SetData(), and lldb_private::ArchSpec::TripleOSWasSpecified().
Referenced by Dump(), ParseSymbols(), and ParseSymtab().
|
overridevirtual |
Returns base address of this object file.
This also sometimes referred to as the "preferred load address" or the "image base address". Addresses within object files are often expressed relative to this base. If this address corresponds to a specific section (usually the first byte of the first section) then the returned address will have this section set. Otherwise, the address will just have the offset member filled in, indicating that this represents a file address.
Reimplemented from lldb_private::ObjectFile.
Definition at line 961 of file ObjectFileELF.cpp.
References lldb_private::ObjectFile::eTypeObjectFile, lldb_private::ObjectFile::GetSectionList(), lldb_private::ObjectFile::GetType(), LLDB_INVALID_ADDRESS, m_section_headers, elf::ELFProgramHeader::p_type, ProgramHeaders(), SectionIndex(), SegmentID(), and elf::ELFSectionHeader::sh_flags.
Referenced by GetSegmentData(), and SetLoadAddress().
|
overridevirtual |
Gets whether endian swapping should occur when extracting data from this object file.
Implements lldb_private::ObjectFile.
Definition at line 775 of file ObjectFileELF.cpp.
References elf::ELFHeader::e_ident, lldb::eByteOrderBig, lldb::eByteOrderInvalid, lldb::eByteOrderLittle, and m_header.
Referenced by GetDynstrData(), GetSegmentData(), and ReadSectionData().
std::optional< FileSpec > ObjectFileELF::GetDebugLink | ( | ) |
Return the contents of the .gnu_debuglink section, if the object file contains it.
Definition at line 866 of file ObjectFileELF.cpp.
References m_gnu_debuglink_file.
Referenced by SymbolVendorELF::CreateInstance().
|
overridevirtual |
Extract the dependent modules from an object file.
If an object file has information about which other images it depends on (such as shared libraries), this function will provide the list. Since many executables or shared libraries may depend on the same files, FileSpecList::AppendIfUnique(const FileSpec &) should be used to make sure any files that are added are not already in the list.
[out] | file_list | A list of file specification objects that gets dependent files appended to. |
Implements lldb_private::ObjectFile.
Definition at line 872 of file ObjectFileELF.cpp.
References lldb_private::FileSpecList::AppendIfUnique(), m_filespec_up, and ParseDependentModules().
|
private |
Get the bytes that represent the .dynamic section.
This function will fetch the data for the .dynamic section in an ELF file. The PT_DYNAMIC program header will be used to extract the data and this function will fall back to using the section headers if PT_DYNAMIC isn't found.
std::nullopt
if an error occured. Definition at line 3863 of file ObjectFileELF.cpp.
References lldb::eSectionTypeELFDynamicLinkInfo, lldb_private::DataExtractor::GetByteSize(), lldb_private::ObjectFile::GetSectionList(), GetSegmentData(), m_dynamic_base_addr, ProgramHeaders(), and ReadSectionData().
Referenced by ParseDynamicSymbols().
|
private |
Get the bytes that represent the dynamic string table data.
This function will fetch the data for the string table in an ELF file. If the ELF file is loaded from a file on disk, it will use the section headers to extract the data and fall back to using the DT_STRTAB and DT_STRSZ .dynamic entries.
std::nullopt
if an error occured. Definition at line 3809 of file ObjectFileELF.cpp.
References elf::ELFDynamic::d_ptr, elf::ELFDynamic::d_val, lldb::eSectionTypeELFDynamicLinkInfo, FindDynamicSymbol(), GetAddressByteSize(), GetByteOrder(), lldb_private::Address::GetSection(), GetSectionHeaderByIndex(), lldb_private::ObjectFile::GetSectionList(), lldb_private::ObjectFile::m_process_wp, lldb_private::ObjectFile::ReadMemory(), ReadSectionData(), and lldb_private::Address::ResolveAddressUsingFileSections().
Referenced by ParseDynamicSymbols().
|
overridevirtual |
Returns the address of the Entry Point in this object file - if the object file doesn't have an entry point (because it is not an executable file) then an invalid address is returned.
Reimplemented from lldb_private::ObjectFile.
Definition at line 944 of file ObjectFileELF.cpp.
References elf::ELFHeader::e_entry, lldb_private::ObjectFile::GetSectionList(), IsExecutable(), lldb_private::Address::IsValid(), m_entry_point_address, m_header, ParseHeader(), lldb_private::Address::ResolveAddressUsingFileSections(), and lldb_private::Address::SetOffset().
Referenced by ParseSymtab().
|
private |
Takes the .gnu_debugdata and returns the decompressed object file that is stored within that section.
nullptr
if an error occured or if there's no section with that name. Definition at line 1983 of file ObjectFileELF.cpp.
References lldb_private::FileSpec::CopyByAppendingPathComponent(), lldb_private::ObjectFile::eTypeDebugInfo, lldb_private::SectionList::FindSectionByName(), lldb_private::DataExtractor::GetData(), lldb_private::ObjectFile::GetFileSpec(), lldb_private::ModuleChild::GetModule(), lldb_private::ObjectFile::GetSectionList(), lldb_private::lzma::isAvailable(), m_gnu_debug_data_object_file, and lldb_private::lzma::uncompress().
Referenced by CreateSections().
|
overridevirtual |
Similar to Process::GetImageInfoAddress().
Some platforms embed auxiliary structures useful to debuggers in the address space of the inferior process. This method returns the address of such a structure if the information can be resolved via entries in the object file. ELF, for example, provides a means to hook into the runtime linker so that a debugger may monitor the loading and unloading of shared libraries.
Reimplemented from lldb_private::ObjectFile.
Definition at line 884 of file ObjectFileELF.cpp.
References elf::ELFDynamic::d_tag, error(), GetAddressByteSize(), lldb_private::Address::GetLoadAddress(), lldb_private::ObjectFile::GetSectionList(), LLDB_INVALID_ADDRESS, m_dynamic_base_addr, m_dynamic_symbols, ParseDynamicSymbols(), lldb_private::Target::ReadPointerFromMemory(), lldb_private::Target::ReadUnsignedIntegerFromMemory(), lldb_private::Address::ResolveAddressUsingFileSections(), lldb_private::Address::SetOffset(), and UINT64_MAX.
Referenced by Dump().
|
overrideprotectedvirtual |
Loads this objfile to memory.
Loads the bits needed to create an executable image to the memory. It is useful with bare-metal targets where target does not have the ability to start a process itself.
[in] | target | Target where to load. |
Reimplemented from lldb_private::ObjectFile.
Definition at line 3780 of file ObjectFileELF.cpp.
References AnySegmentHasPhysicalAddress(), lldb_private::ObjectFile::LoadableData::Contents, lldb_private::ObjectFile::LoadableData::Dest, GetSegmentData(), LLDB_INVALID_ADDRESS, and ProgramHeaders().
|
static |
Definition at line 558 of file ObjectFileELF.cpp.
References lldb_private::ModuleSpecList::Append(), lldb_private::ConstString::AsCString(), calc_crc32(), CalculateELFNotesSegmentsCRC32(), elf::ELFHeader::e_ident, elf::ELFHeader::e_machine, elf::ELFHeader::e_type, lldb_private::eArchTypeELF, g_core_uuid_magic, lldb_private::ModuleSpec::GetArchitecture(), lldb_private::ArchSpec::GetArchitectureName(), lldb_private::FileSpec::GetFilename(), lldb_private::GetLog(), GetOsFromOSABI(), lldb_private::FileSpec::GetPath(), GetProgramHeaderInfo(), GetSectionHeaderInfo(), lldb_private::ModuleSpecList::GetSize(), lldb_private::ArchSpec::GetTriple(), lldb_private::ModuleSpec::GetUUID(), elf::ELFHeader::HasHeaderExtension(), lldb_private::ArchSpec::IsValid(), lldb_private::UUID::IsValid(), LLDB_LOGF, LLDB_SCOPED_TIMERF, MagicBytesMatch(), lldb_private::ObjectFile::MapFileData(), OSABIAsCString(), elf::ELFHeader::Parse(), lldb_private::ArchSpec::SetArchitecture(), lldb_private::DataExtractor::SetData(), lldb_private::ModuleSpec::SetObjectOffset(), lldb_private::ModuleSpec::SetObjectSize(), subTypeFromElfHeader(), and UNUSED_IF_ASSERT_DISABLED.
Referenced by Initialize().
|
inlinestatic |
Definition at line 67 of file ObjectFileELF.h.
Referenced by Initialize().
|
inlineoverridevirtual |
Implements lldb_private::PluginInterface.
Definition at line 91 of file ObjectFileELF.h.
References GetPluginNameStatic().
|
inlinestatic |
Definition at line 65 of file ObjectFileELF.h.
Referenced by GetPluginName(), and Initialize().
|
staticprivate |
Definition at line 1004 of file ObjectFileELF.cpp.
References elf::ELFHeader::e_phentsize, elf::ELFHeader::e_phnum, elf::ELFHeader::e_phoff, and lldb_private::DataExtractor::SetData().
Referenced by GetModuleSpecifications(), and ParseProgramHeaders().
|
private |
Returns the section header with the given id or NULL.
Definition at line 1614 of file ObjectFileELF.cpp.
References m_section_headers, and ParseSectionHeaders().
Referenced by GetDynstrData(), ParseSymbolTable(), ParseSymtab(), ParseTrampolineSymbols(), and RelocateDebugSections().
|
staticprivate |
Parses the elf section headers and returns the uuid, debug link name, crc, archspec.
Definition at line 1353 of file ObjectFileELF.cpp.
References elf::ELFHeader::e_flags, elf::ELFHeader::e_ident, elf::ELFHeader::e_machine, elf::ELFHeader::e_shentsize, elf::ELFHeader::e_shnum, elf::ELFHeader::e_shoff, elf::ELFHeader::e_shstrndx, lldb_private::eArchTypeELF, lldb_private::ArchSpec::eARM_abi_hard_float, lldb_private::ArchSpec::eARM_abi_soft_float, lldb_private::ArchSpec::eMIPS_ABI_FP_64, lldb_private::ArchSpec::eMIPS_ABI_FP_64A, lldb_private::ArchSpec::eMIPS_ABI_FP_ANY, lldb_private::ArchSpec::eMIPS_ABI_FP_DOUBLE, lldb_private::ArchSpec::eMIPS_ABI_FP_OLD_64, lldb_private::ArchSpec::eMIPS_ABI_FP_SINGLE, lldb_private::ArchSpec::eMIPS_ABI_FP_SOFT, lldb_private::ArchSpec::eMIPS_ABI_FP_XX, lldb_private::ArchSpec::eMIPSABI_EABI32, lldb_private::ArchSpec::eMIPSABI_EABI64, lldb_private::ArchSpec::eMIPSABI_N32, lldb_private::ArchSpec::eMIPSABI_N64, lldb_private::ArchSpec::eMIPSABI_O32, lldb_private::ArchSpec::eMIPSABI_O64, lldb_private::ArchSpec::eMIPSAse_mdmx, lldb_private::ArchSpec::eMIPSAse_micromips, lldb_private::ArchSpec::eMIPSAse_mips16, lldb_private::ArchSpec::eRISCV_float_abi_double, lldb_private::ArchSpec::eRISCV_float_abi_quad, lldb_private::ArchSpec::eRISCV_float_abi_single, lldb_private::ArchSpec::eRISCV_rvc, lldb_private::ArchSpec::eRISCV_rve, error(), lldb_private::DataExtractor::GetCStr(), lldb_private::ArchSpec::GetFlags(), lldb_private::GetLog(), lldb_private::ArchSpec::GetMachine(), GetOsFromOSABI(), lldb_private::ArchSpec::GetTriple(), lldb_private::DataExtractor::GetU32(), lldb_private::DataExtractor::GetU8(), lldb_private::ArchSpec::IsMIPS(), LLDB_LOGF, ParseARMAttributes(), lldb_private::DataExtractor::PeekCStr(), RefineModuleDetailsFromNote(), lldb_private::ArchSpec::SetArchitecture(), lldb_private::DataExtractor::SetData(), lldb_private::ArchSpec::SetFlags(), elf::ELFSectionHeader::sh_offset, elf::ELFSectionHeader::sh_size, elf::ELFSectionHeader::sh_type, subTypeFromElfHeader(), and UNUSED_IF_ASSERT_DISABLED.
Referenced by GetModuleSpecifications(), and ParseSectionHeaders().
|
private |
Loads the section name string table into m_shstr_data.
Returns the number of bytes constituting the table.
|
private |
Utility method for looking up a section given its name.
Returns the index of the corresponding section or zero if no section with the given name can be found (note that section indices are always 1 based, and so section index 0 is never valid).
Definition at line 1624 of file ObjectFileELF.cpp.
References m_section_headers, and ParseSectionHeaders().
Referenced by ParseTrampolineSymbols().
|
private |
Definition at line 1680 of file ObjectFileELF.cpp.
References lldb::eSectionTypeCode, lldb::eSectionTypeELFDynamicLinkInfo, lldb::eSectionTypeELFDynamicSymbols, lldb::eSectionTypeELFRelocationEntries, lldb::eSectionTypeELFSymbolTable, lldb::eSectionTypeZeroFill, GetSectionTypeFromName(), lldb_private::ConstString::GetStringRef(), ObjectFileELF::ELFSectionHeaderInfo::section_name, elf::ELFSectionHeader::sh_flags, and elf::ELFSectionHeader::sh_type.
Referenced by CreateSections().
DataExtractor ObjectFileELF::GetSegmentData | ( | const elf::ELFProgramHeader & | H | ) |
Definition at line 3750 of file ObjectFileELF.cpp.
References GetAddressByteSize(), GetBaseAddress(), GetByteOrder(), lldb_private::DataExtractor::GetByteSize(), lldb_private::Address::GetFileAddress(), lldb_private::ObjectFile::IsInMemory(), lldb_private::ObjectFile::m_data, lldb_private::ObjectFile::m_memory_addr, lldb_private::ObjectFile::m_process_wp, elf::ELFProgramHeader::p_filesz, elf::ELFProgramHeader::p_memsz, elf::ELFProgramHeader::p_offset, elf::ELFProgramHeader::p_vaddr, and lldb_private::ObjectFile::ReadMemory().
Referenced by ProcessElfCore::DoLoadCore(), GetDynamicData(), and GetLoadableData().
|
overridevirtual |
Gets the UUID for this object file.
If the object file format contains a UUID, the value should be returned. Else ObjectFile instances should return the MD5 checksum of all of the bytes for the object file (or memory for memory based object files).
Implements lldb_private::ObjectFile.
Definition at line 828 of file ObjectFileELF.cpp.
References calc_crc32(), CalculateELFNotesSegmentsCRC32(), lldb_private::ObjectFile::eTypeCoreFile, g_core_uuid_magic, lldb_private::ObjectFile::GetType(), lldb_private::ObjectFile::m_data, m_gnu_debuglink_crc, m_program_headers, m_uuid, ParseProgramHeaders(), and ParseSectionHeaders().
Referenced by SymbolVendorELF::CreateInstance().
|
static |
Definition at line 355 of file ObjectFileELF.cpp.
References CreateInstance(), CreateMemoryInstance(), GetModuleSpecifications(), GetPluginDescriptionStatic(), GetPluginNameStatic(), and lldb_private::PluginManager::RegisterPlugin().
|
inlineoverridevirtual |
Reimplemented from lldb_private::ObjectFile.
Definition at line 95 of file ObjectFileELF.h.
References ID.
|
overridevirtual |
Tells whether this object file is capable of being the main executable for a process.
Implements lldb_private::ObjectFile.
Definition at line 711 of file ObjectFileELF.cpp.
References elf::ELFHeader::e_entry, elf::ELFHeader::e_type, and m_header.
Referenced by GetEntryPointAddress().
|
overridevirtual |
Detect if this object file has been stripped of local symbols.
Detect if this object file has been stripped of local symbols.
Implements lldb_private::ObjectFile.
Definition at line 3179 of file ObjectFileELF.cpp.
|
static |
Definition at line 454 of file ObjectFileELF.cpp.
References elf::ELFHeader::MagicBytesMatch().
Referenced by GetModuleSpecifications().
|
staticprotected |
Definition at line 3803 of file ObjectFileELF.cpp.
References lldb_private::FileSystem::CreateWritableDataBuffer(), lldb_private::FileSpec::GetPath(), and lldb_private::FileSystem::Instance().
Referenced by CreateInstance().
|
staticprivate |
Definition at line 1282 of file ObjectFileELF.cpp.
References lldb_private::ArchSpec::eARM_abi_hard_float, lldb_private::ArchSpec::eARM_abi_soft_float, lldb_private::DataExtractor::GetCStr(), lldb_private::ArchSpec::GetTriple(), lldb_private::DataExtractor::GetU32(), lldb_private::DataExtractor::GetU8(), lldb_private::DataExtractor::GetULEB128(), and lldb_private::ArchSpec::SetFlags().
Referenced by GetSectionHeaderInfo().
|
private |
Scans the dynamic section and locates all dependent modules (shared libraries) populating m_filespec_up.
This method will compute the dependent module list only once. Returns the number of dependent modules parsed.
Definition at line 983 of file ObjectFileELF.cpp.
References lldb_private::FileSystem::Instance(), m_dynamic_symbols, m_filespec_up, ParseDynamicSymbols(), and lldb_private::FileSystem::Resolve().
Referenced by DumpDependentModules(), and GetDependentModules().
|
private |
Parses the dynamic symbol table and populates m_dynamic_symbols.
The vector retains the order as found in the object file. Returns the number of dynamic symbols parsed.
Definition at line 2442 of file ObjectFileELF.cpp.
References elf::ELFDynamic::d_tag, GetDynamicData(), GetDynstrData(), m_dynamic_symbols, elf::ELFDynamic::Parse(), and ObjectFileELF::ELFDynamicWithName::symbol.
Referenced by DumpELFDynamic(), FindDynamicSymbol(), GetImageInfoAddress(), and ParseDependentModules().
|
overridevirtual |
Attempts to parse the object header.
This function is used as a test to see if a given plug-in instance can parse the header data already contained in ObjectFile::m_data. If an object file parser does not recognize that magic bytes in a header, false should be returned and the next plug-in can attempt to parse an object file.
Implements lldb_private::ObjectFile.
Definition at line 823 of file ObjectFileELF.cpp.
References lldb_private::ObjectFile::m_data, m_header, and elf::ELFHeader::Parse().
Referenced by GetArchitecture(), and GetEntryPointAddress().
|
private |
Parses all section headers present in this object file and populates m_program_headers.
This method will compute the header list only once. Returns true iff the headers have been successfully parsed.
Definition at line 1039 of file ObjectFileELF.cpp.
References GetProgramHeaderInfo(), lldb_private::ObjectFile::m_data, m_header, and m_program_headers.
Referenced by DumpELFProgramHeaders(), GetUUID(), and ProgramHeaders().
|
private |
Parses all section headers present in this object file and populates m_section_headers.
This method will compute the header list only once. Returns the number of headers parsed.
Definition at line 1607 of file ObjectFileELF.cpp.
References GetSectionHeaderInfo(), m_arch_spec, lldb_private::ObjectFile::m_data, m_gnu_debuglink_crc, m_gnu_debuglink_file, m_header, m_section_headers, and m_uuid.
Referenced by CreateSections(), DumpELFSectionHeaders(), GetArchitecture(), GetSectionHeaderByIndex(), GetSectionIndexByName(), and GetUUID().
|
private |
Helper routine for ParseSymbolTable().
Definition at line 2052 of file ObjectFileELF.cpp.
References lldb_private::Symtab::AddSymbol(), CalculateType(), lldb::eSymbolTypeAbsolute, lldb::eSymbolTypeCode, lldb::eSymbolTypeData, lldb::eSymbolTypeInvalid, lldb::eSymbolTypeResolver, lldb::eSymbolTypeSourceFile, lldb::eSymbolTypeTrampoline, lldb::eSymbolTypeUndefined, FindArmAarch64MappingSymbol(), FindMatchingSection(), lldb_private::SectionList::FindSectionByID(), GetArchitecture(), elf::ELFSymbol::getBinding(), lldb_private::Mangled::GetDemangledName(), lldb_private::FileSpec::GetFileNameExtension(), lldb_private::ArchSpec::GetMachine(), lldb_private::Mangled::GetMangledName(), lldb_private::ModuleChild::GetModule(), lldb_private::Mangled::GetName(), lldb_private::ConstString::GetStringRef(), elf::ELFSymbol::getType(), IS_MICROMIPS, lldb_private::ArchSpec::IsMIPS(), lldb_private::ArchSpec::IsValid(), m_address_class_map, lldb_private::ObjectFile::m_file, elf::ELFSymbol::Parse(), lldb_private::DataExtractor::PeekCStr(), lldb_private::Mangled::SetDemangledName(), lldb_private::Symbol::SetIsWeak(), lldb_private::Mangled::SetMangledName(), elf::ELFSymbol::st_info, elf::ELFSymbol::st_name, elf::ELFSymbol::st_other, elf::ELFSymbol::st_shndx, elf::ELFSymbol::st_size, and elf::ELFSymbol::st_value.
Referenced by ParseSymbolTable().
|
private |
Populates the symbol table with all non-dynamic linker symbols.
This method will parse the symbols only once. Returns the number of symbols parsed and a map of address types (used by targets like Arm that have an alternative ISA mode like Thumb).
Definition at line 2393 of file ObjectFileELF.cpp.
References lldb_private::SectionList::FindSectionByID(), lldb_private::DataExtractor::GetByteSize(), lldb_private::UserID::GetID(), lldb_private::Section::GetObjectFile(), GetSectionHeaderByIndex(), m_address_class_map, lldb_private::ObjectFile::m_sections_up, ParseSymbols(), ParseSymbolTable(), ReadSectionData(), elf::ELFSectionHeader::sh_entsize, elf::ELFSectionHeader::sh_link, and elf::ELFSectionHeader::sh_type.
Referenced by ParseSymbolTable(), and ParseSymtab().
|
overridevirtual |
Parse the symbol table into the provides symbol table object.
Symbol table parsing will be done once when this function is called by each object file plugin. All of the necessary locks will already be acquired before this function is called and the symbol table object to populate is supplied as an argument and doesn't need to be created by each plug-in.
The | symbol table to populate. |
Implements lldb_private::ObjectFile.
Definition at line 2947 of file ObjectFileELF.cpp.
References lldb_private::Symtab::AddSymbol(), lldb_private::ConstString::AsCString(), CalculateType(), elf::ELFDynamic::d_ptr, elapsed(), lldb::eSectionTypeELFDynamicSymbols, lldb::eSectionTypeELFSymbolTable, lldb::eSymbolTypeCode, lldb_private::ObjectFile::eTypeExecutable, FindDynamicSymbol(), lldb_private::SectionList::FindSectionByType(), lldb_private::SectionList::FindSectionContainingFileAddress(), lldb_private::Symtab::FindSymbolContainingFileAddress(), lldb_private::Symbol::GetAddressRef(), GetArchitecture(), GetEntryPointAddress(), lldb_private::FileSpec::GetFilename(), lldb_private::UserID::GetID(), lldb_private::ArchSpec::GetMachine(), lldb_private::ModuleChild::GetModule(), lldb_private::Symtab::GetNumSymbols(), GetSectionHeaderByIndex(), lldb_private::ObjectFile::GetSectionList(), m_address_class_map, lldb_private::ObjectFile::m_file, ParseSymbolTable(), lldb_private::ObjectFile::ParseSymtab(), ParseTrampolineSymbols(), ParseUnwindSymbols(), and lldb_private::Address::SetOffset().
|
private |
Scans the relocation entries and adds a set of artificial symbols to the given symbol table for each PLT slot.
Returns the number of symbols added.
Definition at line 2607 of file ObjectFileELF.cpp.
References lldb_private::SectionList::FindSectionByID(), GetSectionHeaderByIndex(), GetSectionIndexByName(), m_header, lldb_private::ObjectFile::m_sections_up, ParsePLTRelocations(), PLTRelocationType(), ReadSectionData(), elf::ELFSectionHeader::sh_link, and elf::ELFSectionHeader::sh_type.
Referenced by ParseSymtab().
|
private |
Definition at line 3122 of file ObjectFileELF.cpp.
References lldb_private::Symtab::AddSymbol(), lldb::eSymbolTypeCode, lldb_private::SectionList::FindSectionContainingFileAddress(), lldb_private::Symtab::FindSymbolAtFileAddress(), lldb_private::DWARFCallFrameInfo::ForEachFDEEntries(), lldb_private::Symbol::GetByteSizeIsValid(), lldb_private::Symbol::GetID(), lldb_private::Symtab::GetNumSymbols(), lldb_private::ObjectFile::GetSectionList(), and lldb_private::Symtab::SymbolAtIndex().
Referenced by ParseSymtab().
|
private |
Definition at line 2490 of file ObjectFileELF.cpp.
References elf::ELFDynamic::d_val, and FindDynamicSymbol().
Referenced by ParseTrampolineSymbols().
llvm::ArrayRef< ELFProgramHeader > ObjectFileELF::ProgramHeaders | ( | ) |
Definition at line 3745 of file ObjectFileELF.cpp.
References m_program_headers, and ParseProgramHeaders().
Referenced by AnySegmentHasPhysicalAddress(), CreateSections(), ProcessElfCore::DoLoadCore(), GetArchitecture(), GetBaseAddress(), GetDynamicData(), and GetLoadableData().
|
overridevirtual |
Reimplemented from lldb_private::ObjectFile.
Definition at line 3688 of file ObjectFileELF.cpp.
References lldb_private::DataExtractor::CopyData(), lldb_private::Section::GetObjectFile(), ReadSectionData(), lldb_private::ObjectFile::ReadSectionData(), and lldb_private::Flags::Test().
Referenced by CalculateStrata(), GetDynamicData(), GetDynstrData(), ParseSymbolTable(), ParseTrampolineSymbols(), and ReadSectionData().
|
overridevirtual |
Reimplemented from lldb_private::ObjectFile.
Definition at line 3706 of file ObjectFileELF.cpp.
References lldb_private::DataExtractor::Clear(), lldb::eByteOrderLittle, error(), lldb_private::Flags::Get(), GetAddressByteSize(), GetByteOrder(), lldb_private::ConstString::GetCString(), lldb_private::ModuleChild::GetModule(), lldb_private::Section::GetName(), lldb_private::Section::GetObjectFile(), lldb_private::ConstString::GetStringRef(), lldb_private::ObjectFile::ReadSectionData(), and lldb_private::DataExtractor::SetData().
|
staticprivate |
Definition at line 1044 of file ObjectFileELF.cpp.
References error(), lldb_private::DataExtractor::GetAddress(), lldb_private::DataExtractor::GetAddressByteSize(), ELFNote::GetByteSize(), lldb_private::DataExtractor::GetCStr(), lldb_private::GetLog(), lldb_private::ArchSpec::GetTriple(), lldb_private::DataExtractor::GetU32(), lldb_private::ArchSpec::IsMIPS(), lldb_private::UUID::IsValid(), LLDB_LOGF, LLDB_NT_FREEBSD_ABI_SIZE, LLDB_NT_FREEBSD_ABI_TAG, LLDB_NT_GNU_ABI_OS_HURD, LLDB_NT_GNU_ABI_OS_LINUX, LLDB_NT_GNU_ABI_OS_SOLARIS, LLDB_NT_GNU_ABI_SIZE, LLDB_NT_GNU_ABI_TAG, LLDB_NT_GNU_BUILD_ID_TAG, LLDB_NT_NETBSD_IDENT_DESCSZ, LLDB_NT_NETBSD_IDENT_NAMESZ, LLDB_NT_NETBSD_IDENT_TAG, LLDB_NT_NETBSD_PROCINFO, LLDB_NT_OWNER_ANDROID, LLDB_NT_OWNER_CORE, LLDB_NT_OWNER_FREEBSD, LLDB_NT_OWNER_GNU, LLDB_NT_OWNER_LINUX, LLDB_NT_OWNER_NETBSD, LLDB_NT_OWNER_NETBSDCORE, LLDB_NT_OWNER_OPENBSD, ELFNote::n_descsz, ELFNote::n_name, ELFNote::n_namesz, ELFNote::n_type, ELFNote::Parse(), and lldb_private::DataExtractor::PeekData().
Referenced by GetArchitecture(), and GetSectionHeaderInfo().
|
private |
Relocates debug sections.
Definition at line 2900 of file ObjectFileELF.cpp.
References ApplyRelocations(), lldb_private::SectionList::FindSectionByID(), lldb_private::ObjectFile::GetData(), lldb_private::Section::GetFileOffset(), lldb_private::Section::GetFileSize(), GetSectionHeaderByIndex(), lldb_private::ObjectFile::GetSectionList(), m_header, elf::ELFSectionHeader::sh_info, elf::ELFSectionHeader::sh_link, and elf::ELFSectionHeader::sh_type.
Referenced by RelocateSection().
|
overridevirtual |
Perform relocations on the section if necessary.
Reimplemented from lldb_private::ObjectFile.
Definition at line 3081 of file ObjectFileELF.cpp.
References CalculateType(), lldb_private::ObjectFile::eTypeObjectFile, lldb_private::ConstString::GetCString(), lldb_private::Section::GetName(), lldb_private::ObjectFile::GetSymtab(), m_section_headers, RelocateDebugSections(), SectionIndex(), and lldb_private::Section::SetIsRelocated().
|
private |
Returns the index of the given section header.
Definition at line 819 of file ObjectFileELF.cpp.
References m_section_headers.
|
private |
Returns the index of the given section header.
Definition at line 815 of file ObjectFileELF.cpp.
References m_section_headers.
Referenced by CreateSections(), GetBaseAddress(), and RelocateSection().
|
overridevirtual |
Sets the load address for an entire module, assuming a rigid slide of sections, if possible in the implementation.
Reimplemented from lldb_private::ObjectFile.
Definition at line 715 of file ObjectFileELF.cpp.
References lldb::eSectionTypeAbsoluteAddress, lldb::eSectionTypeContainer, GetAddressByteSize(), GetBaseAddress(), lldb_private::Address::GetFileAddress(), lldb_private::ModuleChild::GetModule(), lldb_private::SectionList::GetSectionAtIndex(), lldb_private::ObjectFile::GetSectionList(), lldb_private::Target::GetSectionLoadList(), lldb_private::SectionList::GetSize(), LLDB_INVALID_ADDRESS, and lldb_private::SectionLoadList::SetSectionLoadAddress().
|
overridevirtual |
Reimplemented from lldb_private::ObjectFile.
Definition at line 1601 of file ObjectFileELF.cpp.
|
static |
Definition at line 361 of file ObjectFileELF.cpp.
References CreateInstance(), and lldb_private::PluginManager::UnregisterPlugin().
|
staticprivate |
Definition at line 202 of file ObjectFileELF.h.
Referenced by GetModuleSpecifications(), and GetUUID().
|
static |
Definition at line 94 of file ObjectFileELF.h.
|
private |
The address class for each symbol in the elf file.
Definition at line 242 of file ObjectFileELF.h.
Referenced by GetAddressClass(), ParseSymbols(), ParseSymbolTable(), and ParseSymtab().
|
private |
The architecture detected from parsing elf file contents.
Definition at line 239 of file ObjectFileELF.h.
Referenced by CreateSections(), GetArchitecture(), and ParseSectionHeaders().
|
private |
The file address of the .dynamic section.
This can be found in the p_vaddr of the PT_DYNAMIC program header.
Definition at line 222 of file ObjectFileELF.h.
Referenced by GetDynamicData(), and GetImageInfoAddress().
|
private |
Collection of symbols from the dynamic table.
Definition at line 225 of file ObjectFileELF.h.
Referenced by DumpELFDynamic(), FindDynamicSymbol(), GetImageInfoAddress(), ParseDependentModules(), and ParseDynamicSymbols().
|
private |
Cached value of the entry point for this module.
Definition at line 236 of file ObjectFileELF.h.
Referenced by GetEntryPointAddress().
|
mutableprivate |
List of file specifications corresponding to the modules (shared libraries) on which this object file depends.
Definition at line 233 of file ObjectFileELF.h.
Referenced by DumpDependentModules(), GetDependentModules(), and ParseDependentModules().
|
private |
Object file parsed from .gnu_debugdata section (.
Definition at line 229 of file ObjectFileELF.h.
Referenced by GetGnuDebugDataObjectFile().
|
private |
Definition at line 212 of file ObjectFileELF.h.
Referenced by GetUUID(), and ParseSectionHeaders().
|
private |
ELF .gnu_debuglink file and crc data if available.
Definition at line 211 of file ObjectFileELF.h.
Referenced by GetDebugLink(), and ParseSectionHeaders().
|
private |
ELF file header.
Definition at line 205 of file ObjectFileELF.h.
Referenced by CalculateStrata(), CalculateType(), Dump(), DumpELFDynamic(), GetByteOrder(), GetEntryPointAddress(), IsExecutable(), ParseHeader(), ParseProgramHeaders(), ParseSectionHeaders(), ParseTrampolineSymbols(), and RelocateDebugSections().
|
staticprivate |
Version of this reader common to all plugins based on this class.
Definition at line 201 of file ObjectFileELF.h.
|
private |
Collection of program headers.
Definition at line 215 of file ObjectFileELF.h.
Referenced by DumpELFProgramHeaders(), GetUUID(), ParseProgramHeaders(), and ProgramHeaders().
|
private |
Collection of section headers.
Definition at line 218 of file ObjectFileELF.h.
Referenced by CreateSections(), DumpELFSectionHeaders(), GetArchitecture(), GetBaseAddress(), GetSectionHeaderByIndex(), GetSectionIndexByName(), ParseSectionHeaders(), RelocateSection(), and SectionIndex().
|
private |
ELF build ID.
Definition at line 208 of file ObjectFileELF.h.
Referenced by GetUUID(), and ParseSectionHeaders().