9.2.23. let

The let command enables you to change the value of a variable or contents of a memory location.

Syntax

The syntax of the let command is:

{let} {variable | location} = expression{{,} expression}*

where:

variable

Names the variable to change.

location

Names the memory location to change.

expression

Contains the expression or expressions.

Usage

You use the let command in low-level debugging to change memory. If the left-side expression is a constant or a true expression (and not a variable), it is treated as a word address, and memory at that location (and if necessary the following locations) is changed to the values in the following expression(s).

An equals sign (=) or a colon (:) can separate the variable or location from the expression. If you specify multiple expressions, separate them by commas or spaces.

Variables can only be changed to compatible types of expression. However, the debugger converts integers to floating-point and vice versa, rounding to zero. The value of an array can be changed, but not its address, because array names are constants. If the subscript is omitted, it defaults to zero.

If you specify multiple expressions, each expression is assigned to variable[n-1], where n is the nth expression.

See also let for more information on the let command.

Specifying the source directory

You can use the variable $sourcedir to specify alternative search paths for source files for the image currently loaded. This variable defaults to NULL if no alternative directories are specified. You can set the value of $sourcedir using the command:


{let} $sourcedir = string

where string must be a valid pathname, or pathnames. The string must be enclosed in double quotes. If you are using armsd in a Windows DOS environment you must escape the backslash directory separator with another backslash character.

For example:


let $sourcedir="c:\\myhome"

Multiple paths must be separated by a semicolon. For example:


ARMSD: let $sourcedir = "/home/usr/me/src;/home/usr/me/src2"


ARMSD: p $sourcedir
"/home/usr/me/src;/home/usr/me/src2"


ARMSD: let $sourcedir = "/home/usr 2/her name/proj B files"

Note

No warning is displayed if you enter an invalid pathname.

Command-line arguments

You can specify command-line arguments for the debuggee using the let command with the root-level variable $cmdline. The syntax is:


{let} $cmdline = string

The program name is automatically passed as the first argument, so you must not include it in the string. You can examine the setting of $cmdline using print. Commands that use the program name are:

go

Starts execution of the program.

getfile

Reads the contents of an area of memory from a file.

load

Loads an image for debugging.

putfile

Writes the contents of an area of memory to a file.

reload

Reloads the object file specified on the armsd command line, or the last load command.

type

Types the contents of a source file, or any text file, between a specified pair of line numbers.

Reading and writing bytes and halfwords (shorts)

When you specify a write to memory in armsd, a word value is used. For example:


let 0x8000 = 0x01

makes armsd transfer a word (4 bytes) to memory starting at the address 0x8000. The bytes at 0x8001, 0x8002, and 0x8003 are zeroed.

To write only a single byte, you must indicate that a byte transfer is required. You can do this with:


let *(char *)0xaddress = value

Similarly, to read from an address use:


print *(char *)0xaddress

You can also read and write halfwords (shorts) in a similar way:


let *(short *)0x8000 = valueprint /%x *(short *)0x8000 

where /%x displays in hex.

Editing long long variables

If you are changing the value of a long long or unsigned long long variable, your new value might be of such a length that it appears to be invalid. In this case, enter LL or ULL as appropriate at the end of the new value to force its acceptance.

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