Friday, December 12, 2008

Debugging mixed-language code in Apache Harmony + Eclipse

I've been hacking in managed runtimes for more years than I'd care to mention, and plenty of that time has been spent in debuggers of one sort or another!

...and that's the point. Implementing a runtime requires that you have a suite of debuggers that cover the different target platform native code and the dynamic late-bound language du jour. You have to switch from Eclipse to WinDbg/gdb and back again frequently.

Intel's Software group have (for some unknown reason) been quite low key about their innovation in this space, with the development of an integrated debugger for Java and JNI environments. This advance has been enabled by the combination of support in the Eclipse Java Debug Tools and Apache Harmony runtime.

Now, as you step into a native method from Java, the Eclipse debugger shows a logical representation of the mixed Java thread / C thread stack frames and allows you to inspect variables etc. in either language. They also support the JNI methods that call back into Java so you get full roundtripping. Cool.

For most people who need to debug a system comprising Java and native code this is exactly what you want to do, and its a real time saver to be able to manage the breakpoints, variable watches and flow of control from a single IDE.

Kudos to Chris, Vasily, Gregory, Ilya, et al who made this work. Clearly people who live in the real world!

Go watch the screencast demo, download it and try it out!

No comments: