使用方法:

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. hive资料

    Hive基本操作 Hive 解锁操作 之前使用Hive,出现过一种情况:在代码正在执行insert into或insert overwrite时,中途手动将程序停掉,会出现卡死情况,只能执行查询操作, ...

  2. 团队项目Alpha冲刺阶段之学习总结

    线性布局 线性布局是程序中最常见的种布局方式,可以分为水平线性布局和重直线性布局两种,通过Android:orientation属性可以设置线性布局的方向.线性布局的特点是各个子元法彼此连接,中间不留 ...

  3. Java Swing实现展示数据,以及过滤排序

    public class RelationCostctrTable extends DefaultTableModel { public RelationCostctrTable(Vector< ...

  4. JavaSE 初学系统托盘图标SystemTray类

    文章目录 1.预备知识 2.使系统托盘显示图标 3.添加提示 4.添加弹出菜单 设置Java程序的系统托盘图标,用到SystemTray类和TrayIcon类. 1.预备知识 JavaAPI对于Sys ...

  5. Python学习笔记:基础

    本文根据廖雪峰的博客,学习整理笔记.主要内容有:基本数据类型,容器数据类型,变量及其作用域,判断及循环语法,函数式编程,面向对象,模块等概念. 数据类型 在python中,能够直接处理的数据类型有以下 ...

  6. MongoDB学习记录(四) - MongoDB的"增查改删"操作之"改"

    更新文档主要有以下几种方法: db.collection.updateOne(filter, update, options) db.collection.updateMany(filter, upd ...

  7. IntelliJ IDEA 控制台中文乱码解决方案

    配置Intellij的配置文件(在idea安装目录bin目录下) 打开Intellij的根目录,找到下图的两个文件(根据你的系统是32位或64位选择其中一个配置文件),在配置文件中添加: -Dfile ...

  8. rocket-mq windows下载安装

    内容来源:https://www.jianshu.com/p/4a275e779afa 1环境    JDK1.8.Maven.Git 2安装部署 1.下载 1.1地址:http://rocketmq ...

  9. 【ORA-12516 TNS监听程序找不到符合协议堆栈要求的可用处理程序】

    服务器上某个数据库出现' ORA-12516: TNS: 监听程序找不到符合协议堆栈要求的可用处理程'错误,要解决该问题首先查看一下数据库现有的进程数,是否已经达到参数processes的大小. 取得 ...

  10. temp--重庆农商行银联前置改造项目出差

    2019年度 杨伟携程订郎菲酒店 158, 单人住一晚 (3.5晚), 杨伟招行信用卡 预授权 1000. 与方程一起住 1915房    (其实前台预授权是  1000-158 = 842) 3.6 ...