Introduced:
In front of a lot of space to discuss the JVMTI and jdwp parts, now finally see the most close to the user side of the section, JDI.
Analysis:
A. Basic knowledge of JDI
Unlike Jvmti and JDWP, JDI provides a set of interfaces that are written in pure java. They are primarily for the development environment IDE, although the implementation of the debugger can directly take advantage of JDWP or JVMTI, but the more this layer can be from the user's code level to define the request to be sent and the information obtained.
Essentially, the two-way communication between the debugger of Eclipse and the target VM is as follows:
The debugger translates the user's action into a debug command, and the command is sent to the virtual machine on which the target program is running through the link, and the target virtual machine then responds to the accepted commands, sends the results of the debugs back to the debugger on the backend, and finally, the debugger visualizes the data information to the user.
The JDI interface is defined in $java_home/lib/tools.jar, which is divided into 5 large packages from a macro perspective.
Package Name
|
Describe
|
Com.sun.jdi
|
This is the core package of JDI, which provides a mirroring mechanism that maps all data, types, domains, methods, events, states, and resources on the target virtual machine, as well as event requests from the debugger to the target virtual machine, to Mirror objects |
Com.sun.jdi.connect
|
This package is used to define the connection to the target virtual machine JDI
|
Com.sun.jdi.connect.spi
|
The package is used to define the necessary classes and interfaces needed to develop transportservice (that is, the transmitter service that I discussed very deeply in the JDWP layer).
|
Com.sun.jdi.event
|
The package defines the JDI event and event handling
|
Com.sun.jdi.request
|
The package is used to send the JDI event and then send it under certain conditions.
|
The concrete realization of B.JDI
Take eclipse as an example:
Org.eclipse.jdt.debug is a complete implementation of JDI, and Org.eclipse.jdt.debug.ui is an implementation of the Eclipse debugging tool interface. From the package name, we generally divide the jdi into three parts:
(1) Data module. It is responsible for modeling the data on the debugger (Debugger) and on the target VMS (the target VM).
(2) Link module. It establishes a channel of communication between the debugger (Debugger) and the target VM.
(3) Event request and processing module. It provides a way for the debugger (Debugger) to interact with the target virtual machine (VM).
We will analyze these modules from the code level of eclipse in the next few articles.
This article is from the "cohesion of parallel Lines" blog, please be sure to keep this source http://supercharles888.blog.51cto.com/609344/1587958
JPDA Architecture Research 17-jdi Overview