gdb: Dump/Restore Files

 
 10.18 Copy Between Memory and a File
 ====================================
 
 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_ADDR'
 'dump [FORMAT] value FILENAME EXPR'
      Dump the contents of memory from START_ADDR to END_ADDR, or the
      value of EXPR, to FILENAME in the given format.
 
      The FORMAT parameter may be any one of:
      'binary'
           Raw binary form.
      'ihex'
           Intel hex format.
      'srec'
           Motorola S-record format.
      'tekhex'
           Tektronix Hex format.
      'verilog'
           Verilog Hex format.
 
      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_ADDR'
 'append [binary] value FILENAME EXPR'
      Append the contents of memory from START_ADDR to END_ADDR, or the
      value of EXPR, to the file FILENAME, in raw binary form.  (GDB can
      only append data to files in raw binary form.)
 
 'restore FILENAME [binary] BIAS START END'
      Restore the contents of file FILENAME into memory.  The 'restore'
      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.