Crashpad
Public Member Functions | Friends | List of all members
crashpad::internal::MemorySnapshotGeneric< ProcessReaderType > Class Template Referencefinal

A MemorySnapshot of a memory region in a process on the running system. Used on Mac, Linux, Android, and Fuchsia, templated on the platform-specific ProcessReader type. More...

#include "snapshot/memory_snapshot_generic.h"

Inheritance diagram for crashpad::internal::MemorySnapshotGeneric< ProcessReaderType >:
crashpad::MemorySnapshot

Public Member Functions

void Initialize (ProcessReaderType *process_reader, VMAddress address, VMSize size)
 Initializes the object. More...
 
uint64_t Address () const override
 The base address of the memory snapshot in the snapshot process’ address space.
 
size_t Size () const override
 The size of the memory snapshot.
 
bool Read (Delegate *delegate) const override
 Calls Delegate::MemorySnapshotDelegateRead(), providing it with the memory snapshot’s data. More...
 
const MemorySnapshotMergeWithOtherSnapshot (const MemorySnapshot *other) const override
 Creates a new MemorySnapshot based on merging this one with other. More...
 

Friends

template<class T >
const MemorySnapshotMergeWithOtherSnapshotImpl (const T *self, const MemorySnapshot *other)
 A standard implementation of MemorySnapshot::MergeWithOtherSnapshot() for concrete MemorySnapshot implementations that use a process_reader_.
 

Detailed Description

template<class ProcessReaderType>
class crashpad::internal::MemorySnapshotGeneric< ProcessReaderType >

A MemorySnapshot of a memory region in a process on the running system. Used on Mac, Linux, Android, and Fuchsia, templated on the platform-specific ProcessReader type.

Member Function Documentation

◆ Initialize()

template<class ProcessReaderType>
void crashpad::internal::MemorySnapshotGeneric< ProcessReaderType >::Initialize ( ProcessReaderType *  process_reader,
VMAddress  address,
VMSize  size 
)
inline

Initializes the object.

Memory is read lazily. No attempt is made to read the memory snapshot data until Read() is called, and the memory snapshot data is discared when Read() returns.

Parameters
[in]process_readerA reader for the process being snapshotted.
[in]addressThe base address of the memory region to snapshot, in the snapshot process’ address space.
[in]sizeThe size of the memory region to snapshot.

◆ MergeWithOtherSnapshot()

template<class ProcessReaderType>
const MemorySnapshot* crashpad::internal::MemorySnapshotGeneric< ProcessReaderType >::MergeWithOtherSnapshot ( const MemorySnapshot other) const
inlineoverridevirtual

Creates a new MemorySnapshot based on merging this one with other.

The ranges described by the two snapshots must either overlap or abut, and must be of the same concrete type.

Returns
A newly allocated MemorySnapshot representing the merged range, or nullptr with an error logged.

Implements crashpad::MemorySnapshot.

◆ Read()

template<class ProcessReaderType>
bool crashpad::internal::MemorySnapshotGeneric< ProcessReaderType >::Read ( Delegate delegate) const
inlineoverridevirtual

Calls Delegate::MemorySnapshotDelegateRead(), providing it with the memory snapshot’s data.

Implementations do not necessarily read the memory snapshot data prior to this method being called. Memory snapshot data may be loaded lazily and may be discarded after being passed to the delegate. This provides clean memory management without burdening a snapshot implementation with the requirement that it track all memory region data simultaneously.

Returns
false on failure, otherwise, the return value of Delegate::MemorySnapshotDelegateRead(), which should be true on success and false on failure.

Implements crashpad::MemorySnapshot.


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