Debugging with GDB Manual The GNU Source-Level Debugger (769148-001, March 2014)
{number="67",value="0xfe0043b0"},{number="68",value="0xfe00b3e4"},
{number="69",value="0x20002b03"}]
(gdb)
The -data-read-memory command
Synopsis
-data-read-memory [ -o byte-offset ]
address word-format word-size
nr-rows nr-cols [ aschar ]
where:
'address' An expression specifying the address of the first memory word to be read.
Complex expressions containing embedded white space should be quoted
using the C convention.
'word-format' The format to be used to print the memory words. The notation is the same
as for GDB print command (see“Output formats” (page 60)).
'word-size' The size of each memory word in bytes.
'nr-rows' The number of rows in the output table.
'nr-cols' The number of columns in the output table.
'aschar' If present, indicates that each row should include an ASCII dump. The value
of aschar is used as a padding character when a byte is not a member of
the printable ASCII character set (printable ASCII characters are those whose
code is between 32 and 126, inclusively).
'byte-offset' An offset to add to the address before fetching memory.
This command displays memory contents as a table of nr-rows by nr-cols words, each word
being word-size bytes. In total, nr-rows * nr-cols * word-size bytes are read
(returned as 'total-bytes'). Should less than the requested number of bytes be returned by the
target, the missing words are identified using 'N/A'. The number of bytes read from the target is
returned in 'nr-bytes' and the starting address used to read memory in 'addr'.
The address of the next/previous row or page is available in 'next-row' and 'prev-row',
'next-page' and 'prev-page'.
GDB command
The corresponding GDB command is 'x'. gdbtk has 'gdb_get_mem' memory read command.
Example
Read six bytes of memory starting at bytes+6 but then offset by -6 bytes. Format as three rows
of two columns. One byte per word. Display each word in hex.
(gdb)
9-data-read-memory -o -6 -- bytes+6 x 1 3 2
9^done,addr="0x00001390",nr-bytes="6",total-bytes="6",
next-row="0x00001396",prev-row="0x0000138e",next-page="0x00001396",
prev-page="0x0000138a",memory=[
{addr="0x00001390",data=["0x00","0x01"]},
{addr="0x00001392",data=["0x02","0x03"]},
{addr="0x00001394",data=["0x04","0x05"]}]
(gdb)
Read two bytes of memory starting at address shorts + 64 and display as a single word formatted
in decimal.
(gdb)
5-data-read-memory shorts+64 d 2 1 1
5^done,addr="0x00001510",nr-bytes="2",total-bytes="2",
248 The GDB/MI Interface