zoukankan      html  css  js  c++  java
  • GDB dump mem example和命令

    使用方法:

    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

  • 相关阅读:
    怎么查看keras 或者 tensorflow 正在使用的GPU
    tf.layers.Dense与 tf.layers.dense的区别
    pytorch LSTM 简单形式
    JN_0025:在局域网中调试本地loaclhost项目
    JN_0024:浏览器打开弹窗
    JN_0023:谷歌浏览器启动项设置
    H5_0041:定义方法获取URL参数
    H5_0040:iframe 父子页面方法调用
    H5_0039:iframe 页面嵌套格式 安全选项sandbox
    Web_0008:win系统默认80端口被占用的处理方法
  • 原文地址:https://www.cnblogs.com/dylancao/p/9209280.html
Copyright © 2011-2022 走看看