pdb/ipdb
modules
/pdb/ipdb module
The main role of PDB and IPDB is for single-step debugging of Python programs, and Python debugging can refer to links.
Here is a simple example of using
1 Import ipdb 2 3 i = 0 4 while i<100: 5 Print (i) 6 ipdb.set_trace () 7 i + = 1
Once you run the code, you can step through it, as long as you enter the instructions
Note:
1. Please try to avoid using Python's own idle operation, because the idle error will not find stdout,-.-| |.
2. pdb/ipdb debugging can use the Set_trace () function to set breakpoints, but it is worth noting that pdb/ipdb are difficult to support multi-threaded debugging, multi-threaded debugging can refer to the above link using pycharm.
The commands commonly used by the PDB are
Command |
Explain |
Break or b Set Breakpoints |
Set breakpoints |
Continue or C |
Continue to execute the program |
List or L |
View the code snippet for the current row |
Step or s |
Enter function |
return or R |
Executes the code until it returns from the current function |
Exit or Q |
Abort and exit |
Next or N |
Executes the next line |
Pp |
Print the value of a variable |
Help |
Help |
Reference Links
https://www.ibm.com/developerworks/cn/linux/l-cn-pythondebugger/
Python's functional module [4], pdb/ipdb, enables single-step debugging of Python