115 os::Posix::unblock_thread_signal_mask(&newset);
116
117 // support safefetch faults in error handling
118 ucontext_t* const uc = (ucontext_t*) ucVoid;
119 address pc = (uc != NULL) ? os::Posix::ucontext_get_pc(uc) : NULL;
120
121 // Correct pc for SIGILL, SIGFPE (see JDK-8176872)
122 if (sig == SIGILL || sig == SIGFPE) {
123 pc = (address) info->si_addr;
124 }
125
126 // Needed to make it possible to call SafeFetch.. APIs in error handling.
127 if (uc && pc && StubRoutines::is_safefetch_fault(pc)) {
128 os::Posix::ucontext_set_pc(uc, StubRoutines::continuation_for_safefetch_fault(pc));
129 return;
130 }
131
132 // Needed because asserts may happen in error handling too.
133 #ifdef CAN_SHOW_REGISTERS_ON_ASSERT
134 if ((sig == SIGSEGV || sig == SIGBUS) && info != NULL && info->si_addr == g_assert_poison) {
135 handle_assert_poison_fault(ucVoid, info->si_addr);
136 return;
137 }
138 #endif // CAN_SHOW_REGISTERS_ON_ASSERT
139
140 VMError::report_and_die(NULL, sig, pc, info, ucVoid);
141 }
142
143 void VMError::reset_signal_handlers() {
144 // install signal handlers for all synchronous program error signals
145 sigset_t newset;
146 sigemptyset(&newset);
147
148 for (int i = 0; i < NUM_SIGNALS; i++) {
149 save_signal(i, SIGNALS[i]);
150 os::signal(SIGNALS[i], CAST_FROM_FN_PTR(void *, crash_handler));
151 sigaddset(&newset, SIGNALS[i]);
152 }
153 os::Posix::unblock_thread_signal_mask(&newset);
154
155 }
156
|
115 os::Posix::unblock_thread_signal_mask(&newset);
116
117 // support safefetch faults in error handling
118 ucontext_t* const uc = (ucontext_t*) ucVoid;
119 address pc = (uc != NULL) ? os::Posix::ucontext_get_pc(uc) : NULL;
120
121 // Correct pc for SIGILL, SIGFPE (see JDK-8176872)
122 if (sig == SIGILL || sig == SIGFPE) {
123 pc = (address) info->si_addr;
124 }
125
126 // Needed to make it possible to call SafeFetch.. APIs in error handling.
127 if (uc && pc && StubRoutines::is_safefetch_fault(pc)) {
128 os::Posix::ucontext_set_pc(uc, StubRoutines::continuation_for_safefetch_fault(pc));
129 return;
130 }
131
132 // Needed because asserts may happen in error handling too.
133 #ifdef CAN_SHOW_REGISTERS_ON_ASSERT
134 if ((sig == SIGSEGV || sig == SIGBUS) && info != NULL && info->si_addr == g_assert_poison) {
135 if (handle_assert_poison_fault(ucVoid, info->si_addr)) {
136 return;
137 }
138 }
139 #endif // CAN_SHOW_REGISTERS_ON_ASSERT
140
141 VMError::report_and_die(NULL, sig, pc, info, ucVoid);
142 }
143
144 void VMError::reset_signal_handlers() {
145 // install signal handlers for all synchronous program error signals
146 sigset_t newset;
147 sigemptyset(&newset);
148
149 for (int i = 0; i < NUM_SIGNALS; i++) {
150 save_signal(i, SIGNALS[i]);
151 os::signal(SIGNALS[i], CAST_FROM_FN_PTR(void *, crash_handler));
152 sigaddset(&newset, SIGNALS[i]);
153 }
154 os::Posix::unblock_thread_signal_mask(&newset);
155
156 }
157
|