Crashpad

Public Types | Public Member Functions | Static Public Member Functions | List of all members
crashpad::CrashpadInfo Struct Reference

A structure that can be used by a Crashpad-enabled program to provide information to the Crashpad crash handler. More...

`#include "client/crashpad_info.h"`

## Public Types
enum | : uint32_t

## Public Member Functions
void | set_extra_memory_ranges (SimpleAddressRangeBag *address_range_bag)
| Sets the bag of extra memory ranges to be included in the snapshot. More...
void | set_simple_annotations (SimpleStringDictionary *simple_annotations)
| Sets the simple annotations dictionary. More...
void | set_crashpad_handler_behavior (TriState crashpad_handler_behavior)
| Enables or disables Crashpad handler processing. More...
void | set_system_crash_reporter_forwarding (TriState system_crash_reporter_forwarding)
| Enables or disables Crashpad forwarding of exceptions to the system’s crash reporter. More...
void | set_gather_indirectly_referenced_memory (TriState gather_indirectly_referenced_memory, uint32_t limit)
| Enables or disables Crashpad capturing indirectly referenced memory in the minidump. More...
void | AddUserDataMinidumpStream (uint32_t stream_type, const void *data, size_t size)
| Adds a custom stream to the minidump. More...

## Static Public Member Functions
static CrashpadInfo * | GetCrashpadInfo ()
| Returns the global CrashpadInfo structure.

## Detailed Description

A structure that can be used by a Crashpad-enabled program to provide information to the Crashpad crash handler.

It is possible for one CrashpadInfo structure to appear in each loaded code module in a process, but from the perspective of the user of the client interface, there is only one global CrashpadInfo structure, located in the module that contains the client interface code.

## Member Function Documentation

## ◆ AddUserDataMinidumpStream()

void crashpad::CrashpadInfo::AddUserDataMinidumpStream | ( | uint32_t | stream_type,
|  | const void * | data,
|  | size_t | size
| ) |  |

Adds a custom stream to the minidump.

The memory block referenced by data and size will added to the minidump as separate stream with type stream_type. The memory referred to by data and size is owned by the caller and must remain valid while it is in effect for the CrashpadInfo object.

Note that streams will appear in the minidump in the reverse order to which they are added.

TODO(scottmg) This is currently only supported on Windows.

Parameters

  [in] | stream_type | The stream type identifier to use. This should be normally be larger than `MINIDUMP_STREAM_TYPE::LastReservedStream` which is `0xffff`.
  [in] | data | The base pointer of the stream data.
  [in] | size | The size of the stream data.

## ◆ set_crashpad_handler_behavior()

void crashpad::CrashpadInfo::set_crashpad_handler_behavior | ( | TriState | crashpad_handler_behavior | ) |
| inline

Enables or disables Crashpad handler processing.

When handling an exception, the Crashpad handler will scan all modules in a process. The first one that has a CrashpadInfo structure populated with a value other than kUnset for this field will dictate whether the handler is functional or not. If all modules with a CrashpadInfo structure specify kUnset, the handler will be enabled. If disabled, the Crashpad handler will still run and receive exceptions, but will not take any action on an exception on its own behalf, except for the action necessary to determine that it has been disabled.

The Crashpad handler should not normally be disabled. More commonly, it is appropriate to disable crash report upload by calling Settings::SetUploadsEnabled().

## ◆ set_extra_memory_ranges()

void crashpad::CrashpadInfo::set_extra_memory_ranges | ( | SimpleAddressRangeBag * | address_range_bag | ) |
| inline

Sets the bag of extra memory ranges to be included in the snapshot.

Extra memory ranges may exist in address_range_bag at the time that this method is called, or they may be added, removed, or modified in address_range_bag after this method is called.

TODO(scottmg) This is currently only supported on Windows.

Parameters

  [in] | address_range_bag | A bag of address ranges. The CrashpadInfo object does not take ownership of the SimpleAddressRangeBag object. It is the caller’s responsibility to ensure that this pointer remains valid while it is in effect for a CrashpadInfo object.

## ◆ set_gather_indirectly_referenced_memory()

void crashpad::CrashpadInfo::set_gather_indirectly_referenced_memory | ( | TriState | gather_indirectly_referenced_memory,
|  | uint32_t | limit
| ) |  |
| inline

Enables or disables Crashpad capturing indirectly referenced memory in the minidump.

When handling an exception, the Crashpad handler will scan all modules in a process. The first one that has a CrashpadInfo structure populated with a value other than kUnset for this field will dictate whether the extra memory is captured.

This causes Crashpad to include pages of data referenced by locals or other stack memory. Turning this on can increase the size of the minidump significantly.

Parameters

  [in] | gather_indirectly_referenced_memory | Whether extra memory should be gathered.
  [in] | limit | The amount of memory in bytes after which no more indirectly gathered memory should be captured. This value is only used when gather_indirectly_referenced_memory is TriState::kEnabled.

## ◆ set_simple_annotations()

void crashpad::CrashpadInfo::set_simple_annotations | ( | SimpleStringDictionary * | simple_annotations | ) |
| inline

Sets the simple annotations dictionary.

Simple annotations set on a CrashpadInfo structure are interpreted by Crashpad as module-level annotations.

Annotations may exist in simple_annotations at the time that this method is called, or they may be added, removed, or modified in simple_annotations after this method is called.

Parameters

  [in] | simple_annotations | A dictionary that maps string keys to string values. The CrashpadInfo object does not take ownership of the SimpleStringDictionary object. It is the caller’s responsibility to ensure that this pointer remains valid while it is in effect for a CrashpadInfo object.

## ◆ set_system_crash_reporter_forwarding()

void crashpad::CrashpadInfo::set_system_crash_reporter_forwarding | ( | TriState | system_crash_reporter_forwarding | ) |
| inline

Enables or disables Crashpad forwarding of exceptions to the system’s crash reporter.

When handling an exception, the Crashpad handler will scan all modules in a process. The first one that has a CrashpadInfo structure populated with a value other than kUnset for this field will dictate whether the exception is forwarded to the system’s crash reporter. If all modules with a CrashpadInfo structure specify kUnset, forwarding will be enabled. Unless disabled, forwarding may still occur if the Crashpad handler is disabled by SetCrashpadHandlerState(). Even when forwarding is enabled, the Crashpad handler may choose not to forward all exceptions to the system’s crash reporter in cases where it has reason to believe that the system’s crash reporter would not normally have handled the exception in Crashpad’s absence.

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

- client/crashpad_info.h
- client/crashpad_info.cc