165 }
166
167
168 frame os::current_frame() {
169 intptr_t* csp = (intptr_t*) *((intptr_t*) os::current_stack_pointer());
170 // hack.
171 frame topframe(csp, (address)0x8);
172 // return sender of current topframe which hopefully has pc != NULL.
173 return os::get_sender_for_C_frame(&topframe);
174 }
175
176 // Utility functions
177
178 extern "C" JNIEXPORT int
179 JVM_handle_linux_signal(int sig,
180 siginfo_t* info,
181 void* ucVoid,
182 int abort_if_unrecognized) {
183 ucontext_t* uc = (ucontext_t*) ucVoid;
184
185 Thread* t = ThreadLocalStorage::get_thread_slow();
186
187 SignalHandlerMark shm(t);
188
189 // Note: it's not uncommon that JNI code uses signal/sigset to install
190 // then restore certain signal handler (e.g. to temporarily block SIGPIPE,
191 // or have a SIGILL handler when detecting CPU type). When that happens,
192 // JVM_handle_linux_signal() might be invoked with junk info/ucVoid. To
193 // avoid unnecessary crash when libjsig is not preloaded, try handle signals
194 // that do not require siginfo/ucontext first.
195
196 if (sig == SIGPIPE) {
197 if (os::Linux::chained_handler(sig, info, ucVoid)) {
198 return true;
199 } else {
200 if (PrintMiscellaneous && (WizardMode || Verbose)) {
201 warning("Ignoring SIGPIPE - see bug 4229104");
202 }
203 return true;
204 }
205 }
|
165 }
166
167
168 frame os::current_frame() {
169 intptr_t* csp = (intptr_t*) *((intptr_t*) os::current_stack_pointer());
170 // hack.
171 frame topframe(csp, (address)0x8);
172 // return sender of current topframe which hopefully has pc != NULL.
173 return os::get_sender_for_C_frame(&topframe);
174 }
175
176 // Utility functions
177
178 extern "C" JNIEXPORT int
179 JVM_handle_linux_signal(int sig,
180 siginfo_t* info,
181 void* ucVoid,
182 int abort_if_unrecognized) {
183 ucontext_t* uc = (ucontext_t*) ucVoid;
184
185 Thread* t = Thread::current_or_null_safe();
186
187 SignalHandlerMark shm(t);
188
189 // Note: it's not uncommon that JNI code uses signal/sigset to install
190 // then restore certain signal handler (e.g. to temporarily block SIGPIPE,
191 // or have a SIGILL handler when detecting CPU type). When that happens,
192 // JVM_handle_linux_signal() might be invoked with junk info/ucVoid. To
193 // avoid unnecessary crash when libjsig is not preloaded, try handle signals
194 // that do not require siginfo/ucontext first.
195
196 if (sig == SIGPIPE) {
197 if (os::Linux::chained_handler(sig, info, ucVoid)) {
198 return true;
199 } else {
200 if (PrintMiscellaneous && (WizardMode || Verbose)) {
201 warning("Ignoring SIGPIPE - see bug 4229104");
202 }
203 return true;
204 }
205 }
|