Accesses the memory of another Mach task.
More...
#include "util/mach/task_memory.h"
|
| TaskMemory (task_t task) |
|
bool | Read (mach_vm_address_t address, size_t size, void *buffer) |
| Copies memory from the target task into a caller-provided buffer in the current task. More...
|
|
std::unique_ptr< MappedMemory > | ReadMapped (mach_vm_address_t address, size_t size) |
| Maps memory from the target task into the current task. More...
|
|
bool | ReadCString (mach_vm_address_t address, std::string *string) |
| Reads a NUL -terminated C string from the target task into a string in the current task. More...
|
|
bool | ReadCStringSizeLimited (mach_vm_address_t address, mach_vm_size_t size, std::string *string) |
| Reads a NUL -terminated C string from the target task into a string in the current task. More...
|
|
Accesses the memory of another Mach task.
§ TaskMemory()
crashpad::TaskMemory::TaskMemory |
( |
task_t |
task | ) |
|
|
explicit |
- Parameters
-
[in] | task | A send right to the target task’s task port. This object does not take ownership of the send right. |
§ Read()
bool crashpad::TaskMemory::Read |
( |
mach_vm_address_t |
address, |
|
|
size_t |
size, |
|
|
void * |
buffer |
|
) |
| |
Copies memory from the target task into a caller-provided buffer in the current task.
- Parameters
-
[in] | address | The address, in the target task’s 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 task’s memory will be copied. |
- Returns
true
on success, with buffer filled appropriately. false
on failure, with a warning logged. Failures can occur, for example, when encountering unmapped or unreadable pages.
- See also
- ReadMapped()
§ ReadCString()
bool crashpad::TaskMemory::ReadCString |
( |
mach_vm_address_t |
address, |
|
|
std::string * |
string |
|
) |
| |
Reads a NUL
-terminated C string from the target task into a string in the current task.
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] | address | The address, in the target task’s address space, of the string to copy. |
[out] | string | The string read from the other task. |
- Returns
true
on success, with string set appropriately. false
on failure, with a warning logged. Failures can occur, for example, when encountering unmapped or unreadable pages.
- See also
- MappedMemory::ReadCString()
§ ReadCStringSizeLimited()
bool crashpad::TaskMemory::ReadCStringSizeLimited |
( |
mach_vm_address_t |
address, |
|
|
mach_vm_size_t |
size, |
|
|
std::string * |
string |
|
) |
| |
Reads a NUL
-terminated C string from the target task into a string in the current task.
- Parameters
-
[in] | address | The address, in the target task’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 task. |
- Returns
true
on success, with string set appropriately. false
on failure, with a warning logged. Failures can occur, for example, when a NUL
terminator is not found within size bytes, or when encountering unmapped or unreadable pages.
- See also
- MappedMemory::ReadCString()
§ ReadMapped()
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] | address | The address, in the target task’s address space, of the memory region to map. |
[in] | size | The 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:
- util/mach/task_memory.h
- util/mach/task_memory.cc