How is Java's JDI cross platform if JVMTI is not?

171 views Asked by At

So Java's debug interface is using JVMTI as a backend....but JVMTI needs to be compiled on the target architecture, so are these JVMTI functions which are used by JDI pre-compiled and shipped with the JDK as libraries? This would mean that I can use those pre-compiled libraries without using JDI...is that right? I am assume only a handful of functions are already compiled but if I need exactly those functions then I don't need to go through the hassle of compiling them myself....

1

There are 1 answers

4
apangin On BEST ANSWER

Look at Java Platform Debugger Architecture:

                /    |--------------|
               /     |     VM       |
 debuggee ----(      |--------------|  <------- JVM TI - Java VM Tool Interface
               \     |   back-end   |
                \    |--------------|
                /           |
 comm channel -(            |  <--------------- JDWP - Java Debug Wire Protocol
                \           |
                     |--------------|
                     | front-end    |
                     |--------------|  <------- JDI - Java Debug Interface
                     |      UI      |
                     |--------------|
  • JDI works on top of JDWP;
  • from the JVM side, JDWP is provided by jdwp agent, which uses JVM TI to communicate with the JVM.

jdwp agent is a native library, which is compiled for each platform separately, of course. The library is included in the standard JDK package. So, the platform-specific part is already provided by the JDK.