Index: third_party/tcmalloc/chromium/src/base/abort.h |
=================================================================== |
--- third_party/tcmalloc/chromium/src/base/abort.h (revision 0) |
+++ third_party/tcmalloc/chromium/src/base/abort.h (revision 0) |
@@ -0,0 +1,56 @@ |
+// Copyright 2012 Google Inc. |
+// All Rights Reserved. |
+// |
+// Redistribution and use in source and binary forms, with or without |
+// modification, are permitted provided that the following conditions are |
+// met: |
+// |
+// * Redistributions of source code must retain the above copyright |
+// notice, this list of conditions and the following disclaimer. |
+// * Redistributions in binary form must reproduce the above |
+// copyright notice, this list of conditions and the following disclaimer |
+// in the documentation and/or other materials provided with the |
+// distribution. |
+// * Neither the name of Google Inc. nor the names of its |
+// contributors may be used to endorse or promote products derived from |
+// this software without specific prior written permission. |
+// |
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
+ |
+// --- |
+// 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.
|
+// |
+// On some platforms abort() is implemented in a way that Chrome's crash |
+// reporter treats it as a normal exit. See issue: |
+// http://code.google.com/p/chromium/issues/detail?id=118665 |
+// So we replace abort with a |
+// segmentation fault, that crash reporter can always detect. |
+ |
+#ifndef BASE_ABORT_H_ |
+#define BASE_ABORT_H_ |
+ |
+#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
|
+#include <stdlib.h> |
+ |
+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
|
+ abort(); |
+} |
+ |
+#else |
+inline void Abort() { |
+ *((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.
|
+} |
+ |
+#endif |
+ |
+#endif // BASE_ABORT_H_ |