Crashpad
|
Accesses the memory of another process. More...
#include "util/linux/process_memory.h"
Public Member Functions | |
bool | Initialize (pid_t pid) |
Initializes this object to read the memory of a process whose ID is pid. 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 | ReadCString (LinuxVMAddress address, std::string *string) const |
Reads a NUL -terminated C string from the target process into a string 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... | |
Accesses the memory of another process.
bool crashpad::ProcessMemory::Initialize | ( | pid_t | pid | ) |
Initializes this object to read the memory of a process whose ID is pid.
This method must be called successfully prior to calling any other method in this class.
[in] | pid | The process ID of a target process. |
true
on success, false
on failure with a message logged. bool crashpad::ProcessMemory::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::ProcessMemory::ReadCString | ( | LinuxVMAddress | address, |
std::string * | string | ||
) | const |
Reads a NUL
-terminated C string from the target process into a string in the current process.
The length of the string need not be known ahead of time. This method will read contiguous memory until a NUL
terminator is found.
[in] | address | The address, in the target process’s address space, of the string to copy. |
[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 encountering unmapped or unreadable pages. bool crashpad::ProcessMemory::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.