Is it possible to step backwards in pdb?

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

    The GNU debugger, gdb: It is extremely slow, as it undoes single machine instruction at a time.

    The Python debugger, pdb: The jump command takes you backwards in the code, but does not reverse the state of the program.

    For Python, the extended python debugger prototype, epdb, was created for this reason. Here is the thesis and here is the program and the code.

    I used epdb as a starting point to create a live reverse debugger as part of my MSc degree. The thesis is available online: Combining reverse debugging and live programming towards visual thinking in computer programming. In chapter 1 and 2 I also cover most of the historical approaches to reverse debugging.

提交回复
热议问题