Implement noinline SIGBUS hook for debuggers
Like in case of SIGSEGV, SIGBUS also needs a noinline hook that
debuggers can cling on to if ART doesn't handler the signal.
Bug: 324326504
Test: manual
(cherry picked from https://android-review.googlesource.com/q/commit:0c0043d8ccb4309e20ad9ca006abd6968d583cdf)
Merged-In: Ida6a82095b8a2531c189462a6e51c54598202d50
Change-Id: Ida6a82095b8a2531c189462a6e51c54598202d50
diff --git a/runtime/fault_handler.cc b/runtime/fault_handler.cc
index 652368c..6f1452e 100644
--- a/runtime/fault_handler.cc
+++ b/runtime/fault_handler.cc
@@ -43,12 +43,16 @@
// Static fault manger object accessed by signal handler.
FaultManager fault_manager;
-// This needs to be NO_INLINE since some debuggers do not read the inline-info to set a breakpoint
-// if it isn't.
+// These need to be NO_INLINE since some debuggers do not read the inline-info to set a breakpoint
+// if they aren't.
extern "C" NO_INLINE __attribute__((visibility("default"))) void art_sigsegv_fault() {
// Set a breakpoint here to be informed when a SIGSEGV is unhandled by ART.
VLOG(signals)<< "Caught unknown SIGSEGV in ART fault handler - chaining to next handler.";
}
+extern "C" NO_INLINE __attribute__((visibility("default"))) void art_sigbus_fault() {
+ // Set a breakpoint here to be informed when a SIGBUS is unhandled by ART.
+ VLOG(signals) << "Caught unknown SIGBUS in ART fault handler - chaining to next handler.";
+}
// Signal handler called on SIGSEGV.
static bool art_sigsegv_handler(int sig, siginfo_t* info, void* context) {
@@ -233,7 +237,13 @@
// Simulate a crash in a handler.
raise(SIGBUS);
#endif
- return Runtime::Current()->GetHeap()->MarkCompactCollector()->SigbusHandler(info);
+ if (Runtime::Current()->GetHeap()->MarkCompactCollector()->SigbusHandler(info)) {
+ return true;
+ }
+
+ // Set a breakpoint in this function to catch unhandled signals.
+ art_sigbus_fault();
+ return false;
}
inline void FaultManager::CheckForUnrecognizedImplicitSuspendCheckInBootImage(