OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2012 Google Inc. | |
2 // All Rights Reserved. | |
3 // | |
4 // Redistribution and use in source and binary forms, with or without | |
5 // modification, are permitted provided that the following conditions are | |
6 // met: | |
7 // | |
8 // * Redistributions of source code must retain the above copyright | |
9 // notice, this list of conditions and the following disclaimer. | |
10 // * Redistributions in binary form must reproduce the above | |
11 // copyright notice, this list of conditions and the following disclaimer | |
12 // in the documentation and/or other materials provided with the | |
13 // distribution. | |
14 // * Neither the name of Google Inc. nor the names of its | |
15 // contributors may be used to endorse or promote products derived from | |
16 // this software without specific prior written permission. | |
17 // | |
18 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
19 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
20 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
21 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |
22 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
23 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |
24 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
25 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
26 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
27 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |
28 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
29 | |
30 // --- | |
31 // Author: Kai Wang <opensource@google.com> | |
jar (doing other things)
2012/05/11 21:57:56
nit: The whole copyright message for Chrome is onl
kaiwang
2012/05/12 00:06:09
Done.
| |
32 // | |
33 // On some platforms abort() is implemented in a way that Chrome's crash | |
34 // reporter treats it as a normal exit. See issue: | |
35 // http://code.google.com/p/chromium/issues/detail?id=118665 | |
36 // So we replace abort with a | |
37 // segmentation fault, that crash reporter can always detect. | |
38 | |
39 #ifndef BASE_ABORT_H_ | |
40 #define BASE_ABORT_H_ | |
41 | |
42 #ifdef TCMALLOC_USE_SYSTEM_ABORT | |
jar (doing other things)
2012/05/11 21:57:56
nit: I think folks like the format:
#if defined(..
jar (doing other things)
2012/05/11 22:46:35
<doh>. As per conversation, this is over in the
kaiwang
2012/05/12 00:06:09
Done, added to tcmalloc namespace
| |
43 #include <stdlib.h> | |
44 | |
45 inline void Abort() { | |
eroman
2012/05/11 03:55:53
I think this should be inside of namespace base.
kaiwang
2012/05/11 20:54:59
Actually most content in base dir do not have name
eroman
2012/05/11 21:11:14
Sounds fine to me. I'll defer to Jim
jar (doing other things)
2012/05/11 21:57:56
namespaces are good... so I'd go with Eric's sugge
| |
46 abort(); | |
47 } | |
48 | |
49 #else | |
50 inline void Abort() { | |
51 *((int*)0) = 0x2001; // Make a segmentation fault to force abort. | |
jar (doing other things)
2012/05/11 21:57:56
nit: always avoid C style casts.
*reinterpret_cas
kaiwang
2012/05/12 00:06:09
Done.
| |
52 } | |
53 | |
54 #endif | |
55 | |
56 #endif // BASE_ABORT_H_ | |
OLD | NEW |