The RTN_InsertCall
in intel Pin has its definition as
VOID LEVEL_PINCLIENT::RTN_InsertCall(
RTN rtn,
IPOINT action,
AFUNPTR funptr,
...
)
It can call the function funptr
with the arguments provided in ...
(before or after calling the function represented by rtn).
Example:
void func1(int a) {
printf("Argument : %d", a);
}
...
RTN_InsertCall(funcRtn, IPOINT_BEFORE, (AFUNPTR)func1,
IARG_FUNCARG_ENTRYPOINT_VALUE, 0,
IARG_END);
void func2(int a, int b) {
printf("Argument : %d %d", a, b);
}
...
RTN_InsertCall(funcRtn, IPOINT_BEFORE, (AFUNPTR)func1,
IARG_FUNCARG_ENTRYPOINT_VALUE, 0,
IARG_FUNCARG_ENTRYPOINT_VALUE, 1,
IARG_END);
How does this function work? How to call a non-variadic function(and the number of arguments may vary) inside a variadic function?
Btw, the RTN_InsertCall
is used to insert an additional function(func1 / func2) before actually execute the target function(funcRtn). What can we do if we don't know the number of arguments of funcRtn
? How to convert the func1 / func2 into variadic functions?