diff options
author | mark@chromium.org <mark@chromium.org@4c0a9323-5329-0410-9bdc-e9ce6186880e> | 2012-09-04 22:38:41 +0000 |
---|---|---|
committer | mark@chromium.org <mark@chromium.org@4c0a9323-5329-0410-9bdc-e9ce6186880e> | 2012-09-04 22:38:41 +0000 |
commit | 343ce73b73a3058d765965403ab5801c71c08f1a (patch) | |
tree | 5e650d3ef052eb2d643ed10b4fbef6b43998dc74 /src/client/linux/handler/exception_handler.h | |
parent | Add custom getcontext() implementation for Android. (diff) | |
download | breakpad-343ce73b73a3058d765965403ab5801c71c08f1a.tar.xz |
Properly redeliver (or don't) signals to the previous handlers.
If none of the installed ExceptionHandlers handle a signal (their
FilterCallbacks or HandlerCallbacks all return false), then the signal
should be delivered to the signal handlers that were previously
installed.
This requires that old_handlers_ become a static vector so that we can
restore the handlers in the static HandleSignal.
Currently it is also restoring signals in ~ExceptionHandler (if there
are no others). This should not be required since our documentation
states that a process can only have one ExceptionHandler for which
install_handlers is true (and so we get the correct behavior if we
simply leave our handlers installed forever), but even the tests
themselves violate that.
Patch by Chris Hopman <cjhopman@chromium.org>
Review URL: https://breakpad.appspot.com/440002/
git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1025 4c0a9323-5329-0410-9bdc-e9ce6186880e
Diffstat (limited to 'src/client/linux/handler/exception_handler.h')
-rw-r--r-- | src/client/linux/handler/exception_handler.h | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/src/client/linux/handler/exception_handler.h b/src/client/linux/handler/exception_handler.h index f9e7ce3b..cde5ee8a 100644 --- a/src/client/linux/handler/exception_handler.h +++ b/src/client/linux/handler/exception_handler.h @@ -46,8 +46,6 @@ #include "google_breakpad/common/minidump_format.h" #include "processor/scoped_ptr.h" -struct sigaction; - namespace google_breakpad { // ExceptionHandler @@ -194,8 +192,11 @@ class ExceptionHandler { // Force signal handling for the specified signal. bool SimulateSignalDelivery(int sig); private: - bool InstallHandlers(); - void UninstallHandlers(); + // Save the old signal handlers and install new ones. + static bool InstallHandlersLocked(); + // Restore the old signal handlers. + static void RestoreHandlersLocked(); + void PreresolveSymbols(); bool GenerateDump(CrashContext *context); void SendContinueSignalToChild(); @@ -221,13 +222,8 @@ class ExceptionHandler { // multiple ExceptionHandler instances in a process. Each will have itself // registered in this stack. static std::vector<ExceptionHandler*> *handler_stack_; - // The index of the handler that should handle the next exception. - static unsigned handler_stack_index_; static pthread_mutex_t handler_stack_mutex_; - // A vector of the old signal handlers. - std::vector<std::pair<int, struct sigaction *> > old_handlers_; - // We need to explicitly enable ptrace of parent processes on some // kernels, but we need to know the PID of the cloned process before we // can do this. We create a pipe which we can use to block the |