How to Use IntelliJ IDEA’s Reset Frame to Step Back in Debugging
This guide explains how IntelliJ IDEA’s Reset Frame (or Drop Frame in older versions) lets you roll back to a previous stack frame during Java debugging, shows when it works, provides code examples, and clarifies version differences.
When debugging, pressing "Step Over" too quickly can skip code you want to examine; IntelliJ IDEA provides a "Reset Frame" feature that lets you roll back to a previous stack frame.
Using Reset Frame
The button labeled Reset Frame (shown below) is the key.
When Reset Frame Cannot Be Used
For simple sequential code like the following, resetting is not possible:
void test() {
int a = 1;
int b = 2;
int c = a + b;
System.out.println(c);
}When Reset Frame Can Be Used
Consider this example with a separate method call:
void test2() {
int a = 1;
int b = 2;
int c = add(a, b);
System.out.println(c);
}
int add(int a, int b) {
System.out.println("a = " + a);
System.out.println("b = " + b);
return a + b;
}When execution reaches int c = add(a, b), the debugger enters add. At this point you can use Reset Frame to return to the previous line in the calling method.
Can’t Find Reset Frame?
In versions prior to IDEA 2022.1 the feature is called Drop Frame and appears as the button shown below.
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.
Programmer DD
A tinkering programmer and author of "Spring Cloud Microservices in Action"
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.
