The debugger enables you to:

- Set breakpoints on program execution.
- Load your application on to the target system.
- Single step into function calls, over function calls and out of function calls.
- Display and modify the state of your application using the various debugging windows.
- Debug at the instruction level.
- Support the target debug library.

#### Setting Breakpoints

Breakpoints can be set in a number of ways:

- Use the Toggle Breakpoint icon. A breakpoint will be set on the current source code line of the code editor.
- With the source file loaded, left click in the left margin of the code editor on the line you want to set the breakpoint
- With the source file loaded, right click in the code editor and select the Toggle Breakpoint option in the popup menu.
- Symbolic breakpoints can also be set using Debug | Breakpoints | New Breakpoint.

#### Connecting to a target

Before you can debug you have to connect to a target system using either the Targets window or the the Target menu. When you have connected to a target the name of the target will be displayed on the status bar.

#### Loading and running your program

You can now use the Debug | Start Debugging which will load the currently active project, set any breakpoints and start your program running. Note that there are no default breakpoints set by the debugger so if you haven't set any breakpoints then your program will run.

When the target is running under control of the debugger it can be paused using Debug | Break.

You can stop debugging using Debug | Stop. If you wish to restart debugging without reloading the program then you can use Debug | Debug From Reset. Note that when you debug from reset no loading takes place so it is expected that your program is built in a way such that any resetting of data values is done as part of the program startup. You can also attach the debugger to a running target using the Debug | Attach Debugger.

#### On Breakpoint

Once the program has stopped the debugger will locate an edit window to the next statement to be executed. Any debugger data display windows will be updated with their new values and if they have changed will be displayed in red.

The debugger provides the following functionality

- Examine local variables values using Debug | Debug Windows | Locals.
- Display the function calls your program has made using Debug | Debug Windows | Call Stack. As you select an entry in the call stack the edit window will display the corresponding statement and the locals window will update appropriately.
- Evaluate debug expressions using the Debug | Debug Windows | Watch windows.
- Display memory using the Debug | Debug Windows | Memory windows.
- Display registers using the Debug | Debug Window | Registers window.
- On targets that support the feature you can also see a profile of jump occurrences using Debug | Debug Windows | Execution Counts.
- On targets that support the feature you can see a trace of the last executed statements/instructions Debug | Debug Windows | Instruction Trace.

#### Restart/Stepping

When your application has stopped at a breakpoint it can be single stepped using Debug | Step Into which will enable you to single step a source statement to follow the control flow of your application into function calls. If you wish to single step over function calls then you should use Debug | Step Over. You can also step to a specific statement using Debug | Run To Cursor and step out of the current function using Debug | Step Out. To restart your application to run to the next breakpoint use Debug | Go.

Note that when single stepping you may step into a function that the debugger cannot locate source code for. In this case the debugger will display the instructions of the application, you can step out to get back to source code or continue to debug at the instruction code level. There are may be cases in which the debugger cannot display the instructions, in these cases you will informed of this with a dialog and you should step out.

#### Debug Modes

The debugger supports three modes of debug

- Source mode In this mode the source code is located in the editor
- Interleaved mode In this mode the editor displays an interleaved listing of the currently located source code. All single stepping is done an instruction at a time.
- Assembly mode In this mode a disassembly of the instructions around the currently located instruction is shown in the editor. All single stepping is done an instruction at a time.