Reputation: 266
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?
Upvotes: 8
Views: 7360
Reputation: 543
The ADT Bundle now supports this directly. Any code that tells you to do something other than click Debug As-> Android Native Application is out of date as of 05/12/2013 and will cause you headaches unless you are using an older development system. If that is the case, download and install the latest ADT bundle because it will save a lot of trouble.
Upvotes: 0
Reputation: 543
Eclipse Juno release with latest Android Plugins supports the debugging.
How to Use Eclipse to Debug JNI code (Java & C/C++)
Upvotes: 2
Reputation: 841
The 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.
Upvotes: 3