【问题标题】:How to modify memory contents using LLDB?如何使用 LLDB 修改内存内容?
【发布时间】:2014-07-20 14:40:32
【问题描述】:

在 GDB 中,与下面显示的命令等效的 lldb 命令是什么?

(gdb) 设置 {char}0x02ae4=0x12

这些值是任意示例。使用 GDB,我可以轻松地在给定的十六进制地址编辑字节码,同时查看终端中的转储。自从我升级到小牛队后,我一直在尝试更多地使用 lldb,但我在一些领域遇到了困难。也许它甚至还没有这个功能..

【问题讨论】:

    标签: assembly gdb osx-mavericks lldb hexdump


    【解决方案1】:

    memory write 有效,但您也可以将表达式引擎与 C 表达式一起使用,例如

    p *(char*)0x2ae4 = 0x12
    

    【讨论】:

    • 我假设这个例子应该使用0x12 来等同于问题的例子。
    【解决方案2】:

    根据lldb-basics guide LLDB 替代方案是memory write

    还有(lldb) help memory write定义了这样的输入格式:

    memory write -i <filename> [-s <byte-size>] [-o <offset>] <address> <value> [<value> [...]]
    
       -f <format> ( --format <format> )
            Specify a format to be used for display.
    
       -i <filename> ( --infile <filename> )
            Write memory using the contents of a file.
    
       -o <offset> ( --offset <offset> )
            Start writng bytes from an offset within the input file.
    
       -s <byte-size> ( --size <byte-size> )
            The size in bytes to use when displaying with the selected format.
    

    所以,在你的情况下,像 (lldb) memory write 0x02ae4 0x12 这样的东西应该可以工作。

    【讨论】:

      猜你喜欢
      • 2011-03-19
      • 2013-11-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-01-10
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多