How to debug .so on aix which is invoked from java

274 views Asked by At

I have plane C code which after built gives .so file on AIX, and this .so file is invokes from Java, so how can I debug .so file?

cheers Bala

1

There are 1 answers

0
minopret On

Check that your .so is built with debug symbols. If using gcc or g++, that is done using the -g option. Then you can attach gdb to the JVM process by process number because the .so will run there. You could do that using your appropriate equivalent to "PROCESS=`ps | grep java | cut -d' ' -f1`; gdb -p $PROCESS". Add your source directory for debugging by using the gdb command "dir $SOURCEDIR" substituting the path to your source directory for $SOURCEDIR. Finally, set a breakpoint at your desired line of the source code for the .so.

I referred to some information from a blog entry Linux - GDB to debug JNI with Tomcat.