From 8be44cf31e76465090d717ccadcabeb079e03f5e Mon Sep 17 00:00:00 2001 From: Dave Allison Date: Thu, 4 Sep 2014 14:33:42 -0700 Subject: [PATCH] Fix arm64 build warning (promoted to error). This refactors code that caused an warning on the arm64 build. Change-Id: I1c0ddabb7061ea289d98b03554bf764c26256078 --- runtime/fault_handler.cc | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/runtime/fault_handler.cc b/runtime/fault_handler.cc index cc1038cb6..47696f9bd 100644 --- a/runtime/fault_handler.cc +++ b/runtime/fault_handler.cc @@ -186,8 +186,6 @@ void FaultManager::HandleFault(int sig, siginfo_t* info, void* context) { action.sa_restorer = nullptr; #endif - bool signal_handled = false; - // Catch SIGSEGV and SIGABRT to invoke our nested handler int e1 = sigaction(SIGSEGV, &action, &oldsegvaction); int e2 = sigaction(SIGABRT, &action, &oldabortaction); @@ -200,8 +198,12 @@ void FaultManager::HandleFault(int sig, siginfo_t* info, void* context) { if (setjmp(*self->GetNestedSignalState()) == 0) { for (const auto& handler : other_handlers_) { if (handler->Action(sig, info, context)) { - signal_handled = true; - break; + // Restore the signal handlers, reinit the fault manager and return. Signal was + // handled. + sigaction(SIGSEGV, &oldsegvaction, nullptr); + sigaction(SIGABRT, &oldabortaction, nullptr); + fault_manager.Init(); + return; } } } else { @@ -216,13 +218,11 @@ void FaultManager::HandleFault(int sig, siginfo_t* info, void* context) { // Now put the fault manager back in place. fault_manager.Init(); - if (!signal_handled) { - // Set a breakpoint in this function to catch unhandled signals. - art_sigsegv_fault(); + // Set a breakpoint in this function to catch unhandled signals. + art_sigsegv_fault(); - // Pass this on to the next handler in the chain, or the default if none. - InvokeUserSignalHandler(sig, info, context); - } + // Pass this on to the next handler in the chain, or the default if none. + InvokeUserSignalHandler(sig, info, context); } void FaultManager::AddHandler(FaultHandler* handler, bool generated_code) { -- 2.11.0