5.10.18. Using the stack

The Stack pane enables you to monitor the contents of the stack as raw memory and to make changes to those settings. The Stack pane enables you to follow the flow of your application through the hierarchical structure and shows you the path that leads from the main entry point to the currently executing function.

To view the Stack pane:

  1. Select View ? Stack from the default Code window. The Stack pane is displayed as a floating pane.

  2. Select Target ? Reload Image to Target from the Code window main menu to reload the image.

  3. Click the Run button on the Debug toolbar to execute the image. Enter a large number of runs at the application prompt, for example 50000.

  4. Click Stop Execution to stop the program before it finishes.

  5. View the updated Stack pane, shown in Figure 5.11.

    Figure 5.11. Viewing the stack

    Viewing the stack

    The stack pointer, marked by SP, is located at the bottom of the stack. The frame pointer, marked by FP, shows the starting point for the storage of local variables.

Changing the stack pointer

As you step through your code, the default stack pointer is used, shown in Figure 5.11. You can specify an expression or a register to use as the stack pointer from the Stack pane:

  1. Right-click in the left column of an entry to display the Stack context menu.

  2. Select Set Start Address... to display the address prompt box.

  3. Enter an expression or a register, for example @R9, as the new stack pointer.

  4. Click Set to confirm your choice and close the address prompt box.

    The new stack pointer is marked by Expression Pointer (EP), located at the bottom of the stack.

    If you enter a blank expression, or remove the existing expression, in the address prompt box, RealView Debugger reverts to using the default stack pointer register. In this example, this was R13 shown in Figure 5.7.

  5. Select Hide from the Pane Control menu to hide the Stack pane.

Copyright © 2002-2005 ARM Limited. All rights reserved.ARM DUI 0181G