如何在 PyCharm 中向后调试?

How to debug backwards in PyCharm?(如何在 PyCharm 中向后调试?)

本文介绍了如何在 PyCharm 中向后调试?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们都知道 F9 在调试模式下前进.但是F9前进了几步之后我们怎么能倒退,或者这甚至可能吗?

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?

推荐答案

按 F9 前进几步后我们怎么能后退或这可能吗?

这是不可能的,你不能在调试过程中返回".(通常在 Python 和其他编程语言/调试器中就是这种情况.)

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.

这篇关于如何在 PyCharm 中向后调试?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:如何在 PyCharm 中向后调试?

基础教程推荐