set variable

This command evaluates an expression and assigns the result to a variable, register or memory.

Show/hideSyntax

set [variable] expression

Where:

expression

Specifies an expression and assigns the result to a variable, register or memory address.

Note

For formatted registers such as the CPSR you can set bit values symbolically using one or more flags in a string. For example:

set variable $CPSR="nzC"

Each flag modifies the corresponding bit in the register and leaves all the other bits unchanged. Flags are case sensitive:

  • A lowercase flag clears the corresponding bit

  • An uppercase flag sets the corresponding bit.

Show/hideExample

Example 114. set variable

set variable myVar=10                               # Assign 10 to variable myVar
set variable $PC=0x8000                             # Assign address 0x8000 to
                                                    # PC register
set variable $CPSR="nzC"                            # Clear N and Z bits, Set C bit
set variable $CPSR="SVC"                            # Change CPSR register to SVC mode
set variable (*(int*)0x8000)=1                      # Assign 1 to address 0x8000
set variable *0x8000=1                              # Assign 1 to address 0x8000
set variable strcpy((char*)0x8000,"My String")      # Assign string to address 0x8000
set variable memcpy(void*)0x8000,{10,20,30,40},4)   # Assign array to address 0x8000

Show/hideSee also

Copyright © 2010-2012 ARM. All rights reserved.ARM DUI 0452J
Non-ConfidentialID051612