## Starting and Terminating a Debug Session

Once you've started a debug session, the Debug view provides controls to both terminate and restart the session. The following items describe the commands for:

- Starting a session
- Terminating a session
- Restarting a session

#### Starting a session

Use the Debug command () to execute a program under debugger control using the current launch configuration settings.

If the project does not already have a launch configuration, the New Launch Configuration Wizard will automatically create one for emulator targets or ask for additional information to create one. It will generate a default name for the launch configuration and add it to the list of available launch configurations for the project. Once complete and saved the debug session is launched. If a launch configuration is already available, the Debug command launches the last launch configuration used by the project.

To create new launch configurations where none previously existed or launch the last one created:

- Click the Debug button () in the Carbide C/C++ perspective
- Select Run > Debug from the menu bar

To launch a specific launch configuration:

- Right-click the project's EXE file in the C/C++ Projects view and select Debug As > Project_Name from the context menu

#### Terminating a session

Use the Terminate command () to stop or halt a program based on the type of debugging session underway. Terminate behavior includes:

- Emulator - terminates program execution and ends the debug session
- Application TRK or System TRK - kills the process on the device and ends the debug session. To terminate without killing the process, use Disconnect instead.
- Stop-mode soft attach - suspends the attached process while other processes continue to run on the device. If only a single process is running on the device, the device CPU is suspended. Once the CPU is suspended you must launch a new debug session to resume the device CPU.

This behavior differs from suspending a program, as this temporarily suspends execution.

NOTE If the Debug view loses focus, the Terminate control will appear disabled. To regain focus, select a thread in the Debug view to update the tool bar and reactivate the Terminate control.

#### Restarting a session

Use the Restart command () after stopping program execution. The debugger goes back to the beginning of the program and begins execution again. This behavior is equivalent to killing execution, then starting a new debugging session.

#### Other references

- Debugging overview