Execution

Execution of a program in the debugger can be finely controlled. The program can be executed in single steps, or allowed to continue until it encounters a breakpoint. Executing like this is essential for tracking program behaviour. Like a video editing session, the program can be executed in slow motion with the ability to go forward, pause, stop, and so on.

The methods that can be used to execute a program in the debugger are described in the next few sections.

Single stepping (step in)

Single stepping executes only one statement of the program (from the place where it has stopped) and then returns control. If the statement that is executed contains one or more functions, the debugger tries to step inside the functions (in the sequence in which the functions are executed). Once the statement is executed and control is passed back, it is possible to study the various program parameters.

If the program has not been started at the time single stepping is started, the program will be started and will be stopped at the first statement of the program (the first statement in the function main()).

Choose the menu item Debug->Execution->Step In or click on the Step In icon in the Debug toolbar to step into a program.

Single stepping (step over)

Step over is similar to step in, except that it does not step inside any function in the statement being executed. The statement will be executed in one go.

Choose the menu item Debug->Execution->Step Over or click on the Step Over icon in the Debug toolbar to step over statements in a program.

Single stepping (step out)

Step out will execute the current function until it returns. The program will be stopped once it exits from the function. Step out is not really single stepping, because it does not only execute a single statement — it executes the whole function until that function returns to the calling function.

Choose the menu item Debug->Execution->Step Out or click on the Step Out icon in the Debug toolbar to step out in a program.

Run/Continue

This option will continue the execution of the program until a breakpoint is encountered, or the program exits.

If the program is not yet started, then the program will be started and executed until a breakpoint or program termination is reached.

Choose the menu item Debug->Execution->Run/Continue or click on the Run/Continue icon in the Debug toolbar to continue the execution of a program.

Stop Program

This option will kill the program which is being debugged. Note that it is not possible to stop an attached process.

Choose the menu item Debug->Stop Program or click on the Stop Program icon in the Debug toolbar to terminate the execution of a program.

Restart Program

This option will stop the program and then restart it. All of the breakpoints will remain in effect. Note that it is not possible to restart an attached process.

Choose the menu item Debug->Restart Program to restart the execution of a program.