Crashpad
Public Types | Public Member Functions | Static Public Member Functions | List of all members
crashpad::CrashpadClient Class Reference

The primary interface for an application to have Crashpad monitor it for crashes. More...

#include "client/crashpad_client.h"

Public Types

enum  : uint32_t
 
using FirstChanceHandler = bool(*)(int, siginfo_t *, ucontext_t *)
 The type for custom handlers installed by clients.
 

Public Member Functions

bool StartHandler (const base::FilePath &handler, const base::FilePath &database, const base::FilePath &metrics_dir, const std::string &url, const std::map< std::string, std::string > &annotations, const std::vector< std::string > &arguments, bool restartable, bool asynchronous_start)
 Starts a Crashpad handler process, performing any necessary handshake to configure it. More...
 
bool SetHandlerSocket (ScopedFileHandle sock, pid_t pid)
 Sets the socket to a presumably-running Crashpad handler process which was started with StartHandler(). More...
 
bool StartJavaHandlerAtCrash (const std::string &class_name, const std::vector< std::string > *env, const base::FilePath &database, const base::FilePath &metrics_dir, const std::string &url, const std::map< std::string, std::string > &annotations, const std::vector< std::string > &arguments)
 Installs a signal handler to execute /system/bin/app_process and load a Java class in response to a crash. More...
 
bool StartHandlerWithLinkerAtCrash (const std::string &handler_trampoline, const std::string &handler_library, bool is_64_bit, const std::vector< std::string > *env, const base::FilePath &database, const base::FilePath &metrics_dir, const std::string &url, const std::map< std::string, std::string > &annotations, const std::vector< std::string > &arguments)
 Installs a signal handler to start a Crashpad handler process by loading it with /system/bin/linker. More...
 
bool StartHandlerAtCrash (const base::FilePath &handler, const base::FilePath &database, const base::FilePath &metrics_dir, const std::string &url, const std::map< std::string, std::string > &annotations, const std::vector< std::string > &arguments)
 Installs a signal handler to launch a handler process in reponse to a crash. More...
 
void SetUnhandledSignals (const std::set< int > &unhandled_signals)
 Configures a set of signals that shouldn't have Crashpad signal handlers installed. More...
 
void StartCrashpadInProcessHandler ()
 Configures the process to direct its crashes to the iOS in-process Crashpad handler. More...
 
bool SetHandlerMachService (const std::string &service_name)
 Sets the process’ crash handler to a Mach service registered with the bootstrap server. More...
 
bool SetHandlerMachPort (base::mac::ScopedMachSendRight exception_port)
 Sets the process’ crash handler to a Mach port. More...
 
base::mac::ScopedMachSendRight GetHandlerMachPort () const
 Retrieves a send right to the process’ crash handler Mach port. More...
 
bool SetHandlerIPCPipe (const std::wstring &ipc_pipe)
 Sets the IPC pipe of a presumably-running Crashpad handler process which was started with StartHandler() or by other compatible means and does an IPC message exchange to register this process with the handler. Crashes will be serviced once this method returns. More...
 
std::wstring GetHandlerIPCPipe () const
 Retrieves the IPC pipe name used to register with the Crashpad handler. More...
 
bool WaitForHandlerStart (unsigned int timeout_ms)
 When asynchronous_start is used with StartHandler(), this method can be used to block until the handler launch has been completed to retrieve status information. More...
 

Static Public Member Functions

static bool GetHandlerSocket (int *sock, pid_t *pid)
 Retrieve the socket and process ID for the handler. More...
 
static bool StartJavaHandlerForClient (const std::string &class_name, const std::vector< std::string > *env, const base::FilePath &database, const base::FilePath &metrics_dir, const std::string &url, const std::map< std::string, std::string > &annotations, const std::vector< std::string > &arguments, int socket)
 Executes /system/bin/app_process and loads a Java class. More...
 
static bool StartHandlerWithLinkerForClient (const std::string &handler_trampoline, const std::string &handler_library, bool is_64_bit, const std::vector< std::string > *env, const base::FilePath &database, const base::FilePath &metrics_dir, const std::string &url, const std::map< std::string, std::string > &annotations, const std::vector< std::string > &arguments, int socket)
 Starts a Crashpad handler process with an initial client by loading it with /system/bin/linker. More...
 
static bool StartHandlerForClient (const base::FilePath &handler, const base::FilePath &database, const base::FilePath &metrics_dir, const std::string &url, const std::map< std::string, std::string > &annotations, const std::vector< std::string > &arguments, int socket)
 Starts a handler process with an initial client. More...
 
static void DumpWithoutCrash (NativeCPUContext *context)
 Requests that the handler capture a dump even though there hasn't been a crash. More...
 
static void CrashWithoutDump (const std::string &message)
 Disables any installed crash handler, including any FirstChanceHandler and crashes the current process. More...
 
static void SetFirstChanceExceptionHandler (FirstChanceHandler handler)
 Installs a custom crash signal handler which runs before the currently installed Crashpad handler. More...
 
static void DumpWithoutCrash (NativeCPUContext *context)
 Requests that the handler capture a dump even though there hasn't been a crash. More...
 
static void DumpWithoutCrash (const CONTEXT &context)
 Requests that the handler capture a dump even though there hasn't been a crash. More...
 
static void DumpAndCrash (EXCEPTION_POINTERS *exception_pointers)
 Requests that the handler capture a dump using the given exception_pointers to get the EXCEPTION_RECORD and CONTEXT. More...
 
static bool DumpAndCrashTargetProcess (HANDLE process, HANDLE blame_thread, DWORD exception_code)
 Requests that the handler capture a dump of a different process. More...
 
static void UseSystemDefaultHandler ()
 Configures the process to direct its crashes to the default handler for the operating system. More...
 

Detailed Description

The primary interface for an application to have Crashpad monitor it for crashes.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum : uint32_t
Enumerator
kTriggeredExceptionCode 

The exception code (roughly "Client called") used when DumpAndCrashTargetProcess() triggers an exception in a target process.

Note
This value does not have any bits of the top nibble set, to avoid confusion with real exception codes which tend to have those bits set.

Member Function Documentation

◆ CrashWithoutDump()

void crashpad::CrashpadClient::CrashWithoutDump ( const std::string &  message)
static

Disables any installed crash handler, including any FirstChanceHandler and crashes the current process.

Parameters
[in]messageA message to be logged before crashing.

◆ DumpAndCrash()

void crashpad::CrashpadClient::DumpAndCrash ( EXCEPTION_POINTERS *  exception_pointers)
static

Requests that the handler capture a dump using the given exception_pointers to get the EXCEPTION_RECORD and CONTEXT.

This function is not necessary in general usage as an unhandled exception filter is installed by StartHandler() or SetHandlerIPCPipe().

Parameters
[in]exception_pointersAn EXCEPTION_POINTERS, as would generally passed to an unhandled exception filter.

◆ DumpAndCrashTargetProcess()

bool crashpad::CrashpadClient::DumpAndCrashTargetProcess ( HANDLE  process,
HANDLE  blame_thread,
DWORD  exception_code 
)
static

Requests that the handler capture a dump of a different process.

The target process must be an already-registered Crashpad client. An exception will be triggered in the target process, and the regular dump mechanism used. This function will block until the exception in the target process has been handled by the Crashpad handler.

This function is unavailable when running on Windows XP and will return false.

Parameters
[in]processA HANDLE identifying the process to be dumped.
[in]blame_threadIf non-null, a HANDLE valid in the caller's process, referring to a thread in the target process. If this is supplied, instead of the exception referring to the location where the exception was injected, an exception record will be fabricated that refers to the current location of the given thread.
[in]exception_codeIf blame_thread is non-null, this will be used as the exception code in the exception record.
Returns
true if the exception was triggered successfully.

◆ DumpWithoutCrash() [1/3]

void crashpad::CrashpadClient::DumpWithoutCrash ( const CONTEXT &  context)
static

Requests that the handler capture a dump even though there hasn't been a crash.

Parameters
[in]contextA CONTEXT, generally captured by CaptureContext() or similar.

◆ DumpWithoutCrash() [2/3]

void crashpad::CrashpadClient::DumpWithoutCrash ( NativeCPUContext *  context)
static

Requests that the handler capture a dump even though there hasn't been a crash.

A handler must have already been installed before calling this method.

TODO(jperaza): Floating point information in the context is zeroed out until CaptureContext() supports collecting that information.

Parameters
[in]contextA NativeCPUContext, generally captured by CaptureContext() or similar.

◆ DumpWithoutCrash() [3/3]

static void crashpad::CrashpadClient::DumpWithoutCrash ( NativeCPUContext *  context)
static

Requests that the handler capture a dump even though there hasn't been a crash.

A handler must have already been installed before calling this method.

Parameters
[in]contextA NativeCPUContext, generally captured by CaptureContext() or similar.

◆ GetHandlerIPCPipe()

std::wstring crashpad::CrashpadClient::GetHandlerIPCPipe ( ) const

Retrieves the IPC pipe name used to register with the Crashpad handler.

This method is only defined on Windows.

This method retrieves the IPC pipe name set by SetHandlerIPCPipe(), or a suitable IPC pipe name chosen by StartHandler(). It must only be called after a successful call to one of those methods. It is intended to be used to obtain the IPC pipe name so that it may be passed to other processes, so that they may register with an existing Crashpad handler by calling SetHandlerIPCPipe().

Returns
The full name of the crash handler IPC pipe, a string of the form "\\.\pipe\NAME".

◆ GetHandlerMachPort()

base::mac::ScopedMachSendRight crashpad::CrashpadClient::GetHandlerMachPort ( ) const

Retrieves a send right to the process’ crash handler Mach port.

This method is only defined on macOS.

This method can be used to obtain the crash handler Mach port when a Crashpad client process wishes to provide a send right to this port to another process. The IPC mechanism used to convey the right is under the application’s control. If the other process wishes to become a client of the same crash handler, it can provide the transferred right to SetHandlerMachPort().

See StartHandler() for more detail on how the port and handler are configured.

Returns
The Mach port set by SetHandlerMachPort(), possibly indirectly by a call to another method such as StartHandler() or SetHandlerMachService(). This method must only be called after a successful call to one of those methods. MACH_PORT_NULL on failure with a message logged.

◆ GetHandlerSocket()

static bool crashpad::CrashpadClient::GetHandlerSocket ( int *  sock,
pid_t *  pid 
)
static

Retrieve the socket and process ID for the handler.

StartHandler() must have successfully been called before calling this method.

Parameters
[out]sockThe socket connected to the handler, if not nullptr.
[out]pidThe handler's process ID, if not nullptr.
Returns
true on success. Otherwise false with a message logged.

◆ SetFirstChanceExceptionHandler()

void crashpad::CrashpadClient::SetFirstChanceExceptionHandler ( FirstChanceHandler  handler)
static

Installs a custom crash signal handler which runs before the currently installed Crashpad handler.

Handling signals appropriately can be tricky and use of this method should be avoided, if possible.

A handler must have already been installed before calling this method.

The custom handler runs in a signal handler context and must be safe for that purpose.

If the custom handler returns true, the signal is considered handled and the signal handler returns. Otherwise, the currently installed Crashpad signal handler is run.

Parameters
[in]handlerThe custom crash signal handler to install.

◆ SetHandlerIPCPipe()

bool crashpad::CrashpadClient::SetHandlerIPCPipe ( const std::wstring &  ipc_pipe)

Sets the IPC pipe of a presumably-running Crashpad handler process which was started with StartHandler() or by other compatible means and does an IPC message exchange to register this process with the handler. Crashes will be serviced once this method returns.

This method is only defined on Windows.

This method sets the unhandled exception handler to a local function that when reached will "signal and wait" for the crash handler process to create the dump.

Parameters
[in]ipc_pipeThe full name of the crash handler IPC pipe. This is a string of the form "\\.\pipe\NAME".
Returns
true on success and false on failure.

◆ SetHandlerMachPort()

bool crashpad::CrashpadClient::SetHandlerMachPort ( base::mac::ScopedMachSendRight  exception_port)

Sets the process’ crash handler to a Mach port.

This method is only defined on macOS.

See StartHandler() for more detail on how the port and handler are configured.

Parameters
[in]exception_portAn exception_port_t corresponding to a Crashpad exception handler service.
Returns
true on success, false on failure with a message logged.

◆ SetHandlerMachService()

bool crashpad::CrashpadClient::SetHandlerMachService ( const std::string &  service_name)

Sets the process’ crash handler to a Mach service registered with the bootstrap server.

This method is only defined on macOS.

See StartHandler() for more detail on how the port and handler are configured.

Parameters
[in]service_nameThe service name of a Crashpad exception handler service previously registered with the bootstrap server.
Returns
true on success, false on failure with a message logged.

◆ SetHandlerSocket()

bool crashpad::CrashpadClient::SetHandlerSocket ( ScopedFileHandle  sock,
pid_t  pid 
)

Sets the socket to a presumably-running Crashpad handler process which was started with StartHandler().

This method installs a signal handler to request crash dumps on sock.

Parameters
[in]sockA socket connected to a Crashpad handler.
[in]pidThe process ID of the handler, used to set the handler as this process' ptracer. 0 indicates it is not necessary to set the handler as this process' ptracer. -1 indicates that the handler's process ID should be determined by communicating over the socket.

◆ SetUnhandledSignals()

void crashpad::CrashpadClient::SetUnhandledSignals ( const std::set< int > &  unhandled_signals)

Configures a set of signals that shouldn't have Crashpad signal handlers installed.

This method should be called before calling StartHandler(), SetHandlerSocket(), or other methods that install Crashpad signal handlers.

Parameters
[in]unhandled_signalsThe set of unhandled signals

◆ StartCrashpadInProcessHandler()

void crashpad::CrashpadClient::StartCrashpadInProcessHandler ( )

Configures the process to direct its crashes to the iOS in-process Crashpad handler.

This method is only defined on iOS.

TODO(justincohen): This method will need to take database, metrics_dir, url and annotations eventually.

◆ StartHandler()

bool crashpad::CrashpadClient::StartHandler ( const base::FilePath &  handler,
const base::FilePath &  database,
const base::FilePath &  metrics_dir,
const std::string &  url,
const std::map< std::string, std::string > &  annotations,
const std::vector< std::string > &  arguments,
bool  restartable,
bool  asynchronous_start 
)

Starts a Crashpad handler process, performing any necessary handshake to configure it.

This method directs crashes to the Crashpad handler. On macOS, this is applicable to this process and all subsequent child processes. On Windows, child processes must also register by using SetHandlerIPCPipe().

On macOS, this method starts a Crashpad handler and obtains a Mach send right corresponding to a receive right held by the handler process. The handler process runs an exception server on this port. This method sets the task’s exception port for EXC_CRASH, EXC_RESOURCE, and EXC_GUARD exceptions to the Mach send right obtained. The handler will be installed with behavior EXCEPTION_STATE_IDENTITY | MACH_EXCEPTION_CODES and thread state flavor MACHINE_THREAD_STATE. Exception ports are inherited, so a Crashpad handler started here will remain the handler for any child processes created after StartHandler() is called. These child processes do not need to call StartHandler() or be aware of Crashpad in any way. The Crashpad handler will receive crashes from child processes that have inherited it as their exception handler even after the process that called StartHandler() exits.

On Windows, if asynchronous_start is true, this function will not directly call CreateProcess(), making it suitable for use in a DllMain(). In that case, the handler is started from a background thread, deferring the handler's startup. Nevertheless, regardless of the value of asynchronous_start, after calling this method, the global unhandled exception filter is set up, and all crashes will be handled by Crashpad. Optionally, use WaitForHandlerStart() to join with the background thread and retrieve the status of handler startup.

On Fuchsia, this method binds to the exception port of the current default job, and starts a Crashpad handler to monitor that port.

On Linux, this method starts a Crashpad handler, connected to this process via an AF_UNIX socket pair and installs signal handlers to request crash dumps on the client's socket end.

Parameters
[in]handlerThe path to a Crashpad handler executable.
[in]databaseThe path to a Crashpad database. The handler will be started with this path as its --database argument.
[in]metrics_dirThe path to an already existing directory where metrics files can be stored. The handler will be started with this path as its --metrics-dir argument.
[in]urlThe URL of an upload server. The handler will be started with this URL as its --url argument.
[in]annotationsProcess annotations to set in each crash report. The handler will be started with an --annotation argument for each element in this map.
[in]argumentsAdditional arguments to pass to the Crashpad handler. Arguments passed in other parameters and arguments required to perform the handshake are the responsibility of this method, and must not be specified in this parameter.
[in]restartableIf true, the handler will be restarted if it dies, if this behavior is supported. This option is not available on all platforms, and does not function on all OS versions. If it is not supported, it will be ignored.
[out]asynchronous_startIf true, the handler will be started from a background thread. Optionally, WaitForHandlerStart() can be used at a suitable time to retreive the result of background startup. This option is only used on Windows.
Returns
true on success, false on failure with a message logged.

◆ StartHandlerAtCrash()

bool crashpad::CrashpadClient::StartHandlerAtCrash ( const base::FilePath &  handler,
const base::FilePath &  database,
const base::FilePath &  metrics_dir,
const std::string &  url,
const std::map< std::string, std::string > &  annotations,
const std::vector< std::string > &  arguments 
)

Installs a signal handler to launch a handler process in reponse to a crash.

The handler process will create a crash dump for this process and exit.

Parameters
[in]handlerThe path to a Crashpad handler executable.
[in]databaseThe path to a Crashpad database. The handler will be started with this path as its --database argument.
[in]metrics_dirThe path to an already existing directory where metrics files can be stored. The handler will be started with this path as its --metrics-dir argument.
[in]urlThe URL of an upload server. The handler will be started with this URL as its --url argument.
[in]annotationsProcess annotations to set in each crash report. The handler will be started with an --annotation argument for each element in this map.
[in]argumentsAdditional arguments to pass to the Crashpad handler. Arguments passed in other parameters and arguments required to perform the handshake are the responsibility of this method, and must not be specified in this parameter.
Returns
true on success, false on failure with a message logged.

◆ StartHandlerForClient()

bool crashpad::CrashpadClient::StartHandlerForClient ( const base::FilePath &  handler,
const base::FilePath &  database,
const base::FilePath &  metrics_dir,
const std::string &  url,
const std::map< std::string, std::string > &  annotations,
const std::vector< std::string > &  arguments,
int  socket 
)
static

Starts a handler process with an initial client.

This method allows a process to launch the handler process on behalf of another process.

Parameters
[in]handlerThe path to a Crashpad handler executable.
[in]databaseThe path to a Crashpad database. The handler will be started with this path as its --database argument.
[in]metrics_dirThe path to an already existing directory where metrics files can be stored. The handler will be started with this path as its --metrics-dir argument.
[in]urlThe URL of an upload server. The handler will be started with this URL as its --url argument.
[in]annotationsProcess annotations to set in each crash report. The handler will be started with an --annotation argument for each element in this map.
[in]argumentsAdditional arguments to pass to the Crashpad handler. Arguments passed in other parameters and arguments required to perform the handshake are the responsibility of this method, and must not be specified in this parameter.
[in]socketThe server end of a socket pair. The client end should be used with an ExceptionHandlerClient.
Returns
true on success, false on failure with a message logged.

◆ StartHandlerWithLinkerAtCrash()

bool crashpad::CrashpadClient::StartHandlerWithLinkerAtCrash ( const std::string &  handler_trampoline,
const std::string &  handler_library,
bool  is_64_bit,
const std::vector< std::string > *  env,
const base::FilePath &  database,
const base::FilePath &  metrics_dir,
const std::string &  url,
const std::map< std::string, std::string > &  annotations,
const std::vector< std::string > &  arguments 
)

Installs a signal handler to start a Crashpad handler process by loading it with /system/bin/linker.

This method is only supported by Android Q+.

Parameters
[in]handler_trampolineThe path to a Crashpad handler trampoline executable, possibly located within an apk, e.g. "/data/app/myapk.apk!/myabi/libcrashpad_handler_trampoline.so".
[in]handler_libraryThe name of a library exporting the symbol CrashpadHandlerMain(). The path to this library must be present in LD_LIBRARY_PATH.
[in]is_64_bittrue if handler_trampoline and handler_library are 64-bit objects. They must have the same bitness.
[in]envA vector of environment variables of the form var=value defining the environment in which to execute app_process. If this value is nullptr, the application's environment at the time of the crash will be used.
[in]databaseThe path to a Crashpad database. The handler will be started with this path as its --database argument.
[in]metrics_dirThe path to an already existing directory where metrics files can be stored. The handler will be started with this path as its --metrics-dir argument.
[in]urlThe URL of an upload server. The handler will be started with this URL as its --url argument.
[in]annotationsProcess annotations to set in each crash report. The handler will be started with an --annotation argument for each element in this map.
[in]argumentsAdditional arguments to pass to the Crashpad handler. Arguments passed in other parameters and arguments required to perform the handshake are the responsibility of this method, and must not be specified in this parameter.
Returns
true on success, false on failure with a message logged.

◆ StartHandlerWithLinkerForClient()

static bool crashpad::CrashpadClient::StartHandlerWithLinkerForClient ( const std::string &  handler_trampoline,
const std::string &  handler_library,
bool  is_64_bit,
const std::vector< std::string > *  env,
const base::FilePath &  database,
const base::FilePath &  metrics_dir,
const std::string &  url,
const std::map< std::string, std::string > &  annotations,
const std::vector< std::string > &  arguments,
int  socket 
)
static

Starts a Crashpad handler process with an initial client by loading it with /system/bin/linker.

This method is only supported by Android Q+.

Parameters
[in]handler_trampolineThe path to a Crashpad handler trampoline executable, possibly located within an apk, e.g. "/data/app/myapk.apk!/myabi/libcrashpad_handler_trampoline.so".
[in]handler_libraryThe name of a library exporting the symbol CrashpadHandlerMain(). The path to this library must be present in LD_LIBRARY_PATH.
[in]is_64_bittrue if handler_trampoline and handler_library are 64-bit objects. They must have the same bitness.
[in]envA vector of environment variables of the form var=value defining the environment in which to execute app_process. If this value is nullptr, the application's current environment will be used.
[in]databaseThe path to a Crashpad database. The handler will be started with this path as its --database argument.
[in]metrics_dirThe path to an already existing directory where metrics files can be stored. The handler will be started with this path as its --metrics-dir argument.
[in]urlThe URL of an upload server. The handler will be started with this URL as its --url argument.
[in]annotationsProcess annotations to set in each crash report. The handler will be started with an --annotation argument for each element in this map.
[in]argumentsAdditional arguments to pass to the Crashpad handler. Arguments passed in other parameters and arguments required to perform the handshake are the responsibility of this method, and must not be specified in this parameter.
[in]socketThe server end of a socket pair. The client end should be used with an ExceptionHandlerClient.
Returns
true on success, false on failure with a message logged.

◆ StartJavaHandlerAtCrash()

bool crashpad::CrashpadClient::StartJavaHandlerAtCrash ( const std::string &  class_name,
const std::vector< std::string > *  env,
const base::FilePath &  database,
const base::FilePath &  metrics_dir,
const std::string &  url,
const std::map< std::string, std::string > &  annotations,
const std::vector< std::string > &  arguments 
)

Installs a signal handler to execute /system/bin/app_process and load a Java class in response to a crash.

Parameters
[in]class_nameThe fully qualified class name to load, which must define a main() method to be invoked by app_process. Arguments will be passed to this method as though it were the Crashpad handler. This class is expected to load a native library defining crashpad::HandlerMain() and pass the arguments to it.
[in]envA vector of environment variables of the form var=value defining the environment in which to execute app_process. If this value is nullptr, the application's environment at the time of the crash will be used.
[in]databaseThe path to a Crashpad database. The handler will be started with this path as its --database argument.
[in]metrics_dirThe path to an already existing directory where metrics files can be stored. The handler will be started with this path as its --metrics-dir argument.
[in]urlThe URL of an upload server. The handler will be started with this URL as its --url argument.
[in]annotationsProcess annotations to set in each crash report. The handler will be started with an --annotation argument for each element in this map.
[in]argumentsAdditional arguments to pass to the Crashpad handler. Arguments passed in other parameters and arguments required to perform the handshake are the responsibility of this method, and must not be specified in this parameter.
Returns
true on success, false on failure with a message logged.

◆ StartJavaHandlerForClient()

static bool crashpad::CrashpadClient::StartJavaHandlerForClient ( const std::string &  class_name,
const std::vector< std::string > *  env,
const base::FilePath &  database,
const base::FilePath &  metrics_dir,
const std::string &  url,
const std::map< std::string, std::string > &  annotations,
const std::vector< std::string > &  arguments,
int  socket 
)
static

Executes /system/bin/app_process and loads a Java class.

Parameters
[in]class_nameThe fully qualified class name to load, which must define a main() method to be invoked by app_process. Arguments will be passed to this method as though it were the Crashpad handler. This class is expected to load a native library defining crashpad::HandlerMain() and pass the arguments to it.
[in]envA vector of environment variables of the form var=value defining the environment in which to execute app_process. If this value is nullptr, the application's current environment will be used.
[in]databaseThe path to a Crashpad database. The handler will be started with this path as its --database argument.
[in]metrics_dirThe path to an already existing directory where metrics files can be stored. The handler will be started with this path as its --metrics-dir argument.
[in]urlThe URL of an upload server. The handler will be started with this URL as its --url argument.
[in]annotationsProcess annotations to set in each crash report. The handler will be started with an --annotation argument for each element in this map.
[in]argumentsAdditional arguments to pass to the Crashpad handler. Arguments passed in other parameters and arguments required to perform the handshake are the responsibility of this method, and must not be specified in this parameter.
[in]socketThe server end of a socket pair. The client end should be used with an ExceptionHandlerClient.
Returns
true on success, false on failure with a message logged.

◆ UseSystemDefaultHandler()

void crashpad::CrashpadClient::UseSystemDefaultHandler ( )
static

Configures the process to direct its crashes to the default handler for the operating system.

On macOS, this sets the task’s exception port as in SetHandlerMachPort(), but the exception handler used is obtained from SystemCrashReporterHandler(). If the system’s crash reporter handler cannot be determined or set, the task’s exception ports for crash-type exceptions are cleared.

Use of this function is strongly discouraged.

Warning
After a call to this function, Crashpad will no longer monitor the process for crashes until a subsequent call to SetHandlerMachPort().
Note
This is provided as a static function to allow it to be used in situations where a CrashpadClient object is not otherwise available. This may be useful when a child process inherits its parent’s Crashpad handler, but wants to sever this tie.

◆ WaitForHandlerStart()

bool crashpad::CrashpadClient::WaitForHandlerStart ( unsigned int  timeout_ms)

When asynchronous_start is used with StartHandler(), this method can be used to block until the handler launch has been completed to retrieve status information.

This method should not be used unless asynchronous_start was true.

Parameters
[in]timeout_msThe number of milliseconds to wait for a result from the background launch, or 0xffffffff to block indefinitely.
Returns
true if the hander startup succeeded, false otherwise, and an error message will have been logged.

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