当radare2分析一个函数时,它会给出局部变量名,比如local_4h ( ebp - 0x4 )。当这些变量的目的变得清晰时,它还提供了给这些变量更有意义的名称的能力。然而,在变量被重命名后,打印它们变得更加困难。当我看到像mov eax, dword [ebp - i]这样的指令时,我必须
var int i @ ebp-0xcpxw @ebp-0xc型i的值输出线这不是很多工作,但是当我使用许多变量查看大量的程序集时,它很快就会变得单调乏味。
作为后续问题,是否可以在每次执行在断点停止时打印变量/位置,比如GDB的display命令?
发布于 2017-09-24 22:29:28
不是pxw @ local_4h,而是afvd (analyze fcode variables display),它列出了每个或特定的变量:
[0x00400526]> afvd
var local_14h = 0x7fff2eab16ac 0x2eab17a000000001 ........
var local_20h = 0x7fff2eab16a0 0x00007fff2eab17a8 ........ @rsp rsi stack R W 0x7fff2eab21ec --> stack R W 0x74756f2e612f2e (./a.out) --> ascii
var local_8h = 0x7fff2eab16b8 0x0000000000000041 A....... ascii
var local_4h = 0x7fff2eab16bc 0x0040057000000000 ....p.@.
[0x00400526]> .afvd local_14h # note the dot
var local_14h = 0x7fff2eab16ac 0x2eab17a000000001 ........afvd name返回r2命令以显示变量'name‘。开始处的点执行命令。
请记住,您可以始终使用?命令获取帮助:
[0x00400526]> afv?
|Usage: afv[rbs]
| afvr[?] manipulate register based arguments
| afvb[?] manipulate bp based arguments/locals
| afvs[?] manipulate sp based arguments/locals
| afvR [varname] list addresses where vars are accessed
| afvW [varname] list addresses where vars are accessed
| afva analyze function arguments/locals
| afvd name output r2 command for displaying the value of args/locals in the debugger
| afvn [old_name] [new_name] rename argument/local
| afvt [name] [new_type] change type for given argument/local
| afv-([name]) remove all or given var实际上,也有可能使用(几乎)相同的语法,如您的问题。但是,变量名必须事先作为标志添加,而且每次输入函数时都必须这样做。
[0x00400526]> .afv*
[0x00400526]> pxw @ fcnvar.local_14h
0x7fff2eab16ac 0x00000001 0x2eab17a0 [omitted]https://stackoverflow.com/questions/41372971
复制相似问题