How to Use the Debugger in IntelliJ IDEA: Setting Breakpoints and Step Controls
This guide explains how to set breakpoints, start a debugging session, and use step over, step into, force step into, step out, and drop frame functions in IntelliJ IDEA, along with advanced features like multiple breakpoints, breakpoint properties, and variable value modification.
This article records the usage of the debugging tools in IntelliJ IDEA.
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 Debug Session
Click the green bug icon to begin debugging.
The Debug view appears at the bottom, showing the current execution line, call stack, and methods invoked up to the breakpoint.
3. Step Debugging
3.1 Step Over
Click the step over button to execute the current line and move to the next line.
3.2 Step Into
Click the step into button to enter a custom method on the current line.
Set a breakpoint in the custom method (e.g., f1()) and start debugging.
3.3 Force Step Into
This button forces entry into any method during debugging.
3.4 Step Out
Use step out to exit the current method and return to the caller after the method finishes.
3.5 Drop Frame
Drop frame returns execution to a previous method in the call stack, resetting variable values.
4. Advanced Debugging
4.1 Cross‑Breakpoint Debugging
Set multiple breakpoints and start debugging.
Click the button to move to the next breakpoint.
The program runs code between breakpoints; if no further breakpoint exists, clicking again runs to program end.
4.2 View Breakpoints
Click the button to see all set breakpoints and edit their properties.
Arrow 1 shows existing breakpoints; Arrow 2 sets conditional breakpoints (e.g., pause when c==97). Delete breakpoints after debugging.
4.3 Set Variable Values
During debugging, select a variable, right‑click, and choose Set Value to assign a new value, facilitating quick testing of conditions and loops.
(End)
Java Captain
Focused on Java technologies: SSM, the Spring ecosystem, microservices, MySQL, MyCat, clustering, distributed systems, middleware, Linux, networking, multithreading; occasionally covers DevOps tools like Jenkins, Nexus, Docker, ELK; shares practical tech insights and is dedicated to full‑stack Java development.
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.