How to debug backwards in PyCharm?

Question:

We all know F9 goes forward in debug mode. But how can we go backward after going a couple steps forward with F9 or is that even possible?

Asked By: tallcoder

||

Answers:

how can we go backward after going a couple steps forward with F9 or is that possible?

It isn’t possible, you can’t "go back" during debugging. (That is the case in Python and other programming languages/debuggers in general.)

The reason is the debugger would have to restore the state of your program to the previous step. Which using your logic would involve holding a copy of the entire state (memory, stack, temporary files, etc…) at every step of the program. (Not to mention operations protocols that aren’t reversible and require precise timing.) That would be exponential and become easily unfeasible. That’s why it’s not done.

Answered By: bad_coder
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.