mem

Reads and writes memory.

Syntax
mem <addr-spec> [<range>] [-s|-ns] [%<conv>] [-np]
mem
mem <addr-spec> [<range>] [-s|-ns] [%<conv>] =<value>
mem -ms
Overview

The mem command reads or writes one or more adjacent "cells" of memory, where a cell is defined as a contiguous block of bytes. The cell size is determined by the <cell-size> parameter or by the config command option "MemWidth".

Options

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

Table 1. mem Command-line debugger command - Options
Command Description
[none] With no option, next block of memory is read.
<ms> On architectures supporting multiple memory spaces, specifies the memory space in which <addr> is to be found. See the help for the option -ms of display or mem for more information on memory spaces. If unspecified, the setting "config MemIdentifier" is used.
<addr> Target address in hex.
<count> Number of memory cells.
x<cell-size> Memory is displayed in units called cells, where each cell consists of <cell-size> bytes. If unspecified, the setting "config MemWidth" is used.
h<access-size> Memory is accessed with a hardware access size of <access-size> bytes. If unspecified, the setting "config MemAccess" is used.
{8,16,32,64}bit Sets both <cell-size> and <access-size> .
-np Don't print anything to the display, only return the data.
-ms On architectures supporting multiple memory spaces, displays the list of available memory spaces including a mnemonic and/or an integer index which may be used when specifying a target address.
-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 examples assume the following settings:

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

Table 2. mem Command-line debugger command - Examples
Command Description
mem Displays the next block of memory.
mem 10000 Changes memory range 0x10000-3 as one cell.
mem 1:10000 Changes memory range 0x10000-3, memory space 1, as one cell.
mem 10000 16 Displays memory range 0x10000-3f as 16 cells.
mem 10000 16x1h8 Displays 16, 1-byte cells, with a hardware access size of 8-bytes per read.
mem 10000 8bit Displays one byte, with a hardware access size of one byte.
mem 10000 -np Returns one cell, but don't print it to the Command Window.
mem 10000 -s Displays one byte with the data endian-swapped.
mem 10000 %d Displays one cell in decimal format.
mem -ms Displays the available memory spaces, if any.
mem 10000 =10 Changes memory range 0x10000-3 to 0x10 (because radix is hex).
mem 1:10000 =20 Changes memory range 0x10000-3 , memory space 1, to 0x20 .
mem 10000 16x1h8 =31 Changes each of 16, 1-byte cells to 0x31 , using a hardware access size of 8-bytes per write.
mem 10000 -s %d =200 Changes memory range 0x10000-3 to c8000000.