Previously used in Windows Idel with the function of debugging a Python program, under Linux has not been debugged. (Most of the time just print) look up the Internet
Method:
Copy Code code as follows:
a.py is a python file.
Common commands in (PDB) mode:
Q
Exit Debug
H is Help, print all the commands you can
H W
Meaning of Print command W
N
Executes the current line until it reaches the next line or until it returns
S
Executes the current line and stops as soon as possible (for example, there is a function call to the current row). It differs from N (next) when a function call in the current row stops the execution of the current row and calls that function, and N does not stop until the calculation completes the line (the next line is reached).
B (Reak) [[Filename:]lineno | function[, condition]]
Set breakpoints, which can be line numbers or functions. such as B, b foo, b foo,n = 5, and finally set a breakpoint at the entrance of the function foo (), but only if the value of n is 5 o'clock. Prints all breakpoints when the B command has no arguments.
TB (reak) [[Filename:]lineno | function[, condition]]
Temporary breakpoint, hit only once.
disable [Bpnumber [Bpnumber ...]]
Invalidate breakpoints on a pointing line (members)
Enable [Bpnumber [Bpnumber ...]]
Make the breakpoint on the specified line valid
C
Continue executing the program until the next breakpoint is encountered
W
Where, print the location of the current execution point
l [A, [, last]]
Output the source near the current line
P expression
Executes an expression when its value is printed.
A (RGS)
Print the parameters of the current function and their values
< direct return >
Repeat the last command
And when you encounter a command that is not recognized by the PDB, it executes as a python expression. If you want to perform the expression when the front Plus! characters, such as!n = 5
Multiple debug commands can be written on one line, separated by two semicolons, as s;; S