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

An abstract interface to a snapshot representing a code module (binary image) loaded into a snapshot process. More...

#include "snapshot/module_snapshot.h"

Inheritance diagram for crashpad::ModuleSnapshot:
crashpad::internal::ModuleSnapshotElf crashpad::internal::ModuleSnapshotIOS crashpad::internal::ModuleSnapshotMac crashpad::internal::ModuleSnapshotMinidump crashpad::internal::ModuleSnapshotSanitized crashpad::internal::ModuleSnapshotWin crashpad::test::TestModuleSnapshot

Public Types

enum  ModuleType
 A module’s type. More...
 

Public Member Functions

virtual std::string Name () const =0
 Returns the module’s pathname.
 
virtual uint64_t Address () const =0
 Returns the base address that the module is loaded at in the snapshot process.
 
virtual uint64_t Size () const =0
 Returns the size that the module occupies in the snapshot process’ address space, starting at its base address. More...
 
virtual time_t Timestamp () const =0
 Returns the module’s timestamp, if known. More...
 
virtual void FileVersion (uint16_t *version_0, uint16_t *version_1, uint16_t *version_2, uint16_t *version_3) const =0
 Returns the module’s file version in the version_* parameters. More...
 
virtual void SourceVersion (uint16_t *version_0, uint16_t *version_1, uint16_t *version_2, uint16_t *version_3) const =0
 Returns the module’s source version in the version_* parameters. More...
 
virtual ModuleType GetModuleType () const =0
 Returns the module’s type.
 
virtual void UUIDAndAge (crashpad::UUID *uuid, uint32_t *age) const =0
 Returns the module’s UUID in the uuid parameter, and the age of that UUID in age. More...
 
virtual std::string DebugFileName () const =0
 Returns the module’s debug file info name. More...
 
virtual std::vector< uint8_t > BuildID () const =0
 Returns the module’s build ID. More...
 
virtual std::vector< std::string > AnnotationsVector () const =0
 Returns string annotations recorded in the module. More...
 
virtual std::map< std::string, std::string > AnnotationsSimpleMap () const =0
 Returns key-value string annotations recorded in the module. More...
 
virtual std::vector< AnnotationSnapshotAnnotationObjects () const =0
 Returns the typed annotation objects recorded in the module. More...
 
virtual std::set< CheckedRange< uint64_t > > ExtraMemoryRanges () const =0
 Returns a set of extra memory ranges specified in the module as being desirable to include in the crash dump.
 
virtual std::vector< const UserMinidumpStream * > CustomMinidumpStreams () const =0
 Returns a list of custom minidump stream specified in the module to be included in the crash dump. More...
 

Detailed Description

An abstract interface to a snapshot representing a code module (binary image) loaded into a snapshot process.

Member Enumeration Documentation

◆ ModuleType

A module’s type.

Enumerator
kModuleTypeUnknown 

The module’s type is unknown.

kModuleTypeExecutable 

The module is a main executable.

kModuleTypeSharedLibrary 

The module is a shared library.

\sa kModuleTypeLoadableModule 
kModuleTypeLoadableModule 

The module is a loadable module.

On some platforms, loadable modules are distinguished from shared
libraries. On these platforms, a shared library is a module that another
module links against directly, and a loadable module is not. Loadable
modules tend to be binary plug-ins. 
kModuleTypeDynamicLoader 

The module is a dynamic loader.

This is the module responsible for loading other modules. This is
normally `dyld` for macOS and `ld.so` for Linux and other systems using
ELF. 

Member Function Documentation

◆ AnnotationObjects()

virtual std::vector<AnnotationSnapshot> crashpad::ModuleSnapshot::AnnotationObjects ( ) const
pure virtual

Returns the typed annotation objects recorded in the module.

This method retrieves annotations recorded in a module. These annotations are intended for diagnostic use, including crash analysis. Annotation objects are strongly-typed name-value pairs. The names are not unique.

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() or AnnotationsSimpleMap().

Implemented in crashpad::test::TestModuleSnapshot, crashpad::internal::ModuleSnapshotWin, crashpad::internal::ModuleSnapshotElf, crashpad::internal::ModuleSnapshotIOS, crashpad::internal::ModuleSnapshotMac, crashpad::internal::ModuleSnapshotMinidump, and crashpad::internal::ModuleSnapshotSanitized.

◆ AnnotationsSimpleMap()

virtual std::map<std::string, std::string> crashpad::ModuleSnapshot::AnnotationsSimpleMap ( ) const
pure 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() or AnnotationObjects(). Additional annotations related to the process, system, or snapshot producer may be obtained by calling ProcessSnapshot::AnnotationsSimpleMap().

Implemented in crashpad::test::TestModuleSnapshot, crashpad::internal::ModuleSnapshotWin, crashpad::internal::ModuleSnapshotElf, crashpad::internal::ModuleSnapshotIOS, crashpad::internal::ModuleSnapshotMac, crashpad::internal::ModuleSnapshotMinidump, and crashpad::internal::ModuleSnapshotSanitized.

◆ AnnotationsVector()

virtual std::vector<std::string> crashpad::ModuleSnapshot::AnnotationsVector ( ) const
pure 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() or AnnotationObjects().

Implemented in crashpad::test::TestModuleSnapshot, crashpad::internal::ModuleSnapshotWin, crashpad::internal::ModuleSnapshotElf, crashpad::internal::ModuleSnapshotIOS, crashpad::internal::ModuleSnapshotMac, crashpad::internal::ModuleSnapshotMinidump, and crashpad::internal::ModuleSnapshotSanitized.

◆ BuildID()

virtual std::vector<uint8_t> crashpad::ModuleSnapshot::BuildID ( ) const
pure virtual

Returns the module’s build ID.

On ELF platforms, the build ID is a variable-length byte stream that identifies a library uniquely, and is usually used to look up its debug symbols when stored separately. This will return an empty vector if it is unsupported.

BuildID() and UUIDAndAge() are never available in the same place. When UUIDAndAge() is unavailable, it will be filled out with the contents of BuildID() (either 0-padded or truncated) and age will be zero.

See also
UUIDAndAge()

Implemented in crashpad::test::TestModuleSnapshot, crashpad::internal::ModuleSnapshotWin, crashpad::internal::ModuleSnapshotElf, crashpad::internal::ModuleSnapshotIOS, crashpad::internal::ModuleSnapshotMac, crashpad::internal::ModuleSnapshotMinidump, and crashpad::internal::ModuleSnapshotSanitized.

◆ CustomMinidumpStreams()

virtual std::vector<const UserMinidumpStream*> crashpad::ModuleSnapshot::CustomMinidumpStreams ( ) const
pure 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.

Implemented in crashpad::test::TestModuleSnapshot, crashpad::internal::ModuleSnapshotWin, crashpad::internal::ModuleSnapshotElf, crashpad::internal::ModuleSnapshotIOS, crashpad::internal::ModuleSnapshotMac, crashpad::internal::ModuleSnapshotMinidump, and crashpad::internal::ModuleSnapshotSanitized.

◆ DebugFileName()

virtual std::string crashpad::ModuleSnapshot::DebugFileName ( ) const
pure 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()

Implemented in crashpad::test::TestModuleSnapshot, crashpad::internal::ModuleSnapshotWin, crashpad::internal::ModuleSnapshotElf, crashpad::internal::ModuleSnapshotIOS, crashpad::internal::ModuleSnapshotMac, crashpad::internal::ModuleSnapshotMinidump, and crashpad::internal::ModuleSnapshotSanitized.

◆ FileVersion()

virtual void crashpad::ModuleSnapshot::FileVersion ( uint16_t *  version_0,
uint16_t *  version_1,
uint16_t *  version_2,
uint16_t *  version_3 
) const
pure 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.

Implemented in crashpad::test::TestModuleSnapshot, crashpad::internal::ModuleSnapshotWin, crashpad::internal::ModuleSnapshotElf, crashpad::internal::ModuleSnapshotIOS, crashpad::internal::ModuleSnapshotMac, crashpad::internal::ModuleSnapshotMinidump, and crashpad::internal::ModuleSnapshotSanitized.

◆ Size()

virtual uint64_t crashpad::ModuleSnapshot::Size ( ) const
pure 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.

Implemented in crashpad::test::TestModuleSnapshot, crashpad::internal::ModuleSnapshotWin, crashpad::internal::ModuleSnapshotElf, crashpad::internal::ModuleSnapshotIOS, crashpad::internal::ModuleSnapshotMac, crashpad::internal::ModuleSnapshotMinidump, and crashpad::internal::ModuleSnapshotSanitized.

◆ SourceVersion()

virtual void crashpad::ModuleSnapshot::SourceVersion ( uint16_t *  version_0,
uint16_t *  version_1,
uint16_t *  version_2,
uint16_t *  version_3 
) const
pure 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.

Implemented in crashpad::test::TestModuleSnapshot, crashpad::internal::ModuleSnapshotWin, crashpad::internal::ModuleSnapshotElf, crashpad::internal::ModuleSnapshotIOS, crashpad::internal::ModuleSnapshotMac, crashpad::internal::ModuleSnapshotMinidump, and crashpad::internal::ModuleSnapshotSanitized.

◆ Timestamp()

virtual time_t crashpad::ModuleSnapshot::Timestamp ( ) const
pure 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.

Implemented in crashpad::test::TestModuleSnapshot, crashpad::internal::ModuleSnapshotWin, crashpad::internal::ModuleSnapshotElf, crashpad::internal::ModuleSnapshotIOS, crashpad::internal::ModuleSnapshotMac, crashpad::internal::ModuleSnapshotMinidump, and crashpad::internal::ModuleSnapshotSanitized.

◆ UUIDAndAge()

virtual void crashpad::ModuleSnapshot::UUIDAndAge ( crashpad::UUID uuid,
uint32_t *  age 
) const
pure 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
BuildID()
DebugFileName()

Implemented in crashpad::internal::ModuleSnapshotIOS, crashpad::test::TestModuleSnapshot, crashpad::internal::ModuleSnapshotWin, crashpad::internal::ModuleSnapshotElf, crashpad::internal::ModuleSnapshotMac, crashpad::internal::ModuleSnapshotMinidump, and crashpad::internal::ModuleSnapshotSanitized.


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