8

与 GDB 中显示的命令等效的 lldb 命令是什么?

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

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

4

2 回答 2

17

根据lldb-basics 指南, 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应该可以工作。

于 2014-05-30T19:07:00.123 回答
4

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

p *(char*)0x2ae4 = 0x12
于 2021-06-20T19:31:32.483 回答