Yes because printf will invoke malloc which will call your wrapper
which will call printf etc etc until the stack is exhausted.
You can't use anything in your wrapper that might use malloc.
Tom
On 12/07/18 13:07, shuai xi wrote:
thank you for your answer.
But when i use  _WRAP_ macros like
thank you for your answer.
But when i use _WRAP_ macros like following code, it gives me an error.
*code:*
long I_WRAP_SONAME_FNNAME_ZU(libcZdsoZd6,malloc) ( long n )
{
char * r;
OrigFn fn;
printf("1\n");
VALGRIND_GET_ORIG_FN(fn);
CALL_FN_W_W(r, fn, n);
//printf("in wrapper
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 m