| |||
| Home > DS-5 Debugger commands > DS-5 Debugger commands listed in alphabetical order > set variable | |||
This command evaluates an expression and assigns the result to a variable, register or memory.
set [iable] varexpression
Where:
expressionSpecifies an expression and assigns the result to a variable, register or memory address.
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.
Example 113. 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 ((char*)0x8000)="My String" # Assign string to address 0x8000
set variable ((int*)0x8000)={10,20,30,40} # Assign array to address 0x8000