Crashpad
 
Loading...
Searching...
No Matches
crashpad::internal::ScopedVMMap< T > Class Template Reference

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
 
ScopedVMMapoperator= (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.
 

Detailed Description

template<typename T>
class crashpad::internal::ScopedVMMap< T >

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.

Member Function Documentation

◆ Map() [1/2]

template<typename T>
bool crashpad::internal::ScopedVMMap< T >::Map ( const void * data,
size_t count = 1 )
inline

Releases any previously mapped data and vm_remaps data.

Parameters
[in]dataMemory to be mapped by vm_remap.
[in]countLength of data.
Returns
true if all data was mapped. Returns false on failure.

◆ Map() [2/2]

template<typename T>
bool crashpad::internal::ScopedVMMap< T >::Map ( vm_address_t address,
size_t count = 1 )
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.

Parameters
[in]addressAddress of memory to be mapped by vm_remap.
[in]countLength of data.
Returns
true if all of address was mapped. Returns false on failure.

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