| Index: coregrind/m_replacemalloc/vg_replace_malloc.c |
| =================================================================== |
| --- coregrind/m_replacemalloc/vg_replace_malloc.c (revision 10880) |
| +++ coregrind/m_replacemalloc/vg_replace_malloc.c (working copy) |
| @@ -193,6 +193,18 @@ |
| // malloc |
| ALLOC_or_NULL(VG_Z_LIBSTDCXX_SONAME, malloc, malloc); |
| ALLOC_or_NULL(VG_Z_LIBC_SONAME, malloc, malloc); |
| +// Handle libtcmalloc's malloc() function. |
| +// Similar interceptors are added below to handle other libtcmalloc |
| +// allocation/deallocation functions. |
| +// soname=NONE means that a user's allocation function is intercepted. |
| +ALLOC_or_NULL(NONE, malloc, malloc); |
| +// Bash has sh_malloc() and sh_free() along with standard malloc() and free(). |
| +// Sometimes these functions are called inconsistently (e.g. free() after |
| +// sh_malloc()). To deal with this we have to intercept the sh_*() functions |
| +// as well. |
| +ALLOC_or_NULL(NONE, sh_malloc, malloc); |
| +// Handle Python's malloc. |
| +ALLOC_or_NULL(NONE, PyObject_Malloc, malloc); |
| #if defined(VGP_ppc32_aix5) || defined(VGP_ppc64_aix5) |
| ALLOC_or_NULL(VG_Z_LIBC_SONAME, malloc_common, malloc); |
| #elif defined(VGO_darwin) |
| @@ -205,20 +217,24 @@ |
| // operator new(unsigned int), not mangled (for gcc 2.96) |
| ALLOC_or_BOMB(VG_Z_LIBSTDCXX_SONAME, builtin_new, __builtin_new); |
| ALLOC_or_BOMB(VG_Z_LIBC_SONAME, builtin_new, __builtin_new); |
| +ALLOC_or_BOMB(NONE, builtin_new, __builtin_new); |
| |
| ALLOC_or_BOMB(VG_Z_LIBSTDCXX_SONAME, __builtin_new, __builtin_new); |
| ALLOC_or_BOMB(VG_Z_LIBC_SONAME, __builtin_new, __builtin_new); |
| +ALLOC_or_BOMB(NONE, __builtin_new, __builtin_new); |
| |
| // operator new(unsigned int), GNU mangling |
| #if VG_WORDSIZE == 4 |
| ALLOC_or_BOMB(VG_Z_LIBSTDCXX_SONAME, _Znwj, __builtin_new); |
| ALLOC_or_BOMB(VG_Z_LIBC_SONAME, _Znwj, __builtin_new); |
| + ALLOC_or_BOMB(NONE, _Znwj, __builtin_new); |
| #endif |
| |
| // operator new(unsigned long), GNU mangling |
| #if VG_WORDSIZE == 8 || defined(VGP_ppc32_aix5) || defined(VGO_darwin) |
| ALLOC_or_BOMB(VG_Z_LIBSTDCXX_SONAME, _Znwm, __builtin_new); |
| ALLOC_or_BOMB(VG_Z_LIBC_SONAME, _Znwm, __builtin_new); |
| + ALLOC_or_BOMB(NONE, _Znwm, __builtin_new); |
| #endif |
| |
| // operator new(unsigned long), ARM/cfront mangling |
| @@ -233,12 +249,14 @@ |
| #if VG_WORDSIZE == 4 |
| ALLOC_or_NULL(VG_Z_LIBSTDCXX_SONAME, _ZnwjRKSt9nothrow_t, __builtin_new); |
| ALLOC_or_NULL(VG_Z_LIBC_SONAME, _ZnwjRKSt9nothrow_t, __builtin_new); |
| + ALLOC_or_NULL(NONE, _ZnwjRKSt9nothrow_t, __builtin_new); |
| #endif |
| |
| // operator new(unsigned long, std::nothrow_t const&), GNU mangling |
| #if VG_WORDSIZE == 8 || defined(VGP_ppc32_aix5) || defined(VGP_ppc64_aix5) || defined(VGO_darwin) |
| ALLOC_or_NULL(VG_Z_LIBSTDCXX_SONAME, _ZnwmRKSt9nothrow_t, __builtin_new); |
| ALLOC_or_NULL(VG_Z_LIBC_SONAME, _ZnwmRKSt9nothrow_t, __builtin_new); |
| + ALLOC_or_NULL(NONE, _ZnwmRKSt9nothrow_t, __builtin_new); |
| #endif |
| |
| // operator new(unsigned long, std::nothrow_t const&), ARM/cfront mangling |
| @@ -252,17 +270,20 @@ |
| // operator new[](unsigned int), not mangled (for gcc 2.96) |
| ALLOC_or_BOMB(VG_Z_LIBSTDCXX_SONAME, __builtin_vec_new, __builtin_vec_new ); |
| ALLOC_or_BOMB(VG_Z_LIBC_SONAME, __builtin_vec_new, __builtin_vec_new ); |
| +ALLOC_or_BOMB(NONE, __builtin_vec_new, __builtin_vec_new ); |
| |
| // operator new[](unsigned int), GNU mangling |
| #if VG_WORDSIZE == 4 |
| ALLOC_or_BOMB(VG_Z_LIBSTDCXX_SONAME, _Znaj, __builtin_vec_new ); |
| ALLOC_or_BOMB(VG_Z_LIBC_SONAME, _Znaj, __builtin_vec_new ); |
| + ALLOC_or_BOMB(NONE, _Znaj, __builtin_vec_new ); |
| #endif |
| |
| // operator new[](unsigned long), GNU mangling |
| #if VG_WORDSIZE == 8 || defined(VGP_ppc32_aix5) || defined(VGP_ppc64_aix5) || defined(VGO_darwin) |
| ALLOC_or_BOMB(VG_Z_LIBSTDCXX_SONAME, _Znam, __builtin_vec_new ); |
| ALLOC_or_BOMB(VG_Z_LIBC_SONAME, _Znam, __builtin_vec_new ); |
| + ALLOC_or_BOMB(NONE, _Znam, __builtin_vec_new ); |
| #endif |
| |
| // operator new[](unsigned long), ARM/cfront mangling |
| @@ -277,12 +298,14 @@ |
| #if VG_WORDSIZE == 4 |
| ALLOC_or_NULL(VG_Z_LIBSTDCXX_SONAME, _ZnajRKSt9nothrow_t, __builtin_vec_new ); |
| ALLOC_or_NULL(VG_Z_LIBC_SONAME, _ZnajRKSt9nothrow_t, __builtin_vec_new ); |
| + ALLOC_or_NULL(NONE, _ZnajRKSt9nothrow_t, __builtin_vec_new ); |
| #endif |
| |
| // operator new[](unsigned long, std::nothrow_t const&), GNU mangling |
| #if VG_WORDSIZE == 8 || defined(VGP_ppc32_aix5) || defined(VGP_ppc64_aix5) || defined(VGO_darwin) |
| ALLOC_or_NULL(VG_Z_LIBSTDCXX_SONAME, _ZnamRKSt9nothrow_t, __builtin_vec_new ); |
| ALLOC_or_NULL(VG_Z_LIBC_SONAME, _ZnamRKSt9nothrow_t, __builtin_vec_new ); |
| + ALLOC_or_NULL(NONE, _ZnamRKSt9nothrow_t, __builtin_vec_new ); |
| #endif |
| |
| // operator new [](unsigned long, std::nothrow_t const&), ARM/cfront mangling |
| @@ -323,6 +346,9 @@ |
| // free |
| FREE(VG_Z_LIBSTDCXX_SONAME, free, free ); |
| FREE(VG_Z_LIBC_SONAME, free, free ); |
| +FREE(NONE, free, free ); |
| +FREE(NONE, sh_free, free ); |
| +FREE(NONE, PyObject_Free, free ); |
| #if defined(VGP_ppc32_aix5) || defined(VGP_ppc64_aix5) |
| FREE(VG_Z_LIBC_SONAME, free_common, free ); |
| #elif defined(VGO_darwin) |
| @@ -335,16 +361,20 @@ |
| // cfree |
| FREE(VG_Z_LIBSTDCXX_SONAME, cfree, free ); |
| FREE(VG_Z_LIBC_SONAME, cfree, free ); |
| +FREE(NONE, cfree, free ); |
| +FREE(NONE, sh_cfree, free ); |
| |
| |
| /*---------------------- delete ----------------------*/ |
| // operator delete(void*), not mangled (for gcc 2.96) |
| FREE(VG_Z_LIBSTDCXX_SONAME, __builtin_delete, __builtin_delete ); |
| FREE(VG_Z_LIBC_SONAME, __builtin_delete, __builtin_delete ); |
| +FREE(NONE, __builtin_delete, __builtin_delete ); |
| |
| // operator delete(void*), GNU mangling |
| FREE(VG_Z_LIBSTDCXX_SONAME, _ZdlPv, __builtin_delete ); |
| FREE(VG_Z_LIBC_SONAME, _ZdlPv, __builtin_delete ); |
| +FREE(NONE, _ZdlPv, __builtin_delete ); |
| |
| // operator delete(void*), ARM/cfront mangling |
| #if defined(VGP_ppc32_aix5) || defined(VGP_ppc64_aix5) |
| @@ -357,16 +387,19 @@ |
| // operator delete(void*, std::nothrow_t const&), GNU mangling |
| FREE(VG_Z_LIBSTDCXX_SONAME, _ZdlPvRKSt9nothrow_t, __builtin_delete ); |
| FREE(VG_Z_LIBC_SONAME, _ZdlPvRKSt9nothrow_t, __builtin_delete ); |
| +FREE(NONE, _ZdlPvRKSt9nothrow_t, __builtin_delete ); |
| |
| |
| /*---------------------- delete [] ----------------------*/ |
| // operator delete[](void*), not mangled (for gcc 2.96) |
| FREE(VG_Z_LIBSTDCXX_SONAME, __builtin_vec_delete, __builtin_vec_delete ); |
| FREE(VG_Z_LIBC_SONAME, __builtin_vec_delete, __builtin_vec_delete ); |
| +FREE(NONE, __builtin_vec_delete, __builtin_vec_delete ); |
| |
| // operator delete[](void*), GNU mangling |
| FREE(VG_Z_LIBSTDCXX_SONAME, _ZdaPv, __builtin_vec_delete ); |
| FREE(VG_Z_LIBC_SONAME, _ZdaPv, __builtin_vec_delete ); |
| +FREE(NONE, _ZdaPv, __builtin_vec_delete ); |
| |
| // operator delete[](void*), ARM/cfront mangling |
| #if defined(VGP_ppc32_aix5) || defined(VGP_ppc64_aix5) |
| @@ -379,6 +412,7 @@ |
| // operator delete[](void*, std::nothrow_t const&), GNU mangling |
| FREE(VG_Z_LIBSTDCXX_SONAME, _ZdaPvRKSt9nothrow_t, __builtin_vec_delete ); |
| FREE(VG_Z_LIBC_SONAME, _ZdaPvRKSt9nothrow_t, __builtin_vec_delete ); |
| +FREE(NONE, _ZdaPvRKSt9nothrow_t, __builtin_vec_delete ); |
| |
| |
| /*---------------------- calloc ----------------------*/ |
| @@ -416,6 +450,8 @@ |
| } |
| |
| CALLOC(VG_Z_LIBC_SONAME, calloc); |
| +CALLOC(NONE, calloc); |
| +CALLOC(NONE, sh_calloc); |
| #if defined(VGP_ppc32_aix5) || defined(VGP_ppc64_aix5) |
| CALLOC(VG_Z_LIBC_SONAME, calloc_common); |
| #elif defined(VGO_darwin) |
| @@ -474,6 +510,9 @@ |
| } |
| |
| REALLOC(VG_Z_LIBC_SONAME, realloc); |
| +REALLOC(NONE, realloc); |
| +REALLOC(NONE, sh_realloc); |
| +REALLOC(NONE, PyObject_Realloc); |
| #if defined(VGP_ppc32_aix5) || defined(VGP_ppc64_aix5) |
| REALLOC(VG_Z_LIBC_SONAME, realloc_common); |
| #elif defined(VGO_darwin) |
| @@ -530,6 +569,8 @@ |
| } |
| |
| MEMALIGN(VG_Z_LIBC_SONAME, memalign); |
| +MEMALIGN(NONE, memalign); |
| +MEMALIGN(NONE, sh_memalign); |
| #if defined(VGO_darwin) |
| ZONEMEMALIGN(VG_Z_LIBC_SONAME, malloc_zone_memalign); |
| #endif |
| @@ -572,6 +613,8 @@ |
| } |
| |
| VALLOC(VG_Z_LIBC_SONAME, valloc); |
| +VALLOC(NONE, valloc); |
| +VALLOC(NONE, sh_valloc); |
| #if defined(VGO_darwin) |
| ZONEVALLOC(VG_Z_LIBC_SONAME, malloc_zone_valloc); |
| #endif |
| @@ -592,6 +635,7 @@ |
| } |
| |
| MALLOPT(VG_Z_LIBC_SONAME, mallopt); |
| +MALLOPT(NONE, mallopt); |
| |
| |
| /*---------------------- malloc_trim ----------------------*/ |
| @@ -628,6 +672,7 @@ |
| } |
| |
| MALLOC_TRIM(VG_Z_LIBC_SONAME, malloc_trim); |
| +MALLOC_TRIM(NONE, malloc_trim); |
| |
| |
| /*---------------------- posix_memalign ----------------------*/ |
| @@ -658,6 +703,7 @@ |
| } |
| |
| POSIX_MEMALIGN(VG_Z_LIBC_SONAME, posix_memalign); |
| +POSIX_MEMALIGN(NONE, posix_memalign); |
| #if defined(VGP_ppc32_aix5) || defined(VGP_ppc64_aix5) |
| /* 27 Nov 07: it appears that xlc links into executables, a |
| posix_memalign, which calls onwards to memalign_common, with the |
| @@ -688,6 +734,7 @@ |
| |
| MALLOC_USABLE_SIZE(VG_Z_LIBC_SONAME, malloc_usable_size); |
| MALLOC_USABLE_SIZE(VG_Z_LIBC_SONAME, malloc_size); |
| +MALLOC_USABLE_SIZE(NONE, malloc_size); |
| |
| |
| /*---------------------- (unimplemented) ----------------------*/ |
| @@ -742,6 +789,7 @@ |
| } |
| |
| MALLINFO(VG_Z_LIBC_SONAME, mallinfo); |
| +MALLINFO(NONE, mallinfo); |
| |
| |
| #if defined(VGO_darwin) |