PyCharm's breakpoint debugging

Likes and attention are the biggest motivation for my creation~~

Breakpoint debugging is in the process of automatic running of the program. If you hit a breakpoint in the code, when the program runs to the breakpoint position you set, it will be interrupted. At this time, you can see the previous run All program variables.

Breakpoint setting, set the breakpoint in the red box below

Insert picture description here

After setting the breakpoint, open the debug mode to run

Insert picture description here

The row of buttons on the left side of the above figure, from top to bottom, are:
re-debug and run this file;
let go of the current breakpoint and jump directly to the next breakpoint; if there is no next breakpoint, run the program directly (F9);
pause Run;
stop the current debug mode, close the current running program;
display all set breakpoints;
make all set breakpoints invalid.

Insert picture description here

The meanings of the buttons in the upper row of the above figure are:
jump to the current execution position of the code;
execute the code along the program (do not enter the function), in the absence of sub-functions, the effect is the same as step into (F8);
Enter the function, including the source code function (F7);
enter the function written by yourself, the difference from the previous one is that it will not enter the source code;
jump out of the current function body (shift + F8);
run to the cursor position;
calculate Expression, advanced usage of pycharm.

The general operation steps are to set a breakpoint, run the debug, and then F8 single-step debugging. When you encounter the function you want to enter, F7 enters, think of it in shift + F8, skip the places you don't want to see, set the next breakpoint directly, and then F9 goes over.

NB: The line where the breakpoint is located does not run, and the content before the line where the breakpoint is located is run

Ref
newbies must know, pycharm's debugging function (the most detailed article in history)

Guess you like

Origin blog.csdn.net/qq_35762060/article/details/109786996