Crashpad

Public Member Functions | List of all members
crashpad::internal::ModuleSnapshotMac Class Referencefinal

A ModuleSnapshot of a code module (binary image) loaded into a running (or crashed) process on a Mac OS X system. More...

`#include "snapshot/mac/module_snapshot_mac.h"`

Inheritance diagram for crashpad::internal::ModuleSnapshotMac:

## Public Member Functions
bool | Initialize (ProcessReader *process_reader, const ProcessReader::Module &process_reader_module)
| Initializes the object. More...
void | GetCrashpadOptions (CrashpadInfoClientOptions *options)
| Returns options from the module’s CrashpadInfo structure. More...
std::string | Name () const override
| Returns the module’s pathname.
uint64_t | Address () const override
| Returns the base address that the module is loaded at in the snapshot process.
uint64_t | Size () const override
| Returns the size that the module occupies in the snapshot process’ address space, starting at its base address. More...
time_t | Timestamp () const override
| Returns the module’s timestamp, if known. More...
void | FileVersion (uint16_t *version_0, uint16_t *version_1, uint16_t *version_2, uint16_t *version_3) const override
| Returns the module’s file version in the version_* parameters. More...
void | SourceVersion (uint16_t *version_0, uint16_t *version_1, uint16_t *version_2, uint16_t *version_3) const override
| Returns the module’s source version in the version_* parameters. More...
ModuleType | GetModuleType () const override
| Returns the module’s type.
void | UUIDAndAge (crashpad::UUID *uuid, uint32_t *age) const override
| Returns the module’s UUID in the uuid parameter, and the age of that UUID in age. More...
std::string | DebugFileName () const override
| Returns the module’s debug file info name. More...
std::vector< std::string > | AnnotationsVector () const override
| Returns string annotations recorded in the module. More...
std::map< std::string, std::string > | AnnotationsSimpleMap () const override
| Returns key-value string annotations recorded in the module. More...
std::set< CheckedRange< uint64_t > > | ExtraMemoryRanges () const override
| Returns a set of extra memory ranges specified in the module as being desirable to include in the crash dump.
std::vector< const UserMinidumpStream * > | CustomMinidumpStreams () const override
| Returns a list of custom minidump stream specified in the module to be included in the crash dump. More...

## Additional Inherited Members
Public Types inherited from crashpad::ModuleSnapshot
enum | ModuleType
| A module’s type. More...

## Detailed Description

A ModuleSnapshot of a code module (binary image) loaded into a running (or crashed) process on a Mac OS X system.

## Member Function Documentation

## ◆ AnnotationsSimpleMap()

std::map< std::string, std::string > crashpad::internal::ModuleSnapshotMac::AnnotationsSimpleMap | ( |  | ) | const
| override virtual

Returns key-value string annotations recorded in the module.

This method retrieves annotations recorded in a module. 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.”

For macOS snapshots, these annotations are found by interpreting the `__DATA,crashpad_info` section as `CrashpadInfo`. Clients can use the Crashpad client interface to store annotations in this structure. Most annotations under the client’s direct control will be retrievable by this method. For clients such as Chrome, this includes the process type.

The annotations returned by this method do not duplicate those returned by AnnotationsVector(). Additional annotations related to the process, system, or snapshot producer may be obtained by calling ProcessSnapshot::AnnotationsSimpleMap().

Implements crashpad::ModuleSnapshot.

## ◆ AnnotationsVector()

std::vector< std::string > crashpad::internal::ModuleSnapshotMac::AnnotationsVector | ( |  | ) | const
| override virtual

Returns string annotations recorded in the module.

This method retrieves annotations recorded in a module. These annotations are intended for diagnostic use, including crash analysis. A module may contain multiple annotations, so they are returned in a vector.

For macOS snapshots, these annotations are found by interpreting the module’s `__DATA,__crash_info` section as `crashreporter_annotations_t`. System libraries using the crash reporter client interface may reference annotations in this structure. Additional annotations messages may be found in other locations, which may be module-specific. The dynamic linker (`dyld`) can provide an annotation at its `_error_string` symbol.

The annotations returned by this method do not duplicate those returned by AnnotationsSimpleMap().

Implements crashpad::ModuleSnapshot.

## ◆ CustomMinidumpStreams()

std::vector< const UserMinidumpStream * > crashpad::internal::ModuleSnapshotMac::CustomMinidumpStreams | ( |  | ) | const
| override virtual

Returns a list of custom minidump stream specified in the module to be included in the crash dump.

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

Implements crashpad::ModuleSnapshot.

## ◆ DebugFileName()

std::string crashpad::internal::ModuleSnapshotMac::DebugFileName | ( |  | ) | const
| override virtual

Returns the module’s debug file info name.

On Windows, this references the PDB file, which contains symbol information held separately from the module itself. On other platforms, this is normally the basename of the module, because the debug info file’s name is not relevant even in split-debug scenarios.

See also
  UUIDAndAge()

Implements crashpad::ModuleSnapshot.

## ◆ FileVersion()

void crashpad::internal::ModuleSnapshotMac::FileVersion | ( | uint16_t * | version_0,
|  | uint16_t * | version_1,
|  | uint16_t * | version_2,
|  | uint16_t * | version_3
| ) |  | const
| override virtual

Returns the module’s file version in the version_* parameters.

If no file version can be determined, the version_* parameters are set to `0`.

For macOS snapshots, this is taken from the module’s `LC_ID_DYLIB` load command for shared libraries, and is `0` for other module types.

Implements crashpad::ModuleSnapshot.

## ◆ GetCrashpadOptions()

void crashpad::internal::ModuleSnapshotMac::GetCrashpadOptions | ( | CrashpadInfoClientOptions * | options | ) |

Returns options from the module’s CrashpadInfo structure.

Parameters

  [out] | options | Options set in the module’s CrashpadInfo structure.

## ◆ Initialize()

bool crashpad::internal::ModuleSnapshotMac::Initialize | ( | ProcessReader * | process_reader,
|  | const ProcessReader::Module & | process_reader_module
| ) |  |

Initializes the object.

Parameters

  [in] | process_reader | A ProcessReader for the task containing the module.
  [in] | process_reader_module | The module within the ProcessReader for which the snapshot should be created.

Returns
  `true` if the snapshot could be created, `false` otherwise with an appropriate message logged.

## ◆ Size()

uint64_t crashpad::internal::ModuleSnapshotMac::Size | ( |  | ) | const
| override virtual

Returns the size that the module occupies in the snapshot process’ address space, starting at its base address.

For macOS snapshots, this method only reports the size of the `__TEXT` segment, because segments may not be loaded contiguously.

Implements crashpad::ModuleSnapshot.

## ◆ SourceVersion()

void crashpad::internal::ModuleSnapshotMac::SourceVersion | ( | uint16_t * | version_0,
|  | uint16_t * | version_1,
|  | uint16_t * | version_2,
|  | uint16_t * | version_3
| ) |  | const
| override virtual

Returns the module’s source version in the version_* parameters.

If no source version can be determined, the version_* parameters are set to `0`.

For macOS snapshots, this is taken from the module’s `LC_SOURCE_VERSION` load command.

Implements crashpad::ModuleSnapshot.

## ◆ Timestamp()

time_t crashpad::internal::ModuleSnapshotMac::Timestamp | ( |  | ) | const
| override virtual

Returns the module’s timestamp, if known.

The timestamp is typically the modification time of the file that provided the module in `time_t` format, seconds since the POSIX epoch. If the module’s timestamp is unknown, this method returns `0`.

Implements crashpad::ModuleSnapshot.

## ◆ UUIDAndAge()

void crashpad::internal::ModuleSnapshotMac::UUIDAndAge | ( | crashpad::UUID * | uuid,
|  | uint32_t * | age
| ) |  | const
| override virtual

Returns the module’s UUID in the uuid parameter, and the age of that UUID in age.

A snapshot module’s UUID is taken directly from the module itself. If the module does not have a UUID, the uuid parameter will be zeroed out.

age is the number of times the UUID has been reused. This occurs on Windows with incremental linking. On other platforms age will always be `0`.

See also
  DebugFileName()

Implements crashpad::ModuleSnapshot.

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

- snapshot/mac/module_snapshot_mac.h
- snapshot/mac/module_snapshot_mac.cc