views:

666

answers:

1

Hi,

We have system here that uses Java JNI to call a function in a C library. Everything running on Solaris.

I have a problem somewhere with string encoding. An arabic character is returned by the function written in C, but the JNI methods receives a string with another encoding. I already tried setting $NLS_LANG, and the vm parameter for encoding the same way, but nothing has worked. So I need to be able to debug the C code and the Java JNI together.

what is the best way to debug it?

+2  A: 

If dbx debugger (part of Sun Studio) can attach to a JVM process and let you single step between Java code and native code. The functionality went by the code name "jdbx", although it's all part of dbx. It hasn't been heavily promoted, so it might have bugs. There were issues when the IDE had two debug engines both handling Java, but using the command line dbx avoids those issues.

Of course, there are probably lots of more conventional ways to debug your specific problem without necessarily using source level debugging that can mix the Java and C code.

Chris Quenelle