LLDB mainline
Classes | Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | Static Protected Attributes | Private Member Functions | Friends | List of all members
lldb_private::ObjectFile Class Referenceabstract

A plug-in interface definition class for object file parsers. More...

#include "lldb/Symbol/ObjectFile.h"

Inheritance diagram for lldb_private::ObjectFile:
Inheritance graph
[legend]

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 FileSpecGetFileSpec ()
 Get accessor to the object file specification.
 
virtual const FileSpecGetFileSpec () const
 Get const accessor to the object file specification.
 
virtual ArchSpec GetArchitecture ()=0
 Get the ArchSpec for this object file.
 
virtual SectionListGetSectionList (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.
 
SymtabGetSymtab ()
 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 SymbolResolveSymbolForAddress (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 &section_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< LoadableDataGetLoadableData (Target &target)
 Loads this objfile to memory.
 
virtual std::unique_ptr< CallFrameInfoCreateCallFrameInfo ()
 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
 
PluginInterfaceoperator= (const PluginInterface &)=delete
 
- Public Member Functions inherited from lldb_private::ModuleChild
 ModuleChild (const lldb::ModuleSP &module_sp)
 Construct with owning module.
 
 ~ModuleChild ()
 Destructor.
 
const ModuleChildoperator= (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 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::DataBufferSP 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::SectionListm_sections_up
 
std::unique_ptr< lldb_private::Symtabm_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 ObjectFileoperator= (const ObjectFile &)=delete
 

Friends

class lldb_private::Module
 

Detailed Description

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.

Member Enumeration Documentation

◆ BinaryType

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.

◆ Strata

Enumerator
eStrataInvalid 
eStrataUnknown 
eStrataUser 
eStrataKernel 
eStrataRawImage 
eStrataJIT 

Definition at line 69 of file ObjectFile.h.

◆ Type

Enumerator
eTypeInvalid 
eTypeCoreFile 

A core file that has a checkpoint of a program's execution state.

eTypeExecutable 

A normal executable.

eTypeDebugInfo 

An object file that contains only debug information.

eTypeDynamicLinker 

The platform's dynamic linker executable.

eTypeObjectFile 

An intermediate object file.

eTypeSharedLibrary 

A shared library that can be used during execution.

eTypeStubLibrary 

A library that can be linked against but not used for execution.

eTypeJIT 

JIT code that has symbols, sections and possibly debug info.

eTypeUnknown 

Definition at line 48 of file ObjectFile.h.

Constructor & Destructor Documentation

◆ ObjectFile() [1/3]

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 241 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() [2/3]

ObjectFile::ObjectFile ( const lldb::ModuleSP module_sp,
const lldb::ProcessSP process_sp,
lldb::addr_t  header_addr,
lldb::DataBufferSP  data_sp 
)

◆ ~ObjectFile()

ObjectFile::~ObjectFile ( )
override

Destructor.

The destructor is virtual since this class is designed to be inherited from by the plug-in instance.

Definition at line 283 of file ObjectFile.cpp.

References lldb_private::GetLog(), LLDB_LOGF, and lldb_private::Object.

◆ ObjectFile() [3/3]

lldb_private::ObjectFile::ObjectFile ( const ObjectFile )
privatedelete

Member Function Documentation

◆ AllowAssemblyEmulationUnwindPlans()

virtual bool lldb_private::ObjectFile::AllowAssemblyEmulationUnwindPlans ( )
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.

Returns
Returns true if assembly emulation should be used for this module. Only returns false if the ObjectFile is sure that symbol addresses are insufficient for accurate assembly emulation.

Reimplemented in ObjectFileMachO.

Definition at line 445 of file ObjectFile.h.

◆ CalculateStrata()

virtual Strata lldb_private::ObjectFile::CalculateStrata ( )
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.

Returns
The calculated object file strata 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, and lldb_private::wasm::ObjectFileWasm.

Referenced by GetStrata().

◆ CalculateType()

virtual Type lldb_private::ObjectFile::CalculateType ( )
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.

Returns
The calculated file type 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, and lldb_private::wasm::ObjectFileWasm.

Referenced by GetType().

◆ CanTrustAddressRanges()

virtual bool lldb_private::ObjectFile::CanTrustAddressRanges ( )
inlinevirtual

Can we trust the address ranges accelerator associated with this object file to be complete.

Reimplemented in ObjectFileMachO.

Definition at line 699 of file ObjectFile.h.

Referenced by lldb_private::plugin::dwarf::DWARFDebugInfo::GetCompileUnitAranges().

◆ ClearSymtab()

void ObjectFile::ClearSymtab ( )
virtual

◆ CopyData()

size_t ObjectFile::CopyData ( lldb::offset_t  offset,
size_t  length,
void *  dst 
) const

◆ CreateCallFrameInfo()

std::unique_ptr< CallFrameInfo > ObjectFile::CreateCallFrameInfo ( )
virtual

Creates a plugin-specific call frame info.

Reimplemented in ObjectFilePECOFF.

Definition at line 653 of file ObjectFile.cpp.

Referenced by lldb_private::UnwindTable::Initialize().

◆ CreateSections()

virtual void lldb_private::ObjectFile::CreateSections ( SectionList unified_section_list)
pure virtual

◆ Dump()

virtual void lldb_private::ObjectFile::Dump ( Stream s)
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.

Parameters
[in]sThe stream to which to dump the object description.

Implemented in lldb_private::ObjectFileJIT, ObjectFileELF, ObjectFileMachO, ObjectFilePECOFF, ObjectFilePlaceholder, ObjectFileCOFF, lldb_private::breakpad::ObjectFileBreakpad, lldb_private::ObjectFileJSON, lldb_private::ObjectFilePDB, and lldb_private::wasm::ObjectFileWasm.

Referenced by lldb_private::Module::Dump(), and DumpModuleObjfileHeaders().

◆ FindPlugin() [1/2]

ObjectFileSP ObjectFile::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 
)
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.

Parameters
[in]module_spThe parent module that owns this object file.
[in]file_specA file specification that indicates which file to use as the object file.
[in]file_offsetThe offset into the file at which to start parsing the object. This is for files that contain multiple architectures or objects.
[in]file_sizeThe size of the current object file if it can be determined or if it is known. This can be zero.
See also
ObjectFile::ParseHeader()

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(), and ObjectContainerUniversalMachO::GetObjectFile().

◆ FindPlugin() [2/2]

ObjectFileSP ObjectFile::FindPlugin ( const lldb::ModuleSP module_sp,
const lldb::ProcessSP process_sp,
lldb::addr_t  header_addr,
lldb::WritableDataBufferSP  file_data_sp 
)
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.

Parameters
[in]module_spThe parent module that owns this object file.
[in]process_spA shared pointer to the process whose memory space contains an object file. This will be stored as a std::weak_ptr.
[in]header_addrThe 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.

◆ GetAddressableBits()

virtual lldb_private::AddressableBits lldb_private::ObjectFile::GetAddressableBits ( )
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.

Returns
Returns an AddressableBits object which can be used to set the address masks in the Process.

Reimplemented in ObjectFileMachO.

Definition at line 504 of file ObjectFile.h.

Referenced by ProcessMachCore::DoLoadCore().

◆ GetAddressByteSize()

virtual uint32_t lldb_private::ObjectFile::GetAddressByteSize ( ) const
pure virtual

◆ GetAddressClass()

AddressClass ObjectFile::GetAddressClass ( lldb::addr_t  file_addr)
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

Returns
The size of an address in bytes for the currently selected architecture (and object for archives). Returns zero if no architecture or object has been selected.

Reimplemented in lldb_private::breakpad::ObjectFileBreakpad, ObjectFileELF, lldb_private::ObjectFileJSON, ObjectFileMachO, and lldb_private::wasm::ObjectFileWasm.

Definition at line 295 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::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().

◆ GetArchitecture()

virtual ArchSpec lldb_private::ObjectFile::GetArchitecture ( )
pure virtual

◆ GetBaseAddress()

virtual lldb_private::Address lldb_private::ObjectFile::GetBaseAddress ( )
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 479 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(), DynamicLoaderDarwinKernel::KextImageInfo::LoadImageUsingMemoryModule(), DynamicLoaderFreeBSDKernel::KModImageInfo::LoadImageUsingMemoryModule(), DynamicLoaderDarwinKernel::LoadKernelModuleIfNeeded(), and DynamicLoaderDarwinKernel::SearchForKernelAtSameLoadAddr().

◆ GetByteOrder()

virtual lldb::ByteOrder lldb_private::ObjectFile::GetByteOrder ( ) const
pure virtual

◆ GetByteSize()

virtual lldb::addr_t lldb_private::ObjectFile::GetByteSize ( ) const
inlinevirtual

◆ GetCacheHash()

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 758 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().

◆ GetCorefileMainBinaryInfo()

virtual bool lldb_private::ObjectFile::GetCorefileMainBinaryInfo ( lldb::addr_t value,
bool &  value_is_offset,
UUID uuid,
ObjectFile::BinaryType type 
)
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.

Parameters
[out]valueThe 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_offsetSpecifies if value is a load address, or an offset to calculate the load address.
[out]uuidIf the uuid of the binary is specified, this will be set. If no UUID is available, will be cleared.
[out]typeReturn the type of the binary, which will dictate which DynamicLoader plugin should be used.
Returns
Returns true if either address or uuid has been set.

Definition at line 532 of file ObjectFile.h.

References lldb_private::UUID::Clear(), and LLDB_INVALID_ADDRESS.

Referenced by ProcessMachCore::LoadBinariesViaMetadata().

◆ GetCorefileThreadExtraInfos()

virtual bool lldb_private::ObjectFile::GetCorefileThreadExtraInfos ( std::vector< lldb::tid_t > &  tids)
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.

Parameters
[out]tidsFilled 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.
Returns
Returns true if thread metadata was found in this corefile.

Reimplemented in ObjectFileMachO.

Definition at line 561 of file ObjectFile.h.

Referenced by ProcessMachCore::DoUpdateThreadList().

◆ GetData()

size_t ObjectFile::GetData ( lldb::offset_t  offset,
size_t  length,
DataExtractor data 
) const

◆ GetDependentModules()

virtual uint32_t lldb_private::ObjectFile::GetDependentModules ( FileSpecList file_list)
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.

Parameters
[out]file_listA list of file specification objects that gets dependent files appended to.
Returns
The number of new files that were appended to file_list.
See also
FileSpecList::AppendIfUnique(const FileSpec &)

Implemented in lldb_private::breakpad::ObjectFileBreakpad, lldb_private::ObjectFileJSON, lldb_private::ObjectFilePDB, lldb_private::wasm::ObjectFileWasm, ObjectFilePlaceholder, lldb_private::ObjectFileJIT, ObjectFileELF, ObjectFileMachO, ObjectFilePECOFF, and ObjectFileCOFF.

Referenced by lldb_private::Target::SetExecutableModule().

◆ GetEntryPointAddress()

virtual lldb_private::Address lldb_private::ObjectFile::GetEntryPointAddress ( )
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.

Returns
Returns the entry address for this module.

Reimplemented in lldb_private::ObjectFileJIT, ObjectFileELF, ObjectFileMachO, and ObjectFilePECOFF.

Definition at line 469 of file ObjectFile.h.

Referenced by DynamicLoaderPOSIXDYLD::ComputeLoadOffset(), CommandObjectTargetModulesLoad::DoExecute(), lldb_private::Target::GetEntryPointAddress(), and lldb::SBModule::GetObjectFileEntryPointAddress().

◆ GetFileOffset()

virtual lldb::addr_t lldb_private::ObjectFile::GetFileOffset ( ) const
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.

Returns
The offset in bytes into the file. Defaults to zero for simple object files that a represented by an entire file.

Definition at line 265 of file ObjectFile.h.

References m_file_offset.

Referenced by lldb_private::DynamicLoaderDarwin::AddModulesUsingImageInfos(), and lldb::SBSection::GetFileOffset().

◆ GetFileSpec() [1/2]

virtual FileSpec & lldb_private::ObjectFile::GetFileSpec ( )
inlinevirtual

◆ GetFileSpec() [2/2]

virtual const FileSpec & lldb_private::ObjectFile::GetFileSpec ( ) const
inlinevirtual

Get const accessor to the object file specification.

Returns
The const file specification object pointer if there is one, or NULL if this object is only from memory.

Definition at line 281 of file ObjectFile.h.

References m_file.

◆ GetIdentifierString()

virtual std::string lldb_private::ObjectFile::GetIdentifierString ( )
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)

Returns
Returns the identifier string if one exists, else an empty string.

Reimplemented in ObjectFileMachO.

Definition at line 492 of file ObjectFile.h.

Referenced by ProcessMachCore::LoadBinariesViaMetadata().

◆ GetImageInfoAddress()

virtual lldb_private::Address lldb_private::ObjectFile::GetImageInfoAddress ( Target target)
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.

Returns
The address of any auxiliary tables, or an invalid address if this object file format does not support or contain such information.

Reimplemented in ObjectFileELF.

Definition at line 459 of file ObjectFile.h.

Referenced by DynamicLoaderPOSIXDYLD::DidAttach(), ProcessElfCore::GetImageInfoAddress(), lldb_private::ProcessWindows::GetImageInfoAddress(), and DYLDRendezvous::ResolveRendezvousAddress().

◆ GetIsDynamicLinkEditor()

virtual bool lldb_private::ObjectFile::GetIsDynamicLinkEditor ( )
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 640 of file ObjectFile.h.

Referenced by lldb_private::Module::GetIsDynamicLinkEditor().

◆ GetLoadableData()

std::vector< ObjectFile::LoadableData > ObjectFile::GetLoadableData ( Target target)
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.

Parameters
[in]targetTarget where to load.

Reimplemented in ObjectFileELF.

Definition at line 627 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().

◆ GetMinimumOSVersion()

virtual llvm::VersionTuple lldb_private::ObjectFile::GetMinimumOSVersion ( )
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.

Returns
This function returns extracted version numbers as a llvm::VersionTuple. In case of error an empty VersionTuple is returned.

Reimplemented in ObjectFileMachO.

Definition at line 621 of file ObjectFile.h.

Referenced by lldb_private::PlatformDarwin::AddClangModuleCompilationOptionsForSDKType().

◆ GetModuleSpecifications() [1/2]

size_t ObjectFile::GetModuleSpecifications ( const FileSpec file,
lldb::offset_t  file_offset,
lldb::offset_t  file_size,
ModuleSpecList specs,
lldb::DataBufferSP  data_sp = lldb::DataBufferSP() 
)
static

◆ GetModuleSpecifications() [2/2]

size_t ObjectFile::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

◆ GetNumThreadContexts()

virtual uint32_t lldb_private::ObjectFile::GetNumThreadContexts ( )
inlinevirtual

Reimplemented in ObjectFileMachO.

Definition at line 483 of file ObjectFile.h.

Referenced by ProcessMachCore::DoUpdateThreadList().

◆ GetReExportedLibraries()

virtual lldb_private::FileSpecList lldb_private::ObjectFile::GetReExportedLibraries ( )
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.

Returns
Returns filespeclist.

Reimplemented in ObjectFileMachO.

Definition at line 389 of file ObjectFile.h.

◆ GetSDKVersion()

virtual llvm::VersionTuple lldb_private::ObjectFile::GetSDKVersion ( )
inlinevirtual

Get the SDK OS version this object file was built with.

Returns
This function returns extracted version numbers as a llvm::VersionTuple. In case of error an empty VersionTuple is returned.

Reimplemented in ObjectFileMachO.

Definition at line 631 of file ObjectFile.h.

Referenced by lldb_private::PlatformMacOSX::GetSDKDirectory().

◆ GetSectionDataSize()

virtual size_t lldb_private::ObjectFile::GetSectionDataSize ( Section section)
inlinevirtual

Reimplemented in ObjectFilePECOFF.

Definition at line 684 of file ObjectFile.h.

References lldb_private::Section::GetFileSize().

Referenced by ReadSectionData().

◆ GetSectionList()

SectionList * ObjectFile::GetSectionList ( bool  update_module_section_list = true)
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.

Returns
The list of sections contained in this object file.

Definition at line 590 of file ObjectFile.cpp.

References CreateSections(), lldb_private::ModuleChild::GetModule(), and m_sections_up.

Referenced by lldb_private::DynamicLoaderDarwin::AddModulesUsingImageInfos(), 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::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(), DynamicLoaderDarwinKernel::KextImageInfo::LoadImageUsingMemoryModule(), DynamicLoaderFreeBSDKernel::KModImageInfo::LoadImageUsingMemoryModule(), ObjectFileELF::ParseDependentModules(), ObjectFileELF::ParseDynamicSymbols(), ObjectFileCOFF::ParseSymtab(), ObjectFileELF::ParseSymtab(), ObjectFileMachO::ParseSymtab(), ObjectFilePECOFF::ParseSymtab(), ObjectFileELF::ParseUnwindSymbols(), 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().

◆ GetStrata()

Strata lldb_private::ObjectFile::GetStrata ( )
inline

◆ GetSymbolTypeFromName()

lldb::SymbolType ObjectFile::GetSymbolTypeFromName ( llvm::StringRef  name,
lldb::SymbolType  symbol_type_hint = lldb::eSymbolTypeUndefined 
)
static

◆ GetSymtab()

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.

Returns
The symbol table for this object file.

Definition at line 727 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().

◆ GetThreadContextAtIndex()

virtual lldb::RegisterContextSP lldb_private::ObjectFile::GetThreadContextAtIndex ( uint32_t  idx,
lldb_private::Thread thread 
)
inlinevirtual

Reimplemented in ObjectFileMachO.

Definition at line 566 of file ObjectFile.h.

Referenced by ThreadMachCore::CreateRegisterContextForFrame().

◆ GetType()

Type lldb_private::ObjectFile::GetType ( )
inline

◆ GetUUID()

virtual UUID lldb_private::ObjectFile::GetUUID ( )
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).

Returns
The object file's UUID. In case of an error, an empty UUID is returned.

Implemented in lldb_private::ObjectFileJIT, lldb_private::breakpad::ObjectFileBreakpad, ObjectFileCOFF, ObjectFileELF, lldb_private::ObjectFileJSON, ObjectFileMachO, lldb_private::ObjectFilePDB, ObjectFilePECOFF, ObjectFilePlaceholder, and lldb_private::wasm::ObjectFileWasm.

Referenced by lldb_private::CacheSignature::CacheSignature(), lldb_private::Module::GetUUID(), and UUIDsMatch().

◆ GetVersion()

virtual llvm::VersionTuple lldb_private::ObjectFile::GetVersion ( )
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.

Returns
This function returns extracted version numbers as a llvm::VersionTuple. In case of error an empty VersionTuple is returned.

Reimplemented in ObjectFileMachO.

Definition at line 610 of file ObjectFile.h.

◆ isA()

virtual bool lldb_private::ObjectFile::isA ( const void *  ClassID) const
inlinevirtual

◆ IsExecutable()

virtual bool lldb_private::ObjectFile::IsExecutable ( ) const
pure virtual

◆ IsInMemory()

bool lldb_private::ObjectFile::IsInMemory ( ) const
inline

◆ IsStripped()

virtual bool lldb_private::ObjectFile::IsStripped ( )
pure virtual

Detect if this object file has been stripped of local symbols.

Detect if this object file has been stripped of local symbols.

Returns
Return true if the 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, and lldb_private::wasm::ObjectFileWasm.

Referenced by lldb_private::DebuggerStats::ReportStatistics(), and lldb_private::Module::ResolveSymbolContextForAddress().

◆ LoadCoreFileImages()

virtual bool lldb_private::ObjectFile::LoadCoreFileImages ( lldb_private::Process process)
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,

Parameters
[in]processProcess where to load binaries.
Returns
Returns true if any binaries were loaded.

Reimplemented in ObjectFileMachO.

Definition at line 730 of file ObjectFile.h.

Referenced by ProcessMachCore::LoadBinariesViaMetadata().

◆ MapFileData()

DataBufferSP ObjectFile::MapFileData ( const FileSpec file,
uint64_t  Size,
uint64_t  Offset 
)
static

◆ operator=()

const ObjectFile & lldb_private::ObjectFile::operator= ( const ObjectFile )
privatedelete

◆ ParseHeader()

virtual bool lldb_private::ObjectFile::ParseHeader ( )
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.

Returns
Returns true if the header was parsed successfully, false otherwise.

Implemented in lldb_private::ObjectFileJIT, lldb_private::breakpad::ObjectFileBreakpad, ObjectFileCOFF, ObjectFileELF, lldb_private::ObjectFileJSON, ObjectFileMachO, lldb_private::ObjectFilePDB, ObjectFilePECOFF, ObjectFilePlaceholder, and lldb_private::wasm::ObjectFileWasm.

◆ ParseSymtab()

virtual void lldb_private::ObjectFile::ParseSymtab ( Symtab symtab)
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.

Parameters
Thesymbol table to populate.

Implemented in ObjectFileCOFF, lldb_private::ObjectFileJIT, lldb_private::breakpad::ObjectFileBreakpad, ObjectFileELF, lldb_private::ObjectFileJSON, ObjectFileMachO, lldb_private::ObjectFilePDB, ObjectFilePECOFF, ObjectFilePlaceholder, and lldb_private::wasm::ObjectFileWasm.

Referenced by GetSymtab(), and ObjectFileELF::ParseSymtab().

◆ ReadMemory()

DataBufferSP ObjectFile::ReadMemory ( const lldb::ProcessSP process_sp,
lldb::addr_t  addr,
size_t  byte_size 
)
static

◆ ReadSectionData() [1/2]

size_t ObjectFile::ReadSectionData ( Section section,
DataExtractor section_data 
)
virtual

◆ ReadSectionData() [2/2]

size_t ObjectFile::ReadSectionData ( Section section,
lldb::offset_t  section_offset,
void *  dst,
size_t  dst_len 
)
virtual

◆ RelocateSection()

void ObjectFile::RelocateSection ( lldb_private::Section section)
virtual

Perform relocations on the section if necessary.

Reimplemented in ObjectFileELF.

Definition at line 657 of file ObjectFile.cpp.

Referenced by ReadSectionData().

◆ ResolveSymbolForAddress()

virtual Symbol * lldb_private::ObjectFile::ResolveSymbolForAddress ( const Address so_addr,
bool  verify_unique 
)
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.

Returns
The resolved symbol or nullptr. Returns nullptr if a a Symbol could not be found for the specified so_addr.

Definition at line 345 of file ObjectFile.h.

◆ SectionFileAddressesChanged()

virtual void lldb_private::ObjectFile::SectionFileAddressesChanged ( )
inlinevirtual

Notify the ObjectFile that the file addresses in the Sections for this module have been changed.

Definition at line 304 of file ObjectFile.h.

Referenced by lldb_private::Module::SectionFileAddressesChanged(), and lldb_private::SymbolFileCommon::SectionFileAddressesChanged().

◆ SetLoadAddress()

virtual bool lldb_private::ObjectFile::SetLoadAddress ( Target target,
lldb::addr_t  value,
bool  value_is_offset 
)
inlinevirtual

Sets the load address for an entire module, assuming a rigid slide of sections, if possible in the implementation.

Returns
Returns true iff any section's load address changed.

Reimplemented in lldb_private::ObjectFileJIT, ObjectFileELF, ObjectFileMachO, ObjectFilePECOFF, ObjectFilePlaceholder, and lldb_private::wasm::ObjectFileWasm.

Definition at line 398 of file ObjectFile.h.

Referenced by lldb_private::Module::SetLoadAddress().

◆ SetModulesArchitecture()

bool ObjectFile::SetModulesArchitecture ( const ArchSpec new_arch)
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.

Parameters
[in]new_archThe architecture this module will be set to.
Returns
Returns true if the architecture was changed, false otherwise.

Definition at line 288 of file ObjectFile.cpp.

References lldb_private::ModuleChild::GetModule().

Referenced by ObjectFileMachO::ParseHeader().

◆ SetType()

virtual void lldb_private::ObjectFile::SetType ( Type  type)
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 584 of file ObjectFile.h.

References m_type.

◆ SplitArchivePathWithObject()

bool ObjectFile::SplitArchivePathWithObject ( llvm::StringRef  path_with_object,
lldb_private::FileSpec archive_file,
lldb_private::ConstString archive_object,
bool  must_exist 
)
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.

Parameters
[in]path_with_objectA path that might contain an archive path with a .o file specified in parens in the basename of the path.
[out]archive_fileIf true is returned, file_spec will be filled in with the path to the archive.
[out]archive_objectIf true is returned, object will be filled in with the name of the object inside the archive.
Returns
true if the path matches the pattern of archive + object and archive_file and archive_object are modified, false otherwise and archive_file and archive_object are guaranteed to be remain unchanged.

Definition at line 558 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().

◆ StripLinkerSymbolAnnotations()

virtual llvm::StringRef lldb_private::ObjectFile::StripLinkerSymbolAnnotations ( llvm::StringRef  symbol_name) const
inlinevirtual

Reimplemented in ObjectFileELF.

Definition at line 693 of file ObjectFile.h.

Referenced by lldb_private::Symtab::InitNameIndexes().

Friends And Related Function Documentation

◆ lldb_private::Module

friend class lldb_private::Module
friend

Definition at line 45 of file ObjectFile.h.

Member Data Documentation

◆ g_initial_bytes_to_read

size_t ObjectFile::g_initial_bytes_to_read = 512
staticprotected

The number of bytes to read when going through the plugins.

Definition at line 783 of file ObjectFile.h.

Referenced by FindPlugin(), and GetModuleSpecifications().

◆ ID

char ObjectFile::ID
static

Definition at line 209 of file ObjectFile.h.

Referenced by isA().

◆ m_cache_hash

std::optional<uint32_t> lldb_private::ObjectFile::m_cache_hash
protected

Definition at line 768 of file ObjectFile.h.

Referenced by GetCacheHash().

◆ m_data

DataExtractor lldb_private::ObjectFile::m_data
protected

The data for this object file so things can be parsed lazily.

Definition at line 756 of file ObjectFile.h.

Referenced by CopyData(), ObjectFilePECOFF::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().

◆ m_file

FileSpec lldb_private::ObjectFile::m_file
protected

◆ m_file_offset

lldb::addr_t lldb_private::ObjectFile::m_file_offset
protected

The offset in bytes into the file, or the address in memory.

Definition at line 750 of file ObjectFile.h.

Referenced by GetFileOffset(), ObjectFile(), and ObjectFileMachO::ParseHeader().

◆ m_length

lldb::addr_t lldb_private::ObjectFile::m_length
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 752 of file ObjectFile.h.

Referenced by GetByteSize(), ObjectFile(), and ObjectFileMachO::SanitizeSegmentCommand().

◆ m_memory_addr

const lldb::addr_t lldb_private::ObjectFile::m_memory_addr
protected

◆ m_process_wp

lldb::ProcessWP lldb_private::ObjectFile::m_process_wp
protected

◆ m_sections_up

std::unique_ptr<lldb_private::SectionList> lldb_private::ObjectFile::m_sections_up
protected

◆ m_strata

Strata lldb_private::ObjectFile::m_strata
protected

Definition at line 749 of file ObjectFile.h.

Referenced by ObjectFileMachO::CalculateType(), and GetStrata().

◆ m_symtab_once_up

std::unique_ptr<llvm::once_flag> lldb_private::ObjectFile::m_symtab_once_up
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 767 of file ObjectFile.h.

Referenced by ClearSymtab(), and GetSymtab().

◆ m_symtab_up

std::unique_ptr<lldb_private::Symtab> lldb_private::ObjectFile::m_symtab_up
protected

◆ m_type

Type lldb_private::ObjectFile::m_type
protected

The documentation for this class was generated from the following files: