Closed hehaoqian closed 2 years ago
can you check the output from r2? because those args (arg1, arg2) comes from r2
Output of "afv"
var int64_t var_8h @ rbp-0x8
var int64_t var_4h @ rbp-0x4
arg int64_t arg2 @ rsi
arg int64_t arg1 @ rdi
i can confirm that the problem is that those 2 args are inverted by r2 in the json structure.
I don't think this is a correct fix. the arguments must be sorted depending on the calling convention associated with the function. not sorted by name or by register index. Right now the json output doesn't order them in any specific way because it's assume that's part of the frontend who understand the calling convention. but I can fix that in the r2 side so we can ensure the listing honours the calling convention which is probably the expected output.
Version: radare2 5.6.6 and r2dec-js 5.6.6 OS: Ubuntu 20.04.3 LTS gcc: 9.3.0
The original function
Compiled with
gcc test.c -c -o test.o
The disassembly:
The disassembled code generated by
pdd
I think the function prototype should be
Component
Reproduce via JSON (pddi)