Crashpad
 
Loading...
Searching...
No Matches
crashpad::internal::InProcessHandler Class Reference

Manage intermediate minidump generation, and own the crash report upload thread and database. More...

#include "client/ios_handler/in_process_handler.h"

Public Types

using ProcessPendingReportsObservationCallback = std::function<void()>
 Observation callback invoked each time this object finishes processing and attempting to upload on-disk crash reports (whether or not the uploads succeeded).
 

Public Member Functions

 InProcessHandler (const InProcessHandler &)=delete
 
InProcessHandleroperator= (const InProcessHandler &)=delete
 
bool Initialize (const base::FilePath &database, const std::string &url, const std::map< std::string, std::string > &annotations, ProcessPendingReportsObservationCallback callback=ProcessPendingReportsObservationCallback())
 Initializes the in-process handler.
 
void DumpExceptionFromSignal (siginfo_t *siginfo, ucontext_t *context)
 Generate an intermediate dump from a signal handler exception. Writes the dump with the cached writer does not allow concurrent exceptions to be written. It is expected the system will terminate the application after this call.
 
void DumpExceptionFromMachException (exception_behavior_t behavior, thread_t thread, 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)
 Generate an intermediate dump from a mach exception. Writes the dump with the cached writer does not allow concurrent exceptions to be written. It is expected the system will terminate the application after this call.
 
void DumpExceptionFromNSExceptionWithFrames (const uint64_t *frames, const size_t num_frames)
 Generate an intermediate dump from an uncaught NSException.
 
bool DumpExceptionFromSimulatedMachException (const NativeCPUContext *context, exception_type_t exception, base::FilePath *path)
 Generate a simulated intermediate dump similar to a Mach exception in the same base directory as other exceptions. Does not use the cached writer.
 
bool DumpExceptionFromSimulatedMachExceptionAtPath (const NativeCPUContext *context, exception_type_t exception, const base::FilePath &path)
 Generate a simulated intermediate dump similar to a Mach exception at a specific path. Does not use the cached writer.
 
bool MoveIntermediateDumpAtPathToPending (const base::FilePath &path)
 Moves an intermediate dump to the pending directory. This is meant to be used by the UncaughtExceptionHandler, when NSException caught by the preprocessor matches the UncaughtExceptionHandler.
 
void ProcessIntermediateDumps (const std::map< std::string, std::string > &annotations)
 Requests that the handler convert all intermediate dumps into minidumps and trigger an upload if possible.
 
void ProcessIntermediateDump (const base::FilePath &path, const std::map< std::string, std::string > &annotations={})
 Requests that the handler convert a specific intermediate dump into a minidump and trigger an upload if possible.
 
void StartProcessingPendingReports (UploadBehavior upload_behavior=UploadBehavior::kUploadWhenAppIsActive)
 Requests that the handler begin in-process uploading of any pending reports.
 
void SetMachExceptionCallbackForTesting (void(*callback)())
 Inject a callback into Mach handling. Intended to be used by tests to trigger a reentrant exception.
 

Detailed Description

Manage intermediate minidump generation, and own the crash report upload thread and database.

Member Typedef Documentation

◆ ProcessPendingReportsObservationCallback

Observation callback invoked each time this object finishes processing and attempting to upload on-disk crash reports (whether or not the uploads succeeded).

This callback is copied into this object. Any references or pointers inside must outlive this object.

The callback might be invoked on a background thread, so clients must synchronize appropriately.

Member Function Documentation

◆ DumpExceptionFromMachException()

void crashpad::internal::InProcessHandler::DumpExceptionFromMachException ( exception_behavior_t behavior,
thread_t thread,
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 )

Generate an intermediate dump from a mach exception. Writes the dump with the cached writer does not allow concurrent exceptions to be written. It is expected the system will terminate the application after this call.

Parameters
[in]behavior
[in]thread
[in]exception
[in]code
[in]code_count
[in,out]flavor
[in]old_state
[in]old_state_count

◆ DumpExceptionFromNSExceptionWithFrames()

void crashpad::internal::InProcessHandler::DumpExceptionFromNSExceptionWithFrames ( const uint64_t * frames,
const size_t num_frames )

Generate an intermediate dump from an uncaught NSException.

When the ObjcExceptionPreprocessor does not detect an NSException as it is thrown, the last-chance uncaught exception handler passes a list of call stack frame addresses. Record them in the intermediate dump so a minidump with a 'fake' call stack is generated. Writes the dump with the cached writer does not allow concurrent exceptions to be written. It is expected the system will terminate the application after this call.

Parameters
[in]framesAn array of call stack frame addresses.
[in]num_framesThe number of frames in |frames|.

◆ DumpExceptionFromSignal()

void crashpad::internal::InProcessHandler::DumpExceptionFromSignal ( siginfo_t * siginfo,
ucontext_t * context )

Generate an intermediate dump from a signal handler exception. Writes the dump with the cached writer does not allow concurrent exceptions to be written. It is expected the system will terminate the application after this call.

Parameters
[in]siginfoA pointer to a siginfo_t object received by a signal handler.
[in]contextA pointer to a ucontext_t object received by a signal.

◆ DumpExceptionFromSimulatedMachException()

bool crashpad::internal::InProcessHandler::DumpExceptionFromSimulatedMachException ( const NativeCPUContext * context,
exception_type_t exception,
base::FilePath * path )

Generate a simulated intermediate dump similar to a Mach exception in the same base directory as other exceptions. Does not use the cached writer.

Parameters
[in]contextA pointer to a NativeCPUContext object for this simulated exception.
[in]exception
[out]pathThe path of the intermediate dump generated.
Returns
true if the pending intermediate dump could be written.

◆ DumpExceptionFromSimulatedMachExceptionAtPath()

bool crashpad::internal::InProcessHandler::DumpExceptionFromSimulatedMachExceptionAtPath ( const NativeCPUContext * context,
exception_type_t exception,
const base::FilePath & path )

Generate a simulated intermediate dump similar to a Mach exception at a specific path. Does not use the cached writer.

Parameters
[in]contextA pointer to a NativeCPUContext object for this simulated exception.
[in]exception
[in]pathPath to where the intermediate dump should be written.
Returns
true if the pending intermediate dump could be written.

◆ Initialize()

bool crashpad::internal::InProcessHandler::Initialize ( const base::FilePath & database,
const std::string & url,
const std::map< std::string, std::string > & annotations,
ProcessPendingReportsObservationCallback callback = ProcessPendingReportsObservationCallback() )

Initializes the in-process handler.

This method must be called only once, and must be successfully called before any other method in this class may be called.

Parameters
[in]databaseThe path to a Crashpad database.
[in]urlThe URL of an upload server.
[in]annotationsProcess annotations to set in each crash report.
[in]callbackOptional callback invoked zero or more times on a background thread each time this object finishes processing and attempting to upload on-disk crash reports.
Returns
true if a handler to a pending intermediate dump could be opened.

◆ MoveIntermediateDumpAtPathToPending()

bool crashpad::internal::InProcessHandler::MoveIntermediateDumpAtPathToPending ( const base::FilePath & path)

Moves an intermediate dump to the pending directory. This is meant to be used by the UncaughtExceptionHandler, when NSException caught by the preprocessor matches the UncaughtExceptionHandler.

Parameters
[in]pathPath to the specific intermediate dump.

◆ ProcessIntermediateDump()

void crashpad::internal::InProcessHandler::ProcessIntermediateDump ( const base::FilePath & path,
const std::map< std::string, std::string > & annotations = {} )

Requests that the handler convert a specific intermediate dump into a minidump and trigger an upload if possible.

Parameters
[in]pathPath to the specific intermediate dump.
[in]annotationsProcess annotations to set in each crash report.

◆ ProcessIntermediateDumps()

void crashpad::internal::InProcessHandler::ProcessIntermediateDumps ( const std::map< std::string, std::string > & annotations)

Requests that the handler convert all intermediate dumps into minidumps and trigger an upload if possible.

Parameters
[in]annotationsProcess annotations to set in each crash report.

◆ StartProcessingPendingReports()

void crashpad::internal::InProcessHandler::StartProcessingPendingReports ( UploadBehavior upload_behavior = UploadBehavior::kUploadWhenAppIsActive)

Requests that the handler begin in-process uploading of any pending reports.

Parameters
[in]upload_behaviorControls when the upload thread will run and process pending reports. By default, only uploads pending reports when the application is active.

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