Question

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

From PDB

(Pdb) help l
l(ist) [first [,last]]
  List source code for the current file.
  Without arguments, list 11 lines around the current line
  or continue the previous listing.
  With one argument, list 11 lines starting at that line.
  With two arguments, list the given range;
  if the second argument is less than the first, it is a count.

The "continue the previous listing" feature is really nice, but how do you turn it off?

 45  5932  45
1 Jan 1970

Solution

 31

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

2012-08-07

Solution

 27

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.

2018-09-17