LLDB  mainline
Classes | Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
lldb_private::wasm::ObjectFileWasm Class Reference

Generic Wasm object file reader. More...

#include <ObjectFileWasm.h>

Inheritance diagram for lldb_private::wasm::ObjectFileWasm:
Inheritance graph
[legend]
Collaboration diagram for lldb_private::wasm::ObjectFileWasm:
Collaboration graph
[legend]

Classes

struct  section_info
 

Public Member Functions

llvm::Optional< FileSpecGetExternalDebugInfoFileSpec ()
 A Wasm module that has external DWARF debug information should contain a custom section named "external_debug_info", whose payload is an UTF-8 encoded string that points to a Wasm module that contains the debug information for this module. More...
 
llvm::StringRef GetPluginName () override
 PluginInterface protocol. More...
 
bool ParseHeader () override
 ObjectFile Protocol. More...
 
lldb::ByteOrder GetByteOrder () const override
 Gets whether endian swapping should occur when extracting data from this object file. More...
 
bool IsExecutable () const override
 Tells whether this object file is capable of being the main executable for a process. More...
 
uint32_t GetAddressByteSize () const override
 Gets the address size in bytes for the current object file. More...
 
AddressClass GetAddressClass (lldb::addr_t file_addr) override
 Get the address type given a file address in an object file. More...
 
SymtabGetSymtab () override
 Gets the symbol table for the currently selected architecture (and object for archives). More...
 
bool IsStripped () override
 Detect if this object file has been stripped of local symbols. More...
 
void CreateSections (SectionList &unified_section_list) override
 
void Dump (Stream *s) override
 Dump a description of this object to a Stream. More...
 
ArchSpec GetArchitecture () override
 Get the ArchSpec for this object file. More...
 
UUID GetUUID () override
 Gets the UUID for this object file. More...
 
uint32_t GetDependentModules (FileSpecList &files) override
 Extract the dependent modules from an object file. More...
 
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. More...
 
Strata CalculateStrata () override
 The object file should be able to calculate the strata of the object file. More...
 
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. More...
 
lldb_private::Address GetBaseAddress () override
 Returns base address of this object file. More...
 
- 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, const lldb::DataBufferSP &data_sp, lldb::offset_t data_offset)
 Construct with a parent module, offset, and header data. More...
 
 ObjectFile (const lldb::ModuleSP &module_sp, const lldb::ProcessSP &process_sp, lldb::addr_t header_addr, lldb::DataBufferSP &data_sp)
 
 ~ObjectFile () override
 Destructor. More...
 
virtual lldb::addr_t GetFileOffset () const
 Returns the offset into a file at which this object resides. More...
 
virtual lldb::addr_t GetByteSize () const
 
virtual FileSpecGetFileSpec ()
 Get accessor to the object file specification. More...
 
virtual const FileSpecGetFileSpec () const
 Get const accessor to the object file specification. More...
 
virtual SectionListGetSectionList (bool update_module_section_list=true)
 Gets the section list for the currently selected architecture (and object for archives). More...
 
virtual void SectionFileAddressesChanged ()
 Notify the ObjectFile that the file addresses in the Sections for this module have been changed. More...
 
virtual void RelocateSection (lldb_private::Section *section)
 Perform relocations on the section if necessary. More...
 
virtual SymbolResolveSymbolForAddress (const Address &so_addr, bool verify_unique)
 Appends a Symbol for the specified so_addr to the symbol table. More...
 
virtual void ClearSymtab ()
 Frees the symbol table. More...
 
virtual lldb_private::FileSpecList GetReExportedLibraries ()
 Gets the file spec list of libraries re-exported by this object file. More...
 
virtual bool AllowAssemblyEmulationUnwindPlans ()
 Returns if the function bounds for symbols in this symbol file are likely accurate. More...
 
virtual lldb_private::Address GetImageInfoAddress (Target *target)
 Similar to Process::GetImageInfoAddress(). More...
 
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. More...
 
virtual uint32_t GetNumThreadContexts ()
 
virtual std::string GetIdentifierString ()
 Some object files may have an identifier string embedded in them, e.g. More...
 
virtual lldb::addr_t GetAddressMask ()
 Some object files may have the number of bits used for addressing embedded in them, e.g. More...
 
virtual bool GetCorefileMainBinaryInfo (lldb::addr_t &address, UUID &uuid, ObjectFile::BinaryType &type)
 When the ObjectFile is a core file, lldb needs to locate the "binary" in the core file. More...
 
virtual lldb::RegisterContextSP GetThreadContextAtIndex (uint32_t idx, lldb_private::Thread &thread)
 
virtual void SetType (Type type)
 In cases where the type can't be calculated (elf files), this routine allows someone to explicitly set it. More...
 
virtual llvm::VersionTuple GetVersion ()
 Get the object file version numbers. More...
 
virtual llvm::VersionTuple GetMinimumOSVersion ()
 Get the minimum OS version this object file can run on. More...
 
virtual llvm::VersionTuple GetSDKVersion ()
 Get the SDK OS version this object file was built with. More...
 
virtual bool GetIsDynamicLinkEditor ()
 Return true if this file is a dynamic link editor (dyld) More...
 
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)
 
bool IsInMemory () const
 
virtual llvm::StringRef StripLinkerSymbolAnnotations (llvm::StringRef symbol_name) const
 
virtual std::vector< LoadableDataGetLoadableData (Target &target)
 Loads this objfile to memory. More...
 
virtual std::unique_ptr< CallFrameInfoCreateCallFrameInfo ()
 Creates a plugin-specific call frame info. More...
 
virtual bool LoadCoreFileImages (lldb_private::Process &process)
 Load binaries listed in a corefile. More...
 
- Public Member Functions inherited from lldb_private::PluginInterface
 PluginInterface ()=default
 
virtual ~PluginInterface ()=default
 
 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. More...
 
 ~ModuleChild ()
 Destructor. More...
 
const ModuleChildoperator= (const ModuleChild &rhs)
 Assignment operator. More...
 
lldb::ModuleSP GetModule () const
 Get const accessor for the module pointer. More...
 
void SetModule (const lldb::ModuleSP &module_sp)
 Set accessor for the module pointer. More...
 

Static Public Member Functions

static void Initialize ()
 
static void Terminate ()
 
static llvm::StringRef GetPluginNameStatic ()
 
static const char * GetPluginDescriptionStatic ()
 
static ObjectFileCreateInstance (const lldb::ModuleSP &module_sp, lldb::DataBufferSP &data_sp, lldb::offset_t data_offset, const FileSpec *file, lldb::offset_t file_offset, lldb::offset_t length)
 
static ObjectFileCreateMemoryInstance (const lldb::ModuleSP &module_sp, lldb::DataBufferSP &data_sp, const lldb::ProcessSP &process_sp, lldb::addr_t header_addr)
 
static size_t GetModuleSpecifications (const FileSpec &file, lldb::DataBufferSP &data_sp, lldb::offset_t data_offset, lldb::offset_t file_offset, lldb::offset_t length, ModuleSpecList &specs)
 
- Static Public Member Functions inherited from lldb_private::ObjectFile
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. More...
 
static lldb::ObjectFileSP FindPlugin (const lldb::ModuleSP &module_sp, const lldb::ProcessSP &process_sp, lldb::addr_t header_addr, lldb::DataBufferSP &file_data_sp)
 Find a ObjectFile plug-in that can parse a file in memory. More...
 
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. More...
 
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)
 

Private Types

typedef struct lldb_private::wasm::ObjectFileWasm::section_info section_info_t
 

Private Member Functions

 ObjectFileWasm (const lldb::ModuleSP &module_sp, lldb::DataBufferSP &data_sp, lldb::offset_t data_offset, const FileSpec *file, lldb::offset_t offset, lldb::offset_t length)
 
 ObjectFileWasm (const lldb::ModuleSP &module_sp, lldb::DataBufferSP &header_data_sp, const lldb::ProcessSP &process_sp, lldb::addr_t header_addr)
 
DataExtractor ReadImageData (lldb::offset_t offset, uint32_t size)
 Read a range of bytes from the Wasm module. More...
 
bool DecodeNextSection (lldb::offset_t *offset_ptr)
 Wasm section decoding routines. More...
 
bool DecodeSections ()
 
void DumpSectionHeader (llvm::raw_ostream &ostream, const section_info_t &sh)
 Wasm section header dump routines. More...
 
void DumpSectionHeaders (llvm::raw_ostream &ostream)
 

Private Attributes

std::vector< section_info_tm_sect_infos
 
ArchSpec m_arch
 
UUID m_uuid
 
static char ID
 LLVM RTTI support. More...
 
static bool classof (const ObjectFile *obj)
 
bool isA (const void *ClassID) const override
 

Additional Inherited Members

- Public Types inherited from lldb_private::ObjectFile
enum  Type {
  eTypeInvalid = 0, eTypeCoreFile, eTypeExecutable, eTypeDebugInfo,
  eTypeDynamicLinker, eTypeObjectFile, eTypeSharedLibrary, eTypeStubLibrary,
  eTypeJIT, eTypeUnknown
}
 
enum  Strata {
  eStrataInvalid = 0, eStrataUnknown, eStrataUser, eStrataKernel,
  eStrataRawImage, eStrataJIT
}
 
enum  BinaryType {
  eBinaryTypeInvalid = 0, eBinaryTypeUnknown, eBinaryTypeKernel, eBinaryTypeUser,
  eBinaryTypeStandalone
}
 If we have a corefile binary hint, this enum specifies the binary type which we can use to select the correct DynamicLoader plugin. More...
 
- Static Public Attributes inherited from lldb_private::ObjectFile
static char ID
 
- Protected Member Functions inherited from lldb_private::ObjectFile
bool SetModulesArchitecture (const ArchSpec &new_arch)
 Sets the architecture for a module. More...
 
- Static Protected Member Functions inherited from lldb_private::ObjectFile
static lldb::DataBufferSP MapFileData (const FileSpec &file, uint64_t Size, uint64_t Offset)
 
- 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. More...
 
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). More...
 
DataExtractor m_data
 The data for this object file so things can be parsed lazily. More...
 
lldb::ProcessWP m_process_wp
 
const lldb::addr_t m_memory_addr
 
std::unique_ptr< lldb_private::SectionListm_sections_up
 
std::unique_ptr< lldb_private::Symtabm_symtab_up
 
uint32_t m_synthetic_symbol_idx
 
- Protected Attributes inherited from lldb_private::ModuleChild
lldb::ModuleWP m_module_wp
 The Module that owns the object that inherits from this class. More...
 

Detailed Description

Generic Wasm object file reader.

This class provides a generic wasm32 reader plugin implementing the ObjectFile protocol.

Definition at line 22 of file ObjectFileWasm.h.

Member Typedef Documentation

◆ section_info_t

Constructor & Destructor Documentation

◆ ObjectFileWasm() [1/2]

lldb_private::wasm::ObjectFileWasm::ObjectFileWasm ( const lldb::ModuleSP &  module_sp,
lldb::DataBufferSP &  data_sp,
lldb::offset_t  data_offset,
const FileSpec file,
lldb::offset_t  offset,
lldb::offset_t  length 
)
private

◆ ObjectFileWasm() [2/2]

ObjectFileWasm::ObjectFileWasm ( const lldb::ModuleSP &  module_sp,
lldb::DataBufferSP &  header_data_sp,
const lldb::ProcessSP &  process_sp,
lldb::addr_t  header_addr 
)
private

Definition at line 237 of file ObjectFileWasm.cpp.

Member Function Documentation

◆ CalculateStrata()

Strata lldb_private::wasm::ObjectFileWasm::CalculateStrata ( )
inlineoverridevirtual

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.

Implements lldb_private::ObjectFile.

Definition at line 97 of file ObjectFileWasm.h.

References lldb_private::ObjectFile::eStrataUser.

◆ CalculateType()

Type lldb_private::wasm::ObjectFileWasm::CalculateType ( )
inlineoverridevirtual

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.

Implements lldb_private::ObjectFile.

Definition at line 95 of file ObjectFileWasm.h.

References lldb_private::ObjectFile::eTypeSharedLibrary.

◆ classof()

static bool lldb_private::wasm::ObjectFileWasm::classof ( const ObjectFile obj)
inlinestatic

Definition at line 60 of file ObjectFileWasm.h.

References ID, and lldb_private::ObjectFile::isA().

◆ CreateInstance()

ObjectFile * ObjectFileWasm::CreateInstance ( const lldb::ModuleSP &  module_sp,
lldb::DataBufferSP &  data_sp,
lldb::offset_t  data_offset,
const FileSpec file,
lldb::offset_t  file_offset,
lldb::offset_t  length 
)
static

◆ CreateMemoryInstance()

ObjectFile * ObjectFileWasm::CreateMemoryInstance ( const lldb::ModuleSP &  module_sp,
lldb::DataBufferSP &  data_sp,
const lldb::ProcessSP &  process_sp,
lldb::addr_t  header_addr 
)
static

Definition at line 142 of file ObjectFileWasm.cpp.

References ValidateModuleHeader().

◆ CreateSections()

void ObjectFileWasm::CreateSections ( SectionList unified_section_list)
overridevirtual

◆ DecodeNextSection()

bool ObjectFileWasm::DecodeNextSection ( lldb::offset_t offset_ptr)
private

Wasm section decoding routines.

Definition at line 157 of file ObjectFileWasm.cpp.

References lldb_private::DataExtractor::GetAsLLVM(), and GetWasmString().

◆ DecodeSections()

bool ObjectFileWasm::DecodeSections ( )
private

Definition at line 206 of file ObjectFileWasm.cpp.

References kWasmHeaderSize.

Referenced by CreateSections(), and SetLoadAddress().

◆ Dump()

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

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

Implements lldb_private::ObjectFile.

Definition at line 432 of file ObjectFileWasm.cpp.

References lldb_private::Stream::AsRawOstream(), lldb_private::SectionList::Dump(), lldb_private::FileSpec::Dump(), DumpSectionHeaders(), GetArchitecture(), lldb_private::ArchSpec::GetArchitectureName(), lldb_private::Stream::GetIndentLevel(), lldb_private::ModuleChild::GetModule(), lldb_private::ObjectFile::GetSectionList(), lldb_private::Stream::Indent(), lldb_private::ObjectFile::m_file, and UINT32_MAX.

◆ DumpSectionHeader()

void ObjectFileWasm::DumpSectionHeader ( llvm::raw_ostream &  ostream,
const section_info_t sh 
)
private

◆ DumpSectionHeaders()

void ObjectFileWasm::DumpSectionHeaders ( llvm::raw_ostream &  ostream)
private

Definition at line 465 of file ObjectFileWasm.cpp.

References DumpSectionHeader(), and m_sect_infos.

Referenced by Dump().

◆ GetAddressByteSize()

uint32_t lldb_private::wasm::ObjectFileWasm::GetAddressByteSize ( ) const
inlineoverridevirtual

Gets the address size in bytes for the current object file.

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.

Implements lldb_private::ObjectFile.

Definition at line 73 of file ObjectFileWasm.h.

References lldb_private::ArchSpec::GetAddressByteSize(), and m_arch.

Referenced by ReadImageData().

◆ GetAddressClass()

AddressClass lldb_private::wasm::ObjectFileWasm::GetAddressClass ( lldb::addr_t  file_addr)
inlineoverridevirtual

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 from lldb_private::ObjectFile.

Definition at line 77 of file ObjectFileWasm.h.

References lldb_private::eInvalid.

◆ GetArchitecture()

ArchSpec lldb_private::wasm::ObjectFileWasm::GetArchitecture ( )
inlineoverridevirtual

Get the ArchSpec for this object file.

Returns
The ArchSpec of this object file. In case of error, an invalid ArchSpec object is returned.

Implements lldb_private::ObjectFile.

Definition at line 89 of file ObjectFileWasm.h.

References m_arch.

Referenced by Dump().

◆ GetBaseAddress()

lldb_private::Address lldb_private::wasm::ObjectFileWasm::GetBaseAddress ( )
inlineoverridevirtual

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 102 of file ObjectFileWasm.h.

References lldb_private::ObjectFile::IsInMemory(), and lldb_private::ObjectFile::m_memory_addr.

◆ GetByteOrder()

lldb::ByteOrder lldb_private::wasm::ObjectFileWasm::GetByteOrder ( ) const
inlineoverridevirtual

Gets whether endian swapping should occur when extracting data from this object file.

Returns
Returns true if endian swapping is needed, false otherwise.

Implements lldb_private::ObjectFile.

Definition at line 67 of file ObjectFileWasm.h.

References lldb_private::ArchSpec::GetByteOrder(), and m_arch.

Referenced by ReadImageData().

◆ GetDependentModules()

uint32_t lldb_private::wasm::ObjectFileWasm::GetDependentModules ( FileSpecList &  file_list)
inlineoverridevirtual

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 &)

Implements lldb_private::ObjectFile.

Definition at line 93 of file ObjectFileWasm.h.

◆ GetExternalDebugInfoFileSpec()

llvm::Optional< FileSpec > ObjectFileWasm::GetExternalDebugInfoFileSpec ( )

A Wasm module that has external DWARF debug information should contain a custom section named "external_debug_info", whose payload is an UTF-8 encoded string that points to a Wasm module that contains the debug information for this module.

Definition at line 414 of file ObjectFileWasm.cpp.

References lldb_private::DataExtractor::GetAsLLVM(), GetWasmString(), m_sect_infos, and ReadImageData().

Referenced by lldb_private::wasm::SymbolVendorWasm::CreateInstance(), and IsStripped().

◆ GetModuleSpecifications()

size_t ObjectFileWasm::GetModuleSpecifications ( const FileSpec file,
lldb::DataBufferSP &  data_sp,
lldb::offset_t  data_offset,
lldb::offset_t  file_offset,
lldb::offset_t  length,
ModuleSpecList specs 
)
static

◆ GetPluginDescriptionStatic()

static const char* lldb_private::wasm::ObjectFileWasm::GetPluginDescriptionStatic ( )
inlinestatic

Definition at line 28 of file ObjectFileWasm.h.

◆ GetPluginName()

llvm::StringRef lldb_private::wasm::ObjectFileWasm::GetPluginName ( )
inlineoverridevirtual

PluginInterface protocol.

Implements lldb_private::PluginInterface.

Definition at line 51 of file ObjectFileWasm.h.

References GetPluginNameStatic().

◆ GetPluginNameStatic()

static llvm::StringRef lldb_private::wasm::ObjectFileWasm::GetPluginNameStatic ( )
inlinestatic

Definition at line 27 of file ObjectFileWasm.h.

Referenced by GetPluginName().

◆ GetSymtab()

Symtab * ObjectFileWasm::GetSymtab ( )
overridevirtual

Gets the symbol table for the currently selected architecture (and object for archives).

Symbol table parsing can be deferred by ObjectFile instances until this accessor is called the first time.

Returns
The symbol table for this object file.

Implements lldb_private::ObjectFile.

Definition at line 249 of file ObjectFileWasm.cpp.

◆ GetUUID()

UUID lldb_private::wasm::ObjectFileWasm::GetUUID ( )
inlineoverridevirtual

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.

Implements lldb_private::ObjectFile.

Definition at line 91 of file ObjectFileWasm.h.

References m_uuid.

Referenced by lldb_private::wasm::SymbolVendorWasm::CreateInstance().

◆ Initialize()

void ObjectFileWasm::Initialize ( )
static

Definition at line 79 of file ObjectFileWasm.cpp.

◆ isA()

bool lldb_private::wasm::ObjectFileWasm::isA ( const void *  ClassID) const
inlineoverridevirtual

Reimplemented from lldb_private::ObjectFile.

Definition at line 57 of file ObjectFileWasm.h.

References ID, and lldb_private::ObjectFile::isA().

◆ IsExecutable()

bool lldb_private::wasm::ObjectFileWasm::IsExecutable ( ) const
inlineoverridevirtual

Tells whether this object file is capable of being the main executable for a process.

Returns
true if it is, false otherwise.

Implements lldb_private::ObjectFile.

Definition at line 71 of file ObjectFileWasm.h.

◆ IsStripped()

bool lldb_private::wasm::ObjectFileWasm::IsStripped ( )
inlineoverridevirtual

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.

Implements lldb_private::ObjectFile.

Definition at line 83 of file ObjectFileWasm.h.

References GetExternalDebugInfoFileSpec().

◆ ParseHeader()

bool ObjectFileWasm::ParseHeader ( )
overridevirtual

ObjectFile Protocol.

Implements lldb_private::ObjectFile.

Definition at line 244 of file ObjectFileWasm.cpp.

◆ ReadImageData()

DataExtractor ObjectFileWasm::ReadImageData ( lldb::offset_t  offset,
uint32_t  size 
)
private

◆ SetLoadAddress()

bool ObjectFileWasm::SetLoadAddress ( lldb_private::Target target,
lldb::addr_t  value,
bool  value_is_offset 
)
overridevirtual

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.

In WebAssembly, linear memory is disjointed from code space. The VM can load multiple instances of a module, which logically share the same code. We represent a wasm32 code address with 64-bits, like: 63 32 31 0 +------------—+------------—+

  • module_id | offset | +------------—+------------—+ where the lower 32 bits represent a module offset (relative to the module start not to the beginning of the code section) and the higher 32 bits uniquely identify the module in the WebAssembly VM. In other words, we assume that each WebAssembly module is loaded by the engine at a 64-bit address that starts at the boundary of 4GB pages, like 0x0000000400000000 for module_id == 4. These 64-bit addresses will be used to request code ranges for a specific module from the WebAssembly engine.

Reimplemented from lldb_private::ObjectFile.

Definition at line 344 of file ObjectFileWasm.cpp.

References DecodeSections(), lldb_private::ModuleChild::GetModule(), lldb_private::SectionList::GetSectionAtIndex(), lldb_private::ObjectFile::GetSectionList(), lldb_private::SectionList::GetSize(), LLDB_INVALID_ADDRESS, lldb_private::ObjectFile::m_memory_addr, and lldb_private::Target::SetSectionLoadAddress().

◆ Terminate()

void ObjectFileWasm::Terminate ( )
static

Definition at line 85 of file ObjectFileWasm.cpp.

Member Data Documentation

◆ ID

char ObjectFileWasm::ID
static

LLVM RTTI support.

Definition at line 56 of file ObjectFileWasm.h.

Referenced by classof(), and isA().

◆ m_arch

ArchSpec lldb_private::wasm::ObjectFileWasm::m_arch
private

Definition at line 144 of file ObjectFileWasm.h.

Referenced by GetAddressByteSize(), GetArchitecture(), and GetByteOrder().

◆ m_sect_infos

std::vector<section_info_t> lldb_private::wasm::ObjectFileWasm::m_sect_infos
private

◆ m_uuid

UUID lldb_private::wasm::ObjectFileWasm::m_uuid
private

Definition at line 145 of file ObjectFileWasm.h.

Referenced by GetUUID().


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