使用方法:

You can use the commands dumpappend, 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, or Tektronix Hex format; however, gdb can only append to binary 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.

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 [binarybias 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.

举个例子:

dump binary memory result.bin 0x200000000 0x20000c350

This will give you a plain binary dump int file result.bin. You can also use the following to dump it in hex format:

dump ihex memory result.bin 0x200000000 0x20000c350

Using the dump command is much clearer than using the gdb logging hack (which even did not work for me somehow)

参考文档: https://stackoverflow.com/questions/16095948/gdb-dump-memory-save-formatted-output-into-a-file

GDB dump mem example和命令的更多相关文章

  1. gdb调试多进程和多线程命令

     gdb调试多进程和多线程命令 来源:http://blog.csdn.net/pbymw8iwm/article/details/7876797 1. 默认设置下,在调试多进程程序时GDB只会调试主 ...

  2. Linux中使用gdb dump内存

    在应急响应中,我们往往会有dump出某一块内存下来进行分析的必要.今天要讲的是利用gdb命令dump出sshd进程的内存. 按照 Linux 系统的设计哲学,内核只提供dump内存的机制,用户想要du ...

  3. [每天一个Linux小技巧] gdb 下一次运行多个命令

    一般gdb运行的时候,我们仅仅能输入一个命令. 如: (gdb) c (gdb) bt 假设想运行多个命令怎么办? 能否像bash那样, 使用; 如 ls; ls 结论是不行. 但能够通过gdb 内建 ...

  4. [转]gdb调试多进程和多线程命令

    1. 默认设置下,在调试多进程程序时GDB只会调试主进程.但是GDB(>V7.0)支持多进程的分别以及同时调试,换句话说,GDB可以同时调试多个程序.只需要设置follow-fork-mode( ...

  5. gdb调试多进程和多线程命令(转)

    1. 默认设置下,在调试多进程程序时GDB只会调试主进程.但是GDB(>V7.0)支持多进程的分别以及同时调试,换句话说,GDB可以同时调试多个程序.只需要设置follow-fork-mode( ...

  6. CPU IO MEM NETWork 监控命令

    性能优化中CPU.内存.磁盘IO.网络性能的依赖(上) 性能优化中CPU.内存.磁盘IO.网络性能的依赖(下)

  7. gdb各种调试命令和技巧

    陈皓:用GDB调试程序 GDB概述———— GDB是GNU开源组织发布的一个强大的UNIX下的程序调试工具.或许,各位比较喜欢那种图形界面方式的,像VC.BCB等IDE的调试,但如果你是在UNIX平台 ...

  8. linux包之gdb之gdb命令与core文件产生

    gdb-7.2-64.el6_5.2.x86_64/usr/bin/gcore/usr/bin/gdb/usr/bin/gdb-add-index/usr/bin/gdbtui/usr/bin/gst ...

  9. 比较全面的gdb调试命令 (转载)

    转自http://blog.csdn.net/dadalan/article/details/3758025 用GDB调试程序 GDB是一个强大的命令行调试工具.大家知道命令行的强大就是在于,其可以形 ...

随机推荐

  1. POJ 3162.Walking Race 树形dp 树的直径

    Walking Race Time Limit: 10000MS   Memory Limit: 131072K Total Submissions: 4123   Accepted: 1029 Ca ...

  2. hdu3307 欧拉函数

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3307 Description has only two Sentences Time Limit: 3 ...

  3. 解决sqlserver还原数据库失败命令

    1.使用Master数据库 2.选择数据库 select * from master.sys.sysprocesses where dbid=db_id('database') 3.查出进程使用kil ...

  4. XML文件的解析—DOM、SAX

    一.DOM 解析 思路:获得Document对象,遍历其中节点获得需要的内容 要点: Document :  DocuemntBuilderFactory --newDocumentBuilder - ...

  5. docker启动异常driver not supported

    使用阿里云机器重启docker服务出现错误提示信息 [root@iz2ze5ivwiz2bnwddc20k4z ~]# systemctl restart docker Job for docker. ...

  6. CentOS7安装特定版本的Docker

    查询可用版本 [root@bogon ~]# yum list docker-ce --showduplicates | sort -r 查询结果 * updates: centos.ustc.edu ...

  7. sourceInsight4 完美破解

    sourceInsight4 完美破解 参考路径: https://blog.csdn.net/zxy020/article/details/75047670 首先确保你在官网下载了原版4.0并安装好 ...

  8. maven阿里云仓库配置

    为了加速项目构建,在maven的settings.xml 文件里配置mirrors的子节点,添加如下mirror: <mirrors> <mirror> <id>a ...

  9. python基础--------字符串的调用详解(2)

    Python 字符串的的调用方法~~~@@@ 17.  strip  : 去除字符串左右两边指定的字符 18.   rstrip : 去除字符串右边指定的字符 19 .   lstrip  :  去除 ...

  10. python 基础———— 字符串常用的调用 (图)

    Python 常用的 字符串调用方法 这里用到了pycharm ( 使用Python  有力的工具) 下载地址https://www.jetbrains.com/pycharm/download/#s ...