Use QtCreator to debug
simple operation
set breakpoint
Right mouse button to break the point where the break point is needed
debug
Click the little beetle button, you can see three window forms after startup
Here the value of the variable is displayed.
This shows the current execution of the function and the location of the breakpoint
The meanings of these three buttons are:
- step into: single-step execution, you can enter and continue single-step execution when you encounter a sub-function, in short, enter the sub-function
- step over: After single-step execution, when a sub-function is encountered inside the function, it will not enter the sub-function for single-step execution, and it will stop the entire execution of the sub-function, that is, the entire sub-function is regarded as one step, in short In short, the sub-function is passed, but the sub-function will execute
- step out: When stepping into the sub-function, step out can execute the remaining part of the sub-function and return to the previous function
- Press the single-step execution button, the yellow arrow points to the current running place
The program execution stops at the breakpoint on line 14, then press step into to enter the add() function, press step out to execute the rest of the add() function, return to the entry function debug_test() to continue execution, and then press step over directly completes the execution of the divide function, and finally single-step execution guides the end of the entry function.
The above is just a simple example, not an example in QT Creator, the usage is the same