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