Crashpad
Public Member Functions | List of all members
crashpad::CrashReportExceptionHandler Class Reference

An exception handler that writes crash reports for exceptions to a CrashReportDatabase. More...

#include "handler/win/crash_report_exception_handler.h"

Inheritance diagram for crashpad::CrashReportExceptionHandler:
crashpad::ExceptionHandlerServer::Delegate

Public Member Functions

 CrashReportExceptionHandler (CrashReportDatabase *database, CrashReportUploadThread *upload_thread, const std::map< std::string, std::string > *process_annotations, bool write_minidump_to_database, bool write_minidump_to_log, const UserStreamDataSources *user_stream_data_sources)
 Creates a new object that will store crash reports in database. More...
 
bool HandleException (pid_t client_process_id, uid_t client_uid, const ExceptionHandlerProtocol::ClientInformation &info, VMAddress requesting_thread_stack_address=0, pid_t *requesting_thread_id=nullptr, UUID *local_report_id=nullptr) override
 Called on receipt of a crash dump request from a client. More...
 
bool HandleExceptionWithBroker (pid_t client_process_id, uid_t client_uid, const ExceptionHandlerProtocol::ClientInformation &info, int broker_sock, UUID *local_report_id=nullptr) override
 Called on the receipt of a crash dump request from a client for a crash that should be mediated by a PtraceBroker. More...
 
 CrashReportExceptionHandler (CrashReportDatabase *database, CrashReportUploadThread *upload_thread, const std::map< std::string, std::string > *process_annotations, const UserStreamDataSources *user_stream_data_sources)
 Creates a new object that will store crash reports in database. More...
 
kern_return_t CatchMachException (exception_behavior_t behavior, exception_handler_t exception_port, thread_t thread, task_t task, exception_type_t exception, const mach_exception_data_type_t *code, mach_msg_type_number_t code_count, thread_state_flavor_t *flavor, ConstThreadState old_state, mach_msg_type_number_t old_state_count, thread_state_t new_state, mach_msg_type_number_t *new_state_count, const mach_msg_trailer_t *trailer, bool *destroy_complex_request) override
 Processes an exception message by writing a crash report to this object’s CrashReportDatabase.
 
 CrashReportExceptionHandler (CrashReportDatabase *database, CrashReportUploadThread *upload_thread, const std::map< std::string, std::string > *process_annotations, const UserStreamDataSources *user_stream_data_sources)
 Creates a new object that will store crash reports in database. More...
 
void ExceptionHandlerServerStarted () override
 Processes an exception message by writing a crash report to this object's CrashReportDatabase.
 
unsigned int ExceptionHandlerServerException (HANDLE process, WinVMAddress exception_information_address, WinVMAddress debug_critical_section_address) override
 Called when the client has signalled that it has encountered an exception and so wants a crash dump to be taken. More...
 

Detailed Description

An exception handler that writes crash reports for exceptions to a CrashReportDatabase.

An exception handler that writes crash reports for exception messages to a CrashReportDatabase.

Constructor & Destructor Documentation

◆ CrashReportExceptionHandler() [1/3]

crashpad::CrashReportExceptionHandler::CrashReportExceptionHandler ( CrashReportDatabase database,
CrashReportUploadThread upload_thread,
const std::map< std::string, std::string > *  process_annotations,
bool  write_minidump_to_database,
bool  write_minidump_to_log,
const UserStreamDataSources *  user_stream_data_sources 
)

Creates a new object that will store crash reports in database.

Parameters
[in]databaseThe database to store crash reports in. Weak.
[in]upload_threadThe upload thread to notify when a new crash report is written into database. Report upload is skipped if this value is nullptr.
[in]process_annotationsA map of annotations to insert as process-level annotations into each crash report that is written. Do not confuse this with module-level annotations, which are under the control of the crashing process, and are used to implement Chrome’s “crash keys.” Process-level annotations are those that are beyond the control of the crashing process, which must reliably be set even if the process crashes before it’s able to establish its own annotations. To interoperate with Breakpad servers, the recommended practice is to specify values for the "prod" and "ver" keys as process annotations.
[in]write_minidump_to_databaseWhether the minidump shall be written to database.
[in]write_minidump_to_logWhether the minidump shall be written to log.
[in]user_stream_data_sourcesData sources to be used to extend crash reports. For each crash report that is written, the data sources are called in turn. These data sources may contribute additional minidump streams. nullptr if not required.

◆ CrashReportExceptionHandler() [2/3]

crashpad::CrashReportExceptionHandler::CrashReportExceptionHandler ( CrashReportDatabase database,
CrashReportUploadThread upload_thread,
const std::map< std::string, std::string > *  process_annotations,
const UserStreamDataSources *  user_stream_data_sources 
)

Creates a new object that will store crash reports in database.

Parameters
[in]databaseThe database to store crash reports in. Weak.
[in]upload_threadThe upload thread to notify when a new crash report is written into database. Report upload is skipped if this value is nullptr.
[in]process_annotationsA map of annotations to insert as process-level annotations into each crash report that is written. Do not confuse this with module-level annotations, which are under the control of the crashing process, and are used to implement Chrome’s “crash keys.” Process-level annotations are those that are beyond the control of the crashing process, which must reliably be set even if the process crashes before it’s able to establish its own annotations. To interoperate with Breakpad servers, the recommended practice is to specify values for the "prod" and "ver" keys as process annotations.
[in]user_stream_data_sourcesData sources to be used to extend crash reports. For each crash report that is written, the data sources are called in turn. These data sources may contribute additional minidump streams. nullptr if not required.

◆ CrashReportExceptionHandler() [3/3]

crashpad::CrashReportExceptionHandler::CrashReportExceptionHandler ( CrashReportDatabase database,
CrashReportUploadThread upload_thread,
const std::map< std::string, std::string > *  process_annotations,
const UserStreamDataSources *  user_stream_data_sources 
)

Creates a new object that will store crash reports in database.

Parameters
[in]databaseThe database to store crash reports in. Weak.
[in]upload_threadThe upload thread to notify when a new crash report is written into database. Report upload is skipped if this value is nullptr.
[in]process_annotationsA map of annotations to insert as process-level annotations into each crash report that is written. Do not confuse this with module-level annotations, which are under the control of the crashing process, and are used to implement Chrome's "crash keys." Process-level annotations are those that are beyond the control of the crashing process, which must reliably be set even if the process crashes before it's able to establish its own annotations. To interoperate with Breakpad servers, the recommended practice is to specify values for the "prod" and "ver" keys as process annotations.
[in]user_stream_data_sourcesData sources to be used to extend crash reports. For each crash report that is written, the data sources are called in turn. These data sources may contribute additional minidump streams. nullptr if not required.

Member Function Documentation

◆ ExceptionHandlerServerException()

unsigned int crashpad::CrashReportExceptionHandler::ExceptionHandlerServerException ( HANDLE  process,
WinVMAddress  exception_information_address,
WinVMAddress  debug_critical_section_address 
)
overridevirtual

Called when the client has signalled that it has encountered an exception and so wants a crash dump to be taken.

Parameters
[in]processA handle to the client process. Ownership of the lifetime of this handle is not passed to the delegate.
[in]exception_information_addressThe address in the client's address space of an ExceptionInformation structure.
[in]debug_critical_section_addressThe address in the client's address space of a CRITICAL_SECTION allocated with a valid .DebugInfo field, or 0 if unavailable.
Returns
The exit code that should be used when terminating the client process.

Implements crashpad::ExceptionHandlerServer::Delegate.

◆ HandleException()

bool crashpad::CrashReportExceptionHandler::HandleException ( pid_t  client_process_id,
uid_t  client_uid,
const ExceptionHandlerProtocol::ClientInformation info,
VMAddress  requesting_thread_stack_address = 0,
pid_t *  requesting_thread_id = nullptr,
UUID local_report_id = nullptr 
)
overridevirtual

Called on receipt of a crash dump request from a client.

Parameters
[in]client_process_idThe process ID of the crashing client.
[in]client_uidThe user ID of the crashing client.
[in]infoInformation on the client.
[in]requesting_thread_stack_addressAny address within the stack range for the the thread that sent the crash dump request. Optional. If unspecified or 0, requesting_thread_id will be -1.
[out]requesting_thread_idThe thread ID of the thread which requested the crash dump if not nullptr. Set to -1 if the thread ID could not be determined. Optional.
[out]local_report_idThe unique identifier for the report created in the local report database. Optional.
Returns
true on success. false on failure with a message logged.

Implements crashpad::ExceptionHandlerServer::Delegate.

◆ HandleExceptionWithBroker()

bool crashpad::CrashReportExceptionHandler::HandleExceptionWithBroker ( pid_t  client_process_id,
uid_t  client_uid,
const ExceptionHandlerProtocol::ClientInformation info,
int  broker_sock,
UUID local_report_id = nullptr 
)
overridevirtual

Called on the receipt of a crash dump request from a client for a crash that should be mediated by a PtraceBroker.

Parameters
[in]client_process_idThe process ID of the crashing client.
[in]client_uidThe uid of the crashing client.
[in]infoInformation on the client.
[in]broker_sockA socket connected to the PtraceBroker.
[out]local_report_idThe unique identifier for the report created in the local report database. Optional.
Returns
true on success. false on failure with a message logged.

Implements crashpad::ExceptionHandlerServer::Delegate.


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