зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1481009 Part 2 - Avoid changing exception ports when installing the exception handler in replaying processes, r=gsvelto.
--HG-- extra : rebase_source : dafa94bd88c41729b3ff06db40ecf653112afa33
This commit is contained in:
Родитель
ecd9c2fa25
Коммит
00693255ec
|
@ -41,6 +41,8 @@
|
|||
#include "common/mac/scoped_task_suspend-inl.h"
|
||||
#include "google_breakpad/common/minidump_exception_mac.h"
|
||||
|
||||
#include "mozilla/RecordReplay.h"
|
||||
|
||||
#ifndef __EXCEPTIONS
|
||||
// This file uses C++ try/catch (but shouldn't). Duplicate the macros from
|
||||
// <c++/4.2.1/exception_defines.h> allowing this file to work properly with
|
||||
|
@ -637,6 +639,21 @@ void ExceptionHandler::SignalHandler(int sig, siginfo_t* info, void* uc) {
|
|||
#endif
|
||||
}
|
||||
|
||||
// static
|
||||
bool ExceptionHandler::WriteForwardedExceptionMinidump(int exception_type,
|
||||
int exception_code,
|
||||
int exception_subcode,
|
||||
mach_port_t thread)
|
||||
{
|
||||
if (!gProtectedData.handler) {
|
||||
return false;
|
||||
}
|
||||
return gProtectedData.handler->WriteMinidumpWithException(exception_type, exception_code,
|
||||
exception_subcode, NULL, thread,
|
||||
/* exit_after_write = */ false,
|
||||
/* report_current_thread = */ true);
|
||||
}
|
||||
|
||||
bool ExceptionHandler::InstallHandler() {
|
||||
// If a handler is already installed, something is really wrong.
|
||||
if (gProtectedData.handler != NULL) {
|
||||
|
@ -673,6 +690,12 @@ bool ExceptionHandler::InstallHandler() {
|
|||
return false;
|
||||
}
|
||||
|
||||
// Don't modify exception ports when replaying, to avoid interfering with the
|
||||
// record/replay system's exception handler.
|
||||
if (mozilla::recordreplay::IsReplaying()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Save the current exception ports so that we can forward to them
|
||||
previous_->count = EXC_TYPES_COUNT;
|
||||
mach_port_t current_task = mach_task_self();
|
||||
|
@ -762,7 +785,9 @@ bool ExceptionHandler::Setup(bool install_handler) {
|
|||
if (!InstallHandler())
|
||||
return false;
|
||||
|
||||
if (result == KERN_SUCCESS) {
|
||||
// Don't spawn the handler thread when replaying, as we have not set up
|
||||
// exception ports for it to monitor.
|
||||
if (result == KERN_SUCCESS && !mozilla::recordreplay::IsReplaying()) {
|
||||
// Install the handler in its own thread, detached as we won't be joining.
|
||||
pthread_attr_t attr;
|
||||
pthread_attr_init(&attr);
|
||||
|
|
|
@ -155,6 +155,12 @@ class ExceptionHandler {
|
|||
MinidumpCallback callback,
|
||||
void *callback_context);
|
||||
|
||||
// Write a minidump for an exception that was received by another handler.
|
||||
static bool WriteForwardedExceptionMinidump(int exception_type,
|
||||
int exception_code,
|
||||
int exception_subcode,
|
||||
mach_port_t thread);
|
||||
|
||||
// Returns whether out-of-process dump generation is used or not.
|
||||
bool IsOutOfProcess() const {
|
||||
#if TARGET_OS_IPHONE
|
||||
|
|
Загрузка…
Ссылка в новой задаче