KVM Debugging

In order to provide Java-level debugging facilities, hooks must be supplied by the Java VM so that a debugger can perform tasks such as placing breakpoints, inspecting and modifying objects, and arranging to be notified when a debugging-related event occurs within the VM. The Java 2 platform includes an architecture, called the Java Platform Debugger Archicture (JPDA), that defines the debugging features that must be provided by a VM and the way in which they can be accessed by a debugger. Figure 2-1 shows the logical software components defined by the JPDA.

The Java 2 Platform Debugger Architecture

Figure 2-1. The Java 2 Platform Debugger Architecture

The JPDA

In the JPDA, the debugger interacts with the Java VM using a well-defined protocol called the Java Debug Wire Protocol (JDWP). This protocol specifies messages that are passed from a JDWP client to a JDWP server to request that operations be performed on the target VM, corresponding to debugging commands issued by the user. It also defines events that can be transmitted in the opposite direction to notify the debugger of state changes within the VM.

The architecture separates the debugger and the JVM from the details of the wire-level protocol by inserting an insulating layer on each side of the JDWP; this layer takes care of mapping the protocol messages to and from the programming interfaces required by the debugger and provided by the VM. In order to ...

Get J2ME in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.