Is it possible to step backwards in pdb?

后端 未结 3 422
慢半拍i
慢半拍i 2021-01-30 20:28

After I hit n to evaluate a line, I want to go back and then hit s to step into that function if it failed. Is this possible?

The docs say:

j(ump) lineno

3条回答
  •  情话喂你
    2021-01-30 20:49

    PyPy has started to implement RevDB, which supports reverse debugging.

    It is (as of Feb 2017) still at an alpha stage, only supports Python 2.7, only works on Linux or OS X, and requires you to build Python yourself from a special revision. It's also very slow and uses a lot of RAM. To quote the Bitbucket page:

    Note that the log file typically grows at a rate of 1-2 MB per second. Assuming size is not a problem, the limiting factor are:

    • Replaying time. If your recorded execution took more than a few minutes, replaying will be painfully slow. It sometimes needs to go over the whole log several times in a single session. If the bug occurs randomly but rarely, you should run recording for a few minutes, then kill the process and try again, repeatedly until you get the crash.
    • RAM usage for replaying. The RAM requirements are 10 or 15 times larger for replaying than for recording. If that is too much, you can try with a lower value for MAX_SUBPROCESSES in _revdb/process.py, but it will always be several times larger.

    Details are on the PyPy blog and installation and usage instructions are on the RevDB bitbucket page.

提交回复
热议问题