In the perl debugger, if you repeatedly list segments of code taking you away from the current line, you can return to the current line by entering the command .
(dot).
I have not been able to find anything comparable using the python PDB module. If I list myself away from the current line and want to view it again, it seems I have to either remember the line number that was currently executing (unlikely for me) or execute a statement (often undesirable).
Am I missing something?
Late but hopefully still helpful. Make the following alias:
alias ll u;;d;;l
Then whenever you type ll
, pdb will list from the current position. It works by going up the stack and then down the stack, which resets 'l' to show from the current position. (This won't work if you are at the top of the stack trace.)
Tip: Permanent alias
To make the alias permanent, add the line into your .pdbrc
-file in the user home directory (~/.pdbrc
). This works with both pdb and ipdb.