100
101 static void crash_handler(int sig, siginfo_t* info, void* ucVoid) {
102 // unmask current signal
103 sigset_t newset;
104 sigemptyset(&newset);
105 sigaddset(&newset, sig);
106 // also unmask other synchronous signals
107 for (int i = 0; i < NUM_SIGNALS; i++) {
108 sigaddset(&newset, SIGNALS[i]);
109 }
110 thr_sigsetmask(SIG_UNBLOCK, &newset, NULL);
111
112 // support safefetch faults in error handling
113 ucontext_t* const uc = (ucontext_t*) ucVoid;
114 address const pc = uc ? os::Solaris::ucontext_get_pc(uc) : NULL;
115 if (uc && pc && StubRoutines::is_safefetch_fault(pc)) {
116 os::Solaris::ucontext_set_pc(uc, StubRoutines::continuation_for_safefetch_fault(pc));
117 return;
118 }
119
120 VMError err(NULL, sig, pc, info, ucVoid);
121 err.report_and_die();
122 }
123
124 void VMError::reset_signal_handlers() {
125 // install signal handlers for all synchronous program error signals
126 sigset_t newset;
127 sigemptyset(&newset);
128
129 for (int i = 0; i < NUM_SIGNALS; i++) {
130 save_signal(i, SIGNALS[i]);
131 os::signal(SIGNALS[i], CAST_FROM_FN_PTR(void *, crash_handler));
132 sigaddset(&newset, SIGNALS[i]);
133 }
134 thr_sigsetmask(SIG_UNBLOCK, &newset, NULL);
135 }
|
100
101 static void crash_handler(int sig, siginfo_t* info, void* ucVoid) {
102 // unmask current signal
103 sigset_t newset;
104 sigemptyset(&newset);
105 sigaddset(&newset, sig);
106 // also unmask other synchronous signals
107 for (int i = 0; i < NUM_SIGNALS; i++) {
108 sigaddset(&newset, SIGNALS[i]);
109 }
110 thr_sigsetmask(SIG_UNBLOCK, &newset, NULL);
111
112 // support safefetch faults in error handling
113 ucontext_t* const uc = (ucontext_t*) ucVoid;
114 address const pc = uc ? os::Solaris::ucontext_get_pc(uc) : NULL;
115 if (uc && pc && StubRoutines::is_safefetch_fault(pc)) {
116 os::Solaris::ucontext_set_pc(uc, StubRoutines::continuation_for_safefetch_fault(pc));
117 return;
118 }
119
120 VMError::report_and_die(NULL, sig, pc, info, ucVoid);
121 }
122
123 void VMError::reset_signal_handlers() {
124 // install signal handlers for all synchronous program error signals
125 sigset_t newset;
126 sigemptyset(&newset);
127
128 for (int i = 0; i < NUM_SIGNALS; i++) {
129 save_signal(i, SIGNALS[i]);
130 os::signal(SIGNALS[i], CAST_FROM_FN_PTR(void *, crash_handler));
131 sigaddset(&newset, SIGNALS[i]);
132 }
133 thr_sigsetmask(SIG_UNBLOCK, &newset, NULL);
134 }
|