Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

python-2.7

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?

like image 578
Kalle Richter Avatar asked Sep 18 '25 19:09

Kalle Richter


1 Answers

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.

like image 114
Andrew Che Avatar answered Sep 21 '25 15:09

Andrew Che