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

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

#include "handler/win/crash_report_exception_handler.h"

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

Public Member Functions

 CrashReportExceptionHandler (CrashReportDatabase *database, CrashReportUploadThread *upload_thread, const std::map< std::string, std::string > *process_annotations, const std::map< std::string, base::FilePath > *process_attachments, const UserStreamDataSources *user_stream_data_sources)
 Creates a new object that will store crash reports in database. More...
 
bool HandleException (uint64_t process_id, uint64_t thread_id)
 Called when the exception handler server has caught an exception and wants a crash dump to be taken. More...
 
bool HandleExceptionHandles (zx_handle_t process, zx_handle_t thread)
 Called when the exception handler server has caught an exception and wants a crash dump to be taken. 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...
 
bool HandleException (pid_t client_process_id, const ClientInformation &info) override
 Called on receipt of a crash dump request from a client. More...
 
bool HandleExceptionWithBroker (pid_t client_process_id, const ClientInformation &info, int broker_sock) 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 exception messages to a CrashReportDatabase.

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

Constructor & Destructor Documentation

◆ CrashReportExceptionHandler() [1/4]

crashpad::CrashReportExceptionHandler::CrashReportExceptionHandler ( CrashReportDatabase database,
CrashReportUploadThread upload_thread,
const std::map< std::string, std::string > *  process_annotations,
const std::map< std::string, base::FilePath > *  process_attachments,
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.
[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]process_attachmentsA map of file name keys to file paths to be included in the report. Each time a report is written, the file paths will be read in their entirety and included in the report using the file name key as the name in the http upload.
[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/4]

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/4]

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() [4/4]

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() [1/2]

bool crashpad::CrashReportExceptionHandler::HandleException ( pid_t  client_process_id,
const ClientInformation info 
)
overridevirtual

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

Parameters
[in]client_process_idThe process ID of the crashing client.
[in]infoInformation on the client.
Returns
true on success. false on failure with a message logged.

Implements crashpad::ExceptionHandlerServer::Delegate.

◆ HandleException() [2/2]

bool crashpad::CrashReportExceptionHandler::HandleException ( uint64_t  process_id,
uint64_t  thread_id 
)

Called when the exception handler server has caught an exception and wants a crash dump to be taken.

This function is expected to call zx_task_resume() in order to complete handling of the exception.

Parameters
[in]process_idThe koid of the process which sustained the exception.
[in]thread_idThe koid of the thread which sustained the exception.
Returns
true on success, or false with an error logged.

◆ HandleExceptionHandles()

bool crashpad::CrashReportExceptionHandler::HandleExceptionHandles ( zx_handle_t  process,
zx_handle_t  thread 
)

Called when the exception handler server has caught an exception and wants a crash dump to be taken.

This function is expected to call zx_task_resume() in order to complete handling of the exception.

Parameters
[in]processThe handle to the process which sustained the exception.
[in]threadThe handle to the thread of process which sustained the exception.
Returns
true on success, or false with an error logged.

◆ HandleExceptionWithBroker()

bool crashpad::CrashReportExceptionHandler::HandleExceptionWithBroker ( pid_t  client_process_id,
const ClientInformation info,
int  broker_sock 
)
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]infoInformation on the client.
[in]broker_sockA socket connected to the PtraceBroker.
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: