| |||
| Home > Changing the Execution Context > Changing scope to the code pointed to by a Call Stack entry > Moving up and down the Call Stack | |||
To change scope by moving up and down the Call Stack:
Follow the steps described in Before you start.
The rest of this procedure continues to use the dhrystone.axf image
as an example.
Locate the point in your code where you want to stop execution.
In this example, set a breakpoint in the Proc_8() function,
as follows:
Display line 167 in dhry_1.c.
Right-click on the Proc_8 function
name to display the context menu.
Select Set Break On from the context menu.
Click
the Run button.
The program begins execution.
When prompted for the number of runs, enter 1000.
The program continues execution and runs up to the breakpoint. A red box shows the location of the PC at line 93, shown in Figure 9.15.
The Cmd tab of the Output pane shows where execution has stopped, for example:
Stopped at 0x00008FA8 due to SW Instruction Breakpoint
Stopped at 0x00008FA8: DHRY_1\main Line 93
Display the Call Stack pane if it is not already visible.
The Call Stack pane for this example is shown in Figure 9.16. The scope is located
at line 93 in dhry_2.c.
Click
the Stack up button in the Debug toolbar.
RealView Debugger moves up one stack level from the current scope location, changes the code view, issues the UP command, and displays a message in the Output pane showing the new context. A stack level is determined by each calling function.
The addresses on the Call Stack depend on the optimization settings used to build your image.
In this example, the scope is now located at line 169 in dhry_1.c.
Click
the Stack down button in the Debug toolbar.
RealView Debugger moves down one stack level from the current scope location, changes the code view, issues the DOWN command, and displays a message in the Output pane showing the new context. A stack level is determined by each calling function.
In this example, the scope is now located at line 93 in dhry_2.c.
You must use the Stack up button first, because the context is at the last stack level.