Crashpad
Classes | Public Member Functions | List of all members
crashpad::ElfImageReader Class Reference

A reader for ELF images mapped into another process. More...

#include "snapshot/linux/elf_image_reader.h"

Classes

class  ProgramHeaderTable
 
class  ProgramHeaderTableSpecific
 

Public Member Functions

bool Initialize (const ProcessMemoryRange &memory, LinuxVMAddress address)
 Initializes the reader. More...
 
LinuxVMAddress Address () const
 Returns the base address of the image's memory range. More...
 
LinuxVMSize Size () const
 Returns the size of the range containing all loaded segments for this image. More...
 
uint16_t FileType () const
 Returns the file type for the image. More...
 
LinuxVMOffset GetLoadBias () const
 Returns the load bias for the image. More...
 
bool GetDynamicSymbol (const std::string &name, LinuxVMAddress *address, LinuxVMSize *size)
 Reads information from the dynamic symbol table about the symbol identified by name. More...
 
bool ReadDynamicStringTableAtOffset (LinuxVMSize offset, std::string *string)
 Reads a NUL-terminated C string from this image's dynamic string table. More...
 
bool GetDebugAddress (LinuxVMAddress *debug)
 Determine the debug address. More...
 

Detailed Description

A reader for ELF images mapped into another process.

This class is capable of reading both 32-bit and 64-bit images.

Member Function Documentation

◆ Address()

LinuxVMAddress crashpad::ElfImageReader::Address ( ) const
inline

Returns the base address of the image's memory range.

This may differ from the address passed to Initialize() if the ELF header is not loaded at the start of the first PT_LOAD segment.

◆ FileType()

uint16_t crashpad::ElfImageReader::FileType ( ) const

Returns the file type for the image.

Possible values include ET_EXEC or ET_DYN from <elf.h>.

◆ GetDebugAddress()

bool crashpad::ElfImageReader::GetDebugAddress ( LinuxVMAddress debug)

Determine the debug address.

The debug address is a pointer to an r_debug struct defined in <link.h>.

Parameters
[out]debugthe debug address, if found.
Returns
true if the debug address was found.

◆ GetDynamicSymbol()

bool crashpad::ElfImageReader::GetDynamicSymbol ( const std::string &  name,
LinuxVMAddress address,
LinuxVMSize size 
)

Reads information from the dynamic symbol table about the symbol identified by name.

Parameters
[in]nameThe name of the symbol to search for.
[out]addressThe address of the symbol in the target process' address space, if found.
[out]sizeThe size of the symbol, if found.
Returns
true if the symbol was found.

◆ GetLoadBias()

LinuxVMOffset crashpad::ElfImageReader::GetLoadBias ( ) const
inline

Returns the load bias for the image.

The load bias is the actual load address minus the preferred load address.

◆ Initialize()

bool crashpad::ElfImageReader::Initialize ( const ProcessMemoryRange memory,
LinuxVMAddress  address 
)

Initializes the reader.

This method must be called once on an object and must be successfully called before any other method in this class may be called.

Parameters
[in]memoryA memory reader for the remote process.
[in]addressThe address in the remote process' address space where the ELF image is loaded.

◆ ReadDynamicStringTableAtOffset()

bool crashpad::ElfImageReader::ReadDynamicStringTableAtOffset ( LinuxVMSize  offset,
std::string *  string 
)

Reads a NUL-terminated C string from this image's dynamic string table.

Parameters
[in]offsetthe byte offset in the string table to start reading.
[out]stringthe string read.
Returns
true on success. Otherwise false with a message logged.

◆ Size()

LinuxVMSize crashpad::ElfImageReader::Size ( ) const
inline

Returns the size of the range containing all loaded segments for this image.

The size may include memory that is unmapped or mapped to other objects if this image's PT_LOAD segments are not contiguous.


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