LLDB mainline
|
A plug-in interface definition class for object file parsers. More...
#include "lldb/Symbol/ObjectFile.h"
Classes | |
struct | LoadableData |
Public Types | |
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... | |
Public Member Functions | |
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 Member Functions | |
static lldb::ObjectFileSP | FindPlugin (const lldb::ModuleSP &module_sp, const FileSpec *file_spec, lldb::offset_t file_offset, lldb::offset_t file_size, lldb::DataBufferSP &data_sp, lldb::offset_t &data_offset) |
Find a ObjectFile plug-in that can parse file_spec. | |
static lldb::ObjectFileSP | FindPlugin (const lldb::ModuleSP &module_sp, const lldb::ProcessSP &process_sp, lldb::addr_t header_addr, lldb::WritableDataBufferSP file_data_sp) |
Find a ObjectFile plug-in that can parse a file in memory. | |
static size_t | GetModuleSpecifications (const FileSpec &file, lldb::offset_t file_offset, lldb::offset_t file_size, ModuleSpecList &specs, lldb::DataBufferSP data_sp=lldb::DataBufferSP()) |
static size_t | GetModuleSpecifications (const lldb_private::FileSpec &file, lldb::DataBufferSP &data_sp, lldb::offset_t data_offset, lldb::offset_t file_offset, lldb::offset_t file_size, lldb_private::ModuleSpecList &specs) |
static bool | IsObjectFile (lldb_private::FileSpec file_spec) |
static bool | SplitArchivePathWithObject (llvm::StringRef path_with_object, lldb_private::FileSpec &archive_file, lldb_private::ConstString &archive_object, bool must_exist) |
Split a path into a file path with object name. | |
static lldb::WritableDataBufferSP | ReadMemory (const lldb::ProcessSP &process_sp, lldb::addr_t addr, size_t byte_size) |
static lldb::SymbolType | GetSymbolTypeFromName (llvm::StringRef name, lldb::SymbolType symbol_type_hint=lldb::eSymbolTypeUndefined) |
static lldb::DataBufferSP | MapFileData (const FileSpec &file, uint64_t Size, uint64_t Offset) |
Static Public Attributes | |
static char | ID |
Protected Member Functions | |
bool | SetModulesArchitecture (const ArchSpec &new_arch) |
Sets the architecture for a module. | |
Protected Attributes | |
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 | |
static size_t | g_initial_bytes_to_read = 512 |
The number of bytes to read when going through the plugins. | |
Private Member Functions | |
ObjectFile (const ObjectFile &)=delete | |
const ObjectFile & | operator= (const ObjectFile &)=delete |
Friends | |
class | lldb_private::Module |
A plug-in interface definition class for object file parsers.
Object files belong to Module objects and know how to extract information from executable, shared library, and object (.o) files used by operating system runtime. The symbol table and section list for an object file.
Object files can be represented by the entire file, or by part of a file. An example of a partial file ObjectFile is one that contains information for one of multiple architectures in the same file.
Once an architecture is selected the object file information can be extracted from this abstract class.
Definition at line 42 of file ObjectFile.h.
If we have a corefile binary hint, this enum specifies the binary type which we can use to select the correct DynamicLoader plugin.
Enumerator | |
---|---|
eBinaryTypeInvalid | |
eBinaryTypeUnknown | |
eBinaryTypeKernel | |
eBinaryTypeUser | kernel binary |
eBinaryTypeStandalone | user process binary standalone binary / firmware |
Definition at line 81 of file ObjectFile.h.
Enumerator | |
---|---|
eStrataInvalid | |
eStrataUnknown | |
eStrataUser | |
eStrataKernel | |
eStrataRawImage | |
eStrataJIT |
Definition at line 69 of file ObjectFile.h.
Definition at line 48 of file ObjectFile.h.
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.
Object files belong to modules and a valid module must be supplied upon construction. The at an offset within a file for objects that contain more than one architecture or object.
Definition at line 250 of file ObjectFile.cpp.
References lldb_private::GetLog(), lldb_private::FileSpec::GetPath(), LLDB_LOGF, m_data, m_file, m_file_offset, m_length, lldb_private::Object, and lldb_private::DataExtractor::SetData().
ObjectFile::ObjectFile | ( | const lldb::ModuleSP & | module_sp, |
const lldb::ProcessSP & | process_sp, | ||
lldb::addr_t | header_addr, | ||
lldb::DataBufferSP | data_sp | ||
) |
Definition at line 274 of file ObjectFile.cpp.
References lldb_private::GetLog(), LLDB_LOGF, m_data, m_memory_addr, lldb_private::Object, and lldb_private::DataExtractor::SetData().
|
override |
Destructor.
The destructor is virtual since this class is designed to be inherited from by the plug-in instance.
Definition at line 292 of file ObjectFile.cpp.
References lldb_private::GetLog(), LLDB_LOGF, and lldb_private::Object.
|
privatedelete |
|
inlinevirtual |
Returns if the function bounds for symbols in this symbol file are likely accurate.
The unwinder can emulate the instructions of functions to understand prologue/epilogue code sequences, where registers are spilled on the stack, etc. This feature relies on having the correct start addresses of all functions. If the ObjectFile has a way to tell that symbols have been stripped and there's no way to reconstruct start addresses (e.g. LC_FUNCTION_STARTS on Mach-O, or eh_frame unwind info), the ObjectFile should indicate that assembly emulation should not be used for this module.
It is uncommon for this to return false. An ObjectFile needs to be sure that symbol start addresses are unavailable before false is returned. If it is unclear, this should return true.
Reimplemented in ObjectFileMachO.
Definition at line 446 of file ObjectFile.h.
|
pure virtual |
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.
Implemented in lldb_private::ObjectFileJIT, lldb_private::breakpad::ObjectFileBreakpad, ObjectFileCOFF, ObjectFileELF, lldb_private::ObjectFileJSON, ObjectFileMachO, lldb_private::ObjectFilePDB, ObjectFilePECOFF, ObjectFilePlaceholder, lldb_private::wasm::ObjectFileWasm, and ObjectFileXCOFF.
Referenced by GetStrata().
|
pure virtual |
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.
Implemented in lldb_private::ObjectFileJIT, lldb_private::breakpad::ObjectFileBreakpad, ObjectFileCOFF, ObjectFileELF, lldb_private::ObjectFileJSON, ObjectFileMachO, lldb_private::ObjectFilePDB, ObjectFilePECOFF, ObjectFilePlaceholder, lldb_private::wasm::ObjectFileWasm, and ObjectFileXCOFF.
Referenced by GetType().
|
inlinevirtual |
Can we trust the address ranges accelerator associated with this object file to be complete.
Reimplemented in ObjectFileMachO.
Definition at line 701 of file ObjectFile.h.
Referenced by lldb_private::plugin::dwarf::DWARFDebugInfo::GetCompileUnitAranges().
|
virtual |
Frees the symbol table.
This function should only be used when an object file is
Definition at line 588 of file ObjectFile.cpp.
References lldb_private::GetLog(), lldb_private::ModuleChild::GetModule(), LLDB_LOGF, m_symtab_once_up, m_symtab_up, and lldb_private::Object.
Referenced by lldb_private::plugin::dwarf::SymbolFileDWARFDebugMap::CompileUnitInfo::GetFileRangeMap(), and lldb_private::Module::SetSymbolFileFileSpec().
size_t ObjectFile::CopyData | ( | lldb::offset_t | offset, |
size_t | length, | ||
void * | dst | ||
) | const |
Definition at line 481 of file ObjectFile.cpp.
References lldb_private::DataExtractor::CopyData(), and m_data.
Referenced by ProcessElfCore::DoReadMemory(), ProcessMachCore::DoReadMemory(), ProcessMachCore::LoadBinaryViaLowmemUUID(), ProcessElfCore::ReadMemoryTags(), and ReadSectionData().
|
virtual |
Creates a plugin-specific call frame info.
Reimplemented in ObjectFilePECOFF.
Definition at line 665 of file ObjectFile.cpp.
Referenced by lldb_private::UnwindTable::Initialize().
|
pure virtual |
Implemented in ObjectFileCOFF, lldb_private::ObjectFileJIT, ObjectFileELF, ObjectFileMachO, ObjectFilePECOFF, ObjectFilePlaceholder, ObjectFileXCOFF, lldb_private::breakpad::ObjectFileBreakpad, lldb_private::ObjectFileJSON, lldb_private::ObjectFilePDB, and lldb_private::wasm::ObjectFileWasm.
Referenced by lldb_private::Module::GetSectionList(), and GetSectionList().
|
pure virtual |
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. |
Implemented in lldb_private::ObjectFileJIT, ObjectFileELF, ObjectFileMachO, ObjectFilePECOFF, ObjectFilePlaceholder, ObjectFileXCOFF, ObjectFileCOFF, lldb_private::breakpad::ObjectFileBreakpad, lldb_private::ObjectFileJSON, lldb_private::ObjectFilePDB, and lldb_private::wasm::ObjectFileWasm.
Referenced by lldb_private::Module::Dump(), and DumpModuleObjfileHeaders().
|
static |
Find a ObjectFile plug-in that can parse file_spec.
Scans all loaded plug-in interfaces that implement versions of the ObjectFile plug-in interface and returns the first instance that can parse the file.
[in] | module_sp | The parent module that owns this object file. |
[in] | file_spec | A file specification that indicates which file to use as the object file. |
[in] | file_offset | The offset into the file at which to start parsing the object. This is for files that contain multiple architectures or objects. |
[in] | file_size | The size of the current object file if it can be determined or if it is known. This can be zero. |
Definition at line 53 of file ObjectFile.cpp.
References lldb_private::FileSystem::CreateDataBuffer(), CreateObjectFromContainer(), lldb_private::FileSystem::Exists(), g_initial_bytes_to_read, lldb_private::FileSystem::GetByteSize(), lldb_private::PluginManager::GetObjectFileCreateCallbackAtIndex(), lldb_private::FileSpec::GetPath(), lldb_private::FileSystem::Instance(), LLDB_SCOPED_TIMERF, and SplitArchivePathWithObject().
Referenced by SymbolVendorELF::CreateInstance(), SymbolVendorMacOSX::CreateInstance(), SymbolVendorPECOFF::CreateInstance(), lldb_private::wasm::SymbolVendorWasm::CreateInstance(), lldb_private::SymbolVendor::FindPlugin(), lldb_private::plugin::dwarf::SymbolFileDWARF::GetDwoSymbolFileForCompileUnit(), lldb_private::plugin::dwarf::SymbolFileDWARF::GetDwpSymbolFile(), lldb_private::Module::GetMemoryObjectFile(), lldb_private::Module::GetObjectFile(), ObjectContainerBSDArchive::GetObjectFile(), lldb_private::ObjectContainerMachOFileset::GetObjectFile(), ObjectContainerUniversalMachO::GetObjectFile(), IsDwpSymbolFile(), and IsObjectFile().
|
static |
Find a ObjectFile plug-in that can parse a file in memory.
Scans all loaded plug-in interfaces that implement versions of the ObjectFile plug-in interface and returns the first instance that can parse the file.
[in] | module_sp | The parent module that owns this object file. |
[in] | process_sp | A shared pointer to the process whose memory space contains an object file. This will be stored as a std::weak_ptr. |
[in] | header_addr | The address of the header for the object file in memory. |
Definition at line 152 of file ObjectFile.cpp.
References lldb_private::PluginManager::GetObjectFileCreateMemoryCallbackAtIndex(), and LLDB_SCOPED_TIMERF.
|
inlinevirtual |
Some object files may have the number of bits used for addressing embedded in them, e.g.
a Mach-O core file using an LC_NOTE. These object files can return an AddressableBits object that can can be used to set the address masks in the Process.
Reimplemented in ObjectFileMachO.
Definition at line 505 of file ObjectFile.h.
Referenced by ProcessMachCore::DoLoadCore().
|
pure virtual |
Gets the address size in bytes for the current object file.
Implemented in lldb_private::ObjectFileJIT, lldb_private::breakpad::ObjectFileBreakpad, ObjectFileCOFF, ObjectFileELF, lldb_private::ObjectFileJSON, ObjectFileMachO, lldb_private::ObjectFilePDB, ObjectFilePECOFF, ObjectFilePlaceholder, lldb_private::wasm::ObjectFileWasm, and ObjectFileXCOFF.
Referenced by lldb_private::DWARFCallFrameInfo::FDEToUnwindPlan(), lldb_private::Value::GetValueAsData(), lldb_private::Symtab::LoadFromCache(), lldb_private::plugin::dwarf::ManualDWARFIndex::LoadFromCache(), and lldb_private::plugin::dwarf::ManualDWARFIndex::SaveToCache().
|
virtual |
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 in lldb_private::breakpad::ObjectFileBreakpad, ObjectFileELF, lldb_private::ObjectFileJSON, ObjectFileMachO, lldb_private::wasm::ObjectFileWasm, and ObjectFileXCOFF.
Definition at line 304 of file ObjectFile.cpp.
References lldb_private::eCode, lldb_private::eData, lldb_private::eDebug, lldb_private::eRuntime, lldb::eSectionTypeAbsoluteAddress, lldb::eSectionTypeARMexidx, lldb::eSectionTypeARMextab, lldb::eSectionTypeCode, lldb::eSectionTypeCompactUnwind, lldb::eSectionTypeContainer, lldb::eSectionTypeCTF, lldb::eSectionTypeData, lldb::eSectionTypeData16, lldb::eSectionTypeData4, lldb::eSectionTypeData8, lldb::eSectionTypeDataCString, lldb::eSectionTypeDataCStringPointers, lldb::eSectionTypeDataObjCCFStrings, lldb::eSectionTypeDataObjCMessageRefs, lldb::eSectionTypeDataPointers, lldb::eSectionTypeDataSymbolAddress, lldb::eSectionTypeDebug, lldb::eSectionTypeDWARFAppleNames, lldb::eSectionTypeDWARFAppleNamespaces, lldb::eSectionTypeDWARFAppleObjC, lldb::eSectionTypeDWARFAppleTypes, lldb::eSectionTypeDWARFDebugAbbrev, lldb::eSectionTypeDWARFDebugAbbrevDwo, lldb::eSectionTypeDWARFDebugAddr, lldb::eSectionTypeDWARFDebugAranges, lldb::eSectionTypeDWARFDebugCuIndex, lldb::eSectionTypeDWARFDebugFrame, lldb::eSectionTypeDWARFDebugInfo, lldb::eSectionTypeDWARFDebugInfoDwo, lldb::eSectionTypeDWARFDebugLine, lldb::eSectionTypeDWARFDebugLineStr, lldb::eSectionTypeDWARFDebugLoc, lldb::eSectionTypeDWARFDebugLocDwo, lldb::eSectionTypeDWARFDebugLocLists, lldb::eSectionTypeDWARFDebugLocListsDwo, lldb::eSectionTypeDWARFDebugMacInfo, lldb::eSectionTypeDWARFDebugMacro, lldb::eSectionTypeDWARFDebugNames, lldb::eSectionTypeDWARFDebugPubNames, lldb::eSectionTypeDWARFDebugPubTypes, lldb::eSectionTypeDWARFDebugRanges, lldb::eSectionTypeDWARFDebugRngLists, lldb::eSectionTypeDWARFDebugRngListsDwo, lldb::eSectionTypeDWARFDebugStr, lldb::eSectionTypeDWARFDebugStrDwo, lldb::eSectionTypeDWARFDebugStrOffsets, lldb::eSectionTypeDWARFDebugStrOffsetsDwo, lldb::eSectionTypeDWARFDebugTuIndex, lldb::eSectionTypeDWARFDebugTypes, lldb::eSectionTypeDWARFDebugTypesDwo, lldb::eSectionTypeDWARFGNUDebugAltLink, lldb::eSectionTypeEHFrame, lldb::eSectionTypeELFDynamicLinkInfo, lldb::eSectionTypeELFDynamicSymbols, lldb::eSectionTypeELFRelocationEntries, lldb::eSectionTypeELFSymbolTable, lldb::eSectionTypeGoSymtab, lldb::eSectionTypeInvalid, lldb::eSectionTypeLLDBFormatters, lldb::eSectionTypeLLDBTypeSummaries, lldb::eSectionTypeOther, lldb::eSectionTypeSwiftModules, lldb::eSectionTypeZeroFill, lldb::eSymbolTypeAbsolute, lldb::eSymbolTypeAdditional, lldb::eSymbolTypeAny, lldb::eSymbolTypeBlock, lldb::eSymbolTypeCode, lldb::eSymbolTypeCommonBlock, lldb::eSymbolTypeCompiler, lldb::eSymbolTypeData, lldb::eSymbolTypeException, lldb::eSymbolTypeHeaderFile, lldb::eSymbolTypeInstrumentation, lldb::eSymbolTypeLineEntry, lldb::eSymbolTypeLineHeader, lldb::eSymbolTypeLocal, lldb::eSymbolTypeObjCClass, lldb::eSymbolTypeObjCIVar, lldb::eSymbolTypeObjCMetaClass, lldb::eSymbolTypeObjectFile, lldb::eSymbolTypeParam, lldb::eSymbolTypeReExported, lldb::eSymbolTypeResolver, lldb::eSymbolTypeRuntime, lldb::eSymbolTypeScopeBegin, lldb::eSymbolTypeScopeEnd, lldb::eSymbolTypeSourceFile, lldb::eSymbolTypeTrampoline, lldb::eSymbolTypeUndefined, lldb::eSymbolTypeVariable, lldb::eSymbolTypeVariableType, lldb_private::eUnknown, lldb_private::Symtab::FindSymbolContainingFileAddress(), lldb_private::Symbol::GetAddressRef(), lldb_private::Address::GetSection(), GetSymtab(), lldb_private::Symbol::GetType(), and lldb_private::Symbol::ValueIsAddress().
Referenced by lldb_private::Address::GetAddressClass(), and ObjectFileELF::GetAddressClass().
|
pure virtual |
Get the ArchSpec for this object file.
Implemented in lldb_private::ObjectFileJIT, lldb_private::breakpad::ObjectFileBreakpad, ObjectFileCOFF, ObjectFileELF, lldb_private::ObjectFileJSON, ObjectFileMachO, lldb_private::ObjectFilePDB, ObjectFilePECOFF, ObjectFilePlaceholder, lldb_private::wasm::ObjectFileWasm, and ObjectFileXCOFF.
Referenced by SystemRuntimeMacOSX::CreateInstance(), DynamicLoaderMacOSXDYLD::CreateInstance(), lldb_private::Type::GetByteSize(), lldb_private::DWARFCallFrameInfo::GetFDEIndex(), lldb_private::CompactUnwindInfo::GetUnwindPlan(), and lldb_private::CompactUnwindInfo::ScanIndex().
|
inlinevirtual |
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 in lldb_private::ObjectFileJIT, ObjectFileELF, ObjectFileMachO, ObjectFilePECOFF, ObjectFilePlaceholder, and lldb_private::wasm::ObjectFileWasm.
Definition at line 480 of file ObjectFile.h.
References m_memory_addr.
Referenced by BuildModulesSection(), CreateAllImageInfosPayload(), DynamicLoaderFreeBSDKernel::FindKernelAtLoadAddress(), lldb_private::CompactUnwindInfo::GetCompactUnwindInfoForFunction(), lldb::SBModule::GetObjectFileHeaderAddress(), lldb_private::CompactUnwindInfo::GetUnwindPlan(), DynamicLoaderFreeBSDKernel::KModImageInfo::LoadImageUsingMemoryModule(), DynamicLoaderDarwinKernel::KextImageInfo::LoadImageUsingMemoryModule(), DynamicLoaderDarwinKernel::LoadKernelModuleIfNeeded(), CommandObjectTargetModulesList::PrintModule(), and DynamicLoaderDarwinKernel::SearchForKernelAtSameLoadAddr().
|
pure virtual |
Gets whether endian swapping should occur when extracting data from this object file.
Implemented in lldb_private::ObjectFileJIT, lldb_private::breakpad::ObjectFileBreakpad, ObjectFileCOFF, ObjectFileELF, lldb_private::ObjectFileJSON, ObjectFileMachO, lldb_private::ObjectFilePDB, ObjectFilePECOFF, ObjectFilePlaceholder, lldb_private::wasm::ObjectFileWasm, and ObjectFileXCOFF.
Referenced by lldb_private::DWARFExpression::Evaluate(), lldb_private::plugin::dwarf::DWARFUnit::GetByteOrder(), lldb_private::Value::GetValueAsData(), lldb_private::Symtab::LoadFromCache(), and DWARFASTParserClang::ParseSingleMember().
|
inlinevirtual |
Definition at line 268 of file ObjectFile.h.
References m_length.
Referenced by lldb_private::DynamicLoaderDarwin::AddModulesUsingPreloadedModules(), IsObjectFile(), and lldb_private::wasm::ObjectFileWasm::ReadImageData().
uint32_t ObjectFile::GetCacheHash | ( | ) |
Get a hash that can be used for caching object file releated information.
Data for object files can be cached between runs of debug sessions and a module can end up using a main file and a symbol file, both of which can be object files. So we need a unique hash that identifies an object file when storing cached data.
Definition at line 770 of file ObjectFile.cpp.
References lldb_private::Stream::Format(), GetStrata(), lldb_private::StreamString::GetString(), GetType(), m_cache_hash, and m_file.
Referenced by lldb_private::Symtab::GetCacheKey(), and lldb_private::plugin::dwarf::ManualDWARFIndex::GetCacheKey().
|
inlinevirtual |
When the ObjectFile is a core file, lldb needs to locate the "binary" in the core file.
lldb can iterate over the pages looking for a valid binary, but some core files may have metadata describing where the main binary is exactly which removes ambiguity when there are multiple binaries present in the captured memory pages.
[out] | value | The address or offset (slide) where the binary is loaded in memory. LLDB_INVALID_ADDRESS for unspecified. If an offset is given, this offset should be added to the binary's file address to get the load address. |
[out] | value_is_offset | Specifies if value is a load address, or an offset to calculate the load address. |
[out] | uuid | If the uuid of the binary is specified, this will be set. If no UUID is available, will be cleared. |
[out] | type | Return the type of the binary, which will dictate which DynamicLoader plugin should be used. |
Definition at line 533 of file ObjectFile.h.
References lldb_private::UUID::Clear(), and LLDB_INVALID_ADDRESS.
Referenced by ProcessMachCore::LoadBinariesViaMetadata().
|
inlinevirtual |
Get metadata about threads from the corefile.
The corefile may have metadata (e.g. a Mach-O "thread extrainfo" LC_NOTE) which for the threads in the process; this method tries to retrieve them.
[out] | tids | Filled in with a vector of tid_t's that matches the number of threads in the corefile (ObjectFile::GetNumThreadContexts). If a tid is not specified for one of the corefile threads, that entry in the vector will have LLDB_INVALID_THREAD_ID and the caller should assign a tid to the thread that does not conflict with the ones provided in this array. As additional metadata are added, this method may return a tids vector with no thread id's specified at all; the corefile may only specify one of the other metadata. |
Reimplemented in ObjectFileMachO.
Definition at line 562 of file ObjectFile.h.
Referenced by ProcessMachCore::DoUpdateThreadList().
size_t ObjectFile::GetData | ( | lldb::offset_t | offset, |
size_t | length, | ||
DataExtractor & | data | ||
) | const |
Definition at line 474 of file ObjectFile.cpp.
References m_data, and lldb_private::DataExtractor::SetData().
Referenced by ReadSectionData(), and ObjectFileELF::RelocateDebugSections().
|
pure virtual |
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. |
Implemented in lldb_private::breakpad::ObjectFileBreakpad, lldb_private::ObjectFileJSON, lldb_private::ObjectFilePDB, lldb_private::wasm::ObjectFileWasm, ObjectFilePlaceholder, lldb_private::ObjectFileJIT, ObjectFileELF, ObjectFileMachO, ObjectFilePECOFF, ObjectFileXCOFF, and ObjectFileCOFF.
Referenced by lldb_private::Target::SetExecutableModule().
|
inlinevirtual |
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 in lldb_private::ObjectFileJIT, ObjectFileELF, ObjectFileMachO, and ObjectFilePECOFF.
Definition at line 470 of file ObjectFile.h.
Referenced by DynamicLoaderPOSIXDYLD::ComputeLoadOffset(), CommandObjectTargetModulesLoad::DoExecute(), lldb_private::Target::GetEntryPointAddress(), and lldb::SBModule::GetObjectFileEntryPointAddress().
|
inlinevirtual |
Returns the offset into a file at which this object resides.
Some files contain many object files, and this function allows access to an object's offset within the file.
Definition at line 266 of file ObjectFile.h.
References m_file_offset.
Referenced by lldb_private::DynamicLoaderDarwin::AddModulesUsingPreloadedModules(), and lldb::SBSection::GetFileOffset().
|
inlinevirtual |
Get accessor to the object file specification.
Definition at line 275 of file ObjectFile.h.
References m_file.
Referenced by lldb_private::DynamicLoaderDarwin::AddModulesUsingPreloadedModules(), CommandObjectTargetSymbolsAdd::AddModuleSymbols(), lldb_private::CacheSignature::CacheSignature(), SymbolVendorELF::CreateInstance(), SymbolVendorMacOSX::CreateInstance(), SymbolVendorPECOFF::CreateInstance(), lldb_private::wasm::SymbolVendorWasm::CreateInstance(), ObjectFilePlaceholder::Dump(), lldb_private::plugin::dwarf::ManualDWARFIndex::Dump(), lldb_private::Symtab::Dump(), lldb_private::Section::DumpName(), lldb_private::DWARFCallFrameInfo::GetFDEIndex(), ObjectFileELF::GetGnuDebugDataObjectFile(), lldb_private::SymbolContext::GetParentOfInlinedScope(), lldb_private::plugin::dwarf::SymbolFileDWARF::GetSeparateDebugInfo(), lldb_private::SymbolFileOnDemand::GetSymbolFileName(), lldb_private::PlatformDarwin::LocateExecutableScriptingResources(), lldb_private::DebuggerStats::ReportStatistics(), ObjectFileMachO::SetLoadAddress(), lldb_private::Module::SetSymbolFileFileSpec(), lldb_private::DynamicLoaderDarwin::UnloadModuleSections(), and UUIDsMatch().
|
inlinevirtual |
Get const accessor to the object file specification.
Definition at line 282 of file ObjectFile.h.
References m_file.
|
inlinevirtual |
Some object files may have an identifier string embedded in them, e.g.
in a Mach-O core file using the LC_IDENT load command (which is obsolete, but can still be found in some old files)
Reimplemented in ObjectFileMachO.
Definition at line 493 of file ObjectFile.h.
Referenced by ProcessMachCore::LoadBinariesViaMetadata().
|
inlinevirtual |
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 in ObjectFileELF.
Definition at line 460 of file ObjectFile.h.
Referenced by AddLinkMapSections(), ProcessElfCore::GetImageInfoAddress(), lldb_private::ProcessWindows::GetImageInfoAddress(), and DYLDRendezvous::ResolveRendezvousAddress().
|
inlinevirtual |
Return true if this file is a dynamic link editor (dyld)
Often times dyld has symbols that mirror symbols in libc and other shared libraries (like "malloc" and "free") and the user does not want to stop in these shared libraries by default. We can ask the ObjectFile if it is such a file and should be avoided for things like settings breakpoints and doing function lookups for expressions.
Reimplemented in ObjectFileMachO.
Definition at line 641 of file ObjectFile.h.
Referenced by lldb_private::Module::GetIsDynamicLinkEditor().
|
virtual |
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 in ObjectFileELF.
Definition at line 639 of file ObjectFile.cpp.
References lldb_private::ObjectFile::LoadableData::Contents, lldb_private::ObjectFile::LoadableData::Dest, lldb_private::DataExtractor::GetByteSize(), lldb_private::DataExtractor::GetDataStart(), lldb_private::SectionList::GetNumSections(), lldb_private::SectionList::GetSectionAtIndex(), GetSectionList(), lldb_private::SectionLoadList::GetSectionLoadAddress(), lldb_private::Target::GetSectionLoadList(), and LLDB_INVALID_ADDRESS.
Referenced by CommandObjectTargetModulesLoad::DoExecute().
|
inlinevirtual |
Get the minimum OS version this object file can run on.
Some object files have information that specifies the minimum OS version that they can be used on.
Reimplemented in ObjectFileMachO.
Definition at line 622 of file ObjectFile.h.
Referenced by lldb_private::PlatformDarwin::AddClangModuleCompilationOptionsForSDKType().
|
static |
Definition at line 196 of file ObjectFile.cpp.
References lldb_private::FileSystem::CreateDataBuffer(), g_initial_bytes_to_read, lldb_private::FileSystem::GetByteSize(), GetModuleSpecifications(), lldb_private::FileSpec::GetPath(), and lldb_private::FileSystem::Instance().
Referenced by CommandObjectTargetSymbolsAdd::AddModuleSymbols(), lldb_private::TargetList::CreateTargetInternal(), FileAtPathContainsArchAndUUID(), lldb_private::SymbolLocatorDebugSymbols::FindSymbolFileInBundle(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerCommon::GetModuleInfo(), lldb_private::Platform::GetModuleSpec(), lldb::SBModuleSpecList::GetModuleSpecifications(), GetModuleSpecifications(), ObjectContainerBSDArchive::GetModuleSpecifications(), lldb_private::ObjectContainerMachOFileset::GetModuleSpecifications(), ObjectContainerUniversalMachO::GetModuleSpecifications(), lldb_private::SymbolLocatorDebugSymbols::LocateExecutableObjectFile(), lldb_private::SymbolLocatorDefault::LocateExecutableObjectFile(), lldb_private::SymbolLocatorDefault::LocateExecutableSymbolFile(), LocateMacOSXFilesUsingDebugSymbols(), and lldb_private::Module::Module().
|
static |
|
inlinevirtual |
Reimplemented in ObjectFileMachO.
Definition at line 484 of file ObjectFile.h.
Referenced by ProcessMachCore::DoUpdateThreadList().
|
inlinevirtual |
Gets the file spec list of libraries re-exported by this object file.
If the object file format has the notion of one library re-exporting the symbols from another, the re-exported libraries will be returned in the FileSpecList.
Reimplemented in ObjectFileMachO.
Definition at line 390 of file ObjectFile.h.
|
inlinevirtual |
Get the SDK OS version this object file was built with.
Reimplemented in ObjectFileMachO.
Definition at line 632 of file ObjectFile.h.
Referenced by lldb_private::PlatformMacOSX::GetSDKDirectory().
|
inlinevirtual |
Reimplemented in ObjectFilePECOFF.
Definition at line 686 of file ObjectFile.h.
References lldb_private::Section::GetFileSize().
Referenced by ReadSectionData().
|
virtual |
Gets the section list for the currently selected architecture (and object for archives).
Section list parsing can be deferred by ObjectFile instances until this accessor is called the first time.
Definition at line 602 of file ObjectFile.cpp.
References CreateSections(), lldb_private::ModuleChild::GetModule(), and m_sections_up.
Referenced by lldb_private::DynamicLoaderDarwin::AddModulesUsingPreloadedModules(), ObjectFileELF::CalculateStrata(), ObjectFileMachO::CalculateStrata(), lldb::SBTarget::ClearModuleLoadAddress(), SymbolVendorELF::CreateInstance(), SymbolVendorPECOFF::CreateInstance(), lldb_private::wasm::SymbolVendorWasm::CreateInstance(), ProcessMachCore::CreateMemoryRegions(), lldb_private::CompactUnwindInfo::CreateUnwindPlan_i386(), lldb_private::CompactUnwindInfo::CreateUnwindPlan_x86_64(), lldb_private::ObjectFileJIT::Dump(), ObjectFileELF::Dump(), ObjectFileMachO::Dump(), ObjectFilePECOFF::Dump(), ObjectFileCOFF::Dump(), lldb_private::wasm::ObjectFileWasm::Dump(), lldb_private::DWARFCallFrameInfo::FDEToUnwindPlan(), lldb_private::SymbolFile::FindPlugin(), ObjectFilePECOFF::GetAddress(), lldb_private::DWARFCallFrameInfo::GetAddressRange(), ObjectFileELF::GetBaseAddress(), ObjectFileMachO::GetBaseAddress(), ObjectFilePECOFF::GetBaseAddress(), lldb_private::CompactUnwindInfo::GetCompactUnwindInfoForFunction(), ObjectFileELF::GetDynamicData(), ObjectFileELF::GetDynstrData(), ObjectFileELF::GetEntryPointAddress(), ObjectFileMachO::GetEntryPointAddress(), ObjectFilePECOFF::GetEntryPointAddress(), ObjectFileELF::GetGnuDebugDataObjectFile(), ObjectFileELF::GetImageInfoAddress(), GetLoadableData(), ObjectFileMachO::GetMachHeaderSection(), lldb_private::DynamicLoader::GetSectionListFromModule(), DynamicLoaderHexagonDYLD::GetSectionListFromModule(), lldb_private::CompactUnwindInfo::GetUnwindPlan(), lldb_private::Value::GetValueAsData(), lldb_private::Symtab::InitAddressIndexes(), lldb_private::breakpad::SymbolFileBreakpad::LineIterator::LineIterator(), DynamicLoaderStatic::LoadAllImagesAtFileAddresses(), DynamicLoaderFreeBSDKernel::KModImageInfo::LoadImageUsingMemoryModule(), DynamicLoaderDarwinKernel::KextImageInfo::LoadImageUsingMemoryModule(), ObjectFileCOFF::ParseSymtab(), ObjectFileELF::ParseSymtab(), ObjectFileMachO::ParseSymtab(), ObjectFilePECOFF::ParseSymtab(), ObjectFileELF::ParseUnwindSymbols(), ObjectFileELF::ReadDataFromDynamic(), JITLoaderGDB::ReadJITDescriptorImpl(), ObjectFileELF::RelocateDebugSections(), lldb_private::ObjectFileJIT::SetLoadAddress(), ObjectFileELF::SetLoadAddress(), ObjectFileMachO::SetLoadAddress(), ObjectFilePECOFF::SetLoadAddress(), lldb_private::wasm::ObjectFileWasm::SetLoadAddress(), lldb_private::DynamicLoaderDarwin::UnloadModuleSections(), and lldb_private::DynamicLoaderDarwin::UpdateImageLoadAddress().
|
inline |
Definition at line 650 of file ObjectFile.h.
References CalculateStrata(), eStrataInvalid, and m_strata.
Referenced by ProcessKDP::CanDebug(), SystemRuntimeMacOSX::CreateInstance(), DynamicLoaderMacOS::CreateInstance(), DynamicLoaderMacOSXDYLD::CreateInstance(), DynamicLoaderStatic::CreateInstance(), GetCacheHash(), is_kernel(), and ObjectFileMachO::SectionIsLoadable().
|
static |
Definition at line 619 of file ObjectFile.cpp.
References lldb::eSymbolTypeObjCClass, lldb::eSymbolTypeObjCIVar, and lldb::eSymbolTypeObjCMetaClass.
Referenced by ObjectFileMachO::ParseSymtab().
Symtab * ObjectFile::GetSymtab | ( | ) |
Gets the symbol table for the currently selected architecture (and object for archives).
This function will manage when ParseSymtab(...) is called to actually do the symbol table parsing in each plug-in. This function will take care of taking all the necessary locks and finalizing the symbol table when the symbol table does get parsed.
Definition at line 739 of file ObjectFile.cpp.
References elapsed(), lldb_private::ModuleChild::GetModule(), lldb_private::Symtab::GetMutex(), m_symtab_once_up, m_symtab_up, and ParseSymtab().
Referenced by ObjectFileELF::Dump(), lldb_private::plugin::dwarf::SymbolFileDWARFDebugMap::FindCompleteObjCDefinitionTypeForDIE(), findSymbolAddress(), fixupExternalAddrZeroVariable(), lldb_private::Address::GetAddressClass(), GetAddressClass(), ObjectFileELF::GetAddressClass(), ObjectFileMachO::GetAddressClass(), ObjectFileMachO::GetEntryPointAddress(), lldb_private::plugin::dwarf::SymbolFileDWARFDebugMap::CompileUnitInfo::GetFileRangeMap(), lldb_private::SymbolFileCommon::GetSymtab(), ObjectFileELF::RelocateSection(), and lldb_private::Module::ResolveSymbolContextForAddress().
|
inlinevirtual |
Reimplemented in ObjectFileMachO.
Definition at line 567 of file ObjectFile.h.
Referenced by ThreadMachCore::CreateRegisterContextForFrame().
|
inline |
Definition at line 644 of file ObjectFile.h.
References CalculateType(), eTypeInvalid, and m_type.
Referenced by lldb_private::ModuleList::AppendImpl(), ProcessElfCore::CanDebug(), lldb_private::process_gdb_remote::ProcessGDBRemote::CanDebug(), ProcessMachCore::CanDebug(), ProcessKDP::CanDebug(), ObjectFileELF::CreateSections(), ObjectFileELF::GetBaseAddress(), GetCacheHash(), lldb_private::Target::GetExecutableModule(), lldb_private::Target::GetOrCreateModule(), ObjectFileELF::GetUUID(), is_kernel(), is_kmod(), is_reloc(), lldb_private::process_gdb_remote::ProcessGDBRemote::LoadModules(), lldb_private::PlatformDarwin::ModuleIsExcludedForUnconstrainedSearches(), lldb_private::Target::ModulesDidUnload(), and ObjectFileMachO::ProcessSegmentCommand().
|
pure virtual |
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).
Implemented in lldb_private::ObjectFileJIT, lldb_private::breakpad::ObjectFileBreakpad, ObjectFileCOFF, ObjectFileELF, lldb_private::ObjectFileJSON, ObjectFileMachO, lldb_private::ObjectFilePDB, ObjectFilePECOFF, ObjectFilePlaceholder, lldb_private::wasm::ObjectFileWasm, and ObjectFileXCOFF.
Referenced by lldb_private::CacheSignature::CacheSignature(), lldb_private::Module::GetUUID(), and UUIDsMatch().
|
inlinevirtual |
Get the object file version numbers.
Many object files have a set of version numbers that describe the version of the executable or shared library. Typically there are major, minor and build, but there may be more. This function will extract the versions from object files if they are available.
Reimplemented in ObjectFileMachO.
Definition at line 611 of file ObjectFile.h.
|
inlinevirtual |
Reimplemented in lldb_private::ObjectFileJIT, lldb_private::breakpad::ObjectFileBreakpad, ObjectFileCOFF, ObjectFileELF, lldb_private::ObjectFileJSON, ObjectFileMachO, lldb_private::ObjectFilePDB, ObjectFilePECOFF, and lldb_private::wasm::ObjectFileWasm.
Definition at line 211 of file ObjectFile.h.
References ID.
Referenced by lldb_private::ObjectFileJIT::classof(), lldb_private::breakpad::ObjectFileBreakpad::classof(), lldb_private::ObjectFileJSON::classof(), lldb_private::ObjectFilePDB::classof(), lldb_private::wasm::ObjectFileWasm::classof(), lldb_private::ObjectFileJIT::isA(), lldb_private::breakpad::ObjectFileBreakpad::isA(), lldb_private::ObjectFileJSON::isA(), lldb_private::ObjectFilePDB::isA(), and lldb_private::wasm::ObjectFileWasm::isA().
|
pure virtual |
Tells whether this object file is capable of being the main executable for a process.
Implemented in lldb_private::ObjectFileJIT, lldb_private::breakpad::ObjectFileBreakpad, ObjectFileCOFF, ObjectFileELF, lldb_private::ObjectFileJSON, ObjectFileMachO, lldb_private::ObjectFilePDB, ObjectFilePECOFF, ObjectFilePlaceholder, lldb_private::wasm::ObjectFileWasm, and ObjectFileXCOFF.
Referenced by lldb_private::Module::IsExecutable().
|
inline |
Returns true if the object file exists only in memory.
Definition at line 691 of file ObjectFile.h.
References LLDB_INVALID_ADDRESS, and m_memory_addr.
Referenced by lldb_private::wasm::ObjectFileWasm::CreateSections(), lldb_private::wasm::ObjectFileWasm::DecodeSections(), lldb_private::wasm::ObjectFileWasm::GetBaseAddress(), ObjectFileELF::GetSegmentData(), lldb::SBModule::IsFileBacked(), ObjectFileMachO::ParseSymtab(), ObjectFileMachO::ProcessSegmentCommand(), ReadSectionData(), ObjectFileMachO::SanitizeSegmentCommand(), and lldb_private::AppleObjCRuntimeV2::WarnIfNoExpandedSharedCache().
|
static |
Definition at line 187 of file ObjectFile.cpp.
References FindPlugin(), GetByteSize(), and lldb_private::FileSystem::Instance().
Referenced by lldb_private::Platform::ResolveExecutable().
|
pure virtual |
Detect if this object file has been stripped of local symbols.
Detect if this object file has been stripped of local symbols.
Implemented in lldb_private::ObjectFileJIT, lldb_private::breakpad::ObjectFileBreakpad, ObjectFileCOFF, ObjectFileELF, lldb_private::ObjectFileJSON, ObjectFileMachO, lldb_private::ObjectFilePDB, ObjectFilePECOFF, ObjectFilePlaceholder, lldb_private::wasm::ObjectFileWasm, and ObjectFileXCOFF.
Referenced by lldb_private::DebuggerStats::ReportStatistics(), and lldb_private::Module::ResolveSymbolContextForAddress().
|
inlinevirtual |
Load binaries listed in a corefile.
A corefile may have metadata listing binaries that can be loaded, and the offsets at which they were loaded. This method will try to add them to the Target. If any binaries were loaded,
[in] | process | Process where to load binaries. |
Reimplemented in ObjectFileMachO.
Definition at line 732 of file ObjectFile.h.
Referenced by ProcessMachCore::LoadBinariesViaMetadata().
|
static |
Definition at line 673 of file ObjectFile.cpp.
References lldb_private::FileSystem::CreateDataBuffer(), lldb_private::FileSpec::GetPath(), and lldb_private::FileSystem::Instance().
Referenced by lldb_private::breakpad::ObjectFileBreakpad::CreateInstance(), lldb_private::ObjectFileJSON::CreateInstance(), lldb_private::wasm::ObjectFileWasm::CreateInstance(), ObjectFileCOFF::CreateInstance(), ObjectFileMachO::CreateInstance(), ObjectFileXCOFF::CreateInstance(), ObjectFilePECOFF::CreateInstance(), lldb_private::ObjectFileJSON::GetModuleSpecifications(), ObjectFileELF::GetModuleSpecifications(), ObjectFileMachO::GetModuleSpecifications(), ObjectFilePECOFF::GetModuleSpecifications(), ObjectFileMachO::ParseHeader(), lldb_private::ObjectContainerMachOFileset::ParseHeader(), and lldb_private::wasm::ObjectFileWasm::ReadImageData().
|
privatedelete |
|
pure virtual |
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.
Implemented in lldb_private::ObjectFileJIT, lldb_private::breakpad::ObjectFileBreakpad, ObjectFileCOFF, ObjectFileELF, lldb_private::ObjectFileJSON, ObjectFileMachO, lldb_private::ObjectFilePDB, ObjectFilePECOFF, ObjectFilePlaceholder, lldb_private::wasm::ObjectFileWasm, and ObjectFileXCOFF.
|
pure virtual |
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. |
Implemented in ObjectFileCOFF, lldb_private::ObjectFileJIT, lldb_private::breakpad::ObjectFileBreakpad, ObjectFileELF, lldb_private::ObjectFileJSON, ObjectFileMachO, lldb_private::ObjectFilePDB, ObjectFilePECOFF, ObjectFilePlaceholder, lldb_private::wasm::ObjectFileWasm, and ObjectFileXCOFF.
Referenced by GetSymtab(), and ObjectFileELF::ParseSymtab().
|
static |
Definition at line 459 of file ObjectFile.cpp.
References error().
Referenced by ObjectFileELF::CreateMemoryInstance(), ObjectFileELF::GetSegmentData(), lldb_private::ObjectContainerMachOFileset::ParseHeader(), ObjectFileMachO::ParseHeader(), ObjectFileELF::ReadDataFromDynamic(), and ReadSectionData().
|
virtual |
Reimplemented in lldb_private::ObjectFileJIT, and ObjectFileELF.
Definition at line 537 of file ObjectFile.cpp.
References lldb_private::Section::GetByteSize(), lldb_private::DataExtractor::GetByteSize(), GetData(), lldb_private::Section::GetFileOffset(), lldb_private::Section::GetLoadBaseAddress(), lldb_private::Section::GetObjectFile(), GetSectionDataSize(), IsInMemory(), lldb_private::Section::IsRelocated(), LLDB_INVALID_ADDRESS, m_process_wp, ReadMemory(), ReadSectionData(), RelocateSection(), lldb_private::DataExtractor::SetAddressByteSize(), lldb_private::DataExtractor::SetByteOrder(), and lldb_private::DataExtractor::SetData().
|
virtual |
Reimplemented in lldb_private::ObjectFileJIT, and ObjectFileELF.
Definition at line 488 of file ObjectFile.cpp.
References CopyData(), error(), lldb::eSectionTypeZeroFill, lldb_private::Section::GetByteSize(), lldb_private::Section::GetFileOffset(), lldb_private::Section::GetFileSize(), lldb_private::Section::GetLoadBaseAddress(), lldb_private::Section::GetObjectFile(), lldb_private::Section::GetTargetByteSize(), lldb_private::Section::GetType(), IsInMemory(), lldb_private::Section::IsRelocated(), LLDB_INVALID_ADDRESS, m_process_wp, ReadSectionData(), and RelocateSection().
Referenced by lldb_private::ArmUnwindInfo::ArmUnwindInfo(), lldb_private::DWARFCallFrameInfo::GetCFIData(), lldb_private::Section::GetSectionData(), lldb_private::breakpad::SymbolFileBreakpad::LineIterator::LineIterator(), lldb_private::Target::ReadMemoryFromFileCache(), ObjectFileELF::ReadSectionData(), ReadSectionData(), and lldb_private::CompactUnwindInfo::ScanIndex().
|
virtual |
Perform relocations on the section if necessary.
Reimplemented in ObjectFileELF.
Definition at line 669 of file ObjectFile.cpp.
Referenced by ReadSectionData().
|
inlinevirtual |
Appends a Symbol for the specified so_addr to the symbol table.
If verify_unique is false, the symbol table is not searched to determine if a Symbol found at this address has already been added to the symbol table. When verify_unique is true, this method resolves the Symbol as the first match in the SymbolTable and appends a Symbol only if required/found.
Definition at line 346 of file ObjectFile.h.
|
inlinevirtual |
Notify the ObjectFile that the file addresses in the Sections for this module have been changed.
Definition at line 305 of file ObjectFile.h.
Referenced by lldb_private::Module::SectionFileAddressesChanged(), and lldb_private::SymbolFileCommon::SectionFileAddressesChanged().
|
inlinevirtual |
Sets the load address for an entire module, assuming a rigid slide of sections, if possible in the implementation.
Reimplemented in lldb_private::ObjectFileJIT, ObjectFileELF, ObjectFileMachO, ObjectFilePECOFF, ObjectFilePlaceholder, and lldb_private::wasm::ObjectFileWasm.
Definition at line 399 of file ObjectFile.h.
Referenced by lldb_private::Module::SetLoadAddress().
|
protected |
Sets the architecture for a module.
At present the architecture can only be set if it is invalid. It is not allowed to switch from one concrete architecture to another.
[in] | new_arch | The architecture this module will be set to. |
Definition at line 297 of file ObjectFile.cpp.
References lldb_private::ModuleChild::GetModule().
Referenced by ObjectFileMachO::ParseHeader().
|
inlinevirtual |
In cases where the type can't be calculated (elf files), this routine allows someone to explicitly set it.
As an example, SymbolVendorELF uses this routine to set eTypeDebugInfo when loading debug link files.
Definition at line 585 of file ObjectFile.h.
References m_type.
|
static |
Split a path into a file path with object name.
For paths like "/tmp/foo.a(bar.o)" we often need to split a path up into the actual path name and into the object name so we can make a valid object file from it.
[in] | path_with_object | A path that might contain an archive path with a .o file specified in parens in the basename of the path. |
[out] | archive_file | If true is returned, file_spec will be filled in with the path to the archive. |
[out] | archive_object | If true is returned, object will be filled in with the name of the object inside the archive. |
Definition at line 570 of file ObjectFile.cpp.
References lldb_private::FileSystem::Instance(), lldb_private::FileSpec::SetFile(), and lldb_private::ConstString::SetString().
Referenced by FindPlugin(), and lldb_private::plugin::dwarf::SymbolFileDWARFDebugMap::GetModuleByCompUnitInfo().
|
inlinevirtual |
Reimplemented in ObjectFileELF.
Definition at line 695 of file ObjectFile.h.
Referenced by lldb_private::Symtab::InitNameIndexes().
|
friend |
Definition at line 45 of file ObjectFile.h.
|
staticprotected |
The number of bytes to read when going through the plugins.
Definition at line 785 of file ObjectFile.h.
Referenced by FindPlugin(), and GetModuleSpecifications().
|
static |
Definition at line 210 of file ObjectFile.h.
Referenced by isA().
|
protected |
Definition at line 770 of file ObjectFile.h.
Referenced by GetCacheHash().
|
protected |
The data for this object file so things can be parsed lazily.
Definition at line 758 of file ObjectFile.h.
Referenced by CopyData(), ObjectFilePECOFF::CreateBinary(), ObjectFileXCOFF::CreateBinary(), ObjectFileMachO::CreateSections(), lldb_private::breakpad::ObjectFileBreakpad::CreateSections(), ObjectFileMachO::Dump(), ObjectFileMachO::FindLC_NOTEByName(), ObjectFileMachO::GetAddressableBits(), lldb_private::ObjectFileJIT::GetAddressByteSize(), ObjectFileELF::GetAddressByteSize(), ObjectFileMachO::GetAddressByteSize(), ObjectFileELF::GetArchitecture(), ObjectFileMachO::GetArchitecture(), lldb_private::ObjectFileJIT::GetByteOrder(), ObjectFileMachO::GetByteOrder(), ObjectFileMachO::GetCorefileAllImageInfos(), ObjectFileMachO::GetCorefileMainBinaryInfo(), ObjectFileMachO::GetCorefileThreadExtraInfos(), GetData(), ObjectFileMachO::GetDependentModules(), ObjectFileMachO::GetEncryptedFileRanges(), ObjectFileMachO::GetEntryPointAddress(), ObjectFileMachO::GetIdentifierString(), ObjectFileMachO::GetMinimumOSVersion(), ObjectFileMachO::GetNumThreadContexts(), ObjectFileMachO::GetSDKVersion(), ObjectFilePECOFF::GetSectionName(), ObjectFileELF::GetSegmentData(), ObjectFileMachO::GetThreadContextAtIndex(), ObjectFileELF::GetUUID(), ObjectFileMachO::GetUUID(), ObjectFileMachO::GetVersion(), ObjectFileMachO::IsStripped(), ObjectFile(), lldb_private::ObjectFileJIT::ObjectFileJIT(), lldb_private::wasm::ObjectFileWasm::ObjectFileWasm(), ObjectFilePECOFF::ParseCOFFOptionalHeader(), ObjectFileCOFF::ParseHeader(), ObjectFileELF::ParseHeader(), ObjectFileMachO::ParseHeader(), ObjectFilePECOFF::ParseHeader(), ObjectFileELF::ParseProgramHeaders(), ObjectFileELF::ParseSectionHeaders(), ObjectFileMachO::ParseSymtab(), ObjectFileMachO::ProcessDysymtabCommand(), ObjectFileMachO::ProcessSegmentCommand(), and ObjectFilePECOFF::ReadImageData().
|
protected |
Definition at line 749 of file ObjectFile.h.
Referenced by ObjectFilePECOFF::CreateBinary(), ObjectFileXCOFF::CreateBinary(), ObjectFileELF::Dump(), ObjectFileMachO::Dump(), ObjectFilePECOFF::Dump(), ObjectFileCOFF::Dump(), lldb_private::wasm::ObjectFileWasm::Dump(), GetCacheHash(), ObjectFileMachO::GetDependentModules(), GetFileSpec(), lldb_private::ObjectFilePDB::initPDBFile(), ObjectFile(), ObjectFileELF::ObjectFileELF(), ObjectFileXCOFF::ObjectFileXCOFF(), ObjectFilePECOFF::ParseDependentModules(), ObjectFileMachO::ParseHeader(), ObjectFileELF::ParseSymbols(), ObjectFileELF::ParseSymtab(), ObjectFileMachO::ParseSymtab(), and lldb_private::wasm::ObjectFileWasm::ReadImageData().
|
protected |
The offset in bytes into the file, or the address in memory.
Definition at line 752 of file ObjectFile.h.
Referenced by GetFileOffset(), ObjectFile(), and ObjectFileMachO::ParseHeader().
|
protected |
The length of this object file if it is known (can be zero if length is unknown or can't be determined).
Definition at line 754 of file ObjectFile.h.
Referenced by GetByteSize(), ObjectFile(), and ObjectFileMachO::SanitizeSegmentCommand().
|
protected |
Set if the object file only exists in memory.
Definition at line 761 of file ObjectFile.h.
Referenced by lldb_private::wasm::ObjectFileWasm::DecodeSections(), ObjectFileELF::Dump(), GetBaseAddress(), lldb_private::wasm::ObjectFileWasm::GetBaseAddress(), ObjectFileELF::GetSegmentData(), IsInMemory(), ObjectFile(), ObjectFileMachO::ParseHeader(), and lldb_private::wasm::ObjectFileWasm::SetLoadAddress().
|
protected |
Definition at line 759 of file ObjectFile.h.
Referenced by ObjectFileELF::GetDynsymDataFromDynamic(), ObjectFileELF::GetSegmentData(), ObjectFileMachO::ParseHeader(), ObjectFileELF::ReadDataFromDynamic(), lldb_private::wasm::ObjectFileWasm::ReadImageData(), ObjectFilePECOFF::ReadImageData(), ReadSectionData(), and ObjectFileMachO::SectionIsLoadable().
|
protected |
Definition at line 762 of file ObjectFile.h.
Referenced by ObjectFileCOFF::CreateSections(), lldb_private::ObjectFileJIT::CreateSections(), ObjectFileELF::CreateSections(), ObjectFileMachO::CreateSections(), ObjectFilePECOFF::CreateSections(), ObjectFilePlaceholder::CreateSections(), lldb_private::breakpad::ObjectFileBreakpad::CreateSections(), lldb_private::ObjectFileJSON::CreateSections(), lldb_private::wasm::ObjectFileWasm::CreateSections(), ObjectFilePlaceholder::GetBaseAddress(), GetSectionList(), ObjectFileELF::ParseSymbolTable(), ObjectFileELF::ParseTrampolineSymbols(), ObjectFileMachO::ProcessSegmentCommand(), and ObjectFilePlaceholder::SetLoadAddress().
|
protected |
Definition at line 751 of file ObjectFile.h.
Referenced by ObjectFileMachO::CalculateType(), and GetStrata().
|
protected |
We need a llvm::once_flag that we can use to avoid locking the module lock and deadlocking LLDB.
See comments in ObjectFile::GetSymtab() for the full details. We also need to be able to clear the symbol table, so we need to use a std::unique_ptr to a llvm::once_flag so if we clear the symbol table, we can have a new once flag to use when it is created again.
Definition at line 769 of file ObjectFile.h.
Referenced by ClearSymtab(), and GetSymtab().
|
protected |
Definition at line 763 of file ObjectFile.h.
Referenced by ClearSymtab(), lldb_private::ObjectFileJIT::Dump(), ObjectFileMachO::Dump(), ObjectFilePECOFF::Dump(), and GetSymtab().
|
protected |
Definition at line 750 of file ObjectFile.h.
Referenced by ObjectFileMachO::CalculateStrata(), GetType(), ObjectFileMachO::ParseSymtab(), and SetType().