3.2 Running, stopping, and stepping through an application
DS-5 Debugger enables you to control the execution of your application by sequentially running, stopping, and stepping at the source or instruction level.
Once you have connected to your target, you can use the options on the
in the Debug Control
view to run,
interrupt, and step through the application. See Debug Control
You can also use the Commands
view to enter the execution control
group of commands to
control application execution.
Figure 3-1 Debug Control view
You must compile your code with debug information to use the source level stepping
commands. By default, source level calls to functions with no debug
information are stepped over. Use the set step-mode
command to change this default setting.
Be aware that when stepping at the source level, the debugger uses
temporary breakpoints to stop execution at the specified location. These
temporary breakpoints might require the use of hardware breakpoints,
especially when stepping through code in ROM or Flash. If the available
hardware breakpoint resources are not enough, then the debugger displays
an error message.
There are several ways to step through an application. You can choose to step:
Source level or instruction level.
In source level debugging, you step through one line or expression in your
source code. For instruction level debugging, you step through one machine
instruction. Use the
button on the toolbar to switch between source and instruction
level debugging modes.
Into, over, or out of all function calls.
If your source is compiled with debug information, using the execution control
commands, you can step into, step through, or step out of functions.
Through multiple statements in a single line of source code, for example a
- Click to start or resume execution.
- Click to pause execution.
- Click to step through the code.
- Click to step over code.
- Click to continue running to the next line of code after the selected stack frame finishes.
- Click to change the stepping mode between source line and instruction.
Application rewind-specific options:
- Click to continue running backwards through the code.
- Click to step backwards through the code.
- Click to step backwards over a line of code.
- Click to continue running to the next line of code backwards after the
selected stack frame finishes.
Example 3-1 Stepping commands example
To step a specified number of times you must use the
Commands view to manually execute one of the stepping
commands with a number.
steps 5 # Execute five source statements
stepi 5 # Execute five instructions