OLD | NEW |
---|---|
1 /* Copyright (c) 2007, Google Inc. | 1 /* Copyright (c) 2007, Google Inc. |
2 * All rights reserved. | 2 * All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
147 } | 147 } |
148 } | 148 } |
149 | 149 |
150 #ifdef _MSC_VER | 150 #ifdef _MSC_VER |
151 | 151 |
152 // extern "C" suppresses C++ name mangling so we know the symbol names for the | 152 // extern "C" suppresses C++ name mangling so we know the symbol names for the |
153 // linker /INCLUDE:symbol pragmas above. | 153 // linker /INCLUDE:symbol pragmas above. |
154 extern "C" { | 154 extern "C" { |
155 // This tells the linker to run these functions. | 155 // This tells the linker to run these functions. |
156 #pragma data_seg(push, old_seg) | 156 #pragma data_seg(push, old_seg) |
157 #pragma data_seg(".CRT$XLB") | 157 // Use CRT$XLY instead of CRT$XLB to ensure we're called LATER in sequence. |
158 #pragma data_seg(".CRT$XLY") | |
wtc
2011/12/01 00:04:02
Just curious: why didn't you use CRT$XLZ?
| |
158 void (NTAPI *p_thread_callback_tcmalloc)( | 159 void (NTAPI *p_thread_callback_tcmalloc)( |
159 HINSTANCE h, DWORD dwReason, PVOID pv) = on_tls_callback; | 160 HINSTANCE h, DWORD dwReason, PVOID pv) = on_tls_callback; |
160 #pragma data_seg(".CRT$XTU") | 161 #pragma data_seg(".CRT$XTU") |
161 int (*p_process_term_tcmalloc)(void) = on_process_term; | 162 int (*p_process_term_tcmalloc)(void) = on_process_term; |
162 #pragma data_seg(pop, old_seg) | 163 #pragma data_seg(pop, old_seg) |
163 } // extern "C" | 164 } // extern "C" |
164 | 165 |
165 #else // #ifdef _MSC_VER [probably msys/mingw] | 166 #else // #ifdef _MSC_VER [probably msys/mingw] |
166 | 167 |
167 // We have to try the DllMain solution here, because we can't use the | 168 // We have to try the DllMain solution here, because we can't use the |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
328 if ((strlen(fname) >= prefix_length) && | 329 if ((strlen(fname) >= prefix_length) && |
329 (memcmp(fname, prefix, prefix_length) == 0)) { | 330 (memcmp(fname, prefix, prefix_length) == 0)) { |
330 RAW_VLOG(0, "Removing old heap profile %s\n", fname); | 331 RAW_VLOG(0, "Removing old heap profile %s\n", fname); |
331 // TODO(csilvers): we really need to unlink dirname + fname | 332 // TODO(csilvers): we really need to unlink dirname + fname |
332 _unlink(fname); | 333 _unlink(fname); |
333 } | 334 } |
334 } while (FindNextFileA(hFind, &found) != FALSE); // A is for Ansi | 335 } while (FindNextFileA(hFind, &found) != FALSE); // A is for Ansi |
335 FindClose(hFind); | 336 FindClose(hFind); |
336 } | 337 } |
337 } | 338 } |
OLD | NEW |