I want to get a function's signature information: return type and parameters from x64 binaries. I am able to achieve so, using
tif = idaapi.tinfo_t()
ida_nalt.get_tinfo(tif, ea)
function_type = tif.get_rettype()
metadata[function]["ret_type"] = function_type
funcdata = ida_typeinf.func_type_data_t()
for i,v in enumerate(funcdata):
itype = ida_typeinf.print_tinfo('', 0, 0, idc.PRTYPE_1LINE, v.type, '', '')
metadata[function]["parameter_list"].append(tuple([i, v.name,itype]))
This script works in a lot of cases, but fails in some simple cases, like for example
double retDouble()
{
return 2.4;
}
In such case, I get an empty tif
object, and thus I can't recover the return type — which is double in this case. I believe this happens in cases where there are no function parameters present (like in above case). In such case, How can I recover the return type (or at least recover the type, or is it not possible at all)? I want the type object and not the type as a string, the later can be achievable by parsing IDA disassembly and retrieving function signature by something like regex.