1

我有这样的事情:

(fcn) fcn.140001020 20
   fcn.140001020 ();
           ; XREFS: CALL 0x140001080  CALL 0x140001098  CALL 0x1400010b0  CALL 0
           ; XREFS: CALL 0x140001794  CALL 0x1400017ad  CALL 
           0x140001029      mov dword [0x140018a38], eax

我希望能够给地址 0x140018a38 起一个名字,所以它看起来像这样:

           0x140001029      mov dword [myGlobal], eax
4

1 回答 1

0

环境

  • 雷达2:雷达2 4.2.0-git 23519@linux-x86-64 git.4.1.1-84-g0c46c3e1e 提交:0c46c3e1e30bb272a5a05fc367d874af32b41fe4 构建:2020-01-08__09:49:0
  • 系统: Ubuntu 18.04.3 LTS

解决方案

  • 我不确定radare2 是否实现了您正在寻找的确切功能,但我们可以使用 Cf 和 CCa 命令接近。
    • CCa[-at]|[at] [text] [@addr] # 在给定地址添加/删除评论
    • cf[?][-] [sz] [0|cnt][fmt] [a0 a1...] [@addr] # 格式化内存(见 pf?)

例子

user@host:~$ r2 /my/example
[0x00000000]> aaaa
...
[0x00000000]> s fcn.140001020
[0x140001020]> pd 1
(fcn) fcn.140001020 20
   fcn.140001020 ();
           ; XREFS: CALL 0x140001080  CALL 0x140001098  CALL 0x1400010b0  CALL 0
           ; XREFS: CALL 0x140001794  CALL 0x1400017ad  CALL 
           0x140001029      mov dword [0x140018a38], eax
[0x140001020]> CCa 0x140001020 0x140018a38 = myGlobal
[0x140001020]> pd 1
(fcn) fcn.140001020 20
   fcn.140001020 ();
           ; XREFS: CALL 0x140001080  CALL 0x140001098  CALL 0x1400010b0  CALL 0
           ; XREFS: CALL 0x140001794  CALL 0x1400017ad  CALL 
           0x140001029      mov dword [0x140018a38], eax ; 0x140001029 = myGlobal
[0x140001020]> Cf 2 w myGlobal @ 0x140018a38
[0x140001020]> pd 1 @ 0x140018a38
            0x140018a38 format w myGlobal {
 myGlobal : 0x140018a38 = 0xffff
} 2
[0x140001020]> q
user@host:~$ 
于 2020-01-13T15:54:56.470 回答