User manual

UM0036 STM8 C tutorial
Doc ID 7705 Rev 11 351/385
12.5 View execution
In this lesson you will learn the STVD features that allow you to view the application
instructions that have been executed by the debugger. Here, you will:
View calls to the stack
View and change local variables
View variables using the Watch, QuickWatch and Memory windows
12.5.1 View calls to the stack
1. Select View>Call Stack to display the Call stack window. This window shows the
function calls stored in the microcontroller call stack from the most recent function calls,
traced back to the earliest call.
Figure 281. Call Stack window
2. Double-click on entry #1. A call stack frame indicator appears in the Disassembly
window to indicate where the call was made in the disassembled source code. You can
return to any previous stack call in this manner.
3. Select View>Local Variables to view the Local variables window, this shows the
values of the variables as they were at the moment the selected function call was
performed.
4. In the Call Stack window, double-click on entry #0 to return to the current Program
Counter position.
5. Before going on, remove the breakpoint at line 133 by selecting Edit>Remove All
Breakpoints.
12.5.2 View and change local variables
1. Select Debug>Step Out to step out of trapISR and into main_loop.
2. Set an instruction breakpoint on the call to waiting_loop function (line 218).
3. Select Debug>Continue.
4. Select Debug>Step Into to step into the waiting_loop function.
5. Place the cursor on the count variable (line 186), select Edit>QuickWatch to open
the QuickWatch window.
The QuickWatch window is opened in front of the active Editor window. The main
display area displays the count variable and its current values.
6. Double-click in the Value field of the count variable, change its value to 3. and click on
Close.