--- src_new/winsup/cygwin/malloc_wrapper.cc 2014-06-26 23:52:46.537847400 +0200 +++ src/winsup/cygwin/malloc_wrapper.cc 2015-01-16 14:41:15.766384600 +0100 @@ -17,6 +17,7 @@ #include "dtable.h" #include "perprocess.h" #include "miscfuncs.h" +#include "cygtls.h" #include "cygmalloc.h" #ifndef MALLOC_DEBUG #include @@ -38,7 +39,7 @@ extern "C" void free (void *p) { - malloc_printf ("(%p), called by %p", p, __builtin_return_address (0)); + malloc_printf ("(%p), called by %p", p, *(_my_tls.stackptr-1)); if (!use_internal) user_data->free (p); else @@ -61,7 +62,7 @@ res = dlmalloc (size); __malloc_unlock (); } - malloc_printf ("(%ld) = %p, called by %p", size, res, __builtin_return_address (0)); + malloc_printf ("(%ld) = %p, called by %p", size, res, *(_my_tls.stackptr-1)); return res; } @@ -77,7 +78,7 @@ res = dlrealloc (p, size); __malloc_unlock (); } - malloc_printf ("(%p, %ld) = %p, called by %p", p, size, res, __builtin_return_address (0)); + malloc_printf ("(%p, %ld) = %p, called by %p", p, size, res, *(_my_tls.stackptr-1)); return res; } @@ -104,7 +105,7 @@ res = dlcalloc (nmemb, size); __malloc_unlock (); } - malloc_printf ("(%ld, %ld) = %p, called by %p", nmemb, size, res, __builtin_return_address (0)); + malloc_printf ("(%ld, %ld) = %p, called by %p", nmemb, size, res, *(_my_tls.stackptr-1)); return res; }