diff options
author | kaiwang@chromium.org <kaiwang@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-08 21:56:54 +0000 |
---|---|---|
committer | kaiwang@chromium.org <kaiwang@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-08 21:56:54 +0000 |
commit | 49e4b033aa8306df6475696017beb40f880878b9 (patch) | |
tree | 22267a5ecea887f7ffd98ed29df3ce730d6784c6 /third_party | |
parent | f61f4781f80387b0fe2257c035cf95c61eca555a (diff) | |
download | chromium_src-49e4b033aa8306df6475696017beb40f880878b9.zip chromium_src-49e4b033aa8306df6475696017beb40f880878b9.tar.gz chromium_src-49e4b033aa8306df6475696017beb40f880878b9.tar.bz2 |
Try not to inline tcmalloc::Abort() so we can find it in stack trace.
Review URL: https://chromiumcodereview.appspot.com/10535049
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@141295 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'third_party')
-rwxr-xr-x | third_party/tcmalloc/chromium/src/base/abort.cc | 18 | ||||
-rw-r--r-- | third_party/tcmalloc/chromium/src/base/abort.h | 21 |
2 files changed, 21 insertions, 18 deletions
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_ |