Crashpad
Public Member Functions | Friends | List of all members
crashpad::TaskMemory::MappedMemory Class Reference

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

#include "util/mach/task_memory.h"

Public Member Functions

const void * data () const
 Returns a pointer to the data requested by the user. More...
 
bool ReadCString (size_t offset, std::string *string) const
 Reads a NUL-terminated C string from the mapped region. More...
 

Friends

class TaskMemory
 

Detailed Description

A memory region mapped from another Mach task.

The mapping is maintained until this object is destroyed.

Member Function Documentation

◆ data()

const void* crashpad::TaskMemory::MappedMemory::data ( ) const
inline

Returns a pointer to the data requested by the user.

This is the value of the vm_address + user_offset parameters passed to the constructor, casted to const void*.

◆ ReadCString()

bool crashpad::TaskMemory::MappedMemory::ReadCString ( size_t  offset,
std::string *  string 
) const

Reads a NUL-terminated C string from the mapped region.

This method will read contiguous memory until a NUL terminator is found.

Parameters
[in]offsetThe offset into data() of the string to be read.
[out]stringThe string, whose contents begin at data() and continue up to a NUL terminator.
Returns
true on success, with string set appropriately. If offset is greater than or equal to the user_size constructor parameter, or if no NUL terminator was found in data() after offset, returns false with an appropriate warning logged.

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