radeco
radeco copied to clipboard
Use SDB to determine the number of argument of a given function
tmp = sym.imp.puts("Hello, world.", rsi, rdx, rcx, r8, r9)
-> anal/types/func.puts.args=1
tmp = sym.imp.puts("Hello, world.", rsi)
Can probably add a new r2 command that provide the return type and one that provide the number of argument from the function definition afcfj
?
@Maijin sounds like a good idea. @sivaramaaa do you think anything else can be done here?
@Maijin , IMHO i think , no need to print the registers if we already no the value in it , the below output will be very close to original C code i guess !
tmp = sym.imp.puts("Hello, world.", rsi, rdx, rcx, r8, r9)
anal/types/func.puts.args=1
+tmp = sym.imp.puts("Hello, world.")
-tmp = sym.imp.puts("Hello, world.", rsi)
And yess , if u guys need the command to afcfj
to provide {return type , no of arguments , types of each argument}
, pls let me know , i shall implement it !
yeah well that's up to the @radareorg/radeco team ;) as long as it doesn't print ALL registers that's already better.
yeah if you can implement such a command i think could be useful for that case
Okk sure , will do it today !
So i think i have implemented the afcfj command
[0x00000000]> afcfj fgets~{}
[
{
"name": "fgets",
"return": "char *",
"count": 3,
"args": [
{
"name": "s",
"type": "char *"
},
{
"name": "size",
"type": "int"
},
{
"name": "stream",
"type": "FILE *"
}
]
}
]
Hopefully this should solve this issue , pls let me know , if u guys feel anything missing !
@sivaramaaa What happens for no-return functions?
https://github.com/wargio/r2dec-js/commit/3cfd552cad35275eada93f9d92075f5e5b9bcde5