Search |
||
Debugging java, at native levelPosted by kohsuke on June 5, 2008 at 9:03 AM PDT
This is the record of how I debugged JVM at native code level. This is neither a complete guide nor do I work in the JavaVM team. This is just in the hope of helping others in the same boat. There has been a long standing Hudson bug where Maven launched by Hudson in a certain way hangs on Windows. Sometimes when you are looking at a bug, you see that the bug is deep down the software stack, and this bug was one of those. If you start with a debugger support, the problem will be gone. Or if you attach jconsole, you don't see any Java level dead lock. The main Maven execution thread just blocks on gethostbyaddr (or gethostbyname, I forgot), and you have no idea how that could be. I really couldn't figure out what's going on at Java debugger level, so I had to resort to using the native debugger and dive into the JDK.
Now, the main thing I couldn't figure out is how to relate code produced by JIT to their corresponding Java method names. Because of this, I couldn't figure out which Win32 thread corresponds to which Java thread, and where they are executing. If anyone knows how to do this, please share it with us. But still, I think this is an useful way to get into the gory details of how JDK works. It'll be also useful if you are debugging JNI part of your app, because now you can see who's calling your method or how the methods on JNIEnv are behaving. »
Related Topics >>
Java Tools Comments
Comments are listed in date ascending order (oldest first)
Submitted by jchristi on Thu, 2008-06-05 21:02.
You should also be able to do this with the Windbg tool (free) instead of requiring Visual Studio. http://www.microsoft.com/whdc/devtools/debugging/default.mspx
Submitted by kohsuke on Fri, 2008-06-06 06:53.
Visual Studio Express is also free, though. Is there any reason one should prefer WinDbg, which IIRC is a kernel debugger?
|
||
|
|