A scoped wrapper for calls to vm_remap
and vm_deallocate
. Allows in-process handler to safely read and write memory (modulo its protection level) for the intermediate dump.
More...
#include "util/ios/scoped_vm_map.h"
Public Member Functions | |
ScopedVMMap (const ScopedVMMap &)=delete | |
ScopedVMMap & | operator= (const ScopedVMMap &)=delete |
bool | Map (const void *data, size_t count=1) |
Releases any previously mapped data and vm_remaps data. | |
bool | Map (vm_address_t address, size_t count=1) |
Releases any previously mapped data and vm_remaps address. | |
T * | operator-> () const |
Returns the pointer to memory safe to read and write (respecting the CurrentProtection() level) during the in-process crash handler. | |
T * | get () const |
Returns the pointer to memory safe to read and write (respecting the CurrentProtection() level) during the in-process crash handler. | |
vm_prot_t | CurrentProtection () const |
Returns the current protection level of the mapped memory. | |
A scoped wrapper for calls to vm_remap
and vm_deallocate
. Allows in-process handler to safely read and write memory (modulo its protection level) for the intermediate dump.
Note: RUNS-DURING-CRASH.
|
inline |
Releases any previously mapped data and vm_remaps data.
[in] | data | Memory to be mapped by vm_remap. |
[in] | count | Length of data. |
true
if all data was mapped. Returns false on failure.
|
inline |
Releases any previously mapped data and vm_remaps address.
Before reading or writing the memory, check CurrentProtection()
to ensure the data is readable or writable.
[in] | address | Address of memory to be mapped by vm_remap. |
[in] | count | Length of data. |
true
if all of address was mapped. Returns false on failure.