Crashpad
|
Provides range protected access to the memory of another process. More...
#include "util/linux/process_memory_range.h"
Public Member Functions | |
bool | Initialize (const ProcessMemory *memory, bool is_64_bit, LinuxVMAddress base, LinuxVMSize size) |
Initializes this object. More... | |
bool | Initialize (const ProcessMemory *memory, bool is_64_bit) |
Initializes this object with the maximum range for the address space. More... | |
bool | Initialize (const ProcessMemoryRange &other) |
Initializes this object from an existing memory range. More... | |
bool | Is64Bit () const |
Returns whether the range is part of a 64-bit address space. | |
LinuxVMAddress | Base () const |
Returns the base address of the range. | |
LinuxVMSize | Size () const |
Returns the size of the range. | |
bool | RestrictRange (LinuxVMAddress base, LinuxVMSize size) |
Shrinks the range to the new base and size. More... | |
bool | Read (LinuxVMAddress address, size_t size, void *buffer) const |
Copies memory from the target process into a caller-provided buffer in the current process. More... | |
bool | ReadCStringSizeLimited (LinuxVMAddress address, size_t size, std::string *string) const |
Reads a NUL -terminated C string from the target process into a string in the current process. More... | |
Provides range protected access to the memory of another process.
bool crashpad::ProcessMemoryRange::Initialize | ( | const ProcessMemory * | memory, |
bool | is_64_bit, | ||
LinuxVMAddress | base, | ||
LinuxVMSize | size | ||
) |
Initializes this object.
One of the Initialize methods must be successfully called on this object before calling any other.
[in] | memory | The memory reader to delegate to. |
[in] | is_64_bit | Whether the target process is 64-bit. |
[in] | base | The base address of the initial range. |
[in] | size | The size of the initial range. |
true
on success. false
on failure with a message logged. bool crashpad::ProcessMemoryRange::Initialize | ( | const ProcessMemory * | memory, |
bool | is_64_bit | ||
) |
Initializes this object with the maximum range for the address space.
One of the Initialize methods must be successfully called on this object before calling any other.
[in] | memory | The memory reader to delegate to. |
[in] | is_64_bit | Whether the target process is 64-bit. |
bool crashpad::ProcessMemoryRange::Initialize | ( | const ProcessMemoryRange & | other | ) |
Initializes this object from an existing memory range.
One of the Initialize methods must be successfully called on this object before calling any other.
[in] | other | The memory range object to initialize from. |
true
on success. false
on failure with a message logged. bool crashpad::ProcessMemoryRange::Read | ( | LinuxVMAddress | address, |
size_t | size, | ||
void * | buffer | ||
) | const |
Copies memory from the target process into a caller-provided buffer in the current process.
[in] | address | The address, in the target process' address space, of the memory region to copy. |
[in] | size | The size, in bytes, of the memory region to copy. buffer must be at least this size. |
[out] | buffer | The buffer into which the contents of the other process' memory will be copied. |
true
on success, with buffer filled appropriately. false
on failure, with a message logged. bool crashpad::ProcessMemoryRange::ReadCStringSizeLimited | ( | LinuxVMAddress | address, |
size_t | size, | ||
std::string * | string | ||
) | const |
Reads a NUL
-terminated C string from the target process into a string in the current process.
[in] | address | The address, in the target process’s address space, of the string to copy. |
[in] | size | The maximum number of bytes to read. The string is required to be NUL -terminated within this many bytes. |
[out] | string | The string read from the other process. |
true
on success, with string set appropriately. false
on failure, with a message logged. Failures can occur, for example, when a NUL
terminator is not found within size bytes, or when encountering unmapped or unreadable pages. bool crashpad::ProcessMemoryRange::RestrictRange | ( | LinuxVMAddress | base, |
LinuxVMSize | size | ||
) |
Shrinks the range to the new base and size.
The new range must be contained within the existing range for this object.
[in] | base | The new base of the range. |
[in] | size | The new size of the range. |
true
on success. false
on failure with a message logged.