< prev index next >

src/hotspot/os/posix/vmError_posix.cpp

Print this page
rev 49276 : 8191101: Show register content in hs-err file on assert
Reviewed-by:

@@ -25,10 +25,11 @@
 #include "precompiled.hpp"
 #include "memory/metaspaceShared.hpp"
 #include "runtime/arguments.hpp"
 #include "runtime/os.hpp"
 #include "runtime/thread.hpp"
+#include "utilities/debug.hpp"
 #include "utilities/vmError.hpp"
 
 #include <sys/types.h>
 #include <sys/wait.h>
 #include <signal.h>

@@ -120,15 +121,24 @@
   // Correct pc for SIGILL, SIGFPE (see JDK-8176872)
   if (sig == SIGILL || sig == SIGFPE) {
     pc = (address) info->si_addr;
   }
 
+  // Needed to make it possible to call SafeFetch.. APIs in error handling.
   if (uc && pc && StubRoutines::is_safefetch_fault(pc)) {
     os::Posix::ucontext_set_pc(uc, StubRoutines::continuation_for_safefetch_fault(pc));
     return;
   }
 
+  // Needed because asserts may happen in error handling too.
+  #ifdef CAN_SHOW_REGISTERS_ON_ASSERT
+  if ( (sig == SIGSEGV || sig == SIGBUS) && info != NULL && info->si_addr == g_assert_poison) {
+    handle_assert_poison_fault(ucVoid, info->si_addr);
+    return;
+  }
+  #endif // CAN_SHOW_REGISTERS_ON_ASSERT
+
   VMError::report_and_die(NULL, sig, pc, info, ucVoid);
 }
 
 void VMError::reset_signal_handlers() {
   // install signal handlers for all synchronous program error signals
< prev index next >