|
From: Julian S. <js...@ac...> - 2014-09-26 16:23:31
|
On 09/23/2014 03:31 AM, Myoungkyu Song wrote: > I have a question, which maybe was discussed. I would like to implement a > wrapper function for standard API such as "strcpy". However, I failed to > do. When I tested a user-defined function like "hello(char *, char *)" > below, I successfully wrapped it, accessing to arguments and a return > value. The problem is here > char* I_WRAP_SONAME_FNNAME_ZU(NONE,strcpy) ( char *dest, const char *src ) By using "(NONE,strcpy)" you are requesting to wrap the function strcpy in the main executable (that's what "NONE") means. But strcpy lives in libc.so. Really you need to use VG_Z_LIBC_SONAME (with a suitable definition for VG_Z_LIBC_SONAME) to make it work. Unfortunately the definition of VG_Z_LIBC_SONAME is system-dependent. You should be able to find all the examples you need in shared/vg_replace_strmem.c Note also, using -v is very helpful for debugging wrapping/intercept problems. If you need complete details, also try --trace-redir=yes. J |