简体   繁体   中英

How to debug backwards in PyCharm?

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM