Search code examples
java-native-interfacevalgrindsegmentation-fault

How to tell valgrind to ignore SIGSEGV


I have a C++/JNI program that runs fine standalone but exits with SIGSEGV when run with valgrind. I've verified that the signal is thrown from the exact same spot as when running the program in the gdb debugger. In the context of gdb the issue is well explained here: Strange sigsegv while calling java code from c++ through jni

The solution is to get gdb/valgrind to ignore the SIGSEGV signal. For gdb it's easy. for valgrind - I've been unsuccessful so far. I've tried http://sourceforge.net/p/valgrind/mailman/message/12485481/ as well as --vex-iropt-register-updates=allregs-at-mem-access but to no avail.


Solution

  • Didn't find out how to ignore SIGSEGV but found out how to get JVM not to throw SIGSEGV. The -Xint option, interpreted mode execution only, will prevent the SIGSEGV from being thrown.