Crashpad
Public Types | Public Member Functions | List of all members
crashpad::SystemSnapshot Class Referenceabstract

An abstract interface to a snapshot representing the state of a system, comprising an operating system, CPU architecture, and various other characteristics. More...

#include "snapshot/system_snapshot.h"

Inheritance diagram for crashpad::SystemSnapshot:
crashpad::internal::SystemSnapshotFuchsia crashpad::internal::SystemSnapshotIOS crashpad::internal::SystemSnapshotLinux crashpad::internal::SystemSnapshotMac crashpad::internal::SystemSnapshotMinidump crashpad::internal::SystemSnapshotWin crashpad::test::TestSystemSnapshot

Public Types

enum  OperatingSystem
 A system’s operating system family. More...
 
enum  DaylightSavingTimeStatus
 A system’s daylight saving time status. More...
 

Public Member Functions

virtual CPUArchitecture GetCPUArchitecture () const =0
 Returns the snapshot system’s CPU architecture. More...
 
virtual uint32_t CPURevision () const =0
 Returns the snapshot system’s CPU revision. More...
 
virtual uint8_t CPUCount () const =0
 Returns the total number of CPUs present in the snapshot system.
 
virtual std::string CPUVendor () const =0
 Returns the vendor of the snapshot system’s CPUs. More...
 
virtual void CPUFrequency (uint64_t *current_hz, uint64_t *max_hz) const =0
 Returns frequency information about the snapshot system’s CPUs in current_hz and max_hz. More...
 
virtual uint32_t CPUX86Signature () const =0
 Returns an x86-family snapshot system’s CPU signature. More...
 
virtual uint64_t CPUX86Features () const =0
 Returns an x86-family snapshot system’s CPU features. More...
 
virtual uint64_t CPUX86ExtendedFeatures () const =0
 Returns an x86-family snapshot system’s extended CPU features. More...
 
virtual uint32_t CPUX86Leaf7Features () const =0
 Returns an x86-family snapshot system’s “leaf 7” CPU features. More...
 
virtual bool CPUX86SupportsDAZ () const =0
 Returns an x86-family snapshot system’s CPU’s support for the SSE DAZ (“denormals are zeros”) mode. More...
 
virtual OperatingSystem GetOperatingSystem () const =0
 Returns the snapshot system’s operating system family.
 
virtual bool OSServer () const =0
 Returns whether the snapshot system runs a server variant of its operating system.
 
virtual void OSVersion (int *major, int *minor, int *bugfix, std::string *build) const =0
 Returns the snapshot system’s operating system version information in major, minor, bugfix, and build. More...
 
virtual std::string OSVersionFull () const =0
 Returns the snapshot system’s full operating system version information in string format. More...
 
virtual std::string MachineDescription () const =0
 Returns a description of the snapshot system’s hardware in string format. More...
 
virtual bool NXEnabled () const =0
 Returns the status of the NX (no-execute, or XD, execute-disable) feature on the snapshot system. More...
 
virtual void TimeZone (DaylightSavingTimeStatus *dst_status, int *standard_offset_seconds, int *daylight_offset_seconds, std::string *standard_name, std::string *daylight_name) const =0
 Returns time zone information from the snapshot system, based on its locale configuration and real-time clock. More...
 

Detailed Description

An abstract interface to a snapshot representing the state of a system, comprising an operating system, CPU architecture, and various other characteristics.

Member Enumeration Documentation

◆ DaylightSavingTimeStatus

A system’s daylight saving time status.

The daylight saving time status is taken partially from the system’s locale configuration. This determines whether daylight saving time is ever observed on the system. If it is, the snapshot’s time (ProcessSnapshot::SnapshotTime()) is used to determine whether the system was observing daylight saving time at the time of the snapshot.

Enumerator
kDoesNotObserveDaylightSavingTime 

Daylight saving time is never observed on the snapshot system.

kObservingStandardTime 

Daylight saving time is observed on the snapshot system when in effect, but standard time was in effect at the time of the snapshot.

kObservingDaylightSavingTime 

Daylight saving time is observed on the snapshot system when in effect, and daylight saving time was in effect at the time of the snapshot.

◆ OperatingSystem

A system’s operating system family.

Enumerator
kOperatingSystemUnknown 

The snapshot system’s operating system is unknown.

kOperatingSystemMacOSX 

macOS.

kOperatingSystemWindows 

Windows.

kOperatingSystemLinux 

Linux.

kOperatingSystemAndroid 

Android.

kOperatingSystemFuchsia 

Fuchsia.

kOperatingSystemIOS 

iOS.

Member Function Documentation

◆ CPUFrequency()

virtual void crashpad::SystemSnapshot::CPUFrequency ( uint64_t *  current_hz,
uint64_t *  max_hz 
) const
pure virtual

Returns frequency information about the snapshot system’s CPUs in current_hz and max_hz.

Parameters
[out]current_hzThe snapshot system’s CPU clock frequency in Hz at the time of the snapshot.
[out]max_hzThe snapshot system’s maximum possible CPU clock frequency.

Implemented in crashpad::test::TestSystemSnapshot, crashpad::internal::SystemSnapshotLinux, crashpad::internal::SystemSnapshotMac, crashpad::internal::SystemSnapshotWin, crashpad::internal::SystemSnapshotFuchsia, crashpad::internal::SystemSnapshotMinidump, and crashpad::internal::SystemSnapshotIOS.

◆ CPURevision()

virtual uint32_t crashpad::SystemSnapshot::CPURevision ( ) const
pure virtual

Returns the snapshot system’s CPU revision.

For x86-family CPUs (including x86_64 and 32-bit x86), this is the CPU family, model, and stepping ID values from cpuid 1 eax. The family and model values are adjusted to take the extended family and model IDs into account. These values are encoded in this method’s return value with the family in the high high 16 bits, the model in the next 8 bits, and the stepping in the low 8 bits.

Returns
A CPU architecture-specific value identifying the CPU revision.

Implemented in crashpad::test::TestSystemSnapshot, crashpad::internal::SystemSnapshotLinux, crashpad::internal::SystemSnapshotMac, crashpad::internal::SystemSnapshotWin, crashpad::internal::SystemSnapshotFuchsia, crashpad::internal::SystemSnapshotMinidump, and crashpad::internal::SystemSnapshotIOS.

◆ CPUVendor()

virtual std::string crashpad::SystemSnapshot::CPUVendor ( ) const
pure virtual

Returns the vendor of the snapshot system’s CPUs.

For x86-family CPUs (including x86_64 and 32-bit x86), this is the CPU vendor identification string as encoded in cpuid 0 ebx, edx, and ecx.

Returns
A string identifying the vendor of the snapshot system’s CPUs.

Implemented in crashpad::test::TestSystemSnapshot, crashpad::internal::SystemSnapshotLinux, crashpad::internal::SystemSnapshotMac, crashpad::internal::SystemSnapshotWin, crashpad::internal::SystemSnapshotFuchsia, crashpad::internal::SystemSnapshotMinidump, and crashpad::internal::SystemSnapshotIOS.

◆ CPUX86ExtendedFeatures()

virtual uint64_t crashpad::SystemSnapshot::CPUX86ExtendedFeatures ( ) const
pure virtual

Returns an x86-family snapshot system’s extended CPU features.

This is the extended feature information as encoded in cpuid 0x80000001 edx and ecx. edx is placed in the low half of the return value, and ecx is placed in the high half.

This method must only be called when GetCPUArchitecture() indicates an x86-family CPU architecture (kCPUArchitectureX86 or kCPUArchitectureX86_64).

Returns
An x86 family-specific value identifying extended CPU features.
See also
CPUX86Features()
CPUX86Leaf7Features()

Implemented in crashpad::test::TestSystemSnapshot, crashpad::internal::SystemSnapshotLinux, crashpad::internal::SystemSnapshotMac, crashpad::internal::SystemSnapshotWin, crashpad::internal::SystemSnapshotFuchsia, crashpad::internal::SystemSnapshotMinidump, and crashpad::internal::SystemSnapshotIOS.

◆ CPUX86Features()

virtual uint64_t crashpad::SystemSnapshot::CPUX86Features ( ) const
pure virtual

Returns an x86-family snapshot system’s CPU features.

This is the feature information as encoded in cpuid 1 edx and ecx. edx is placed in the low half of the return value, and ecx is placed in the high half.

This method must only be called when GetCPUArchitecture() indicates an x86-family CPU architecture (kCPUArchitectureX86 or kCPUArchitectureX86_64).

Returns
An x86 family-specific value identifying CPU features.
See also
CPUX86ExtendedFeatures()
CPUX86Leaf7Features()

Implemented in crashpad::test::TestSystemSnapshot, crashpad::internal::SystemSnapshotLinux, crashpad::internal::SystemSnapshotMac, crashpad::internal::SystemSnapshotWin, crashpad::internal::SystemSnapshotFuchsia, crashpad::internal::SystemSnapshotMinidump, and crashpad::internal::SystemSnapshotIOS.

◆ CPUX86Leaf7Features()

virtual uint32_t crashpad::SystemSnapshot::CPUX86Leaf7Features ( ) const
pure virtual

Returns an x86-family snapshot system’s “leaf 7” CPU features.

This is the “leaf 7” feature information as encoded in cpuid 7 ebx. If cpuid 7 is not supported by the snapshot CPU, this returns 0.

This method must only be called when GetCPUArchitecture() indicates an x86-family CPU architecture (kCPUArchitectureX86 or kCPUArchitectureX86_64).

Returns
An x86 family-specific value identifying “leaf 7” CPU features.
See also
CPUX86Features()
CPUX86ExtendedFeatures()

Implemented in crashpad::test::TestSystemSnapshot, crashpad::internal::SystemSnapshotLinux, crashpad::internal::SystemSnapshotMac, crashpad::internal::SystemSnapshotWin, crashpad::internal::SystemSnapshotFuchsia, crashpad::internal::SystemSnapshotMinidump, and crashpad::internal::SystemSnapshotIOS.

◆ CPUX86Signature()

virtual uint32_t crashpad::SystemSnapshot::CPUX86Signature ( ) const
pure virtual

Returns an x86-family snapshot system’s CPU signature.

This is the family, model, and stepping ID values as encoded in cpuid 1 eax.

This method must only be called when GetCPUArchitecture() indicates an x86-family CPU architecture (kCPUArchitectureX86 or kCPUArchitectureX86_64).

Returns
An x86 family-specific value identifying the CPU signature.

Implemented in crashpad::test::TestSystemSnapshot, crashpad::internal::SystemSnapshotLinux, crashpad::internal::SystemSnapshotMac, crashpad::internal::SystemSnapshotWin, crashpad::internal::SystemSnapshotFuchsia, crashpad::internal::SystemSnapshotMinidump, and crashpad::internal::SystemSnapshotIOS.

◆ CPUX86SupportsDAZ()

virtual bool crashpad::SystemSnapshot::CPUX86SupportsDAZ ( ) const
pure virtual

Returns an x86-family snapshot system’s CPU’s support for the SSE DAZ (“denormals are zeros”) mode.

This determines whether the CPU supports DAZ mode at all, not whether this mode is enabled for any particular thread. DAZ mode support is detected by examining the DAZ bit in the mxcsr_mask field of the floating-point context saved by fxsave.

This method must only be called when GetCPUArchitecture() indicates an x86-family CPU architecture (kCPUArchitectureX86 or kCPUArchitectureX86_64).

Returns
true if the snapshot system’s CPUs support the SSE DAZ mode, false if they do not.

Implemented in crashpad::test::TestSystemSnapshot, crashpad::internal::SystemSnapshotLinux, crashpad::internal::SystemSnapshotMac, crashpad::internal::SystemSnapshotWin, crashpad::internal::SystemSnapshotFuchsia, crashpad::internal::SystemSnapshotMinidump, and crashpad::internal::SystemSnapshotIOS.

◆ GetCPUArchitecture()

virtual CPUArchitecture crashpad::SystemSnapshot::GetCPUArchitecture ( ) const
pure virtual

Returns the snapshot system’s CPU architecture.

In some cases, a system may be able to run processes of multiple specific architecture types. For example, systems based on 64-bit architectures such as x86_64 are often able to run 32-bit code of another architecture in the same family, such as 32-bit x86. On these systems, this method will return the architecture of the process that the snapshot is associated with, provided that the SystemSnapshot object was obtained from ProcessSnapshot::System(). This renders one aspect of this method’s return value a process attribute rather than a system attribute, but it’s defined here rather than in ProcessSnapshot because the CPU architecture is a better conceptual fit for the system abstraction alongside these other related methods.

Implemented in crashpad::test::TestSystemSnapshot, crashpad::internal::SystemSnapshotLinux, crashpad::internal::SystemSnapshotMac, crashpad::internal::SystemSnapshotWin, crashpad::internal::SystemSnapshotFuchsia, crashpad::internal::SystemSnapshotMinidump, and crashpad::internal::SystemSnapshotIOS.

◆ MachineDescription()

virtual std::string crashpad::SystemSnapshot::MachineDescription ( ) const
pure virtual

Returns a description of the snapshot system’s hardware in string format.

For macOS, the string contains the Mac model and board ID. A mid-2014 15" MacBook Pro would be identified as `"MacBookPro11,3 (Mac-2BD1B31983FE1663)"`.

Implemented in crashpad::test::TestSystemSnapshot, crashpad::internal::SystemSnapshotLinux, crashpad::internal::SystemSnapshotMac, crashpad::internal::SystemSnapshotWin, crashpad::internal::SystemSnapshotFuchsia, crashpad::internal::SystemSnapshotMinidump, and crashpad::internal::SystemSnapshotIOS.

◆ NXEnabled()

virtual bool crashpad::SystemSnapshot::NXEnabled ( ) const
pure virtual

Returns the status of the NX (no-execute, or XD, execute-disable) feature on the snapshot system.

This refers to a feature that allows mapped readable pages to be marked as non-executable.

Returns
true if the snapshot system supports NX and it is enabled.

Implemented in crashpad::test::TestSystemSnapshot, crashpad::internal::SystemSnapshotLinux, crashpad::internal::SystemSnapshotMac, crashpad::internal::SystemSnapshotWin, crashpad::internal::SystemSnapshotMinidump, crashpad::internal::SystemSnapshotFuchsia, and crashpad::internal::SystemSnapshotIOS.

◆ OSVersion()

virtual void crashpad::SystemSnapshot::OSVersion ( int *  major,
int *  minor,
int *  bugfix,
std::string *  build 
) const
pure virtual

Returns the snapshot system’s operating system version information in major, minor, bugfix, and build.

Parameters
[out]majorThe snapshot system’s operating system’s first (major) version number component. This would be 10 for macOS 10.12.1, and 6 for Windows 7 (NT 6.1) SP1 version 6.1.7601.
[out]minorThe snapshot system’s operating system’s second (minor) version number component. This would be 12 for macOS 10.12.1, and 1 for Windows 7 (NT 6.1) SP1 version 6.1.7601.
[out]bugfixThe snapshot system’s operating system’s third (bugfix) version number component. This would be 1 for macOS 10.12.1, and 7601 for Windows 7 (NT 6.1) SP1 version 6.1.7601.
[out]buildA string further identifying an operating system version. For macOS 10.12.1, this would be "16B2657". For Windows, this would be "Service Pack 1" if that service pack was installed. On Android, the ro.build.fingerprint system property would be appended. For Linux and other Unix-like systems, this would be the kernel version from uname -srvm, possibly with additional information appended.

Implemented in crashpad::test::TestSystemSnapshot, crashpad::internal::SystemSnapshotLinux, crashpad::internal::SystemSnapshotMac, crashpad::internal::SystemSnapshotWin, crashpad::internal::SystemSnapshotFuchsia, crashpad::internal::SystemSnapshotMinidump, and crashpad::internal::SystemSnapshotIOS.

◆ OSVersionFull()

virtual std::string crashpad::SystemSnapshot::OSVersionFull ( ) const
pure virtual

Returns the snapshot system’s full operating system version information in string format.

For macOS, the string contains values from the operating system and kernel. A macOS 10.12.1 system snapshot would be identified as `"Mac OS X 10.12.1 (16B2657); Darwin 16.1.0 Darwin Kernel Version 16.1.0: Wed Oct 19 20:31:56 PDT 2016; root:xnu-3789.21.4~4/RELEASE_X86_64 x86_64"`.

Implemented in crashpad::test::TestSystemSnapshot, crashpad::internal::SystemSnapshotLinux, crashpad::internal::SystemSnapshotMac, crashpad::internal::SystemSnapshotWin, crashpad::internal::SystemSnapshotMinidump, crashpad::internal::SystemSnapshotFuchsia, and crashpad::internal::SystemSnapshotIOS.

◆ TimeZone()

virtual void crashpad::SystemSnapshot::TimeZone ( DaylightSavingTimeStatus dst_status,
int *  standard_offset_seconds,
int *  daylight_offset_seconds,
std::string *  standard_name,
std::string *  daylight_name 
) const
pure virtual

Returns time zone information from the snapshot system, based on its locale configuration and real-time clock.

Parameters
[out]dst_statusWhether the location observes daylight saving time, and if so, whether it or standard time is currently being observed.
[out]standard_offset_secondsThe number of seconds that the location’s time zone is east (ahead) of UTC during standard time.
[out]daylight_offset_secondsThe number of seconds that the location’s time zone is east (ahead) of UTC during daylight saving. time.
[out]standard_nameThe name of the time zone while standard time is being observed.
[out]daylight_nameThe name of the time zone while daylight saving time is being observed.

Implemented in crashpad::test::TestSystemSnapshot, crashpad::internal::SystemSnapshotLinux, crashpad::internal::SystemSnapshotMac, crashpad::internal::SystemSnapshotWin, crashpad::internal::SystemSnapshotMinidump, and crashpad::internal::SystemSnapshotFuchsia.


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