Master IntelliJ IDEA Debugging: Step-by-Step Guide to Breakpoints and Advanced Features
This guide walks you through setting breakpoints, starting a debug session, using step controls, and leveraging advanced debugging features in IntelliJ IDEA, helping you efficiently inspect code execution and manipulate variables during runtime.
Recently I've been using IntelliJ IDEA, and this article records how to use its debugging tools. First compile the program you want to debug.
1. Set Breakpoints
Click the left mouse button in the gutter next to the line number to set a breakpoint.
2. Start a Debug Session
Click the red bug icon to start debugging.
The Debug view appears at the bottom of the IDE. The red arrow points to the current execution line (e.g., method f2() line 11). The call stack is shown in the same area, with the most recent calls at the bottom.
3. Step Debugging
3.1 Step Over
Click the step over button to execute the current line; if the line contains a method call, the method runs completely before moving to the next line.
3.2 Step Into
Click the step into button to execute the current line and, if it calls a user‑defined method, enter that method (does not enter library code).
Set a breakpoint in the custom method (e.g., f1()) and run the debug session.
Click
3.3 Force Step Into
This button forces entry into any method during debugging.
3.4 Step Out
If you have entered a method (e.g., f2()) and want to exit it, use Step Out to return to the caller's next line; the method has already finished executing.
3.5 Drop Frame
Click this button to return to the caller of the current method (e.g., back to main()), resetting all variable values to the state at that point. You can jump to any upper method in the call chain.
4. Advanced Debugging
4.1 Cross‑Breakpoint Debugging
Set multiple breakpoints and start debugging.
To move to the next breakpoint, click the button shown.
The program will run the code between the current and next breakpoint. If there is no further breakpoint, clicking the button runs the program to completion.
4.2 View Breakpoints
Click the button to view previously set breakpoints and edit their properties.
Arrow 1 shows existing breakpoints; Arrow 2 sets conditional breakpoints (e.g., pause when c==97). After debugging, delete breakpoints using the red minus sign.
4.3 Set Variable Values
During debugging, you can assign a new value to a variable by selecting it, right‑clicking, and choosing “Set Value…”. This helps quickly test conditions and loops.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Java High-Performance Architecture
Sharing Java development articles and resources, including SSM architecture and the Spring ecosystem (Spring Boot, Spring Cloud, MyBatis, Dubbo, Docker), Zookeeper, Redis, architecture design, microservices, message queues, Git, etc.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
