8.1.2. Variable names and context

You can usually refer to variables by their names in the original source code. To print the value of a variable, type:


print variable

High-level languages

With structured high-level languages, you can access variables defined in the current context by giving their names. Other variables must be preceded by the context (for example, the name of the function) in which they are defined. This also gives access to variables that are not visible to the executing program at the point at which they are being examined. The syntax is:


procedure:variable

Global variables

You can access global variables by qualifying them with the module name or filename if there is any ambiguity. For example, because the module name is the same as a procedure name, you must prefix the filename or module name with #. The syntax is:


#module:variable

Ambiguous declarations

If a variable is declared more than once within the same procedure, resolve the ambiguity by qualifying the reference with the line number in which the variable is declared in addition to, or instead of, the function name:


#module:procedure:line-no:variable

Variables within activations of a function

To pick out a particular activation of a repeated or recursive function call, prefix the variable name with a backslash (\) followed by an integer. Use 1 for the first activation, 2 for the second, and so on. A negative number looks backwards through activations of the function, starting with \-1 for the previous one. If no number is specified and multiple activations of a function are present, the debugger always looks at the most recent activation.

To refer to a variable within a particular activation of a function, use:


procedure\{-}activation-number:variable

Expressing context

The complete syntax for the various ways of expressing context is:


{#}module{{:procedure}*
{\{-}activation-number}}
{#}procedure{{:procedure}*
{\{-}activation-number}}
#

Specifying variable names

The complete syntax for specifying a variable name is:


{context:.{line-number:::}}variable

The various syntax extensions required to differentiate between objects rarely have to be used together.

Copyright © 1999-2004 ARM Limited. All rights reserved.ARM DUI 0066F
Non-Confidential