Valid Line Breakpoints
Winpdb is the first python debugger that allows you to set breakpoints to valid lines only. In python, some source lines are never executed, so setting a breakpoint to such lines results in the debugger ignoring them. With Winpdb you donâ€™t have to guess which lines are valid since the debugger knows that for you, and sets the breakpoint to the nearest previous valid line.
Winpdb automatically saves breakpoints when you end a debug session. Next time you start a debug session to the same script the saved breakpoints will be loaded. You can even save and load breakpoints manually and have more than one set of breakpoints by specifying a breakpoints file name.
Breakpoints in Winpdb stick to their scope. You can change a script considerably and yet, next time you debug it and load the saved breakpoints, they will probably remain in the correct source lines.
bp â€“ Set a breakpoint.
bl, bd, be, bc â€“ List, disable, enable, and clear breakpoints respectively.
load, save â€“ Load and save breakpoints respectively.
For more information type ‘help bp’ in the debugger console.
bp 28 - Set a breakpoint to line 28 in the current file. bp 28, a == 5 - Set a conditional breakpoint to line 28 in the current file. bp myscript.py:28 - Set to line 28 in file myscript.py. bp myscript.py:CMyClass.my_method - Set to first line of method my_method of class CMyClass bp foo, i > 100 - Set a conditional breakpoint to the first line of function foo. bd * - Disable all breakpoints. bl - List all breakpoints. save - Save breakpoints to the default session file. save my_breakpoint_file - Save breakpoints to a file named 'ny_breakpoint_file.bpl'.
Toggle a Breakpoint
To toggle a breakpoint in the current line in the current file, click Breakpoints->Toggle or F9
Another option is to click on the left margin of a source line in the source viewer.
Breakpoints are represented in the source viewer as a colored background for a line with a breakpoint. The colors are RED for an enabled breakpoint and YELLOW for a disable breakpoint. When a breakpoint is hit its color is LIGHT BLUE.