2.3.137. TEST

Reads target memory to verify that specified values exist throughout the specified memory area.


TEST [{/B|/H|/W|/8|/16|/32}] [/R] address-range [={expression | expressionlist}]


/B|/H|/W are deprecated in this release.



Sets the access size to 8 bits.


Sets the access size to 16 bits.


Sets the access size to 32 bits.


If no access size is specified, the default is the native format for the debug target. For example, the ARM7TDMI processor naturally addresses 8 bits.


Continues to test for the specified expression, displaying each match until the end of the block or until the stop button Cancel is pressed.


The range of addresses to be tested. See Specifying address ranges for details on how to specify an address range.


A value to check against the contents of memory.

An expression to be evaluated to a value and checked against the specified memory region. The expression can be:

  • a decimal or hexadecimal number

  • a debugger expression, for example a math calculation

  • a string enclosed in single or double quotation marks.

If you use a quoted string:

  • each character of the string is treated as a byte value in an expressionlist

  • no C-style zero terminator byte is written to memory.

Also, see Rules for specifying strings in the TEST command for more details on using strings with the TEST command.


A list of expressions to check against the contents of the specified memory region. An expressionlist is a sequence of expressions separated by commas, for example "Text",0,0x20.

The debugger tests the memory area to verify that it is filled with those values in the pattern of the string.


All expressions in an expression list are padded or truncated to the size specified by the size qualifiers if they do not fit the specified size evenly. This also applies to each character of a string.


The TEST command examines target memory to verify that specified values exist throughout the specified memory area. Unless you use the /R qualifier, Testing stops when a mismatch is found. The debugger always displays any mismatched address and value.

Subsequent TEST commands issued without parameters cause the debugger to continue testing through the address range originally specified, beginning with the last address that did not match.

Considerations when using the TEST command

Be aware of the following when using the TEST command:

  • The TEST command does not recognize variable typing, so you must ensure the access size qualifier is compatible with the variable type.

  • If the length of the expression list is greater than the specified address range, any values in the expression list after the end of the address range are ignored. For example, test/8 0x9000..0x9003="Message" compares the four bytes in the address range with "Mess", and ignores "age".

  • If you specify only a start address, one copy of the expression is checked, examining only as many bytes as required for the expression. For example, test/8 0x9000="Message" compares bytes in the address range 0x9000 to 0x9006 with "Message".

  • If you specify an address range with equal start and end addresses, then only that memory location is checked against first byte of the expression. The rest of the expression list is ignored. For example, test/8 0x9000..0x9000="Message" compares the byte at address 0x9000 with "M".

    If an expression is not specified, the debugger acts as if =0 had been specified as the expression.

  • The TEST command runs synchronously.

Rules for specifying strings in the TEST command

Follow these rules when specifying a string:

  • No C-style zero terminator byte is checked in memory after a specified string. To check for a NUL-terminated string, add a zero value expression after the string, for example:

    "Test Message",0

  • You cannot use an empty string to test for a NUL character.

  • Use the /8 qualifier, if you want to compare the characters of a string with consecutive bytes of memory.


The following examples show how to use TEST:

test/8 0x8000..0x9000 =0

Find the address of the first non-zero byte in the 4KB page from 0x8000.

test/r/16 0x10000..0x20000 =0xFFFF

Find and display the addresses of any 16-bit values in the address range that is not 0xFFFF. This might be useful to find out which regions of a Flash memory device are programmed.

test/8 0x9008..0x9014="Test Message",0

Check if the memory region from 0x9008 to 0x9014 matches the NUL terminated string "Test Message". This might be useful to check the memory reqion after you have written a NUL-teminated string to that region using the SETMEM command.

See also

Copyright © 2002-2011 ARM. All rights reserved.ARM DUI 0175N