I'm trying to debug a JNI code. For this purpose I'm following an idea about attaching gdb to the java process running my Java code.
The problem is when I do that gdb hangs at pthread_join()
inside libjli.so
, producing the following output.
0x7fff59850000
0x00007ffa9fbb8218 in pthread_join ()
from /lib/x86_64-linux-gnu/libpthread.so.0
And then I can't make my Java code attend to requests (it is a server).
Update: It is not inside pthread_join()
, but after that, when I continue the execution and make a request to the server. It is using actually libzmq.so
for communication. I don't know if gdb interferes the library somehow.
Finally found out what was going on. Java uses SIGSEGV during garbage collection, which is intercepted by gdb causing an apparently crash. To solve this I added handle SIGSEGV pass nostop
to my ~/.gdbinit
file.