Crashpad
Public Member Functions | List of all members
crashpad::test::TestProcessSnapshot Class Referencefinal

A test ProcessSnapshot that can carry arbitrary data for testing purposes. More...

#include "snapshot/test/test_process_snapshot.h"

Inheritance diagram for crashpad::test::TestProcessSnapshot:
crashpad::ProcessSnapshot

Public Member Functions

void SetProcessID (crashpad::ProcessID process_id)
 
void SetParentProcessID (crashpad::ProcessID parent_process_id)
 
void SetSnapshotTime (const timeval &snapshot_time)
 
void SetProcessStartTime (const timeval &start_time)
 
void SetProcessCPUTimes (const timeval &user_time, const timeval &system_time)
 
void SetReportID (const UUID &report_id)
 
void SetClientID (const UUID &client_id)
 
void SetAnnotationsSimpleMap (const std::map< std::string, std::string > &annotations_simple_map)
 
void SetSystem (std::unique_ptr< SystemSnapshot > system)
 Sets the system snapshot to be returned by System(). More...
 
void AddThread (std::unique_ptr< ThreadSnapshot > thread)
 Adds a thread snapshot to be returned by Threads(). More...
 
void AddModule (std::unique_ptr< ModuleSnapshot > module)
 Adds a module snapshot to be returned by Modules(). More...
 
void AddModule (const UnloadedModuleSnapshot &unloaded_module)
 Adds an unloaded module snapshot to be returned by UnloadedModules(). More...
 
void SetException (std::unique_ptr< ExceptionSnapshot > exception)
 Sets the exception snapshot to be returned by Exception(). More...
 
void AddMemoryMapRegion (std::unique_ptr< MemoryMapRegionSnapshot > region)
 Adds a memory map region snapshot to be returned by MemoryMap(). More...
 
void AddHandle (const HandleSnapshot &handle)
 Adds a handle snapshot to be returned by Handles(). More...
 
void AddExtraMemory (std::unique_ptr< MemorySnapshot > extra_memory)
 Add a memory snapshot to be returned by ExtraMemory(). More...
 
void SetProcessMemory (std::unique_ptr< ProcessMemory > process_memory)
 Add a process memory object to be returned by Memory(). More...
 
crashpad::ProcessID ProcessID () const override
 Returns the snapshot process’ process ID.
 
crashpad::ProcessID ParentProcessID () const override
 Returns the snapshot process’ parent process’ process ID.
 
void SnapshotTime (timeval *snapshot_time) const override
 Returns the time that the snapshot was taken in snapshot_time. More...
 
void ProcessStartTime (timeval *start_time) const override
 Returns the time that the snapshot process was started in start_time. More...
 
void ProcessCPUTimes (timeval *user_time, timeval *system_time) const override
 Returns the snapshot process’ CPU usage times in user_time and system_time. More...
 
void ReportID (UUID *report_id) const override
 Returns a UUID identifying the event that the snapshot describes. More...
 
void ClientID (UUID *client_id) const override
 Returns a UUID identifying the client that the snapshot represents. More...
 
const std::map< std::string, std::string > & AnnotationsSimpleMap () const override
 Returns key-value string annotations recorded for the process, system, or snapshot producer. More...
 
const SystemSnapshotSystem () const override
 Returns a SystemSnapshot reflecting the characteristics of the system that ran the snapshot process at the time of the snapshot. More...
 
std::vector< const ThreadSnapshot * > Threads () const override
 Returns ThreadSnapshot objects reflecting the threads (lightweight processes) existing in the snapshot process at the time of the snapshot. More...
 
std::vector< const ModuleSnapshot * > Modules () const override
 Returns ModuleSnapshot objects reflecting the code modules (binary images) loaded into the snapshot process at the time of the snapshot. More...
 
std::vector< UnloadedModuleSnapshotUnloadedModules () const override
 Returns UnloadedModuleSnapshot objects reflecting the code modules the were recorded as unloaded at the time of the snapshot. More...
 
const ExceptionSnapshotException () const override
 Returns an ExceptionSnapshot reflecting the exception that the snapshot process sustained to trigger the snapshot being taken. More...
 
std::vector< const MemoryMapRegionSnapshot * > MemoryMap () const override
 Returns MemoryMapRegionSnapshot objects reflecting the regions of the memory map in the snapshot process at the time of the snapshot. More...
 
std::vector< HandleSnapshotHandles () const override
 Returns HandleSnapshot objects reflecting the open handles in the snapshot process at the time of the snapshot. More...
 
std::vector< const MemorySnapshot * > ExtraMemory () const override
 Returns a vector of additional memory blocks that should be included in a minidump. More...
 
const ProcessMemoryMemory () const override
 Returns a ProcessMemory object that allows accessing the process' memory directly. More...
 

Detailed Description

A test ProcessSnapshot that can carry arbitrary data for testing purposes.

Member Function Documentation

◆ AddExtraMemory()

void crashpad::test::TestProcessSnapshot::AddExtraMemory ( std::unique_ptr< MemorySnapshot extra_memory)
inline

Add a memory snapshot to be returned by ExtraMemory().

Parameters
[in]extra_memoryThe memory snapshot that will be included in ExtraMemory(). The TestProcessSnapshot object takes ownership of extra_memory.

◆ AddHandle()

void crashpad::test::TestProcessSnapshot::AddHandle ( const HandleSnapshot handle)
inline

Adds a handle snapshot to be returned by Handles().

Parameters
[in]handleThe handle snapshot that will be included in Handles().

◆ AddMemoryMapRegion()

void crashpad::test::TestProcessSnapshot::AddMemoryMapRegion ( std::unique_ptr< MemoryMapRegionSnapshot region)
inline

Adds a memory map region snapshot to be returned by MemoryMap().

Parameters
[in]regionThe memory map region snapshot that will be included in MemoryMap(). The TestProcessSnapshot object takes ownership of region.

◆ AddModule() [1/2]

void crashpad::test::TestProcessSnapshot::AddModule ( const UnloadedModuleSnapshot unloaded_module)
inline

Adds an unloaded module snapshot to be returned by UnloadedModules().

Parameters
[in]unloaded_moduleThe unloaded module snapshot that will be included in UnloadedModules().

◆ AddModule() [2/2]

void crashpad::test::TestProcessSnapshot::AddModule ( std::unique_ptr< ModuleSnapshot module)
inline

Adds a module snapshot to be returned by Modules().

Parameters
[in]moduleThe module snapshot that will be included in Modules(). The TestProcessSnapshot object takes ownership of module.

◆ AddThread()

void crashpad::test::TestProcessSnapshot::AddThread ( std::unique_ptr< ThreadSnapshot thread)
inline

Adds a thread snapshot to be returned by Threads().

Parameters
[in]threadThe thread snapshot that will be included in Threads(). The TestProcessSnapshot object takes ownership of thread.

◆ AnnotationsSimpleMap()

const std::map< std::string, std::string > & crashpad::test::TestProcessSnapshot::AnnotationsSimpleMap ( ) const
overridevirtual

Returns key-value string annotations recorded for the process, system, or snapshot producer.

This method retrieves annotations recorded for a process. These annotations are intended for diagnostic use, including crash analysis. “Simple annotations” are structured as a sequence of key-value pairs, where all keys and values are strings. These are referred to in Chrome as “crash keys.”

Annotations stored here may reflect the process, system, or snapshot producer. Most annotations not under the client’s direct control will be retrievable by this method. For clients such as Chrome, this includes the product name and version.

Additional per-module annotations may be obtained by calling ModuleSnapshot::AnnotationsSimpleMap().

Implements crashpad::ProcessSnapshot.

◆ ClientID()

void crashpad::test::TestProcessSnapshot::ClientID ( UUID client_id) const
overridevirtual

Returns a UUID identifying the client that the snapshot represents.

Client identification is within the scope of the application, but it is expected that the identifier will be unique for an instance of Crashpad monitoring an application or set of applications for a user. The identifier shall remain stable over time.

If no identifier is available, this field will contain zeroes.

Implements crashpad::ProcessSnapshot.

◆ Exception()

const ExceptionSnapshot * crashpad::test::TestProcessSnapshot::Exception ( ) const
overridevirtual

Returns an ExceptionSnapshot reflecting the exception that the snapshot process sustained to trigger the snapshot being taken.

Returns
An ExceptionSnapshot object. The caller does not take ownership of this object, it is scoped to the lifetime of the ProcessSnapshot object that it was obtained from. If the snapshot is not a result of an exception, returns nullptr.

Implements crashpad::ProcessSnapshot.

◆ ExtraMemory()

std::vector< const MemorySnapshot * > crashpad::test::TestProcessSnapshot::ExtraMemory ( ) const
overridevirtual

Returns a vector of additional memory blocks that should be included in a minidump.

Returns
An vector of MemorySnapshot objects that will be included in the crash dump. The caller does not take ownership of these objects, they are scoped to the lifetime of the ProcessSnapshot object that they were obtained from.

Implements crashpad::ProcessSnapshot.

◆ Handles()

std::vector< HandleSnapshot > crashpad::test::TestProcessSnapshot::Handles ( ) const
overridevirtual

Returns HandleSnapshot objects reflecting the open handles in the snapshot process at the time of the snapshot.

Returns
A vector of HandleSnapshot objects.

Implements crashpad::ProcessSnapshot.

◆ Memory()

const ProcessMemory * crashpad::test::TestProcessSnapshot::Memory ( ) const
overridevirtual

Returns a ProcessMemory object that allows accessing the process' memory directly.

Returns
A ProcessMemory object. The caller does not take ownership of this object, it is scoped to the lifetime of the ProcessSnapshot object that it was obtained from.

Implements crashpad::ProcessSnapshot.

◆ MemoryMap()

std::vector< const MemoryMapRegionSnapshot * > crashpad::test::TestProcessSnapshot::MemoryMap ( ) const
overridevirtual

Returns MemoryMapRegionSnapshot objects reflecting the regions of the memory map in the snapshot process at the time of the snapshot.

Returns
A vector of MemoryMapRegionSnapshot objects. The caller does not take ownership of these objects, they are scoped to the lifetime of the ProcessSnapshot object that they were obtained from.

Implements crashpad::ProcessSnapshot.

◆ Modules()

std::vector< const ModuleSnapshot * > crashpad::test::TestProcessSnapshot::Modules ( ) const
overridevirtual

Returns ModuleSnapshot objects reflecting the code modules (binary images) loaded into the snapshot process at the time of the snapshot.

Returns
A vector of ModuleSnapshot objects. The caller does not take ownership of these objects, they are scoped to the lifetime of the ProcessSnapshot object that they were obtained from.

Implements crashpad::ProcessSnapshot.

◆ ProcessCPUTimes()

void crashpad::test::TestProcessSnapshot::ProcessCPUTimes ( timeval *  user_time,
timeval *  system_time 
) const
overridevirtual

Returns the snapshot process’ CPU usage times in user_time and system_time.

Parameters
[out]user_timeThe time that the process has spent executing in user mode.
[out]system_timeThe time that the process has spent executing in system (kernel) mode.

Implements crashpad::ProcessSnapshot.

◆ ProcessStartTime()

void crashpad::test::TestProcessSnapshot::ProcessStartTime ( timeval *  start_time) const
overridevirtual

Returns the time that the snapshot process was started in start_time.

Normally, process uptime in wall clock time can be computed as SnapshotTime()ProcessStartTime(), but this cannot be guaranteed in cases where the real-time clock has been set during the snapshot process’ lifetime.

Parameters
[out]start_timeThe time that the process was started.

Implements crashpad::ProcessSnapshot.

◆ ReportID()

void crashpad::test::TestProcessSnapshot::ReportID ( UUID client_id) const
overridevirtual

Returns a UUID identifying the event that the snapshot describes.

This provides a stable identifier for a crash even as the report is converted to different formats, provided that all formats support storing a crash report ID. When a report is originally created, a report ID should be assigned. From that point on, any operations involving the same report should preserve the same report ID.

If no identifier is available, this field will contain zeroes.

Implements crashpad::ProcessSnapshot.

◆ SetException()

void crashpad::test::TestProcessSnapshot::SetException ( std::unique_ptr< ExceptionSnapshot exception)
inline

Sets the exception snapshot to be returned by Exception().

Parameters
[in]exceptionThe exception snapshot that Exception() will return. The TestProcessSnapshot object takes ownership of exception.

◆ SetProcessMemory()

void crashpad::test::TestProcessSnapshot::SetProcessMemory ( std::unique_ptr< ProcessMemory process_memory)
inline

Add a process memory object to be returned by Memory().

Parameters
[in]process_memoryThe memory object that will be returned by Memory(). The TestProcessSnapshot object takes ownership of extra_memory.

◆ SetSystem()

void crashpad::test::TestProcessSnapshot::SetSystem ( std::unique_ptr< SystemSnapshot system)
inline

Sets the system snapshot to be returned by System().

Parameters
[in]systemThe system snapshot that System() will return. The TestProcessSnapshot object takes ownership of system.

◆ SnapshotTime()

void crashpad::test::TestProcessSnapshot::SnapshotTime ( timeval *  snapshot_time) const
overridevirtual

Returns the time that the snapshot was taken in snapshot_time.

Parameters
[out]snapshot_timeThe time that the snapshot was taken. This is distinct from the time that a ProcessSnapshot object was created or initialized, although it may be that time for ProcessSnapshot objects representing live or recently-crashed process state.

Implements crashpad::ProcessSnapshot.

◆ System()

const SystemSnapshot * crashpad::test::TestProcessSnapshot::System ( ) const
overridevirtual

Returns a SystemSnapshot reflecting the characteristics of the system that ran the snapshot process at the time of the snapshot.

Returns
A SystemSnapshot object. The caller does not take ownership of this object, it is scoped to the lifetime of the ProcessSnapshot object that it was obtained from.

Implements crashpad::ProcessSnapshot.

◆ Threads()

std::vector< const ThreadSnapshot * > crashpad::test::TestProcessSnapshot::Threads ( ) const
overridevirtual

Returns ThreadSnapshot objects reflecting the threads (lightweight processes) existing in the snapshot process at the time of the snapshot.

Returns
A vector of ThreadSnapshot objects. The caller does not take ownership of these objects, they are scoped to the lifetime of the ProcessSnapshot object that they were obtained from.

Implements crashpad::ProcessSnapshot.

◆ UnloadedModules()

std::vector< UnloadedModuleSnapshot > crashpad::test::TestProcessSnapshot::UnloadedModules ( ) const
overridevirtual

Returns UnloadedModuleSnapshot objects reflecting the code modules the were recorded as unloaded at the time of the snapshot.

Returns
A vector of UnloadedModuleSnapshot objects.

Implements crashpad::ProcessSnapshot.


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