Java Platform Debugger Architecture
Components Debugger Interfaces / |--------------| / | VM | debuggee ----( |--------------| <------- JVM TI - Java VM Tool Interface \ | back-end | \ |--------------| / | comm channel -( | <--------------- JDWP - Java Debug Wire Protocol \ | |--------------| | front-end | |--------------| <------- JDI - Java Debug Interface | UI | |--------------|
JPDA consists of three layers:
Some debuggers are built on top of lower layers, JDWP (for example if the front-end is not written in the Java language) or JVM TI (for specialized debuggers which need low-level functionality).
The debugger architecture is being designed for use in wide spectrum of VM implementations.
The VM implements the Java Virtual Machine Debug Interface (JVM TI).
It is clear from experience that debugger support code, running on the debuggee and written in Java, contends with the debuggee in ways that cause hangs and other undesired behavior. Thus, the back-end is native code. This, in turn, implies that the JVM TI be a pure native interface.
Starting with J2SE 5.0, JPDA includes service provider interfaces to allow the development and deployment of connector and transport implementations. These service provider interfaces allow debugger and other tool vendors to develop new connector implementations and provide addition transport mechanisms over and beyond the socket and shared memory transport provided by Sun. The service provider interfaces in JDI are specified in the com.sun.jdi.connect.spi package.
- A connector. A connector is a JDI object that is the means by which a connection is established between the front and back-ends.
JPDA defines three types of connectors:
- listening connectors: The front-end listens for an incoming connection from the back-end
- attaching connectors: The front-end attaches to an already running back-end.
- launching connectors: The front-end actually launches the java process that will run the debuggee code and the back-end.
- A transport. A transport is the underlying mechanism used to move bits between the front-end and the back-end.
The transport mechanism used is unspecified; possible mechanisms include: sockets, serial lines, and shared memory. However, the format and semantics of the serialized bit-stream flowing over the channel is specified by the Java Debug Wire Protocol (JDWP).
In addition to the service provider interfaces in JDI, JPDA also defines a transport library interface called the Java TMDebug Wire Protocol Transport Interface. A transport library is loaded by the JDWP agent in the target VM and is used to establish a connection to the debugger and to transport JDWP packets between the debugger and the VM.See JavaTM Platform Debugger Architecture - Service Provider Interfaces for more information on using these SPIs.
The example UIs are clients of the Java Debug Interface (JDI).
Defines the services a VM must provide for debugging. Includes requests for information (for example, current stack frame), actions (for example, set a breakpoint), and notification (for example, when a breakpoint has been hit). A debugger may make use of VM information other than this (for example, Java Native Interface (JNI)), but this is the source of all debugger specific information.
Specifying the VM Interface allows any VM implementor to plug easily into the debugging architecture. It also allows alternate communication channel implementations. VM implementations which do not adhere to this interface can still provide access via the Java Debug Wire Protocol (JDWP).
The specification of the protocol allows the debuggee and debugger front-end to run under separate VM implementations and/or on separate platforms. It also allows the front-end to be written in a language other than Java, or the debuggee to be non-native (e.g. Java).
Information and requests are roughly at the level of the Java Virtual Machine Debug Interface (JVM TI), but will include additional information and requests necessitated by bandwidth issues, examples include information filtering and batching.
Defines information and requests at a user code level.
While debugger implementors could directly use the Java Debug Wire Protocol (JDWP) or Java Virtual Machine Debug Interface (JVM TI), this interface greatly facilitates the integration of debugging capabilities into development environments. We recommend the JDI layer for all debugger development.
Copyright © 1993, 2011, Oracle and/or its affiliates. All rights reserved.