mirror of
https://github.com/chromium/crashpad.git
synced 2025-03-09 14:06:33 +00:00
mac: Make UseSystemDefaultHandler() clear handlers on failure
If the task’s exception handler for EXC_CRASH, EXC_RESOURCE, and EXC_GUARD exceptions cannot be set, clear the handler instead. Nothing considered this function’s return value, and the only viable fallback action on failure would have been to do what the function now does, so its return type is changed to void. R=rsesek@chromium.org Review URL: https://codereview.chromium.org/1386943002 .
This commit is contained in:
parent
ca2925e2a0
commit
c95b30464a
@ -128,22 +128,19 @@ class CrashpadClient {
|
||||
//!
|
||||
//! On OS X, this sets the task’s exception port as in UseHandler(), but the
|
||||
//! exception handler used is obtained from SystemCrashReporterHandler(). If
|
||||
//! the system’s crash reporter handler cannot be determined, the task’s
|
||||
//! exception ports for crash-type exceptions are cleared.
|
||||
//! 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 successful call to this function, Crashpad will no longer
|
||||
//! monitor the process for crashes until a subsequent call to
|
||||
//! UseHandler().
|
||||
//! \warning After a call to this function, Crashpad will no longer monitor
|
||||
//! the process for crashes until a subsequent call to UseHandler().
|
||||
//!
|
||||
//! \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.
|
||||
//!
|
||||
//! \return `true` on success, `false` on failure with a message logged.
|
||||
static bool UseSystemDefaultHandler();
|
||||
static void UseSystemDefaultHandler();
|
||||
#endif
|
||||
|
||||
private:
|
||||
|
@ -221,13 +221,15 @@ bool CrashpadClient::UseHandler() {
|
||||
}
|
||||
|
||||
// static
|
||||
bool CrashpadClient::UseSystemDefaultHandler() {
|
||||
void CrashpadClient::UseSystemDefaultHandler() {
|
||||
base::mac::ScopedMachSendRight
|
||||
system_crash_reporter_handler(SystemCrashReporterHandler());
|
||||
|
||||
// Proceed even if SystemCrashReporterHandler() failed, setting MACH_PORT_NULL
|
||||
// to clear the current exception ports.
|
||||
return SetCrashExceptionPorts(system_crash_reporter_handler);
|
||||
if (!SetCrashExceptionPorts(system_crash_reporter_handler)) {
|
||||
SetCrashExceptionPorts(MACH_PORT_NULL);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace crashpad
|
||||
|
Loading…
x
Reference in New Issue
Block a user