In pdb how do you reset the list (l) command line count?

If you use epdb instead of pdb, you can use "l" to go forward like in pdb, but then "l." goes back to the current line number, and "l-" goes backwards through the file. You can also use until # to continue until a given line. Epdb offers a bunch of other niceties too. Need to debug remotely? Try serve() instead of set_trace() and then telnet in (port 8080 is the default port).

import epdb
epdb.serve()

I don't think there is a way to turn it off. It's annoyed me enough that once I went looking in the pdb source to see if there was an undocumented syntax, but I didn't find any.

There really needs to be a syntax that means, "List the lines near the current execution pointer."


Try this.

(pdb) l .

Maybe you can always type the dot.

ps. You may consider to use pudb. This is a nice UI to pdb what gdbtui is to gdb.


Late but hopefully still helpful. In pdb, make the following alias (which you can add to your .pdbrc file so it's always available):

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.)

Tags:

Python

Pdb