blob: a485560823a67eeb8b5cd5f9cf2c4edc4637b395 [file] [log] [blame]
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,13 @@
// 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, tc_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)
@@ -267,6 +274,8 @@
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 ----------------------*/
@@ -287,6 +296,8 @@
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 [] ----------------------*/
@@ -311,6 +322,8 @@
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 ----------------------*/
@@ -331,6 +344,8 @@
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 ----------------------*/
@@ -364,6 +379,8 @@
// free
FREE(VG_Z_LIBSTDCXX_SONAME, free, free );
FREE(VG_Z_LIBC_SONAME, 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,6 +393,7 @@
// cfree
FREE(VG_Z_LIBSTDCXX_SONAME, cfree, free );
FREE(VG_Z_LIBC_SONAME, cfree, free );
+FREE(NONE, tc_cfree, free );
/*---------------------- delete ----------------------*/
@@ -392,6 +410,8 @@
FREE(VG_Z_LIBC_DOT_A, __dl__FPv, __builtin_delete );
#endif
+// libtcmalloc's delete
+FREE(NONE, tc_delete, __builtin_delete);
/*---------------------- delete nothrow ----------------------*/
@@ -399,6 +419,8 @@
FREE(VG_Z_LIBSTDCXX_SONAME, _ZdlPvRKSt9nothrow_t, __builtin_delete );
FREE(VG_Z_LIBC_SONAME, _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)
@@ -414,6 +436,8 @@
FREE(VG_Z_LIBC_DOT_A, __vd__FPv, __builtin_vec_delete );
#endif
+// libtcmalloc's delete []
+FREE(NONE, tc_deletearray, __builtin_vec_delete);
/*---------------------- delete [] nothrow ----------------------*/
@@ -421,6 +445,8 @@
FREE(VG_Z_LIBSTDCXX_SONAME, _ZdaPvRKSt9nothrow_t, __builtin_vec_delete );
FREE(VG_Z_LIBC_SONAME, _ZdaPvRKSt9nothrow_t, __builtin_vec_delete );
+// libtcmalloc's delete [] nothrow
+FREE(NONE, tc_deletearray_nothrow, __builtin_vec_delete);
/*---------------------- calloc ----------------------*/
@@ -465,6 +491,7 @@
}
CALLOC(VG_Z_LIBC_SONAME, calloc);
+CALLOC(NONE, tc_calloc);
#if defined(VGP_ppc32_aix5) || defined(VGP_ppc64_aix5)
CALLOC(VG_Z_LIBC_SONAME, calloc_common);
#elif defined(VGO_darwin)
@@ -523,6 +550,8 @@
}
REALLOC(VG_Z_LIBC_SONAME, realloc);
+REALLOC(NONE, tc_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 +608,7 @@
}
MEMALIGN(VG_Z_LIBC_SONAME, memalign);
+MEMALIGN(NONE, tc_memalign);
#if defined(VGO_darwin)
ZONEMEMALIGN(VG_Z_LIBC_SONAME, malloc_zone_memalign);
#endif
@@ -621,6 +651,7 @@
}
VALLOC(VG_Z_LIBC_SONAME, valloc);
+VALLOC(NONE, tc_valloc);
#if defined(VGO_darwin)
ZONEVALLOC(VG_Z_LIBC_SONAME, malloc_zone_valloc);
#endif
@@ -641,6 +672,7 @@
}
MALLOPT(VG_Z_LIBC_SONAME, mallopt);
+MALLOPT(NONE, tc_mallopt);
/*---------------------- malloc_trim ----------------------*/
@@ -707,6 +739,7 @@
}
POSIX_MEMALIGN(VG_Z_LIBC_SONAME, 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
@@ -791,6 +824,7 @@
}
MALLINFO(VG_Z_LIBC_SONAME, mallinfo);
+MALLINFO(NONE, tc_mallinfo);
#if defined(VGO_darwin)