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?
Essential pdb CommandsPrint the value of an expression. Pretty-print the value of an expression. Continue execution until the next line in the current function is reached or it returns. Execute the current line and stop at the first possible occasion (either in a function that is called or in the current function).
Then when you are in Pdb, you can type cls() to clear the screen without needing as many key strokes at the command line.
The debugger has a trace function that it uses to track the execution of your code. It examines the current stack frame to see if you've gotten to a breakpoint, for example. pdb. set_trace means, "set the pdb trace function as the trace function with sys.
from pdb, just type disable N, where N is the breakpoint number you are stuck on. If you don't know the number of your troubling breakpoint, enter tbreak. This will list your breakpoints by number under column "Num" and show whether (yes) or not (no) they are enabled or disabled under the column headed with "Enb."
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.)
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With