简体   繁体   English

PyCharm如何反向调试?

[英]How to debug backwards in PyCharm?

We all know F9 goes forward in debug mode.我们都知道F9在调试模式下前进。 But how can we go backward after going a couple steps forward with F9 or is that even possible?但是,在使用F9向前走了几步之后,我们怎么能 go 倒退呢?或者这有可能吗?

how can we go backward after going a couple steps forward with F9 or is that possible?在使用 F9 向前走几步之后,我们如何才能向后 go 或者这可能吗?

It isn't possible, you can't "go back" during debugging.这是不可能的,你不能在调试期间“返回” (That is the case in Python and other programming languages/debuggers in general.) (Python 和其他编程语言/调试器通常就是这种情况。)

The reason is the debugger would have to restore the state of your program to the previous step.原因是调试器必须将程序的 state 恢复到上一步。 Which using your logic would involve holding a copy of the entire state (memory, stack, temporary files, etc...) at every step of the program.使用您的逻辑将涉及在程序的每一步都保存整个 state(内存、堆栈、临时文件等)的副本。 (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.这就是为什么它没有完成。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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