You can use the commands dump
, append
, and
restore
to copy data between target memory and a file. The
dump
and append
commands write data to a file, and the
restore
command reads data from a file back into the inferior's
memory. Files may be in binary, Motorola S-record, Intel hex,
Tektronix Hex, or Verilog Hex format; however, gdb can only
append to binary files, and cannot read from Verilog Hex files.
dump
[format] memory
filename start_addr end_addrdump
[format] value
filename exprThe format parameter may be any one of:
binary
ihex
srec
tekhex
verilog
gdb uses the same definitions of these formats as the gnu binary utilities, like ‘objdump’ and ‘objcopy’. If format is omitted, gdb dumps the data in raw binary form.
append
[binary
] memory
filename start_addr end_addrappend
[binary
] value
filename exprrestore
filename [binary
] bias start endrestore
command can automatically recognize any known bfd
file format, except for raw binary. To restore a raw binary file you
must specify the optional keyword binary
after the filename.
If bias is non-zero, its value will be added to the addresses contained in the file. Binary files always start at address zero, so they will be restored at address bias. Other bfd files have a built-in location; they will be restored at offset bias from that location.
If start and/or end are non-zero, then only data between file offset start and file offset end will be restored. These offsets are relative to the addresses in the file, before the bias argument is applied.