01_Debug Overview and Meaning
-
What is program DeBug?
-
Debug is a program developer must be able to Debug programs.
-
The ratio of program development to program debugging in the enterprise is 1:1.5, so if you can’t debug, you can’t program.
-
-
What does Debug help us do?
-
Track the flow of the code.
-
Program abnormal operation location.
-
Online problem tracking.
-
-
Debug for program learners
-
Through debugging, you can better view the execution process of the program.
-
The complicated program logic is difficult to understand clearly through the teacher’s oral explanation. At this time, debugging can help students understand the program very well.
-
Identify problems and improve the ability to solve them.
-
Debug step in 02_IDEA
-
Setting breakpoints (F9)
-
Debugger (8 buttons)
button instructions (Alt + F10) : If your cursor is on another line or page, click this button to jump to the current line of code execution (F8) : step by, line by line, if there is a method on this line will not enter the method. (F7) : Step in. If the current line has a method, it can go inside the method, usually used to go into a custom method, not into the official class library method. (Alt + Shift + F7) : Force in, can enter any method, view the underlying source code can be used to enter the official class library method. (Shift + F8) : Step out, exits from the method you entered into to the method call, when the method has completed execution but has not completed assignment. Rollback breakpoint. Fall back to the invocation of the current method. (Alt + F9) : Run to the cursor, you can position the cursor to the line you want to view, then use this function, the code will run to the cursor line, no break point. (Alt + F8) : Evaluates the expression. -
Observed variables
- There are three ways to view variables:
- Program area to view variables
- Check Variables from Variables in the Debugger
- Hovering over the name of a variable will bring up the value of the current variable
- There are three ways to view variables:
-
View the output
03_ Jumps to the line where the current code is executing
-
Jump to the current line of code execution (Alt + F10)
-
role
-
Switches the program window to the currently running program.
-
04_ Use of step over debugging
- Step through debugging
- Step past the debug button (F8)
- role
- Step by, line by line, if there’s a method on that line it doesn’t go into the method.
- Often used during debugging when you do not want to enter the body of the called method.
05_ Use of step in debugging
-
Enter debug
- Step over the Debug button (F7)
-
role
-
Step in, line by line down, if there is a method on the line, inside the method.
-
Generally used to enter custom methods, not into the official class library method.
-
06_ Use of forced walk-in debugging
-
Forced walk-in debugging
- Force the debug button (Alt + Shift + F7)
-
role
-
Enter the official class library method
-
Help us learn and view the JDK source code
-
07_ Use of step out debugging
-
Step out to debug
- Step out debug button (Shift + F8)
-
role
- Exit from within a method to a method call.
- When debugging, you will sometimes jump into a method body that you don’t want to see, so step out.
08_ Use of rollback breakpoint debugging
-
The fallback breakpoint
- Rollback breakpoint button
-
role
-
Fall back to the invocation of the current method.
-
When you want to re-view the execution of the method body, you can use the breakpoint rollback mode instead of restarting Debug.
-
09_ Run to cursor
- Run to the cursor
- Run cursor button (F9)
- role
- Enables the program to run at the cursor without setting a breakpoint.
10_ Evaluate the expression
-
Computed expression
-
Evaluate expression button (Alt + F8)
-
-
role
-
Set variables, in the evaluation of the expression box, you can change the value of the variable, so sometimes it is very convenient to debug various values.
-
11_ Conditional breakpoint
-
Conditional breakpoints
-
Right-click a breakpoint to set the conditions for entering the breakpoint
-
-
role
-
By setting breakpoint conditions, the system stops at the breakpoint only when the conditions are met. Otherwise, the system runs directly.
-
12_ Multithreaded debugging
- steps
-
Multithreaded debugging, need to adjust the breakpoint suspend level to Thread
-
Select thread in Frame for debugging
-
13 _ the source
This video is from UP Wind Qingyang of STATION B. Combining video learning is more efficient.