Kalle Richter
Kalle Richter

Reputation: 8728

How to display m[,n] lines around current line in pdb?

The Python 2.7 debugger pdb allows to display lines o to p with l [o[,p]], but one has to figure out which line the debugger stand on and then substract and add. Is there a way to display an m lines before and n lines after the current line without arithmetics?

Upvotes: 4

Views: 1959

Answers (1)

Andrew Che
Andrew Che

Reputation: 968

As far as I know, no. The l(ist) command will display 11 lines around the current line, but you can't display m lines before and n after the current line.

https://docs.python.org/2/library/pdb.html

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 around at that line. With two arguments, list the given range; if the second argument is less than the first, it is interpreted as a count.

Upvotes: 2

Related Questions