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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « scripts/fork.patch ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 Index: coregrind/m_replacemalloc/vg_replace_malloc.c 1 Index: coregrind/m_replacemalloc/vg_replace_malloc.c
2 =================================================================== 2 ===================================================================
3 --- coregrind/m_replacemalloc/vg_replace_malloc.c» (revision 11055) 3 --- coregrind/m_replacemalloc/vg_replace_malloc.c» (revision 10880)
4 +++ coregrind/m_replacemalloc/vg_replace_malloc.c (working copy) 4 +++ coregrind/m_replacemalloc/vg_replace_malloc.c (working copy)
5 @@ -234,6 +234,13 @@ 5 @@ -193,6 +193,18 @@
6 // malloc 6 // malloc
7 ALLOC_or_NULL(VG_Z_LIBSTDCXX_SONAME, malloc, malloc); 7 ALLOC_or_NULL(VG_Z_LIBSTDCXX_SONAME, malloc, malloc);
8 ALLOC_or_NULL(VG_Z_LIBC_SONAME, malloc, malloc); 8 ALLOC_or_NULL(VG_Z_LIBC_SONAME, malloc, malloc);
9 +// Handle libtcmalloc's malloc() function. 9 +// Handle libtcmalloc's malloc() function.
10 +// Similar interceptors are added below to handle other libtcmalloc 10 +// Similar interceptors are added below to handle other libtcmalloc
11 +// allocation/deallocation functions. 11 +// allocation/deallocation functions.
12 +// soname=NONE means that a user's allocation function is intercepted. 12 +// soname=NONE means that a user's allocation function is intercepted.
13 +ALLOC_or_NULL(NONE, tc_malloc, malloc); 13 +ALLOC_or_NULL(NONE, malloc, malloc);
14 +// Bash has sh_malloc() and sh_free() along with standard malloc() and free().
15 +// Sometimes these functions are called inconsistently (e.g. free() after
16 +// sh_malloc()). To deal with this we have to intercept the sh_*() functions
17 +// as well.
18 +ALLOC_or_NULL(NONE, sh_malloc, malloc);
14 +// Handle Python's malloc. 19 +// Handle Python's malloc.
15 +ALLOC_or_NULL(NONE, PyObject_Malloc, malloc); 20 +ALLOC_or_NULL(NONE, PyObject_Malloc, malloc);
16 #if defined(VGP_ppc32_aix5) || defined(VGP_ppc64_aix5) 21 #if defined(VGP_ppc32_aix5) || defined(VGP_ppc64_aix5)
17 ALLOC_or_NULL(VG_Z_LIBC_SONAME, malloc_common, malloc); 22 ALLOC_or_NULL(VG_Z_LIBC_SONAME, malloc_common, malloc);
18 #elif defined(VGO_darwin) 23 #elif defined(VGO_darwin)
19 @@ -267,6 +274,8 @@ 24 @@ -205,20 +217,24 @@
20 ALLOC_or_BOMB(VG_Z_LIBC_DOT_A, __nw__FUl, __builtin_new); 25 // operator new(unsigned int), not mangled (for gcc 2.96)
21 #endif 26 ALLOC_or_BOMB(VG_Z_LIBSTDCXX_SONAME, builtin_new, __builtin_new);
22 27 ALLOC_or_BOMB(VG_Z_LIBC_SONAME, builtin_new, __builtin_new);
23 +// libtcmalloc's new 28 +ALLOC_or_BOMB(NONE, builtin_new, __builtin_new);
24 +ALLOC_or_BOMB(NONE, tc_new, __builtin_new); 29
25 30 ALLOC_or_BOMB(VG_Z_LIBSTDCXX_SONAME, __builtin_new, __builtin_new);
26 /*---------------------- new nothrow ----------------------*/ 31 ALLOC_or_BOMB(VG_Z_LIBC_SONAME, __builtin_new, __builtin_new);
27 32 +ALLOC_or_BOMB(NONE, __builtin_new, __builtin_new);
28 @@ -287,6 +296,8 @@ 33
29 ALLOC_or_NULL(VG_Z_LIBC_DOT_A, __nw__FUlRCQ2_3std9nothrow_t, __builtin_new) ; 34 // operator new(unsigned int), GNU mangling
30 #endif 35 #if VG_WORDSIZE == 4
31 36 ALLOC_or_BOMB(VG_Z_LIBSTDCXX_SONAME, _Znwj, __builtin_new);
32 +// libtcmalloc's new nothrow 37 ALLOC_or_BOMB(VG_Z_LIBC_SONAME, _Znwj, __builtin_new);
33 +ALLOC_or_NULL(NONE, tc_new_nothrow, __builtin_new); 38 + ALLOC_or_BOMB(NONE, _Znwj, __builtin_new);
34 39 #endif
35 /*---------------------- new [] ----------------------*/ 40
36 41 // operator new(unsigned long), GNU mangling
37 @@ -311,6 +322,8 @@ 42 #if VG_WORDSIZE == 8 || defined(VGP_ppc32_aix5) || defined(VGO_darwin)
38 ALLOC_or_BOMB(VG_Z_LIBC_DOT_A, __vn__FUl, __builtin_vec_new); 43 ALLOC_or_BOMB(VG_Z_LIBSTDCXX_SONAME, _Znwm, __builtin_new);
39 #endif 44 ALLOC_or_BOMB(VG_Z_LIBC_SONAME, _Znwm, __builtin_new);
40 45 + ALLOC_or_BOMB(NONE, _Znwm, __builtin_new);
41 +// libtcmalloc's new [] 46 #endif
42 +ALLOC_or_BOMB(NONE, tc_newarray, __builtin_vec_new); 47
43 48 // operator new(unsigned long), ARM/cfront mangling
44 /*---------------------- new [] nothrow ----------------------*/ 49 @@ -233,12 +249,14 @@
45 50 #if VG_WORDSIZE == 4
46 @@ -331,6 +344,8 @@ 51 ALLOC_or_NULL(VG_Z_LIBSTDCXX_SONAME, _ZnwjRKSt9nothrow_t, __builtin_new);
47 ALLOC_or_BOMB(VG_Z_LIBC_DOT_A, __vn__FUlRCQ2_3std9nothrow_t, __builtin_vec_n ew ); 52 ALLOC_or_NULL(VG_Z_LIBC_SONAME, _ZnwjRKSt9nothrow_t, __builtin_new);
48 #endif 53 + ALLOC_or_NULL(NONE, _ZnwjRKSt9nothrow_t, __builtin_new);
49 54 #endif
50 +// libtcmalloc's new [] nothrow 55
51 +ALLOC_or_NULL(NONE, tc_newarray_nothrow, __builtin_vec_new); 56 // operator new(unsigned long, std::nothrow_t const&), GNU mangling
52 57 #if VG_WORDSIZE == 8 || defined(VGP_ppc32_aix5) || defined(VGP_ppc64_aix5) || d efined(VGO_darwin)
53 /*---------------------- free ----------------------*/ 58 ALLOC_or_NULL(VG_Z_LIBSTDCXX_SONAME, _ZnwmRKSt9nothrow_t, __builtin_new);
54 59 ALLOC_or_NULL(VG_Z_LIBC_SONAME, _ZnwmRKSt9nothrow_t, __builtin_new);
55 @@ -364,6 +379,8 @@ 60 + ALLOC_or_NULL(NONE, _ZnwmRKSt9nothrow_t, __builtin_new);
61 #endif
62
63 // operator new(unsigned long, std::nothrow_t const&), ARM/cfront mangling
64 @@ -252,17 +270,20 @@
65 // operator new[](unsigned int), not mangled (for gcc 2.96)
66 ALLOC_or_BOMB(VG_Z_LIBSTDCXX_SONAME, __builtin_vec_new, __builtin_vec_new );
67 ALLOC_or_BOMB(VG_Z_LIBC_SONAME, __builtin_vec_new, __builtin_vec_new );
68 +ALLOC_or_BOMB(NONE, __builtin_vec_new, __builtin_vec_new );
69
70 // operator new[](unsigned int), GNU mangling
71 #if VG_WORDSIZE == 4
72 ALLOC_or_BOMB(VG_Z_LIBSTDCXX_SONAME, _Znaj, __builtin_vec_new );
73 ALLOC_or_BOMB(VG_Z_LIBC_SONAME, _Znaj, __builtin_vec_new );
74 + ALLOC_or_BOMB(NONE, _Znaj, __builtin_vec_new );
75 #endif
76
77 // operator new[](unsigned long), GNU mangling
78 #if VG_WORDSIZE == 8 || defined(VGP_ppc32_aix5) || defined(VGP_ppc64_aix5) || d efined(VGO_darwin)
79 ALLOC_or_BOMB(VG_Z_LIBSTDCXX_SONAME, _Znam, __builtin_vec_new );
80 ALLOC_or_BOMB(VG_Z_LIBC_SONAME, _Znam, __builtin_vec_new );
81 + ALLOC_or_BOMB(NONE, _Znam, __builtin_vec_new );
82 #endif
83
84 // operator new[](unsigned long), ARM/cfront mangling
85 @@ -277,12 +298,14 @@
86 #if VG_WORDSIZE == 4
87 ALLOC_or_NULL(VG_Z_LIBSTDCXX_SONAME, _ZnajRKSt9nothrow_t, __builtin_vec_new );
88 ALLOC_or_NULL(VG_Z_LIBC_SONAME, _ZnajRKSt9nothrow_t, __builtin_vec_new );
89 + ALLOC_or_NULL(NONE, _ZnajRKSt9nothrow_t, __builtin_vec_new );
90 #endif
91
92 // operator new[](unsigned long, std::nothrow_t const&), GNU mangling
93 #if VG_WORDSIZE == 8 || defined(VGP_ppc32_aix5) || defined(VGP_ppc64_aix5) || d efined(VGO_darwin)
94 ALLOC_or_NULL(VG_Z_LIBSTDCXX_SONAME, _ZnamRKSt9nothrow_t, __builtin_vec_new );
95 ALLOC_or_NULL(VG_Z_LIBC_SONAME, _ZnamRKSt9nothrow_t, __builtin_vec_new );
96 + ALLOC_or_NULL(NONE, _ZnamRKSt9nothrow_t, __builtin_vec_new );
97 #endif
98
99 // operator new [](unsigned long, std::nothrow_t const&), ARM/cfront mangling
100 @@ -323,6 +346,9 @@
56 // free 101 // free
57 FREE(VG_Z_LIBSTDCXX_SONAME, free, free ); 102 FREE(VG_Z_LIBSTDCXX_SONAME, free, free );
58 FREE(VG_Z_LIBC_SONAME, free, free ); 103 FREE(VG_Z_LIBC_SONAME, free, free );
59 +FREE(NONE, tc_free, free ); 104 +FREE(NONE, free, free );
105 +FREE(NONE, sh_free, free );
60 +FREE(NONE, PyObject_Free, free ); 106 +FREE(NONE, PyObject_Free, free );
61 #if defined(VGP_ppc32_aix5) || defined(VGP_ppc64_aix5) 107 #if defined(VGP_ppc32_aix5) || defined(VGP_ppc64_aix5)
62 FREE(VG_Z_LIBC_SONAME, free_common, free ); 108 FREE(VG_Z_LIBC_SONAME, free_common, free );
63 #elif defined(VGO_darwin) 109 #elif defined(VGO_darwin)
64 @@ -376,6 +393,7 @@ 110 @@ -335,16 +361,20 @@
65 // cfree 111 // cfree
66 FREE(VG_Z_LIBSTDCXX_SONAME, cfree, free ); 112 FREE(VG_Z_LIBSTDCXX_SONAME, cfree, free );
67 FREE(VG_Z_LIBC_SONAME, cfree, free ); 113 FREE(VG_Z_LIBC_SONAME, cfree, free );
68 +FREE(NONE, tc_cfree, free ); 114 +FREE(NONE, cfree, free );
115 +FREE(NONE, sh_cfree, free );
69 116
70 117
71 /*---------------------- delete ----------------------*/ 118 /*---------------------- delete ----------------------*/
72 @@ -392,6 +410,8 @@ 119 // operator delete(void*), not mangled (for gcc 2.96)
73 FREE(VG_Z_LIBC_DOT_A, __dl__FPv, __builtin_delete ); 120 FREE(VG_Z_LIBSTDCXX_SONAME, __builtin_delete, __builtin_delete );
74 #endif 121 FREE(VG_Z_LIBC_SONAME, __builtin_delete, __builtin_delete );
75 122 +FREE(NONE, __builtin_delete, __builtin_delete );
76 +// libtcmalloc's delete 123
77 +FREE(NONE, tc_delete, __builtin_delete); 124 // operator delete(void*), GNU mangling
78 125 FREE(VG_Z_LIBSTDCXX_SONAME, _ZdlPv, __builtin_delete );
79 /*---------------------- delete nothrow ----------------------*/ 126 FREE(VG_Z_LIBC_SONAME, _ZdlPv, __builtin_delete );
80 127 +FREE(NONE, _ZdlPv, __builtin_delete );
81 @@ -399,6 +419,8 @@ 128
129 // operator delete(void*), ARM/cfront mangling
130 #if defined(VGP_ppc32_aix5) || defined(VGP_ppc64_aix5)
131 @@ -357,16 +387,19 @@
132 // operator delete(void*, std::nothrow_t const&), GNU mangling
82 FREE(VG_Z_LIBSTDCXX_SONAME, _ZdlPvRKSt9nothrow_t, __builtin_delete ); 133 FREE(VG_Z_LIBSTDCXX_SONAME, _ZdlPvRKSt9nothrow_t, __builtin_delete );
83 FREE(VG_Z_LIBC_SONAME, _ZdlPvRKSt9nothrow_t, __builtin_delete ); 134 FREE(VG_Z_LIBC_SONAME, _ZdlPvRKSt9nothrow_t, __builtin_delete );
84 135 +FREE(NONE, _ZdlPvRKSt9nothrow_t, __builtin_delete );
85 +// libtcmalloc's delete nothrow 136
86 +FREE(NONE, tc_delete_nothrow, __builtin_delete);
87 137
88 /*---------------------- delete [] ----------------------*/ 138 /*---------------------- delete [] ----------------------*/
89 // operator delete[](void*), not mangled (for gcc 2.96) 139 // operator delete[](void*), not mangled (for gcc 2.96)
90 @@ -414,6 +436,8 @@ 140 FREE(VG_Z_LIBSTDCXX_SONAME, __builtin_vec_delete, __builtin_vec_delete );
91 FREE(VG_Z_LIBC_DOT_A, __vd__FPv, __builtin_vec_delete ); 141 FREE(VG_Z_LIBC_SONAME, __builtin_vec_delete, __builtin_vec_delete );
92 #endif 142 +FREE(NONE, __builtin_vec_delete, __builtin_vec_delete );
93 143
94 +// libtcmalloc's delete [] 144 // operator delete[](void*), GNU mangling
95 +FREE(NONE, tc_deletearray, __builtin_vec_delete); 145 FREE(VG_Z_LIBSTDCXX_SONAME, _ZdaPv, __builtin_vec_delete );
96 146 FREE(VG_Z_LIBC_SONAME, _ZdaPv, __builtin_vec_delete );
97 /*---------------------- delete [] nothrow ----------------------*/ 147 +FREE(NONE, _ZdaPv, __builtin_vec_delete );
98 148
99 @@ -421,6 +445,8 @@ 149 // operator delete[](void*), ARM/cfront mangling
150 #if defined(VGP_ppc32_aix5) || defined(VGP_ppc64_aix5)
151 @@ -379,6 +412,7 @@
152 // operator delete[](void*, std::nothrow_t const&), GNU mangling
100 FREE(VG_Z_LIBSTDCXX_SONAME, _ZdaPvRKSt9nothrow_t, __builtin_vec_delete ); 153 FREE(VG_Z_LIBSTDCXX_SONAME, _ZdaPvRKSt9nothrow_t, __builtin_vec_delete );
101 FREE(VG_Z_LIBC_SONAME, _ZdaPvRKSt9nothrow_t, __builtin_vec_delete ); 154 FREE(VG_Z_LIBC_SONAME, _ZdaPvRKSt9nothrow_t, __builtin_vec_delete );
102 155 +FREE(NONE, _ZdaPvRKSt9nothrow_t, __builtin_vec_delete );
103 +// libtcmalloc's delete [] nothrow 156
104 +FREE(NONE, tc_deletearray_nothrow, __builtin_vec_delete);
105 157
106 /*---------------------- calloc ----------------------*/ 158 /*---------------------- calloc ----------------------*/
107 159 @@ -416,6 +450,8 @@
108 @@ -465,6 +491,7 @@
109 } 160 }
110 161
111 CALLOC(VG_Z_LIBC_SONAME, calloc); 162 CALLOC(VG_Z_LIBC_SONAME, calloc);
112 +CALLOC(NONE, tc_calloc); 163 +CALLOC(NONE, calloc);
164 +CALLOC(NONE, sh_calloc);
113 #if defined(VGP_ppc32_aix5) || defined(VGP_ppc64_aix5) 165 #if defined(VGP_ppc32_aix5) || defined(VGP_ppc64_aix5)
114 CALLOC(VG_Z_LIBC_SONAME, calloc_common); 166 CALLOC(VG_Z_LIBC_SONAME, calloc_common);
115 #elif defined(VGO_darwin) 167 #elif defined(VGO_darwin)
116 @@ -523,6 +550,8 @@ 168 @@ -474,6 +510,9 @@
117 } 169 }
118 170
119 REALLOC(VG_Z_LIBC_SONAME, realloc); 171 REALLOC(VG_Z_LIBC_SONAME, realloc);
120 +REALLOC(NONE, tc_realloc); 172 +REALLOC(NONE, realloc);
173 +REALLOC(NONE, sh_realloc);
121 +REALLOC(NONE, PyObject_Realloc); 174 +REALLOC(NONE, PyObject_Realloc);
122 #if defined(VGP_ppc32_aix5) || defined(VGP_ppc64_aix5) 175 #if defined(VGP_ppc32_aix5) || defined(VGP_ppc64_aix5)
123 REALLOC(VG_Z_LIBC_SONAME, realloc_common); 176 REALLOC(VG_Z_LIBC_SONAME, realloc_common);
124 #elif defined(VGO_darwin) 177 #elif defined(VGO_darwin)
125 @@ -579,6 +608,7 @@ 178 @@ -530,6 +569,8 @@
126 } 179 }
127 180
128 MEMALIGN(VG_Z_LIBC_SONAME, memalign); 181 MEMALIGN(VG_Z_LIBC_SONAME, memalign);
129 +MEMALIGN(NONE, tc_memalign); 182 +MEMALIGN(NONE, memalign);
183 +MEMALIGN(NONE, sh_memalign);
130 #if defined(VGO_darwin) 184 #if defined(VGO_darwin)
131 ZONEMEMALIGN(VG_Z_LIBC_SONAME, malloc_zone_memalign); 185 ZONEMEMALIGN(VG_Z_LIBC_SONAME, malloc_zone_memalign);
132 #endif 186 #endif
133 @@ -621,6 +651,7 @@ 187 @@ -572,6 +613,8 @@
134 } 188 }
135 189
136 VALLOC(VG_Z_LIBC_SONAME, valloc); 190 VALLOC(VG_Z_LIBC_SONAME, valloc);
137 +VALLOC(NONE, tc_valloc); 191 +VALLOC(NONE, valloc);
192 +VALLOC(NONE, sh_valloc);
138 #if defined(VGO_darwin) 193 #if defined(VGO_darwin)
139 ZONEVALLOC(VG_Z_LIBC_SONAME, malloc_zone_valloc); 194 ZONEVALLOC(VG_Z_LIBC_SONAME, malloc_zone_valloc);
140 #endif 195 #endif
141 @@ -641,6 +672,7 @@ 196 @@ -592,6 +635,7 @@
142 } 197 }
143 198
144 MALLOPT(VG_Z_LIBC_SONAME, mallopt); 199 MALLOPT(VG_Z_LIBC_SONAME, mallopt);
145 +MALLOPT(NONE, tc_mallopt); 200 +MALLOPT(NONE, mallopt);
146 201
147 202
148 /*---------------------- malloc_trim ----------------------*/ 203 /*---------------------- malloc_trim ----------------------*/
149 @@ -707,6 +739,7 @@ 204 @@ -628,6 +672,7 @@
205 }
206
207 MALLOC_TRIM(VG_Z_LIBC_SONAME, malloc_trim);
208 +MALLOC_TRIM(NONE, malloc_trim);
209
210
211 /*---------------------- posix_memalign ----------------------*/
212 @@ -658,6 +703,7 @@
150 } 213 }
151 214
152 POSIX_MEMALIGN(VG_Z_LIBC_SONAME, posix_memalign); 215 POSIX_MEMALIGN(VG_Z_LIBC_SONAME, posix_memalign);
153 +POSIX_MEMALIGN(NONE, tc_posix_memalign); 216 +POSIX_MEMALIGN(NONE, posix_memalign);
154 #if defined(VGP_ppc32_aix5) || defined(VGP_ppc64_aix5) 217 #if defined(VGP_ppc32_aix5) || defined(VGP_ppc64_aix5)
155 /* 27 Nov 07: it appears that xlc links into executables, a 218 /* 27 Nov 07: it appears that xlc links into executables, a
156 posix_memalign, which calls onwards to memalign_common, with the 219 posix_memalign, which calls onwards to memalign_common, with the
157 @@ -791,6 +824,7 @@ 220 @@ -688,6 +734,7 @@
221
222 MALLOC_USABLE_SIZE(VG_Z_LIBC_SONAME, malloc_usable_size);
223 MALLOC_USABLE_SIZE(VG_Z_LIBC_SONAME, malloc_size);
224 +MALLOC_USABLE_SIZE(NONE, malloc_size);
225
226
227 /*---------------------- (unimplemented) ----------------------*/
228 @@ -742,6 +789,7 @@
158 } 229 }
159 230
160 MALLINFO(VG_Z_LIBC_SONAME, mallinfo); 231 MALLINFO(VG_Z_LIBC_SONAME, mallinfo);
161 +MALLINFO(NONE, tc_mallinfo); 232 +MALLINFO(NONE, mallinfo);
162 233
163 234
164 #if defined(VGO_darwin) 235 #if defined(VGO_darwin)
OLDNEW
« 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