Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FirstChanceHandler execute once #95

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions client/crashpad_client_linux.cc
Original file line number Diff line number Diff line change
Expand Up @@ -207,16 +207,16 @@ class SignalHandler {
static void HandleOrReraiseSignal(int signo,
siginfo_t* siginfo,
void* context) {
if (handler_->first_chance_handler_ &&
handler_->first_chance_handler_(
signo, siginfo, static_cast<ucontext_t*>(context))) {
return;
}

// Only handle the first fatal signal observed. If another thread receives a
// crash signal, it waits for the first dump to complete instead of
// requesting another.
if (!handler_->disabled_.test_and_set()) {
if (handler_->first_chance_handler_ &&
handler_->first_chance_handler_(
signo, siginfo, static_cast<ucontext_t*>(context))) {
_exit(EXIT_FAILURE);
}

handler_->HandleCrash(signo, siginfo, context);
handler_->WakeThreads();
if (handler_->last_chance_handler_ &&
Expand Down
8 changes: 4 additions & 4 deletions client/crashpad_client_win.cc
Original file line number Diff line number Diff line change
Expand Up @@ -155,10 +155,6 @@ LONG WINAPI UnhandledExceptionHandler(EXCEPTION_POINTERS* exception_pointers) {
return EXCEPTION_CONTINUE_SEARCH;
}

if (first_chance_handler_ && first_chance_handler_(exception_pointers)) {
return EXCEPTION_CONTINUE_SEARCH;
}

// Otherwise, we know the handler startup has succeeded, and we can continue.

// Tracks whether a thread has already entered UnhandledExceptionHandler.
Expand All @@ -180,6 +176,10 @@ LONG WINAPI UnhandledExceptionHandler(EXCEPTION_POINTERS* exception_pointers) {
SleepEx(INFINITE, false);
}

if (first_chance_handler_ && first_chance_handler_(exception_pointers)) {
SafeTerminateProcess(GetCurrentProcess(), kTerminationCodeCrashNoDump);
}

// Otherwise, we're the first thread, so record the exception pointer and
// signal the crash handler.
g_crash_exception_information.thread_id = GetCurrentThreadId();
Expand Down
Loading