var

Reads and writes variables or C-expressions.

Syntax
var
var <var-spec> [-np] [-s|-ns] [%<conv>]
var v: [-np] [-s|-ns] [%<conv>]
var <var-spec> [-s|-ns] [%<conv>] =<value>
Options

The following table lists and defines options of the var command.

Table 1. var Command-line debugger command - Options
Command Description
[none] No option is equivalent to "var v:".
v: If this option appears with no <var> following it, then all variables pertinent to the current scope are printed.
<var> Symbolic name of the variable to print. Can be a C expression as well.
-np Don't print anything to the display, only return the data.
-s|-ns Specifies whether each value is to be swapped. For memory, specifies whether each cell is to be swapped. With a setting of -ns, target memory is written in order from lowest to highest byte address. Otherwise, each cell is endian swapped. If unspecified, the setting "config MemSwap" is used.
%<conv> Specifies the type of the data. Possible values for <conv> are given below. The default conversion is set by the radix command for memory and registers and by the config var command for variables.
%x Hexadecimal.
%d Signed decimal.
%u Unsigned decimal.
%f Floating point.
%[Q<n>]F Fixed or Fractional. The range of a fixed point value depends on the (fixed) location of the decimal point. The default location is set by the config command option "MemFixedIntBits".
%s ASCII.
Examples

The following table lists and defines examples of the var command.

Table 2. var Command-line debugger command - Examples
Command Description
var myVar -s %d Displays the endian-swapped contents of variable myVar in decimal.
var myVar =10 Changes the value of variable myVar to 16 (0x10).