|
From: Philippe W. <phi...@sk...> - 2015-04-01 20:43:20
|
On Wed, 2015-04-01 at 17:23 -0300, Andres Tiraboschi wrote: > But in drd_malloc_wrappers.c for example if you comment > "VG_(needs_malloc_replacement)(drd_malloc, ..." in > DRD_(register_malloc_wrappers) when pthread_create is called you'll > have the following segmentation fault. > > --6540-- VG_USERREQ__CLIENT_CALL2: func=0x0 > ==6540== > ==6540== Process terminating with default action of signal 11 (SIGSEGV) > . > . > . > Segmentation fault (core dumped) Yes. This is because you are now removing a *part* of the functionality needed to replace malloc. Then malloc replacement still happens, and then it segv, because the call to VG_(needs_malloc_replacement) is the one that provides some info needed when malloc replacement happens. Malloc replacement is activated by another mechanism (LD_PRELOAD of an .so with specially crafted function names that the Valgrind debug info reader recognises). Replacement/wrapping of functions in Valgrind is non trivial. What you do above just makes it crash, as you have then a partially implemented replacement. Philippe |