equal
deleted
inserted
replaced
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
20 * or visit www.oracle.com if you need additional information or have any |
20 * or visit www.oracle.com if you need additional information or have any |
21 * questions. |
21 * questions. |
22 */ |
22 */ |
23 |
23 |
24 #define _GNU_SOURCE // for the definition of REG_RIP in ucontext.h |
|
25 #include <stdio.h> |
24 #include <stdio.h> |
26 #include <jni.h> |
25 #include <jni.h> |
27 #include <signal.h> |
26 #include <signal.h> |
28 #include <sys/ucontext.h> |
27 #include <sys/ucontext.h> |
29 |
28 |
30 #ifdef __cplusplus |
29 #ifdef __cplusplus |
31 extern "C" { |
30 extern "C" { |
32 #endif |
31 #endif |
33 |
32 |
34 void sig_handler(int sig, siginfo_t *info, ucontext_t *context) { |
33 void sig_handler(int sig, siginfo_t *info, ucontext_t *context) { |
35 int thrNum; |
|
36 |
34 |
37 printf( " HANDLER (1) " ); |
35 printf( " HANDLER (1) " ); |
38 // Move forward RIP to skip failing instruction |
|
39 context->uc_mcontext.gregs[REG_RIP] += 6; |
|
40 } |
36 } |
41 |
37 |
42 JNIEXPORT void JNICALL Java_TestJNI_doSomething(JNIEnv *env, jclass klass, jint val) { |
38 JNIEXPORT void JNICALL Java_TestJNI_doSomething(JNIEnv *env, jclass klass, jint val) { |
43 struct sigaction act; |
39 struct sigaction act; |
44 struct sigaction oact; |
40 struct sigaction oact; |