9.12.2. Moving up and down the Call Stack

To change scope by moving up and down the Call Stack:

  1. Follow the steps described in Before you start.

    The rest of this procedure continues to use the dhrystone.axf image as an example.

  2. 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:

    1. Display line 167 in dhry_1.c.

    2. Right-click on the Proc_8 function name to display the context menu.

    3. Select Set Break On from the context menu.

  3. Click the Run button.

    The program begins execution.

  4. 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.

    Figure 9.15. Stopped at breakpoint in Proc_8() function

    Stopped at breakpoint in Proc_8() function

    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

  5. 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.

    Figure 9.16. Call Stack pane

    Call Stack pane
  6. 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.

    Note

    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.

  7. 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.

Note

You must use the Stack up button first, because the context is at the last stack level.

Copyright © 2002-2006 ARM Limited. All rights reserved.ARM DUI 0153H
Non-Confidential