使用方法:

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. oracle使用数据泵进行数据的导入导出

    https://m.jb51.net/article/32352.htm

  2. js string和number

    number Js只有一种数字类型(包括整型,浮点型) 极大或极小的可用科学计数法来表示.(7.7123e+1) 所有js数字均为64位 Js所有的数字都存储为浮点型 小数的最大位数是17位 0开头的 ...

  3. 通过java读取excle数据的方法,今天用到了留下来供以后参考使用

    近期项目属于一个棋牌类项目 用到的配置表比较多 所以在这里 贴一下代码,留下来可以参考.也希望对有需要的朋友有所帮助哦 >1.需求将一个excle表格中的数据 读取 然后封装成自定义的对象,本项 ...

  4. 别人的Linux私房菜(14)Linux账号管理和ACL权限设置

    用户标识符UID.GID 用户的账号信息,主要是指UID对应.组和GID对应 检查系统中是否存在用户bin:id bin 登录shell验证账号密码的步骤:找到/etc/passwd核对是否存在账号, ...

  5. SIFT算法大综合

     SIFT算法原理+参看资料+问题issue 参考书籍——<图像局部不变性特征与描述>王永明.王贵锦著 SIFT特征点提取——详见博客:https://blog.csdn.net/ling ...

  6. Code First的实体继承模式

    Entity Framework的Code First模式有三种实体继承模式 1.Table per Type (TPT)继承 2.Table per Class Hierarchy(TPH)继承 3 ...

  7. web测试和app测试的区别

    功能上: 功能上没有什么区别,都是用同样的方法来写用例(等效.边界值...) 架构上: web是B/S架构(浏览器和服务器)代码更新后数据会同步,可以保证所有客户一致 app是C/S架构(客户端和服务 ...

  8. shell遍历文件夹

    遍历目录下的所有文件 假如有一个文件夹路径为dir,遍历文件 for file in /path/dir/* do if test -f $file then echo $file arrary=($ ...

  9. 如何从本地远程访问虚拟机内的Mysql服务器?

    假设重装了操作系统,则本地的很多软件可能都需要重新安装,比如数据库.但是,假设我们把一些重要的软件安装在虚拟机当中,则在重装操作系统之前,数据库服务器可以和虚拟机一起进行备份.重装操作系统之后,原先的 ...

  10. c语言编程上次输入影响下次记过怎么解决要交作业啦求大神相助

    秦时鸥总算知道为什么这里这么多的房屋了,当一座吧台和一张张台球桌清理出来的时候他才发现,原来这渔场还有酒吧和桌球厅.