< prev index next >

src/os/posix/vm/vmError_posix.cpp

Print this page
rev 12800 : 8176872: [s390] wrong pc shown in error logs
Reviewed-by: dholmes, dsamersoff


  98     if (SIGNALS[i] == sig) {
  99       return resettedSighandler[i];
 100     }
 101   }
 102   return NULL;
 103 }
 104 
 105 static void crash_handler(int sig, siginfo_t* info, void* ucVoid) {
 106   // unmask current signal
 107   sigset_t newset;
 108   sigemptyset(&newset);
 109   sigaddset(&newset, sig);
 110   // also unmask other synchronous signals
 111   for (int i = 0; i < NUM_SIGNALS; i++) {
 112     sigaddset(&newset, SIGNALS[i]);
 113   }
 114   os::Posix::unblock_thread_signal_mask(&newset);
 115 
 116   // support safefetch faults in error handling
 117   ucontext_t* const uc = (ucontext_t*) ucVoid;
 118   address const pc = uc ? os::Posix::ucontext_get_pc(uc) : NULL;





 119 
 120   if (uc && pc && StubRoutines::is_safefetch_fault(pc)) {
 121     os::Posix::ucontext_set_pc(uc, StubRoutines::continuation_for_safefetch_fault(pc));
 122     return;
 123   }
 124 
 125   VMError::report_and_die(NULL, sig, pc, info, ucVoid);
 126 }
 127 
 128 void VMError::reset_signal_handlers() {
 129   // install signal handlers for all synchronous program error signals
 130   sigset_t newset;
 131   sigemptyset(&newset);
 132 
 133   for (int i = 0; i < NUM_SIGNALS; i++) {
 134     save_signal(i, SIGNALS[i]);
 135     os::signal(SIGNALS[i], CAST_FROM_FN_PTR(void *, crash_handler));
 136     sigaddset(&newset, SIGNALS[i]);
 137   }
 138   os::Posix::unblock_thread_signal_mask(&newset);




  98     if (SIGNALS[i] == sig) {
  99       return resettedSighandler[i];
 100     }
 101   }
 102   return NULL;
 103 }
 104 
 105 static void crash_handler(int sig, siginfo_t* info, void* ucVoid) {
 106   // unmask current signal
 107   sigset_t newset;
 108   sigemptyset(&newset);
 109   sigaddset(&newset, sig);
 110   // also unmask other synchronous signals
 111   for (int i = 0; i < NUM_SIGNALS; i++) {
 112     sigaddset(&newset, SIGNALS[i]);
 113   }
 114   os::Posix::unblock_thread_signal_mask(&newset);
 115 
 116   // support safefetch faults in error handling
 117   ucontext_t* const uc = (ucontext_t*) ucVoid;
 118   address pc = (uc == NULL) ? os::Posix::ucontext_get_pc(uc) : NULL;
 119 
 120   // Correct pc for SIGILL, SIGFPE (see JDK-8176872)
 121   if (sig == SIGILL || sig == SIGFPE) {
 122     pc = (address) info->si_addr;
 123   }
 124 
 125   if (uc && pc && StubRoutines::is_safefetch_fault(pc)) {
 126     os::Posix::ucontext_set_pc(uc, StubRoutines::continuation_for_safefetch_fault(pc));
 127     return;
 128   }
 129 
 130   VMError::report_and_die(NULL, sig, pc, info, ucVoid);
 131 }
 132 
 133 void VMError::reset_signal_handlers() {
 134   // install signal handlers for all synchronous program error signals
 135   sigset_t newset;
 136   sigemptyset(&newset);
 137 
 138   for (int i = 0; i < NUM_SIGNALS; i++) {
 139     save_signal(i, SIGNALS[i]);
 140     os::signal(SIGNALS[i], CAST_FROM_FN_PTR(void *, crash_handler));
 141     sigaddset(&newset, SIGNALS[i]);
 142   }
 143   os::Posix::unblock_thread_signal_mask(&newset);


< prev index next >