diff options
author | 2024-02-15 23:10:17 +0000 | |
---|---|---|
committer | 2024-02-16 17:50:02 +0000 | |
commit | 0c0043d8ccb4309e20ad9ca006abd6968d583cdf (patch) | |
tree | 2ff41f9f01f73f5c17e0d338fe36c660a2ec16c8 /runtime/fault_handler.cc | |
parent | 7a8b55945ed2b518b55d2e9ed54e3c4f16d543a3 (diff) |
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
Change-Id: Ida6a82095b8a2531c189462a6e51c54598202d50
Diffstat (limited to 'runtime/fault_handler.cc')
-rw-r--r-- | runtime/fault_handler.cc | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/runtime/fault_handler.cc b/runtime/fault_handler.cc index ccf6fbd288..635de2af69 100644 --- a/runtime/fault_handler.cc +++ b/runtime/fault_handler.cc @@ -42,12 +42,16 @@ namespace art HIDDEN { // 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) { @@ -232,7 +236,13 @@ bool FaultManager::HandleSigbusFault(int sig, siginfo_t* info, [[maybe_unused]] // 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( |