Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the principle of java program debugging?

2025-03-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

In this issue, the editor will bring you about the principle of java program debugging. The article is rich in content and analyzes and describes for you from a professional point of view. I hope you can get something after reading this article.

There is a significant difference between Java program debugging and C++ program debugging. Java is based on a virtual machine, so the essence of debugging is to check the status of the virtual machine at run time, while c, when debugging, you need to generate a debug version of the program, and all run-time states are provided by this debugger.

Graphical ide such as eclipse,intellij,netbeans provides a debugger that can debug java programs. This kind of debugger needs to be developed based on the debugging architecture of java. They are just a shell, and java comes with jdb console debug commands.

JPDA (Java Platform Debugger Architecture) is the abbreviation of Java platform debugging architecture. Through the API provided by JPDA, developers can build Java debugging applications conveniently and flexibly. JPDA mainly consists of three parts: Java virtual machine tool interface (JVMTI), Java debug line protocol (JDWP), and Java debug interface (JDI).

Their relationships are callers, callees, and communication layer protocols.

(debugged) jvmti (Java Virtual Machine Debug Interface), the essence of debugging is to check the running status variables of the virtual machine, set callbacks, etc., through jvmti.

(communication layer protocol) JDWP (Java Debug Wire Protocol) is a data definition that defines the relationship between the debugger and the debugger. It specifies the format of the command called by the back end and the format of the data returned by the front end. Jdwp.dll (jdwp.so) is the implementation of sun.

The protocol layer only defines the data format, and there are no constraints on the transport layer, just as we specify the packaging, coding and destination visit format of the goods. But there is no limit to whether it is express delivery or logistics. Therefore, the transport layer can be customized, and there are generally two implementations.

1. Socket mode

two。 And the shared memory method on Windows.

Of course, the transport layer itself is nothing more than local inter-process communication and remote communication, and users can also implement it according to the JDWP standard if they are interested.

Java Debug Interface (JDI)

JDI (Java Debug Interface) is the highest-level interface of the three modules. In most JDK, it is implemented by the Java language. JDI consists of interfaces defined for the front end, through which debugging tool developers can remotely control the running of debugged programs on the back-end virtual machine through the debugger on the front-end virtual machine. JDI can not only help developers format JDWP data, but also provide queue, cache and other optimization services for JDWP data transmission. In theory, developers only need to use JDWP and JVMTI to support cross-platform remote debugging, but writing JDWP programs directly is time-consuming and inefficient. Therefore, the introduction of JDI layer based on Java simplifies the operation and improves the efficiency of developers in developing and debugging programs.

Table 1. JPDA hierarchical comparison module hierarchical programming language functions JVMTI underlying C to obtain and control current virtual machine status JDWP intermediary layer C defines the data format for JVMTI and JDI interaction JDI high-level Java provides Java API to remotely control the virtual machine being debugged

Java's JPDA is a set of operation tools for debugging and optimizing virtual machines, in which JVMTI is the interface integrated in the virtual machine, JDWP is a communication layer, and JDI is the front-end tools and runtime for developers.

The above is the principle of java program debugging shared by Xiaobian. If you happen to have similar doubts, you might as well refer to the above analysis to understand. If you want to know more about it, you are welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report