usage
The pdb tool is Python's own debugging tool, which can debug code on the command line.
Usage example:
import pdb
num_a=1
num_b=2
pdb.set_trace()
sum=num_a+num_b
The running effect is as follows:
Common commands
-
break or b: set breakpoint
-
continue or c: continue executing the program
-
list or l: View the code segment of the current line
-
step or s: enter the function (use next instead of step to enter the for loop)
-
return or r: execute code until returning from the current function
-
next or n: execute the next line
-
up or u: return to the previous call point (not the previous line)
-
px: print the value of variable x
-
exit or q: terminate debugging and exit the program
-
help: help