How to step one step back in IntelliJ?
Solution 1
You can drop the frames until you reach the point where you want to be. This isn't exactly stepping backwards, but it is quite similar in a lot of respects.
Though as the comments mention below, this will not revert the global state of your application -- which isn't a huge concern if you're developing stateless services, but could be if you're developing swing applications (if anyone actually does that any more).
On the debugger toolbar it looks like this: . In
Idea 2016.3
the drop-frame icon changed to look like this , and since
2019.3
it changed to look like this .
Full documentation is available here: IntelliJ Debugger Docs, and there is a StackOverflow Drop Frame Question, with a few useful answers
Solution 2
Check out Chronon Debugger plugin which actually allows you to step back, not just drop the frame http://blog.jetbrains.com/idea/2014/03/try-chronon-debugger-with-intellij-idea-13-1-eap/

Cristian Gutu
Updated on July 05, 2022Comments
-
Cristian Gutu 7 months
Is it possible to step backwards through executed code in a debug session?
For example I step over a method called
abc()
expecting to get12
but after re-checking the value returned I notice it's5
instead of12
. How can I step back to where I was before and step into the method to see what is going on? I know you can do this in visual studio but I can't find how to do this in intelliJ. -
Rana Ghosh almost 9 yearsYou just made me more productive. Thanks
-
Software Engineer about 8 yearsI've tried this now, and I think it's really quite poor. The idea seems good at first, but it seems not to really work./
-
Rodrigo Farias Rezino over 7 yearsDidn't find it. Isn't it available anymore ?
-
Software Engineer over 7 yearsThe icon has changed, but it's still there. It's a box with a red x in the top left.
-
Bitcoin Cash - ADA enthusiast over 7 years"it is functionally equivalent" - This is wrong. Dropping frames won't, for instance, revert static or field variables. It will only revert local variables. One must be aware of this before using this feature.
-
Software Engineer over 7 yearsThanks @Tiago -- I've edited the answer to be less strongly worded.