I have a lib from which a function is called using function pointer, the function pointer is set by us in local code.
The issue is, i have assigned the pointer an address of a function which accepts arguments.
and i am suspecting that in lib the function is called without arguments i.e. after type casting it to some other type.
Now, i want to know by using gdb or any other tool weather the function is called with/without type cast. I do not have exact code for the lib but i do have the lib with debug flags.
To explain here is a code snippet:
typedef int (*type1)(void);
typedef int (*type2)(int, int);
int calledFunc (int,int);
int main(int argc, char *argv[])
{
type1 t1;
t1 = (type1)&calledFunc;
t1();
((type2)t1)(5,6);
system("PAUSE");
return 0;
}
int calledFunc (int a, int b)
{
printf("Function called=> %d\n",a+b);
return (a+b);
}
In above code how we can deduce using gdb if CalledFunc is called with or without typecasting?
Aucun commentaire:
Enregistrer un commentaire