diff options
-rw-r--r-- | base/allocator/allocator.gyp | 4 | ||||
-rwxr-xr-x | third_party/tcmalloc/chromium/src/base/abort.cc | 18 | ||||
-rw-r--r-- | third_party/tcmalloc/chromium/src/base/abort.h | 21 |
3 files changed, 24 insertions, 19 deletions
diff --git a/base/allocator/allocator.gyp b/base/allocator/allocator.gyp index 6288581..e2c8ac0 100644 --- a/base/allocator/allocator.gyp +++ b/base/allocator/allocator.gyp @@ -52,8 +52,10 @@ # all tcmalloc native and forked files '<(tcmalloc_dir)/src/addressmap-inl.h', - '<(tcmalloc_dir)/src/base/atomicops-internals-linuxppc.h', + '<(tcmalloc_dir)/src/base/abort.cc', + '<(tcmalloc_dir)/src/base/abort.h', '<(tcmalloc_dir)/src/base/arm_instruction_set_select.h', + '<(tcmalloc_dir)/src/base/atomicops-internals-linuxppc.h', '<(tcmalloc_dir)/src/base/atomicops-internals-arm-generic.h', '<(tcmalloc_dir)/src/base/atomicops-internals-arm-v6plus.h', '<(tcmalloc_dir)/src/base/atomicops-internals-macosx.h', diff --git a/third_party/tcmalloc/chromium/src/base/abort.cc b/third_party/tcmalloc/chromium/src/base/abort.cc new file mode 100755 index 0000000..05d4dd7 --- /dev/null +++ b/third_party/tcmalloc/chromium/src/base/abort.cc @@ -0,0 +1,18 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "base/abort.h" + +#include "base/basictypes.h" + +namespace tcmalloc { + +// Try not to inline so we can find Abort() call from stack trace. +ATTRIBUTE_NOINLINE void Abort() { + // Make a segmentation fault to force abort. Writing to a specific address + // so it's easier to find on crash stacks. + *(reinterpret_cast<volatile char*>(NULL) + 57) = 0x2001; +} + +} // namespace tcmalloc diff --git a/third_party/tcmalloc/chromium/src/base/abort.h b/third_party/tcmalloc/chromium/src/base/abort.h index 11bb967..18ec319 100644 --- a/third_party/tcmalloc/chromium/src/base/abort.h +++ b/third_party/tcmalloc/chromium/src/base/abort.h @@ -6,29 +6,14 @@ // 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. +// So we replace abort with a segmentation fault, then crash reporter can +// always detect. #ifndef BASE_ABORT_H_ #define BASE_ABORT_H_ -#if defined(TCMALLOC_USE_SYSTEM_ABORT) -#include <stdlib.h> - namespace tcmalloc { -inline void Abort() { - abort(); -} +void Abort(); } // namespace tcmalloc -#else -namespace tcmalloc { -inline void Abort() { - // Make a segmentation fault to force abort. - *reinterpret_cast<volatile int*>(NULL) = 0x2001; -} -} // namespace tcmalloc - -#endif - #endif // BASE_ABORT_H_ |