Crashpad
Public Member Functions | Friends | List of all members
crashpad::ProcessMemory Class Referenceabstract

Abstract base class for accessing the memory of another process. More...

#include "util/process/process_memory.h"

Inheritance diagram for crashpad::ProcessMemory:
crashpad::ProcessMemoryFuchsia crashpad::ProcessMemoryLinux crashpad::ProcessMemoryMac crashpad::ProcessMemorySanitized crashpad::ProcessMemoryWin FakeProcessMemory

Public Member Functions

bool Read (VMAddress address, VMSize size, void *buffer) const
 Copies memory from the target process into a caller-provided buffer in the current process. More...
 
bool ReadCString (VMAddress 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 (VMAddress address, VMSize size, std::string *string) const
 Reads a NUL-terminated C string from the target process into a string in the current process. More...
 

Friends

class ProcessMemorySanitized
 

Detailed Description

Abstract base class for accessing the memory of another process.

Implementations are platform-specific.

Member Function Documentation

◆ Read()

bool crashpad::ProcessMemory::Read ( VMAddress  address,
VMSize  size,
void *  buffer 
) const

Copies memory from the target process into a caller-provided buffer in the current process.

Parameters
[in]addressThe address, in the target process' address space, of the memory region to copy.
[in]sizeThe size, in bytes, of the memory region to copy. buffer must be at least this size.
[out]bufferThe buffer into which the contents of the other process' memory will be copied.
Returns
true on success, with buffer filled appropriately. false on failure, with a message logged.

◆ ReadCString()

bool crashpad::ProcessMemory::ReadCString ( VMAddress  address,
std::string *  string 
) const
inline

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.

Parameters
[in]addressThe address, in the target process’s address space, of the string to copy.
[out]stringThe string read from the other process.
Returns
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.

◆ ReadCStringSizeLimited()

bool crashpad::ProcessMemory::ReadCStringSizeLimited ( VMAddress  address,
VMSize  size,
std::string *  string 
) const
inline

Reads a NUL-terminated C string from the target process into a string in the current process.

Parameters
[in]addressThe address, in the target process’s address space, of the string to copy.
[in]sizeThe maximum number of bytes to read. The string is required to be NUL-terminated within this many bytes.
[out]stringThe string read from the other process.
Returns
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.

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