4.2.2. Defining scope and context

RealView Debugger uses scope to determine the value of a symbol. Scope shows how RealView Debugger accesses variables and finds symbols in expressions. The scope determines the execution context and defines how local variables are accessed. Any symbol value available to a C or C++ program at the current PC is also available to RealView Debugger.

When your program is executing, the PC stores the address of the current execution point. By default, the scope is set when the PC changes. Loading an image sets the PC at the entry point using autoscope, that is the PC defines the scope. Autoscope is also used in an assembly language routine when you step into code that has no source information. In this case, RealView Debugger shows the last calling function that had valid source in the Src tab.

RealView Debugger uses a red box to highlight the location of the PC where this is visible in the selected code view. The PC is only visible in an execution tab. However, if you force scope to a different location then the red box highlights the current context. This might not be the true location of the PC.

When RealView Debugger first loads an image, and assuming that you do not force scope, the File Editor pane contains tabs showing program execution:

Locating the Program Counter

You can locate the PC using the Debug menu:

  • select Debug → Execution Control → Show Line at PC to display the current location of the PC in the Output pane

  • select Debug → Execution Control → Show Context of PC to display the current context of the PC in the Output pane.

Forcing scope

Scope is forced when it is not set by the PC. To force the scope:

  1. Connect to your target and load an image, for example dhrystone.axf.

  2. Click on the Src tab to view the source file dhry_1.c.

    The PC is at the entry point at line 78, marked with a red box.

  3. Right-click at a location (line or address) in your execution view, for example line 149 in the source file dhry_1.c.

  4. Select Scope To Here from the context menu.

    The forced scope is identified by a filled blue pointer at the chosen location. This moves the red box to highlight the current context.

  5. Select Debug → Execution Control → Show Context of PC to see the location of the PC in the Output pane.

  6. Click High-level Step Into to step into the program.

  7. Select Debug → Execution Control → Show Context of PC to see the location of the PC.

To reset the PC to the entry point, either:

  • Select File → Set PC to Entry Point from the Code window main menu.

  • Click Set PC to Entry on the Actions toolbar.

If you reset the PC to the entry point, this issues a RESTART command but does not reset the values of variables, reset the Stack Pointer (SP), or clear breakpoints.

Copyright © 2003, 2004 ARM Limited. All rights reserved.ARM DUI 0234B
Non-Confidential