views:

88

answers:

2

Hi,

I really like the remote debugging facilities of the JVM. But I wonder how it works internally.

My assumption: It is done through a JVM feature where the running process is downloading/using the source-code from the attached remote-debugger (like IDE) It knows the line of the current stack-trace and then can jump to the respective IDE breakpoint. The communication of stack-trace and introspection of the application state is then done either through sockets or shared-memory (setting of remote debugger).

Has anybody interesting links/resources on that?

+3  A: 

Java's debugging architecture is called JPDA. You probably want to read the JPDA documentation. In particular, the Walk-through section gives an example of an IDE interfacing with the JDI to obtain a value on the stack.

Daniel Trebbien
+5  A: 

The debugging features of the JVM are provided via the Java Platform Debugger Architecture (JPDA).

The JPDA itself is composed of the following:

  • Java Virtual Machine Tool Interface (JVM TI) - the native programming interface for tools to use. This interface allows for state inspection and helps in controlling the flow of execution within the debuggee.
  • Java Debug Wire Protocol (JDWP) - used to define the communication between the debugger and debuggee processes.
  • Java Debug Interface (JDI) - this interface allows tool developers to write remote debugger applications.

The diagram listed in the JPDA architecture structure is a good starting point. Additional places to look for would be the guides listed in the JPDA page.

Vineet Reynolds
Thanks, was a worthwhile read. Just for interest I'll try to use jdi.jar library to directly see the debugging in action.
manuel aldana
@manuel, if you have time and patience, take a look at the source code of JSwat (http://code.google.com/p/jswat/). It is built on top of the Netbeans platform, and serves as a front-end application as far as JPDA is concerned. I must admit that I've myself not looked into the sources.
Vineet Reynolds