class ElfImageReader

Defined at line 37 of file ../../third_party/crashpad/src/snapshot/elf/elf_image_reader.h

A reader for ELF images mapped into another process.

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

Public Methods

void ElfImageReader ()
void ElfImageReader (const ElfImageReader & )

Defined at line 120 of file ../../third_party/crashpad/src/snapshot/elf/elf_image_reader.h

ElfImageReader & operator= (const ElfImageReader & )

Defined at line 121 of file ../../third_party/crashpad/src/snapshot/elf/elf_image_reader.h

VMAddress Address ()

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.

Defined at line 145 of file ../../third_party/crashpad/src/snapshot/elf/elf_image_reader.h

void ~ElfImageReader ()
bool Initialize (const ProcessMemoryRange & memory, VMAddress address, bool verbose)

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

memory [in] A memory reader for the remote process.
address [in] The address in the remote process' address space where the ELF image is loaded.
verbose [in] `true` if this method should log error messages during initialization. Setting this value to `false` will reduce the error messages relating to verifying the ELF image, but may not suppress logging entirely.
uint16_t FileType ()

Returns the file type for the image.

Possible values include `ET_EXEC` or `ET_DYN` from `

<elf

.h>`.

VMSize Size ()

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.

Defined at line 152 of file ../../third_party/crashpad/src/snapshot/elf/elf_image_reader.h

VMOffset GetLoadBias ()

Returns the load bias for the image.

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

Defined at line 162 of file ../../third_party/crashpad/src/snapshot/elf/elf_image_reader.h

bool SoName (std::string * name)

Determines the name of this object using `DT_SONAME`, if present.

Parameters

name [out] The name of this object, only valid if this method returns `true`.

Returns

`true` if a name was found for this object.

bool GetDynamicSymbol (const std::string & name, VMAddress * address, VMSize * size)

Reads information from the dynamic symbol table about the symbol

identified by

Parameters

name [in] The name of the symbol to search for.
address [out] The address of the symbol in the target process' address space, if found.
size [out] The size of the symbol, if found.

Returns

`true` if the symbol was found.

bool ReadDynamicStringTableAtOffset (VMSize offset, std::string * string)

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

table.

Parameters

offset [in] the byte offset in the string table to start reading.
string [out] the string read.

Returns

`true` on success. Otherwise `false` with a message logged.

bool GetDebugAddress (VMAddress * debug)

Determine the debug address.

The debug address is a pointer to an `r_debug` struct defined in

`

<link

.h>`.

Parameters

debug [out] the debug address, if found.

Returns

`true` if the debug address was found.

bool GetDynamicArrayAddress (VMAddress * address)

Determine the address of `PT_DYNAMIC` segment.

Parameters

address [out] The address of the array, valid if this method returns `true`.

Returns

`true` on success. Otherwise `false` with a message logged.

VMAddress GetProgramHeaderTableAddress ()

Return the address of the program header table.

std::unique_ptr<NoteReader> Notes (size_t max_note_size)

Return a NoteReader for this image, which scans all PT_NOTE

segments in the image.

The returned NoteReader is only valid for the lifetime of the

ElfImageReader that created it.

Parameters

max_note_size [in] The maximum note size to read. Notes whose combined name, descriptor, and padding size are greater than will be silently skipped.

Returns

A NoteReader object capable of reading notes in this image.

std::unique_ptr<NoteReader> NotesWithNameAndType (const std::string & name, NoteReader::NoteType type, size_t max_note_size)

Return a NoteReader for this image, which scans all PT_NOTE

segments in the image, filtering by name and type.

The returned NoteReader is only valid for the lifetime of the

ElfImageReader that created it.

Parameters

name [in] The note name to match.
type [in] The note type to match.
max_note_size [in] The maximum note size to read. Notes whose combined name, descriptor, and padding size are greater than will be silently skipped.

Returns

A NoteReader object capable of reading notes in this image.

const ProcessMemoryRange * Memory ()

Return a ProcessMemoryRange restricted to the range of this image.

The caller does not take ownership of the returned object.

bool GetNumberOfSymbolEntriesFromDtHash (VMSize * number_of_symbol_table_entries)

Retrieves the number of symbol table entries in `DT_SYMTAB`

according to the data in the `DT_HASH` section.

Parameters

number_of_symbol_table_entries [out] The number of entries expected in `DT_SYMTAB`.

Returns

`true` if a `DT_HASH` section was found, and was read

successfully, otherwise `false` with an error logged.

bool GetNumberOfSymbolEntriesFromDtGnuHash (VMSize * number_of_symbol_table_entries)

Retrieves the number of symbol table entries in `DT_SYMTAB`

according to the data in the `DT_GNU_HASH` section.

Parameters

number_of_symbol_table_entries [out] The number of entries expected in `DT_SYMTAB`.

Returns

`true` if a `DT_GNU_HASH` section was found, and was read

successfully, otherwise `false` with an error logged.

Records