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

Accesses the memory of another Mach task. More...

#include "util/process/process_memory_mac.h"

Inheritance diagram for crashpad::ProcessMemoryMac:
crashpad::ProcessMemory

Classes

class  MappedMemory
 A memory region mapped from another Mach task. More...
 

Public Member Functions

bool Initialize (task_t task)
 Initializes this object to read the memory of a task with the provided task port. More...
 
std::unique_ptr< MappedMemoryReadMapped (mach_vm_address_t address, size_t size) const
 Maps memory from the target task into the current task. More...
 
- Public Member Functions inherited from crashpad::ProcessMemory
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...
 

Detailed Description

Accesses the memory of another Mach task.

Member Function Documentation

◆ Initialize()

bool crashpad::ProcessMemoryMac::Initialize ( task_t  task)

Initializes this object to read the memory of a task with the provided task port.

This method must be called successfully prior to calling any other method in this class.

Parameters
[in]taskA send right to the target task's task port. This object does not take ownership of the send right.
Returns
true on success, false on failure with a message logged.

◆ ReadMapped()

std::unique_ptr< ProcessMemoryMac::MappedMemory > crashpad::ProcessMemoryMac::ReadMapped ( mach_vm_address_t  address,
size_t  size 
) const

Maps memory from the target task into the current task.

This interface is an alternative to Read() that does not require the caller to provide a buffer to fill. This avoids copying memory, which can offer a performance improvement.

Parameters
[in]addressThe address, in the target task’s address space, of the memory region to map.
[in]sizeThe size, in bytes, of the memory region to map.
Returns
On success, a MappedMemory object that provides access to the data requested. On faliure, nullptr, with a warning logged. Failures can occur, for example, when encountering unmapped or unreadable pages.

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