0
Can I show the context any time I step through code using Python's pdb
debugger without having to explicitly call the list command?
I've tried chaining commands with something like n & l
or n && l
or nl
or n + l
or n; l
. I can't find any documentation regarding this.
The trouble is, any time I step through the code, I end up typing n
RET
and then either l
RET
or l
l
RET
...every..single..time to see some context.
Steve Ferg's guide describes the apparent intended pdb
workflow accurately:
So a typical interaction with pdb might go like this
- The pdb.set_trace() statement is encountered, and you start tracing with the (Pdb) prompt
- You press “n” and then ENTER, to start stepping through your code.
- You just press ENTER to step again.
- You just press ENTER to step again.
- You just press ENTER to step again. etc. etc. etc.
- Eventually, you realize that you are a bit lost. You’re not exactly sure where you are in your program any more. So…
- You press “l” and then ENTER. This lists the area of your program that is currently being executed.
- You inspect the display, get your bearings, and are ready to start again. So….
- You press “n” and then ENTER, to start stepping through your code.
- You just press ENTER to step again.
- You just press ENTER to step again. etc. etc. etc.
It seems obvious to me that showing the context after every move would be useful and desired by the user. However, since there doesn't seem to be a simple option to do so, it makes me think that I'm using pdb
incorrectly. Maybe my constant need to see the context is an indication of misuse? But how else would I use pdb
?