I need to debug the interaction of our Java code with a certain native dll. I have some experience debugging .NET-native interaction in windbg + sosex.
However, there does not seem to exist any windbg extension that would show me the Java call stack.
Also, I could not find any debug build of jdk 6.
I am not that desperate to compile jdk 6 from the source code (even if I knew how).
So, my question is how would you debug or profile the interaction of your Java code with some native DLL?
I’ve done this using a combination of jdb and windbg. Set bp’s in java with jdb just before and after your native call and set a bp at the start of your native function with windbg. Neither debugger knows about the other nor do they need to. You won’t be able to get a stack trace with both java bytecode frames and native frames but that’s no big deal since you can look at the java stack before and after your native call.
Note: The jvm (at least the 1.5 version) uses exceptions for normal cases which is a huge pain when running under a native debugger. Luckily EIP is mostly the same for all of them so you can ignore using something like:
.if (@eip == <addr>) {gn}