a question about malloc replacement

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

a question about malloc replacement

willdang
This post has NOT been accepted by the mailing list yet.
I'am a new hand in using valgrind, nowdays I hava a question about the function:VG_(needs_malloc_replacement)

I develop a new Valgrind tool just as valgrind_manual described. I only add the function VG_(needs_malloc_replacement) additionally,and define function parameters. The tool can work and the client program can output correctly. However, the malloc function did not replaced.
Can anyone tell me what's wrong,maybe I forgot some thing? thanks

and my client program is very simple:
int main()
 {
      int *ptr = malloc(sizeof(int));
      *ptr = 100;
      printf("%d\n",*ptr);
      return 0;
}
Reply | Threaded
Open this post in threaded view
|

Re: a question about malloc replacement

willdang
This post has NOT been accepted by the mailing list yet.
Finally I found the answer: I just do as the manual said:Copy none/Makefile.am into foobar/.
However, the  none/Makefile.am doesn't contain vgpreload_......

To solve this problem, just  add
#----------------------------------------------------------------------------
# vgpreload_testcase-<platform>.so
#----------------------------------------------------------------------------
noinst_PROGRAMS += vgpreload_testcase-@VGCONF_ARCH_PRI@-@VGCONF_OS@.so
if VGCONF_HAVE_PLATFORM_SEC
noinst_PROGRAMS += vgpreload_testcase-@VGCONF_ARCH_SEC@-@VGCONF_OS@.so
endif
......

to Makefile.am file.  Then all things be OK!