One can also use the `restore' command (and its friends to dump memory regions to a file), see (gdb) Dump/Restore Files for further information.