Is it possible to step backwards in pdb?

后端 未结 3 414
慢半拍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:56

    Reverse debugging (returning to previously recorded application state or backwards single-stepping debugging) is generally an assembly or C level debugger feature. E.g. gdb can do it:

    https://sourceware.org/gdb/wiki/ReverseDebug

    Bidirectional (or reverse) debugging

    Reverse debugging is utterly complex, and may have performance penalty of 50.000x. It also requires extensive support from the debugging tools. Python virtual machine does not provide the reverse debugging support.

    If you are interactively evaluation Python code I suggest trying IPython Notebook which provide HTML-based interactive Python shells. You can easily write your code and mix and match the order. There is no pdb debugging support, though. There is ipdb which provides better history and search facilities for entered debugging commands, but it doesn't do direct backwards jumps either as far as I know.

提交回复
热议问题