From: Tom H. <to...@co...> - 2018-07-12 11:24:22
|
On 12/07/18 10:26, shuai xi wrote: > I know that 'Memcheck's implementation of malloc has "nothing to do" > with glibc's implementation' after readind some code of valgrind, but i > want to use the glibc's malloc to avoid changing heap layout. > Memcheck sets the VG_(needs_malloc_replacement) to hook malloc and exec > MC_(malloc) instead of real malloc. It's very convenient. So can i > get the address of the original malloc in MC_(malloc) and exec it? > if not,can i use I_WRAP_SONAME_FNNAME_ZU function to hook malloc in my > valgrind tool's code? Yes if you want to wrap the function rather than replacing it then use the _WRAP_ macros and then your wrapper can get the original address and call it. Tom -- Tom Hughes (to...@co...) http://compton.nu/ |