diff options
author | Andreas Haas <ahaas@chromium.org> | 2019-01-15 15:15:14 +0100 |
---|---|---|
committer | Mark Mentovai <mark@chromium.org> | 2019-01-15 15:14:20 +0000 |
commit | 9b06049ed9fdc8f6e2162bde88cbe902b7147735 (patch) | |
tree | 5f6f113a8531f774ac60f7816a78e2e727572494 /src/client/linux/handler/exception_handler.cc | |
parent | Extract intruction pointer correctly for Windows ARM64 (diff) | |
download | breakpad-9b06049ed9fdc8f6e2162bde88cbe902b7147735.tar.xz |
Introduce SetFirstChanceHandler with more strict signature
Eventually, I want to remove the current version of
SetFirstChanceHandler. That is why I changed the name of the current
callback type to FirstChanceHandlerDeprecated.
I also made sure that it is not possible to have two different
FirstChanceHandlers set at the same time.
This is the first of a set of CLs to clean up the API between Chrome,
BreakPad, and V8. See more information in the tracking bug.
R=mark@chromium.org
Bug: chromium:921971
Change-Id: Ia8c2fd9bd875c36dd7ae8bb4a02e538556bc67a1
Reviewed-on: https://chromium-review.googlesource.com/c/1411776
Reviewed-by: Mark Mentovai <mark@chromium.org>
Diffstat (limited to 'src/client/linux/handler/exception_handler.cc')
-rw-r--r-- | src/client/linux/handler/exception_handler.cc | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/client/linux/handler/exception_handler.cc b/src/client/linux/handler/exception_handler.cc index b895f6d7..0d7cd9cf 100644 --- a/src/client/linux/handler/exception_handler.cc +++ b/src/client/linux/handler/exception_handler.cc @@ -213,6 +213,7 @@ pthread_mutex_t g_handler_stack_mutex_ = PTHREAD_MUTEX_INITIALIZER; ExceptionHandler::CrashContext g_crash_context_; FirstChanceHandler g_first_chance_handler_ = nullptr; +FirstChanceHandlerDeprecated g_first_chance_handler_deprecated_ = nullptr; } // namespace // Runs before crashing: normal context. @@ -338,6 +339,11 @@ void ExceptionHandler::SignalHandler(int sig, siginfo_t* info, void* uc) { return; } + if (g_first_chance_handler_deprecated_ != nullptr && + g_first_chance_handler_deprecated_(sig, info, uc)) { + return; + } + // All the exception signals are blocked at this point. pthread_mutex_lock(&g_handler_stack_mutex_); @@ -791,7 +797,13 @@ bool ExceptionHandler::WriteMinidumpForChild(pid_t child, } void SetFirstChanceExceptionHandler(FirstChanceHandler callback) { + g_first_chance_handler_deprecated_ = nullptr; g_first_chance_handler_ = callback; } +void SetFirstChanceExceptionHandler(FirstChanceHandlerDeprecated callback) { + g_first_chance_handler_ = nullptr; + g_first_chance_handler_deprecated_ = callback; +} + } // namespace google_breakpad |