What is JDB in Java

In general, the inherited development environment (IDE) provides the one-step breakpoint setting and one-step tracking functionality that programmers often refer to as debugging functions.
In fact, JDK has such a set of tools in its bin directory as well. jdb helps us finish debugging.
Here is a simple program "Hello.java"

Use javac -g Hello.java first
Compile class files,
What I want to say here is that javac -g Hello.java gets variable information and another "-g" during the debugging phase.
Use the DOS command, but change to the directory where the Hello.class file is located. (Assuming it's F: \ Hello.class.) If that's not very clear, here's what you can refer to. You can skip this part directly:.
cmd enters the DOS window
proceed as shown

(The case in f: is the same)
That's fine
The jdb Hello command enters jdb's interactive environment and loads the class file at the same time.
Work as shown

(1), first use stop on Hello: 5 to set a breakpoint on the fifth line.
(2), run again and then stop at the breakpoint,
(3) At this point, use local elements to display variables (the local variables are empty and have not yet been executed there).
(4), step (or next) step in, you can see the progress from step 5 to step 6.
(5), step (or next step) and then go to the seventh step, ie the sixth step is complete, enter the string "Hello WindowsUtils!"
(6), cont means to stop executing the rest of the program and exit the JDB environment.
Of course, you can also use the list command to output the source code once to see whether it is your own source file.
as shown

These are the usage scenarios for the most common commands we are debugging. The commonly used commands from jdb are far more than these. In conclusion, I'll list the commonly used commands (with the exception of the above):
exit (or quit): Exit the debugger

Help (right?): List all commands

Ignore classID: Ignore the specific exception interface

Load class name: Load the Java class to be debugged

Methods classID: Lists the member method set of a class

Print ID [ID…]: Print variable value

Dump ID: Outputs detailed information on variables

resume [threadID ...]: continue threads (by default all threads continue)

suspend [threadID ...]: Stops a thread (by default it stops all threads)

Of course, you can also check the official documents for more details
https://docs.oracle.com/javase/7/docs/technotes/tools/windows/jdb.html(Jdb7 official document)

https://docs.oracle.com/javase/8/docs/technotes/guides/troubleshoot/tooldescr011.html#BABGIEHH(Jdb8 official document)

https://docs.oracle.com/javase/8/docs/technotes/guides/troubleshoot/introclientissues005.html (And the official JDWP document in dk8 which is also very important)