LLDB mainline
|
#include <ObjectFilePECOFF.h>
Classes | |
struct | coff_header |
struct | coff_opt_header |
struct | data_directory |
struct | dos_header |
struct | section_header |
Public Member Functions | |
ObjectFilePECOFF (const lldb::ModuleSP &module_sp, lldb::DataBufferSP data_sp, lldb::offset_t data_offset, const lldb_private::FileSpec *file, lldb::offset_t file_offset, lldb::offset_t length) | |
ObjectFilePECOFF (const lldb::ModuleSP &module_sp, lldb::WritableDataBufferSP header_data_sp, const lldb::ProcessSP &process_sp, lldb::addr_t header_addr) | |
~ObjectFilePECOFF () override | |
bool | isA (const void *ClassID) const override |
bool | ParseHeader () override |
Attempts to parse the object header. | |
bool | SetLoadAddress (lldb_private::Target &target, lldb::addr_t value, bool value_is_offset) override |
Sets the load address for an entire module, assuming a rigid slide of sections, if possible in the implementation. | |
lldb::ByteOrder | GetByteOrder () const override |
Gets whether endian swapping should occur when extracting data from this object file. | |
bool | IsExecutable () const override |
Tells whether this object file is capable of being the main executable for a process. | |
uint32_t | GetAddressByteSize () const override |
Gets the address size in bytes for the current object file. | |
void | ParseSymtab (lldb_private::Symtab &symtab) override |
Parse the symbol table into the provides symbol table object. | |
bool | IsStripped () override |
Detect if this object file has been stripped of local symbols. | |
void | CreateSections (lldb_private::SectionList &unified_section_list) override |
void | Dump (lldb_private::Stream *s) override |
Dump a description of this object to a Stream. | |
lldb_private::ArchSpec | GetArchitecture () override |
Get the ArchSpec for this object file. | |
lldb_private::UUID | GetUUID () override |
Gets the UUID for this object file. | |
std::optional< lldb_private::FileSpec > | GetDebugLink () |
Return the contents of the .gnu_debuglink section, if the object file contains it. | |
uint32_t | GetDependentModules (lldb_private::FileSpecList &files) override |
Extract the dependent modules from an object file. | |
lldb_private::Address | GetEntryPointAddress () override |
Returns the address of the Entry Point in this object file - if the object file doesn't have an entry point (because it is not an executable file) then an invalid address is returned. | |
lldb_private::Address | GetBaseAddress () override |
Returns base address of this object file. | |
ObjectFile::Type | CalculateType () override |
The object file should be able to calculate its type by looking at its file header and possibly the sections or other data in the object file. | |
ObjectFile::Strata | CalculateStrata () override |
The object file should be able to calculate the strata of the object file. | |
llvm::StringRef | GetPluginName () override |
bool | IsWindowsSubsystem () |
uint32_t | GetRVA (const lldb_private::Address &addr) const |
lldb_private::Address | GetAddress (uint32_t rva) |
lldb::addr_t | GetFileAddress (uint32_t rva) const |
lldb_private::DataExtractor | ReadImageData (uint32_t offset, size_t size) |
lldb_private::DataExtractor | ReadImageDataByRVA (uint32_t rva, size_t size) |
std::unique_ptr< lldb_private::CallFrameInfo > | CreateCallFrameInfo () override |
Creates a plugin-specific call frame info. | |
Public Member Functions inherited from lldb_private::ObjectFile | |
ObjectFile (const lldb::ModuleSP &module_sp, const FileSpec *file_spec_ptr, lldb::offset_t file_offset, lldb::offset_t length, lldb::DataBufferSP data_sp, lldb::offset_t data_offset) | |
Construct with a parent module, offset, and header data. | |
ObjectFile (const lldb::ModuleSP &module_sp, const lldb::ProcessSP &process_sp, lldb::addr_t header_addr, lldb::DataBufferSP data_sp) | |
~ObjectFile () override | |
Destructor. | |
virtual void | Dump (Stream *s)=0 |
Dump a description of this object to a Stream. | |
virtual bool | isA (const void *ClassID) const |
virtual uint32_t | GetAddressByteSize () const =0 |
Gets the address size in bytes for the current object file. | |
virtual AddressClass | GetAddressClass (lldb::addr_t file_addr) |
Get the address type given a file address in an object file. | |
virtual uint32_t | GetDependentModules (FileSpecList &file_list)=0 |
Extract the dependent modules from an object file. | |
virtual bool | IsExecutable () const =0 |
Tells whether this object file is capable of being the main executable for a process. | |
virtual lldb::addr_t | GetFileOffset () const |
Returns the offset into a file at which this object resides. | |
virtual lldb::addr_t | GetByteSize () const |
virtual FileSpec & | GetFileSpec () |
Get accessor to the object file specification. | |
virtual const FileSpec & | GetFileSpec () const |
Get const accessor to the object file specification. | |
virtual ArchSpec | GetArchitecture ()=0 |
Get the ArchSpec for this object file. | |
virtual SectionList * | GetSectionList (bool update_module_section_list=true) |
Gets the section list for the currently selected architecture (and object for archives). | |
virtual void | CreateSections (SectionList &unified_section_list)=0 |
virtual void | SectionFileAddressesChanged () |
Notify the ObjectFile that the file addresses in the Sections for this module have been changed. | |
Symtab * | GetSymtab () |
Gets the symbol table for the currently selected architecture (and object for archives). | |
virtual void | ParseSymtab (Symtab &symtab)=0 |
Parse the symbol table into the provides symbol table object. | |
virtual void | RelocateSection (lldb_private::Section *section) |
Perform relocations on the section if necessary. | |
virtual Symbol * | ResolveSymbolForAddress (const Address &so_addr, bool verify_unique) |
Appends a Symbol for the specified so_addr to the symbol table. | |
virtual bool | IsStripped ()=0 |
Detect if this object file has been stripped of local symbols. | |
virtual void | ClearSymtab () |
Frees the symbol table. | |
virtual UUID | GetUUID ()=0 |
Gets the UUID for this object file. | |
virtual lldb_private::FileSpecList | GetReExportedLibraries () |
Gets the file spec list of libraries re-exported by this object file. | |
virtual bool | SetLoadAddress (Target &target, lldb::addr_t value, bool value_is_offset) |
Sets the load address for an entire module, assuming a rigid slide of sections, if possible in the implementation. | |
virtual lldb::ByteOrder | GetByteOrder () const =0 |
Gets whether endian swapping should occur when extracting data from this object file. | |
virtual bool | ParseHeader ()=0 |
Attempts to parse the object header. | |
virtual bool | AllowAssemblyEmulationUnwindPlans () |
Returns if the function bounds for symbols in this symbol file are likely accurate. | |
virtual lldb_private::Address | GetImageInfoAddress (Target *target) |
Similar to Process::GetImageInfoAddress(). | |
virtual lldb_private::Address | GetEntryPointAddress () |
Returns the address of the Entry Point in this object file - if the object file doesn't have an entry point (because it is not an executable file) then an invalid address is returned. | |
virtual lldb_private::Address | GetBaseAddress () |
Returns base address of this object file. | |
virtual uint32_t | GetNumThreadContexts () |
virtual std::string | GetIdentifierString () |
Some object files may have an identifier string embedded in them, e.g. | |
virtual lldb_private::AddressableBits | GetAddressableBits () |
Some object files may have the number of bits used for addressing embedded in them, e.g. | |
virtual bool | GetCorefileMainBinaryInfo (lldb::addr_t &value, bool &value_is_offset, UUID &uuid, ObjectFile::BinaryType &type) |
When the ObjectFile is a core file, lldb needs to locate the "binary" in the core file. | |
virtual bool | GetCorefileThreadExtraInfos (std::vector< lldb::tid_t > &tids) |
Get metadata about threads from the corefile. | |
virtual lldb::RegisterContextSP | GetThreadContextAtIndex (uint32_t idx, lldb_private::Thread &thread) |
virtual Type | CalculateType ()=0 |
The object file should be able to calculate its type by looking at its file header and possibly the sections or other data in the object file. | |
virtual void | SetType (Type type) |
In cases where the type can't be calculated (elf files), this routine allows someone to explicitly set it. | |
virtual Strata | CalculateStrata ()=0 |
The object file should be able to calculate the strata of the object file. | |
virtual llvm::VersionTuple | GetVersion () |
Get the object file version numbers. | |
virtual llvm::VersionTuple | GetMinimumOSVersion () |
Get the minimum OS version this object file can run on. | |
virtual llvm::VersionTuple | GetSDKVersion () |
Get the SDK OS version this object file was built with. | |
virtual bool | GetIsDynamicLinkEditor () |
Return true if this file is a dynamic link editor (dyld) | |
Type | GetType () |
Strata | GetStrata () |
size_t | GetData (lldb::offset_t offset, size_t length, DataExtractor &data) const |
size_t | CopyData (lldb::offset_t offset, size_t length, void *dst) const |
virtual size_t | ReadSectionData (Section *section, lldb::offset_t section_offset, void *dst, size_t dst_len) |
virtual size_t | ReadSectionData (Section *section, DataExtractor §ion_data) |
virtual size_t | GetSectionDataSize (Section *section) |
bool | IsInMemory () const |
Returns true if the object file exists only in memory. | |
virtual llvm::StringRef | StripLinkerSymbolAnnotations (llvm::StringRef symbol_name) const |
virtual bool | CanTrustAddressRanges () |
Can we trust the address ranges accelerator associated with this object file to be complete. | |
virtual std::vector< LoadableData > | GetLoadableData (Target &target) |
Loads this objfile to memory. | |
virtual std::unique_ptr< CallFrameInfo > | CreateCallFrameInfo () |
Creates a plugin-specific call frame info. | |
virtual bool | LoadCoreFileImages (lldb_private::Process &process) |
Load binaries listed in a corefile. | |
uint32_t | GetCacheHash () |
Get a hash that can be used for caching object file releated information. | |
Public Member Functions inherited from lldb_private::PluginInterface | |
PluginInterface ()=default | |
virtual | ~PluginInterface ()=default |
virtual llvm::StringRef | GetPluginName ()=0 |
PluginInterface (const PluginInterface &)=delete | |
PluginInterface & | operator= (const PluginInterface &)=delete |
Public Member Functions inherited from lldb_private::ModuleChild | |
ModuleChild (const lldb::ModuleSP &module_sp) | |
Construct with owning module. | |
~ModuleChild () | |
Destructor. | |
const ModuleChild & | operator= (const ModuleChild &rhs) |
Assignment operator. | |
lldb::ModuleSP | GetModule () const |
Get const accessor for the module pointer. | |
void | SetModule (const lldb::ModuleSP &module_sp) |
Set accessor for the module pointer. | |
Static Public Attributes | |
static char | ID |
Static Public Attributes inherited from lldb_private::ObjectFile | |
static char | ID |
Protected Types | |
typedef struct ObjectFilePECOFF::dos_header | dos_header_t |
typedef struct ObjectFilePECOFF::coff_header | coff_header_t |
typedef struct ObjectFilePECOFF::data_directory | data_directory_t |
typedef struct ObjectFilePECOFF::coff_opt_header | coff_opt_header_t |
typedef struct ObjectFilePECOFF::section_header | section_header_t |
typedef std::vector< section_header_t > | SectionHeaderColl |
typedef SectionHeaderColl::iterator | SectionHeaderCollIter |
typedef SectionHeaderColl::const_iterator | SectionHeaderCollConstIter |
Protected Member Functions | |
bool | NeedsEndianSwap () const |
bool | ParseCOFFOptionalHeader (lldb::offset_t *offset_ptr) |
bool | ParseSectionHeaders (uint32_t offset) |
uint32_t | ParseDependentModules () |
void | DumpSectionHeaders (lldb_private::Stream *s) |
void | DumpSectionHeader (lldb_private::Stream *s, const section_header_t &sh) |
void | DumpDependentModules (lldb_private::Stream *s) |
llvm::StringRef | GetSectionName (const section_header_t §) |
size_t | GetSectionDataSize (lldb_private::Section *section) override |
Protected Member Functions inherited from lldb_private::ObjectFile | |
bool | SetModulesArchitecture (const ArchSpec &new_arch) |
Sets the architecture for a module. | |
Static Protected Member Functions | |
static bool | ParseDOSHeader (lldb_private::DataExtractor &data, dos_header_t &dos_header) |
static bool | ParseCOFFHeader (lldb_private::DataExtractor &data, lldb::offset_t *offset_ptr, coff_header_t &coff_header) |
static void | DumpDOSHeader (lldb_private::Stream *s, const dos_header_t &header) |
static void | DumpCOFFHeader (lldb_private::Stream *s, const coff_header_t &header) |
static void | DumpOptCOFFHeader (lldb_private::Stream *s, const coff_opt_header_t &header) |
static lldb::SectionType | GetSectionType (llvm::StringRef sect_name, const section_header_t §) |
Private Types | |
typedef std::vector< std::pair< uint32_t, uint32_t > > | rva_symbol_list_t |
Private Member Functions | |
bool | CreateBinary () |
void | AppendFromCOFFSymbolTable (lldb_private::SectionList *sect_list, lldb_private::Symtab &symtab, const rva_symbol_list_t &sorted_exports) |
rva_symbol_list_t | AppendFromExportTable (lldb_private::SectionList *sect_list, lldb_private::Symtab &symtab) |
Private Attributes | |
dos_header_t | m_dos_header |
coff_header_t | m_coff_header |
coff_opt_header_t | m_coff_header_opt |
SectionHeaderColl | m_sect_headers |
lldb::addr_t | m_image_base |
lldb_private::Address | m_entry_point_address |
std::optional< lldb_private::FileSpecList > | m_deps_filespec |
std::unique_ptr< llvm::object::COFFObjectFile > | m_binary |
lldb_private::UUID | m_uuid |
Additional Inherited Members | |
Protected Attributes inherited from lldb_private::ObjectFile | |
FileSpec | m_file |
Type | m_type |
Strata | m_strata |
lldb::addr_t | m_file_offset |
The offset in bytes into the file, or the address in memory. | |
lldb::addr_t | m_length |
The length of this object file if it is known (can be zero if length is unknown or can't be determined). | |
DataExtractor | m_data |
The data for this object file so things can be parsed lazily. | |
lldb::ProcessWP | m_process_wp |
const lldb::addr_t | m_memory_addr |
Set if the object file only exists in memory. | |
std::unique_ptr< lldb_private::SectionList > | m_sections_up |
std::unique_ptr< lldb_private::Symtab > | m_symtab_up |
std::unique_ptr< llvm::once_flag > | m_symtab_once_up |
We need a llvm::once_flag that we can use to avoid locking the module lock and deadlocking LLDB. | |
std::optional< uint32_t > | m_cache_hash |
Protected Attributes inherited from lldb_private::ModuleChild | |
lldb::ModuleWP | m_module_wp |
The Module that owns the object that inherits from this class. | |
Static Protected Attributes inherited from lldb_private::ObjectFile | |
static size_t | g_initial_bytes_to_read = 512 |
The number of bytes to read when going through the plugins. | |
Definition at line 18 of file ObjectFilePECOFF.h.
|
protected |
|
protected |
|
protected |
|
protected |
|
private |
Definition at line 273 of file ObjectFilePECOFF.h.
|
protected |
|
protected |
Definition at line 267 of file ObjectFilePECOFF.h.
|
protected |
Definition at line 269 of file ObjectFilePECOFF.h.
|
protected |
Definition at line 268 of file ObjectFilePECOFF.h.
Definition at line 20 of file ObjectFilePECOFF.h.
ObjectFilePECOFF::ObjectFilePECOFF | ( | const lldb::ModuleSP & | module_sp, |
lldb::DataBufferSP | data_sp, | ||
lldb::offset_t | data_offset, | ||
const lldb_private::FileSpec * | file, | ||
lldb::offset_t | file_offset, | ||
lldb::offset_t | length | ||
) |
Definition at line 417 of file ObjectFilePECOFF.cpp.
ObjectFilePECOFF::ObjectFilePECOFF | ( | const lldb::ModuleSP & | module_sp, |
lldb::WritableDataBufferSP | header_data_sp, | ||
const lldb::ProcessSP & | process_sp, | ||
lldb::addr_t | header_addr | ||
) |
Definition at line 428 of file ObjectFilePECOFF.cpp.
|
overridedefault |
|
private |
Definition at line 779 of file ObjectFilePECOFF.cpp.
References lldb_private::Symtab::AddSymbol(), lldb::eSymbolTypeAbsolute, lldb::eSymbolTypeAdditional, lldb::eSymbolTypeInvalid, lldb_private::SectionList::FindSectionByID(), lldb_private::Symbol::GetAddressRef(), lldb_private::Address::GetFileAddress(), lldb_private::GetLog(), lldb_private::Symbol::GetMangled(), lldb_private::Symtab::GetNumSymbols(), lldb_private::Symbol::GetType(), ObjectFilePECOFF::coff_opt_header::image_base, LLDB_LOG_ERROR, m_binary, m_coff_header_opt, MapSymbolType(), lldb_private::Symtab::Reserve(), RVASymbolListCompareRVA(), lldb_private::Symbol::SetExternal(), lldb_private::Symbol::SetType(), lldb_private::Mangled::SetValue(), and lldb_private::Symtab::SymbolAtIndex().
Referenced by ParseSymtab().
|
private |
Definition at line 847 of file ObjectFilePECOFF.cpp.
References lldb_private::Symtab::AddSymbol(), lldb::eSymbolTypeCode, lldb::eSymbolTypeData, lldb_private::Log::Format(), lldb_private::Symbol::GetAddressRef(), lldb_private::Symbol::GetDisplayName(), lldb_private::GetLog(), lldb_private::Symbol::GetMangled(), lldb_private::Symtab::GetNumSymbols(), lldb_private::Address::GetSection(), lldb_private::ConstString::GetStringRef(), ObjectFilePECOFF::coff_opt_header::image_base, m_binary, m_coff_header_opt, lldb_private::Symtab::Reserve(), RVASymbolListCompareRVA(), lldb_private::Mangled::SetDemangledName(), lldb_private::Symbol::SetDemangledNameIsSynthesized(), lldb_private::Symbol::SetExternal(), lldb_private::Symbol::SetID(), lldb_private::Symbol::SetType(), and lldb_private::Mangled::SetValue().
Referenced by ParseSymtab().
|
overridevirtual |
The object file should be able to calculate the strata of the object file.
Many object files for platforms might be for either user space debugging or for kernel debugging. If your object file subclass can figure this out, it will help with debugger plug-in selection when it comes time to debug.
Implements lldb_private::ObjectFile.
Definition at line 1431 of file ObjectFilePECOFF.cpp.
References lldb_private::ObjectFile::eStrataUser.
|
overridevirtual |
The object file should be able to calculate its type by looking at its file header and possibly the sections or other data in the object file.
The file type is used in the debugger to help select the correct plug- ins for the job at hand, so this is important to get right. If any eTypeXXX definitions do not match up with the type of file you are loading, please feel free to add a new enumeration value.
Implements lldb_private::ObjectFile.
Definition at line 1421 of file ObjectFilePECOFF.cpp.
References lldb_private::ObjectFile::eTypeExecutable, lldb_private::ObjectFile::eTypeSharedLibrary, ObjectFilePECOFF::coff_header::flags, m_coff_header, and ObjectFilePECOFF::coff_header::machine.
|
inlinestatic |
Definition at line 97 of file ObjectFilePECOFF.h.
References ID.
|
private |
Definition at line 391 of file ObjectFilePECOFF.cpp.
References lldb_private::DataExtractor::GetData(), lldb_private::FileSpec::GetFilename(), lldb_private::GetLog(), lldb_private::ModuleChild::GetModule(), lldb_private::FileSpec::GetPath(), lldb_private::ConstString::GetStringRef(), LLDB_LOG, LLDB_LOG_ERROR, m_binary, lldb_private::ObjectFile::m_data, and lldb_private::ObjectFile::m_file.
Referenced by GetUUID(), and ParseDependentModules().
|
overridevirtual |
Creates a plugin-specific call frame info.
Reimplemented from lldb_private::ObjectFile.
Definition at line 937 of file ObjectFilePECOFF.cpp.
References ObjectFilePECOFF::coff_opt_header::data_dirs, m_coff_header, m_coff_header_opt, ObjectFilePECOFF::coff_header::machine, ObjectFilePECOFF::data_directory::vmaddr, and ObjectFilePECOFF::data_directory::vmsize.
|
static |
Definition at line 204 of file ObjectFilePECOFF.cpp.
References MagicBytesMatch(), and lldb_private::ObjectFile::MapFileData().
Referenced by Initialize(), and Terminate().
|
static |
Definition at line 237 of file ObjectFilePECOFF.cpp.
References MagicBytesMatch().
Referenced by Initialize().
|
overridevirtual |
Implements lldb_private::ObjectFile.
Definition at line 1040 of file ObjectFilePECOFF.cpp.
References lldb_private::SectionList::AddSection(), lldb::eSectionTypeOther, lldb_private::ModuleChild::GetModule(), GetSectionName(), GetSectionType(), ObjectFilePECOFF::coff_opt_header::header_size, ObjectFilePECOFF::coff_opt_header::image_base, m_coff_header_opt, m_sect_headers, lldb_private::ObjectFile::m_sections_up, and ObjectFilePECOFF::coff_opt_header::sect_alignment.
|
static |
Definition at line 185 of file ObjectFilePECOFF.cpp.
References lldb_private::PluginManager::CreateSettingForObjectFilePlugin(), GetGlobalPluginProperties(), and lldb_private::PluginManager::GetSettingForObjectFilePlugin().
Referenced by Initialize().
|
overridevirtual |
Dump a description of this object to a Stream.
Dump a description of the current contents of this object to the supplied stream s. The dumping should include the section list if it has been parsed, and the symbol table if it has been parsed.
[in] | s | The stream to which to dump the object description. |
Implements lldb_private::ObjectFile.
Definition at line 1200 of file ObjectFilePECOFF.cpp.
References lldb_private::Stream::AsRawOstream(), lldb_private::SectionList::Dump(), DumpCOFFHeader(), DumpDependentModules(), DumpDOSHeader(), DumpOptCOFFHeader(), DumpSectionHeaders(), ObjectFilePECOFF::dos_header::e_magic, lldb_private::Stream::EOL(), lldb_private::eSortOrderNone, GetArchitecture(), lldb_private::ArchSpec::GetArchitectureName(), lldb_private::Stream::GetIndentLevel(), lldb_private::ModuleChild::GetModule(), lldb_private::ObjectFile::GetSectionList(), ObjectFilePECOFF::coff_header::hdrsize, lldb_private::Stream::Indent(), m_coff_header, m_coff_header_opt, m_dos_header, lldb_private::ObjectFile::m_file, lldb_private::ObjectFile::m_symtab_up, ObjectFilePECOFF::coff_header::machine, lldb_private::Stream::Printf(), lldb_private::Stream::PutCString(), and UINT32_MAX.
|
staticprotected |
Definition at line 1272 of file ObjectFilePECOFF.cpp.
References ObjectFilePECOFF::coff_header::hdrsize, ObjectFilePECOFF::coff_header::machine, ObjectFilePECOFF::coff_header::modtime, ObjectFilePECOFF::coff_header::nsects, ObjectFilePECOFF::coff_header::nsyms, lldb_private::Stream::Printf(), lldb_private::Stream::PutCString(), and ObjectFilePECOFF::coff_header::symoff.
Referenced by Dump().
|
protected |
Definition at line 1373 of file ObjectFilePECOFF.cpp.
References m_deps_filespec, ParseDependentModules(), lldb_private::Stream::Printf(), and lldb_private::Stream::PutCString().
Referenced by Dump().
|
staticprotected |
Definition at line 1240 of file ObjectFilePECOFF.cpp.
References ObjectFilePECOFF::dos_header::e_cblp, ObjectFilePECOFF::dos_header::e_cp, ObjectFilePECOFF::dos_header::e_cparhdr, ObjectFilePECOFF::dos_header::e_crlc, ObjectFilePECOFF::dos_header::e_cs, ObjectFilePECOFF::dos_header::e_csum, ObjectFilePECOFF::dos_header::e_ip, ObjectFilePECOFF::dos_header::e_lfanew, ObjectFilePECOFF::dos_header::e_lfarlc, ObjectFilePECOFF::dos_header::e_magic, ObjectFilePECOFF::dos_header::e_maxalloc, ObjectFilePECOFF::dos_header::e_minalloc, ObjectFilePECOFF::dos_header::e_oemid, ObjectFilePECOFF::dos_header::e_oeminfo, ObjectFilePECOFF::dos_header::e_ovno, ObjectFilePECOFF::dos_header::e_res, ObjectFilePECOFF::dos_header::e_res2, ObjectFilePECOFF::dos_header::e_sp, ObjectFilePECOFF::dos_header::e_ss, lldb_private::Stream::Printf(), and lldb_private::Stream::PutCString().
Referenced by Dump().
|
staticprotected |
Definition at line 1285 of file ObjectFilePECOFF.cpp.
References ObjectFilePECOFF::coff_opt_header::bss_size, ObjectFilePECOFF::coff_opt_header::checksum, ObjectFilePECOFF::coff_opt_header::code_offset, ObjectFilePECOFF::coff_opt_header::code_size, ObjectFilePECOFF::coff_opt_header::data_dirs, ObjectFilePECOFF::coff_opt_header::data_offset, ObjectFilePECOFF::coff_opt_header::data_size, ObjectFilePECOFF::coff_opt_header::dll_flags, ObjectFilePECOFF::coff_opt_header::entry, ObjectFilePECOFF::coff_opt_header::file_alignment, ObjectFilePECOFF::coff_opt_header::header_size, ObjectFilePECOFF::coff_opt_header::heap_commit_size, ObjectFilePECOFF::coff_opt_header::heap_reserve_size, ObjectFilePECOFF::coff_opt_header::image_base, ObjectFilePECOFF::coff_opt_header::image_size, ObjectFilePECOFF::coff_opt_header::loader_flags, ObjectFilePECOFF::coff_opt_header::magic, ObjectFilePECOFF::coff_opt_header::major_image_version, ObjectFilePECOFF::coff_opt_header::major_linker_version, ObjectFilePECOFF::coff_opt_header::major_os_system_version, ObjectFilePECOFF::coff_opt_header::major_subsystem_version, ObjectFilePECOFF::coff_opt_header::minor_image_version, ObjectFilePECOFF::coff_opt_header::minor_linker_version, ObjectFilePECOFF::coff_opt_header::minor_os_system_version, ObjectFilePECOFF::coff_opt_header::minor_subsystem_version, lldb_private::Stream::Printf(), lldb_private::Stream::PutCString(), ObjectFilePECOFF::coff_opt_header::reserved1, ObjectFilePECOFF::coff_opt_header::sect_alignment, ObjectFilePECOFF::coff_opt_header::stack_commit_size, ObjectFilePECOFF::coff_opt_header::stack_reserve_size, and ObjectFilePECOFF::coff_opt_header::subsystem.
Referenced by Dump().
|
protected |
Definition at line 1341 of file ObjectFilePECOFF.cpp.
References ObjectFilePECOFF::section_header::flags, GetSectionName(), ObjectFilePECOFF::section_header::lineoff, ObjectFilePECOFF::section_header::nline, ObjectFilePECOFF::section_header::nreloc, ObjectFilePECOFF::section_header::offset, lldb_private::Stream::Printf(), ObjectFilePECOFF::section_header::reloff, ObjectFilePECOFF::section_header::size, ObjectFilePECOFF::section_header::vmaddr, and ObjectFilePECOFF::section_header::vmsize.
Referenced by DumpSectionHeaders().
|
protected |
Definition at line 1353 of file ObjectFilePECOFF.cpp.
References DumpSectionHeader(), m_sect_headers, lldb_private::Stream::Printf(), and lldb_private::Stream::PutCString().
Referenced by Dump().
Address ObjectFilePECOFF::GetAddress | ( | uint32_t | rva | ) |
Definition at line 670 of file ObjectFilePECOFF.cpp.
References GetFileAddress(), and lldb_private::ObjectFile::GetSectionList().
Referenced by PECallFrameInfo::GetAddressRange(), PECallFrameInfo::GetUnwindPlan(), and ReadImageDataByRVA().
|
overridevirtual |
Gets the address size in bytes for the current object file.
Implements lldb_private::ObjectFile.
Definition at line 501 of file ObjectFilePECOFF.cpp.
References m_coff_header_opt, ObjectFilePECOFF::coff_opt_header::magic, OPT_HEADER_MAGIC_PE32, and OPT_HEADER_MAGIC_PE32_PLUS.
Referenced by ParseCOFFOptionalHeader(), and ParseHeader().
|
overridevirtual |
Get the ArchSpec for this object file.
Implements lldb_private::ObjectFile.
Definition at line 1399 of file ObjectFilePECOFF.cpp.
References lldb_private::eArchTypeCOFF, IsWindowsSubsystem(), LLDB_INVALID_CPUTYPE, m_coff_header, ObjectFilePECOFF::coff_header::machine, and lldb_private::ArchSpec::SetArchitecture().
Referenced by Dump().
|
overridevirtual |
Returns base address of this object file.
This also sometimes referred to as the "preferred load address" or the "image base address". Addresses within object files are often expressed relative to this base. If this address corresponds to a specific section (usually the first byte of the first section) then the returned address will have this section set. Otherwise, the address will just have the offset member filled in, indicating that this represents a file address.
Reimplemented from lldb_private::ObjectFile.
Definition at line 1192 of file ObjectFilePECOFF.cpp.
References lldb_private::ObjectFile::GetSectionList().
|
overridevirtual |
Gets whether endian swapping should occur when extracting data from this object file.
Implements lldb_private::ObjectFile.
Definition at line 495 of file ObjectFilePECOFF.cpp.
References lldb::eByteOrderLittle.
std::optional< FileSpec > ObjectFilePECOFF::GetDebugLink | ( | ) |
Return the contents of the .gnu_debuglink section, if the object file contains it.
Definition at line 1108 of file ObjectFilePECOFF.cpp.
References GetDebugLinkContents(), and m_binary.
Referenced by SymbolVendorPECOFF::CreateInstance().
|
overridevirtual |
Extract the dependent modules from an object file.
If an object file has information about which other images it depends on (such as shared libraries), this function will provide the list. Since many executables or shared libraries may depend on the same files, FileSpecList::AppendIfUnique(const FileSpec &) should be used to make sure any files that are added are not already in the list.
[out] | file_list | A list of file specification objects that gets dependent files appended to. |
Implements lldb_private::ObjectFile.
Definition at line 1164 of file ObjectFilePECOFF.cpp.
References lldb_private::FileSpecList::AppendIfUnique(), lldb_private::FileSpecList::GetSize(), m_deps_filespec, and ParseDependentModules().
|
overridevirtual |
Returns the address of the Entry Point in this object file - if the object file doesn't have an entry point (because it is not an executable file) then an invalid address is returned.
Reimplemented from lldb_private::ObjectFile.
Definition at line 1174 of file ObjectFilePECOFF.cpp.
References ObjectFilePECOFF::coff_opt_header::entry, lldb_private::ObjectFile::GetSectionList(), ObjectFilePECOFF::coff_opt_header::image_base, IsExecutable(), lldb_private::Address::IsValid(), m_coff_header_opt, m_entry_point_address, ParseHeader(), lldb_private::Address::ResolveAddressUsingFileSections(), and lldb_private::Address::SetOffset().
lldb::addr_t ObjectFilePECOFF::GetFileAddress | ( | uint32_t | rva | ) | const |
Definition at line 678 of file ObjectFilePECOFF.cpp.
References m_image_base.
Referenced by GetAddress().
|
static |
Definition at line 250 of file ObjectFilePECOFF.cpp.
References lldb_private::ModuleSpecList::Append(), lldb_private::ModuleSpec::GetArchitecture(), GetCoffUUID(), lldb_private::FileSpec::GetFilename(), GetGlobalPluginProperties(), lldb_private::GetLog(), lldb_private::ModuleSpecList::GetSize(), lldb_private::ConstString::GetStringRef(), lldb_private::ArchSpec::GetTriple(), lldb_private::ModuleSpec::GetUUID(), lldb_private::UUID::IsValid(), LLDB_LOG_ERROR, MachineAmd64, MachineArm64, MachineArm64X, MachineArmNt, MachineX86, MagicBytesMatch(), lldb_private::ObjectFile::MapFileData(), and lldb_private::ArchSpec::SetTriple().
Referenced by Initialize().
|
static |
Definition at line 199 of file ObjectFilePECOFF.cpp.
Referenced by Initialize().
|
inlineoverridevirtual |
Implements lldb_private::PluginInterface.
Definition at line 140 of file ObjectFilePECOFF.h.
References GetPluginNameStatic().
|
inlinestatic |
Definition at line 64 of file ObjectFilePECOFF.h.
Referenced by GetPluginName(), and Initialize().
uint32_t ObjectFilePECOFF::GetRVA | ( | const lldb_private::Address & | addr | ) | const |
Definition at line 666 of file ObjectFilePECOFF.cpp.
References lldb_private::Address::GetFileAddress(), and m_image_base.
Referenced by PECallFrameInfo::FindRuntimeFunctionIntersectsWithRange().
|
overrideprotectedvirtual |
Reimplemented from lldb_private::ObjectFile.
Definition at line 1030 of file ObjectFilePECOFF.cpp.
References lldb_private::Section::GetByteSize(), lldb_private::Section::GetFileSize(), and m_binary.
|
protected |
Definition at line 752 of file ObjectFilePECOFF.cpp.
References lldb_private::DataExtractor::GetCStr(), m_coff_header, lldb_private::ObjectFile::m_data, ObjectFilePECOFF::section_header::name, ObjectFilePECOFF::coff_header::nsyms, and ObjectFilePECOFF::coff_header::symoff.
Referenced by CreateSections(), and DumpSectionHeader().
|
staticprotected |
Definition at line 958 of file ObjectFilePECOFF.cpp.
References lldb::eSectionTypeCode, lldb::eSectionTypeData, lldb::eSectionTypeDataCString, lldb::eSectionTypeDebug, lldb::eSectionTypeDWARFDebugAbbrev, lldb::eSectionTypeDWARFDebugAranges, lldb::eSectionTypeDWARFDebugFrame, lldb::eSectionTypeDWARFDebugInfo, lldb::eSectionTypeDWARFDebugLine, lldb::eSectionTypeDWARFDebugLoc, lldb::eSectionTypeDWARFDebugLocLists, lldb::eSectionTypeDWARFDebugMacInfo, lldb::eSectionTypeDWARFDebugNames, lldb::eSectionTypeDWARFDebugPubNames, lldb::eSectionTypeDWARFDebugPubTypes, lldb::eSectionTypeDWARFDebugRanges, lldb::eSectionTypeDWARFDebugStr, lldb::eSectionTypeDWARFDebugTypes, lldb::eSectionTypeEHFrame, lldb::eSectionTypeGoSymtab, lldb::eSectionTypeInvalid, lldb::eSectionTypeOther, lldb::eSectionTypeSwiftModules, lldb::eSectionTypeZeroFill, ObjectFilePECOFF::section_header::flags, ObjectFilePECOFF::section_header::offset, and ObjectFilePECOFF::section_header::size.
Referenced by CreateSections().
|
overridevirtual |
Gets the UUID for this object file.
If the object file format contains a UUID, the value should be returned. Else ObjectFile instances should return the MD5 checksum of all of the bytes for the object file (or memory for memory based object files).
Implements lldb_private::ObjectFile.
Definition at line 1097 of file ObjectFilePECOFF.cpp.
References CreateBinary(), GetCoffUUID(), lldb_private::UUID::IsValid(), m_binary, and m_uuid.
Referenced by SymbolVendorPECOFF::CreateInstance().
|
static |
Definition at line 178 of file ObjectFilePECOFF.cpp.
References CreateInstance(), CreateMemoryInstance(), DebuggerInitialize(), GetModuleSpecifications(), GetPluginDescriptionStatic(), GetPluginNameStatic(), lldb_private::PluginManager::RegisterPlugin(), and SaveCore().
|
inlineoverridevirtual |
Reimplemented from lldb_private::ObjectFile.
Definition at line 94 of file ObjectFilePECOFF.h.
References ID.
|
overridevirtual |
Tells whether this object file is capable of being the main executable for a process.
Implements lldb_private::ObjectFile.
Definition at line 497 of file ObjectFilePECOFF.cpp.
References ObjectFilePECOFF::coff_header::flags, and m_coff_header.
Referenced by GetEntryPointAddress().
|
overridevirtual |
Detect if this object file has been stripped of local symbols.
Detect if this object file has been stripped of local symbols.
Implements lldb_private::ObjectFile.
Definition at line 953 of file ObjectFilePECOFF.cpp.
bool ObjectFilePECOFF::IsWindowsSubsystem | ( | ) |
Definition at line 1384 of file ObjectFilePECOFF.cpp.
References m_coff_header_opt, and ObjectFilePECOFF::coff_opt_header::subsystem.
Referenced by GetArchitecture().
|
static |
Definition at line 366 of file ObjectFilePECOFF.cpp.
References lldb::eByteOrderLittle, lldb_private::DataExtractor::GetU16(), and IMAGE_DOS_SIGNATURE.
Referenced by CreateInstance(), CreateMemoryInstance(), and GetModuleSpecifications().
|
static |
Definition at line 373 of file ObjectFilePECOFF.cpp.
References lldb::eSymbolTypeCode, lldb::eSymbolTypeData, and lldb::eSymbolTypeInvalid.
Referenced by AppendFromCOFFSymbolTable().
|
protected |
Definition at line 513 of file ObjectFilePECOFF.cpp.
|
staticprotected |
Definition at line 580 of file ObjectFilePECOFF.cpp.
References ObjectFilePECOFF::coff_header::flags, lldb_private::DataExtractor::GetU16(), lldb_private::DataExtractor::GetU32(), ObjectFilePECOFF::coff_header::hdrsize, ObjectFilePECOFF::coff_header::machine, ObjectFilePECOFF::coff_header::modtime, ObjectFilePECOFF::coff_header::nsects, ObjectFilePECOFF::coff_header::nsyms, ObjectFilePECOFF::coff_header::symoff, and lldb_private::DataExtractor::ValidOffsetForDataOfSize().
Referenced by ParseHeader().
|
protected |
Definition at line 599 of file ObjectFilePECOFF.cpp.
References ObjectFilePECOFF::coff_opt_header::bss_size, ObjectFilePECOFF::coff_opt_header::checksum, ObjectFilePECOFF::coff_opt_header::code_offset, ObjectFilePECOFF::coff_opt_header::code_size, ObjectFilePECOFF::coff_opt_header::data_dirs, ObjectFilePECOFF::coff_opt_header::data_offset, ObjectFilePECOFF::coff_opt_header::data_size, ObjectFilePECOFF::coff_opt_header::dll_flags, ObjectFilePECOFF::coff_opt_header::entry, ObjectFilePECOFF::coff_opt_header::file_alignment, GetAddressByteSize(), lldb_private::DataExtractor::GetMaxU64(), lldb_private::DataExtractor::GetU16(), lldb_private::DataExtractor::GetU32(), lldb_private::DataExtractor::GetU8(), ObjectFilePECOFF::coff_header::hdrsize, ObjectFilePECOFF::coff_opt_header::header_size, ObjectFilePECOFF::coff_opt_header::heap_commit_size, ObjectFilePECOFF::coff_opt_header::heap_reserve_size, ObjectFilePECOFF::coff_opt_header::image_base, ObjectFilePECOFF::coff_opt_header::image_size, ObjectFilePECOFF::coff_opt_header::loader_flags, m_coff_header, m_coff_header_opt, lldb_private::ObjectFile::m_data, m_image_base, ObjectFilePECOFF::coff_opt_header::magic, ObjectFilePECOFF::coff_opt_header::major_image_version, ObjectFilePECOFF::coff_opt_header::major_linker_version, ObjectFilePECOFF::coff_opt_header::major_os_system_version, ObjectFilePECOFF::coff_opt_header::major_subsystem_version, ObjectFilePECOFF::coff_opt_header::minor_image_version, ObjectFilePECOFF::coff_opt_header::minor_linker_version, ObjectFilePECOFF::coff_opt_header::minor_os_system_version, ObjectFilePECOFF::coff_opt_header::minor_subsystem_version, OPT_HEADER_MAGIC_PE32, ObjectFilePECOFF::coff_opt_header::reserved1, ObjectFilePECOFF::coff_opt_header::sect_alignment, ObjectFilePECOFF::coff_opt_header::stack_commit_size, ObjectFilePECOFF::coff_opt_header::stack_reserve_size, and ObjectFilePECOFF::coff_opt_header::subsystem.
Referenced by ParseHeader().
|
protected |
Definition at line 1116 of file ObjectFilePECOFF.cpp.
References CreateBinary(), lldb_private::FileSpec::GetDirectory(), lldb_private::GetLog(), lldb_private::ModuleChild::GetModule(), lldb_private::FileSpec::GetPath(), LLDB_LOG, LLDB_LOGF, m_binary, m_deps_filespec, lldb_private::ObjectFile::m_file, and lldb_private::FileSpec::SetDirectory().
Referenced by DumpDependentModules(), and GetDependentModules().
|
staticprotected |
Definition at line 521 of file ObjectFilePECOFF.cpp.
References ObjectFilePECOFF::dos_header::e_cblp, ObjectFilePECOFF::dos_header::e_cp, ObjectFilePECOFF::dos_header::e_cparhdr, ObjectFilePECOFF::dos_header::e_crlc, ObjectFilePECOFF::dos_header::e_cs, ObjectFilePECOFF::dos_header::e_csum, ObjectFilePECOFF::dos_header::e_ip, ObjectFilePECOFF::dos_header::e_lfanew, ObjectFilePECOFF::dos_header::e_lfarlc, ObjectFilePECOFF::dos_header::e_magic, ObjectFilePECOFF::dos_header::e_maxalloc, ObjectFilePECOFF::dos_header::e_minalloc, ObjectFilePECOFF::dos_header::e_oemid, ObjectFilePECOFF::dos_header::e_oeminfo, ObjectFilePECOFF::dos_header::e_ovno, ObjectFilePECOFF::dos_header::e_res, ObjectFilePECOFF::dos_header::e_res2, ObjectFilePECOFF::dos_header::e_sp, ObjectFilePECOFF::dos_header::e_ss, lldb_private::DataExtractor::GetU16(), lldb_private::DataExtractor::GetU32(), IMAGE_DOS_SIGNATURE, and lldb_private::DataExtractor::ValidOffsetForDataOfSize().
Referenced by ParseHeader().
|
overridevirtual |
Attempts to parse the object header.
This function is used as a test to see if a given plug-in instance can parse the header data already contained in ObjectFile::m_data. If an object file parser does not recognize that magic bytes in a header, false should be returned and the next plug-in can attempt to parse an object file.
Implements lldb_private::ObjectFile.
Definition at line 439 of file ObjectFilePECOFF.cpp.
References ObjectFilePECOFF::dos_header::e_lfanew, lldb::eByteOrderLittle, GetAddressByteSize(), lldb_private::ModuleChild::GetModule(), lldb_private::DataExtractor::GetU32(), ObjectFilePECOFF::coff_header::hdrsize, IMAGE_NT_SIGNATURE, m_coff_header, lldb_private::ObjectFile::m_data, m_dos_header, m_sect_headers, ParseCOFFHeader(), ParseCOFFOptionalHeader(), ParseDOSHeader(), ParseSectionHeaders(), lldb_private::DataExtractor::SetAddressByteSize(), and lldb_private::DataExtractor::SetByteOrder().
Referenced by GetEntryPointAddress().
|
protected |
Definition at line 716 of file ObjectFilePECOFF.cpp.
References m_coff_header, m_sect_headers, ObjectFilePECOFF::coff_header::nsects, and ReadImageData().
Referenced by ParseHeader().
|
overridevirtual |
Parse the symbol table into the provides symbol table object.
Symbol table parsing will be done once when this function is called by each object file plugin. All of the necessary locks will already be acquired before this function is called and the symbol table object to populate is supplied as an argument and doesn't need to be created by each plug-in.
The | symbol table to populate. |
Implements lldb_private::ObjectFile.
Definition at line 768 of file ObjectFilePECOFF.cpp.
References AppendFromCOFFSymbolTable(), AppendFromExportTable(), and lldb_private::ObjectFile::GetSectionList().
DataExtractor ObjectFilePECOFF::ReadImageData | ( | uint32_t | offset, |
size_t | size | ||
) |
Definition at line 682 of file ObjectFilePECOFF.cpp.
References lldb_private::ObjectFile::m_data, m_image_base, lldb_private::ObjectFile::m_process_wp, lldb_private::DataExtractor::SetData(), and lldb_private::DataExtractor::ValidOffsetForDataOfSize().
Referenced by ParseSectionHeaders(), and ReadImageDataByRVA().
DataExtractor ObjectFilePECOFF::ReadImageDataByRVA | ( | uint32_t | rva, |
size_t | size | ||
) |
Definition at line 705 of file ObjectFilePECOFF.cpp.
References GetAddress(), lldb_private::Address::GetOffset(), lldb_private::Address::GetSection(), and ReadImageData().
Referenced by UnwindCodesIterator::GetNext().
|
static |
Definition at line 357 of file ObjectFilePECOFF.cpp.
References error(), lldb_private::SaveCoreOptions::GetOutputFile(), and lldb_private::SaveMiniDump().
Referenced by Initialize().
|
overridevirtual |
Sets the load address for an entire module, assuming a rigid slide of sections, if possible in the implementation.
Reimplemented from lldb_private::ObjectFile.
Definition at line 464 of file ObjectFilePECOFF.cpp.
References lldb_private::ModuleChild::GetModule(), lldb_private::SectionList::GetSectionAtIndex(), lldb_private::ObjectFile::GetSectionList(), lldb_private::Target::GetSectionLoadList(), lldb_private::SectionList::GetSize(), m_image_base, and lldb_private::SectionLoadList::SetSectionLoadAddress().
|
static |
Definition at line 195 of file ObjectFilePECOFF.cpp.
References CreateInstance(), and lldb_private::PluginManager::UnregisterPlugin().
|
static |
Definition at line 93 of file ObjectFilePECOFF.h.
|
private |
Definition at line 287 of file ObjectFilePECOFF.h.
Referenced by AppendFromCOFFSymbolTable(), AppendFromExportTable(), CreateBinary(), GetDebugLink(), GetSectionDataSize(), GetUUID(), and ParseDependentModules().
|
private |
Definition at line 281 of file ObjectFilePECOFF.h.
Referenced by CalculateType(), CreateCallFrameInfo(), Dump(), GetArchitecture(), GetSectionName(), IsExecutable(), ParseCOFFOptionalHeader(), ParseHeader(), and ParseSectionHeaders().
|
private |
Definition at line 282 of file ObjectFilePECOFF.h.
Referenced by AppendFromCOFFSymbolTable(), AppendFromExportTable(), CreateCallFrameInfo(), CreateSections(), Dump(), GetAddressByteSize(), GetEntryPointAddress(), IsWindowsSubsystem(), and ParseCOFFOptionalHeader().
|
private |
Definition at line 286 of file ObjectFilePECOFF.h.
Referenced by DumpDependentModules(), GetDependentModules(), and ParseDependentModules().
|
private |
Definition at line 280 of file ObjectFilePECOFF.h.
Referenced by Dump(), and ParseHeader().
|
private |
Definition at line 285 of file ObjectFilePECOFF.h.
Referenced by GetEntryPointAddress().
|
private |
Definition at line 284 of file ObjectFilePECOFF.h.
Referenced by GetFileAddress(), GetRVA(), ParseCOFFOptionalHeader(), ReadImageData(), and SetLoadAddress().
|
private |
Definition at line 283 of file ObjectFilePECOFF.h.
Referenced by CreateSections(), DumpSectionHeaders(), ParseHeader(), and ParseSectionHeaders().
|
private |
Definition at line 288 of file ObjectFilePECOFF.h.
Referenced by GetUUID().