1.7.1. Scope

All variables and functions in a C or C++ source program have a storage class that defines how the variable or function is created and accessed. C preprocessor symbols might not be available to the debugger.

Global (extern)

In the debugger, global variables can be referred to from any module. However, if a symbol of the same name exists in the local scope, this variable must be qualified by a root name, by \ (current root), or with ::.

Static

In the debugger, static functions can be referred to from the same module without qualification. Static functions in other modules must be qualified with the module name if the name is ambiguous or the module has not been used yet (not loaded).

Local

A local variable is accessible when it is local to the current function, local to the current unnamed block, or when its function is on the stack. It can be qualified by function, line, or stack level.

Register

Register variables might not be available from all lines in the function, because hardware registers can be shared by more than one local register variable. A register variable is accessible when it is local to the current function or when its function is on the stack. It can be qualified by function or stack level.

Scoping rules

References to symbols follow the standard scoping rules of C and C++. If a symbol is referenced, the debugger searches its symbol table using the following priority:

  1. Any symbol local to the current macro.

  2. Any symbol local to the current line.

  3. Any symbol local to the current function.

  4. Any symbol local to the class of the current function.

  5. Any symbol static to the current module.

  6. Any global symbol not necessarily in the current module.

  7. A static symbol in another module.

  8. A global symbol in another root (that is, a different loaded file).

Copyright © 2002-2010 ARM Limited. All rights reserved.ARM DUI 0175M
Non-ConfidentialID102410