Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(467)

Unified Diff: scripts/intercept_tcmalloc.patch

Issue 2746004: Restore deps/third_party/valgrind to its state at r48920 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/valgrind/
Patch Set: Created 10 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « scripts/fork.patch ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: scripts/intercept_tcmalloc.patch
===================================================================
--- scripts/intercept_tcmalloc.patch (revision 49170)
+++ scripts/intercept_tcmalloc.patch (working copy)
@@ -1,8 +1,8 @@
Index: coregrind/m_replacemalloc/vg_replace_malloc.c
===================================================================
---- coregrind/m_replacemalloc/vg_replace_malloc.c (revision 11055)
+--- coregrind/m_replacemalloc/vg_replace_malloc.c (revision 10880)
+++ coregrind/m_replacemalloc/vg_replace_malloc.c (working copy)
-@@ -234,6 +234,13 @@
+@@ -193,6 +193,18 @@
// malloc
ALLOC_or_NULL(VG_Z_LIBSTDCXX_SONAME, malloc, malloc);
ALLOC_or_NULL(VG_Z_LIBC_SONAME, malloc, malloc);
@@ -10,155 +10,226 @@
+// 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);
++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)
-@@ -267,6 +274,8 @@
- ALLOC_or_BOMB(VG_Z_LIBC_DOT_A, __nw__FUl, __builtin_new);
- #endif
+@@ -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);
-+// libtcmalloc's new
-+ALLOC_or_BOMB(NONE, tc_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);
- /*---------------------- new nothrow ----------------------*/
+ // 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
-@@ -287,6 +296,8 @@
- ALLOC_or_NULL(VG_Z_LIBC_DOT_A, __nw__FUlRCQ2_3std9nothrow_t, __builtin_new);
+ // 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
-+// libtcmalloc's new nothrow
-+ALLOC_or_NULL(NONE, tc_new_nothrow, __builtin_new);
+ // 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
- /*---------------------- new [] ----------------------*/
-
-@@ -311,6 +322,8 @@
- ALLOC_or_BOMB(VG_Z_LIBC_DOT_A, __vn__FUl, __builtin_vec_new);
+ // 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
-+// libtcmalloc's new []
-+ALLOC_or_BOMB(NONE, tc_newarray, __builtin_vec_new);
+ // 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 );
- /*---------------------- new [] nothrow ----------------------*/
+ // 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
-@@ -331,6 +344,8 @@
- ALLOC_or_BOMB(VG_Z_LIBC_DOT_A, __vn__FUlRCQ2_3std9nothrow_t, __builtin_vec_new );
+ // 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
-+// libtcmalloc's new [] nothrow
-+ALLOC_or_NULL(NONE, tc_newarray_nothrow, __builtin_vec_new);
+ // 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
- /*---------------------- free ----------------------*/
+ // 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
-@@ -364,6 +379,8 @@
+ // 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, tc_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)
-@@ -376,6 +393,7 @@
+@@ -335,16 +361,20 @@
// cfree
FREE(VG_Z_LIBSTDCXX_SONAME, cfree, free );
FREE(VG_Z_LIBC_SONAME, cfree, free );
-+FREE(NONE, tc_cfree, free );
++FREE(NONE, cfree, free );
++FREE(NONE, sh_cfree, free );
/*---------------------- delete ----------------------*/
-@@ -392,6 +410,8 @@
- FREE(VG_Z_LIBC_DOT_A, __dl__FPv, __builtin_delete );
- #endif
+ // 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 );
-+// libtcmalloc's delete
-+FREE(NONE, tc_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 );
- /*---------------------- delete nothrow ----------------------*/
-
-@@ -399,6 +419,8 @@
+ // 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 );
-+// 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
+ 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 );
-+// libtcmalloc's delete []
-+FREE(NONE, tc_deletearray, __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 );
- /*---------------------- delete [] nothrow ----------------------*/
-
-@@ -421,6 +445,8 @@
+ // 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 );
-+// libtcmalloc's delete [] nothrow
-+FREE(NONE, tc_deletearray_nothrow, __builtin_vec_delete);
/*---------------------- calloc ----------------------*/
-
-@@ -465,6 +491,7 @@
+@@ -416,6 +450,8 @@
}
CALLOC(VG_Z_LIBC_SONAME, calloc);
-+CALLOC(NONE, tc_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)
-@@ -523,6 +550,8 @@
+@@ -474,6 +510,9 @@
}
REALLOC(VG_Z_LIBC_SONAME, realloc);
-+REALLOC(NONE, tc_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)
-@@ -579,6 +608,7 @@
+@@ -530,6 +569,8 @@
}
MEMALIGN(VG_Z_LIBC_SONAME, memalign);
-+MEMALIGN(NONE, tc_memalign);
++MEMALIGN(NONE, memalign);
++MEMALIGN(NONE, sh_memalign);
#if defined(VGO_darwin)
ZONEMEMALIGN(VG_Z_LIBC_SONAME, malloc_zone_memalign);
#endif
-@@ -621,6 +651,7 @@
+@@ -572,6 +613,8 @@
}
VALLOC(VG_Z_LIBC_SONAME, valloc);
-+VALLOC(NONE, tc_valloc);
++VALLOC(NONE, valloc);
++VALLOC(NONE, sh_valloc);
#if defined(VGO_darwin)
ZONEVALLOC(VG_Z_LIBC_SONAME, malloc_zone_valloc);
#endif
-@@ -641,6 +672,7 @@
+@@ -592,6 +635,7 @@
}
MALLOPT(VG_Z_LIBC_SONAME, mallopt);
-+MALLOPT(NONE, tc_mallopt);
++MALLOPT(NONE, mallopt);
/*---------------------- malloc_trim ----------------------*/
-@@ -707,6 +739,7 @@
+@@ -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, tc_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
-@@ -791,6 +824,7 @@
+@@ -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, tc_mallinfo);
++MALLINFO(NONE, mallinfo);
#if defined(VGO_darwin)
« no previous file with comments | « scripts/fork.patch ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698