OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 // | |
5 // --- | |
6 // On some platforms abort() is implemented in a way that Chrome's crash | |
7 // reporter treats it as a normal exit. See issue: | |
8 // http://code.google.com/p/chromium/issues/detail?id=118665 | |
9 // So we replace abort with a | |
10 // segmentation fault, that crash reporter can always detect. | |
11 | |
12 #ifndef BASE_ABORT_H_ | |
13 #define BASE_ABORT_H_ | |
14 | |
15 #if defined(TCMALLOC_USE_SYSTEM_ABORT) | |
16 #include <stdlib.h> | |
17 | |
18 namespace tcmalloc { | |
19 inline void Abort() { | |
20 abort(); | |
21 } | |
22 } // namespace tcmalloc | |
23 | |
24 #else | |
25 namespace tcmalloc { | |
26 inline void Abort() { | |
27 // Make a segmentation fault to force abort. | |
28 *reinterpret_cast<int*>(NULL) = 0x2001; | |
hans
2012/05/15 11:38:07
This causes a Clang warning:
abort.h:28:3: warnin
kaiwang
2012/05/15 17:56:03
Sure, I'll fix. Sorry for the inconvenience
kaiwang
2012/05/15 18:04:51
Just curious, I don't see this warning while compi
| |
29 } | |
30 } // namespace tcmalloc | |
31 | |
32 #endif | |
33 | |
34 #endif // BASE_ABORT_H_ | |
OLD | NEW |