Using Pin, I would like to call some instrumentation function before and after each application function call. I've read that RTN_InsertCall
to add some entry/exit analysis functions with IPOINT_BEFORE
and IPOINT_AFTER
is unreliable as the exit may never be called.
My understanding is that the 'correct' way to do this is to replace the routine via RTN_ReplaceSignature
, then in my replacement function add the entry and exit calls around a call to the original routine, where the original routine is called using PIN_CallApplicationFunction
.
However, as far as I can tell PIN_CallApplicationFunction
requires that I state in advance all of the arguments for the routine that I am wrapping, e.g., for malloc
I would need to explicitly pass in some size_t
argument, whereas for free
I would pass in a pointer, and so on.
As I just want to wrap all function calls, I don't know the arguments! Is there some way to simply jump into the original function that I replaced, passing along the arguments for the original signature? Or perhaps some better way to do this?
Thanks for any help!