| Index: scripts/intercept_tcmalloc.patch
|
| ===================================================================
|
| --- scripts/intercept_tcmalloc.patch (revision 81227)
|
| +++ scripts/intercept_tcmalloc.patch (working copy)
|
| @@ -1,308 +0,0 @@
|
| -Index: coregrind/m_replacemalloc/vg_replace_malloc.c
|
| -===================================================================
|
| ---- coregrind/m_replacemalloc/vg_replace_malloc.c (revision 11055)
|
| -+++ coregrind/m_replacemalloc/vg_replace_malloc.c (working copy)
|
| -@@ -234,6 +234,23 @@
|
| - // 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);
|
| -+// 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, tc_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)
|
| -@@ -246,20 +263,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
|
| -@@ -267,19 +288,24 @@
|
| - ALLOC_or_BOMB(VG_Z_LIBC_DOT_A, __nw__FUl, __builtin_new);
|
| - #endif
|
| -
|
| -+// libtcmalloc's new
|
| -+ALLOC_or_BOMB(NONE, tc_new, __builtin_new);
|
| -
|
| -+
|
| - /*---------------------- new nothrow ----------------------*/
|
| -
|
| - // operator new(unsigned, std::nothrow_t const&), GNU mangling
|
| - #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
|
| -@@ -287,23 +313,29 @@
|
| - ALLOC_or_NULL(VG_Z_LIBC_DOT_A, __nw__FUlRCQ2_3std9nothrow_t, __builtin_new);
|
| - #endif
|
| -
|
| -+// libtcmalloc's new nothrow
|
| -+ALLOC_or_NULL(NONE, tc_new_nothrow, __builtin_new);
|
| -
|
| -+
|
| - /*---------------------- new [] ----------------------*/
|
| -
|
| - // 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
|
| -@@ -311,19 +343,24 @@
|
| - ALLOC_or_BOMB(VG_Z_LIBC_DOT_A, __vn__FUl, __builtin_vec_new);
|
| - #endif
|
| -
|
| -+// libtcmalloc's new []
|
| -+ALLOC_or_BOMB(NONE, tc_newarray, __builtin_vec_new);
|
| -
|
| -+
|
| - /*---------------------- new [] nothrow ----------------------*/
|
| -
|
| - // operator new[](unsigned, std::nothrow_t const&), GNU mangling
|
| - #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
|
| -@@ -331,7 +368,10 @@
|
| - ALLOC_or_BOMB(VG_Z_LIBC_DOT_A, __vn__FUlRCQ2_3std9nothrow_t, __builtin_vec_new );
|
| - #endif
|
| -
|
| -+// libtcmalloc's new [] nothrow
|
| -+ALLOC_or_NULL(NONE, tc_newarray_nothrow, __builtin_vec_new);
|
| -
|
| -+
|
| - /*---------------------- free ----------------------*/
|
| -
|
| - /* Generate a replacement for 'fnname' in object 'soname', which calls
|
| -@@ -364,6 +404,10 @@
|
| - // 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, tc_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)
|
| -@@ -376,43 +420,57 @@
|
| - // cfree
|
| - FREE(VG_Z_LIBSTDCXX_SONAME, cfree, free );
|
| - FREE(VG_Z_LIBC_SONAME, cfree, free );
|
| -+FREE(NONE, cfree, free );
|
| -+FREE(NONE, tc_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)
|
| - FREE(VG_Z_LIBC_DOT_A, __dl__FPv, __builtin_delete );
|
| - #endif
|
| -
|
| -+// libtcmalloc's delete
|
| -+FREE(NONE, tc_delete, __builtin_delete);
|
| -
|
| -+
|
| - /*---------------------- delete nothrow ----------------------*/
|
| -
|
| - // 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 );
|
| -+// libtcmalloc's delete nothrow
|
| -+FREE(NONE, tc_delete_nothrow, __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)
|
| - FREE(VG_Z_LIBC_DOT_A, __vd__FPv, __builtin_vec_delete );
|
| - #endif
|
| -+// libtcmalloc's delete []
|
| -+FREE(NONE, tc_deletearray, __builtin_vec_delete);
|
| -
|
| -
|
| - /*---------------------- delete [] nothrow ----------------------*/
|
| -@@ -420,6 +478,9 @@
|
| - // 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 );
|
| -+// libtcmalloc's delete [] nothrow
|
| -+FREE(NONE, tc_deletearray_nothrow, __builtin_vec_delete);
|
| -
|
| -
|
| - /*---------------------- calloc ----------------------*/
|
| -@@ -465,6 +526,9 @@
|
| - }
|
| -
|
| - CALLOC(VG_Z_LIBC_SONAME, calloc);
|
| -+CALLOC(NONE, calloc);
|
| -+CALLOC(NONE, tc_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)
|
| -@@ -523,6 +587,10 @@
|
| - }
|
| -
|
| - REALLOC(VG_Z_LIBC_SONAME, realloc);
|
| -+REALLOC(NONE, realloc);
|
| -+REALLOC(NONE, tc_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)
|
| -@@ -579,6 +647,9 @@
|
| - }
|
| -
|
| - MEMALIGN(VG_Z_LIBC_SONAME, memalign);
|
| -+MEMALIGN(NONE, memalign);
|
| -+MEMALIGN(NONE, tc_memalign);
|
| -+MEMALIGN(NONE, sh_memalign);
|
| - #if defined(VGO_darwin)
|
| - ZONEMEMALIGN(VG_Z_LIBC_SONAME, malloc_zone_memalign);
|
| - #endif
|
| -@@ -621,6 +692,9 @@
|
| - }
|
| -
|
| - VALLOC(VG_Z_LIBC_SONAME, valloc);
|
| -+VALLOC(NONE, valloc);
|
| -+VALLOC(NONE, tc_valloc);
|
| -+VALLOC(NONE, sh_valloc);
|
| - #if defined(VGO_darwin)
|
| - ZONEVALLOC(VG_Z_LIBC_SONAME, malloc_zone_valloc);
|
| - #endif
|
| -@@ -641,6 +715,8 @@
|
| - }
|
| -
|
| - MALLOPT(VG_Z_LIBC_SONAME, mallopt);
|
| -+MALLOPT(NONE, mallopt);
|
| -+MALLOPT(NONE, tc_mallopt);
|
| -
|
| -
|
| - /*---------------------- malloc_trim ----------------------*/
|
| -@@ -677,6 +753,7 @@
|
| - }
|
| -
|
| - MALLOC_TRIM(VG_Z_LIBC_SONAME, malloc_trim);
|
| -+MALLOC_TRIM(NONE, malloc_trim);
|
| -
|
| -
|
| - /*---------------------- posix_memalign ----------------------*/
|
| -@@ -707,6 +784,8 @@
|
| - }
|
| -
|
| - POSIX_MEMALIGN(VG_Z_LIBC_SONAME, posix_memalign);
|
| -+POSIX_MEMALIGN(NONE, posix_memalign);
|
| -+POSIX_MEMALIGN(NONE, tc_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
|
| -@@ -737,6 +816,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) ----------------------*/
|
| -@@ -791,6 +871,8 @@
|
| - }
|
| -
|
| - MALLINFO(VG_Z_LIBC_SONAME, mallinfo);
|
| -+MALLINFO(NONE, mallinfo);
|
| -+MALLINFO(NONE, tc_mallinfo);
|
| -
|
| -
|
| - #if defined(VGO_darwin)
|
|
|