diff options
author | rsesek@chromium.org <rsesek@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-18 20:23:04 +0000 |
---|---|---|
committer | rsesek@chromium.org <rsesek@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-18 20:23:04 +0000 |
commit | 2558a4d98d5bc9a828d289e7df795e9649745036 (patch) | |
tree | 29998b8ebd027673ca3491267d3b020b412ec452 /base/process_util_unittest.cc | |
parent | 65f629a9e07e8e26e3f7a217e080a4e6fc511e4e (diff) | |
download | chromium_src-2558a4d98d5bc9a828d289e7df795e9649745036.zip chromium_src-2558a4d98d5bc9a828d289e7df795e9649745036.tar.gz chromium_src-2558a4d98d5bc9a828d289e7df795e9649745036.tar.bz2 |
[Mac] Implement base::EnableTerminationOnHeapCorruption() by overriding malloc_error_break().
This makes malloc_error_break() fatal for all processes in an attempt to get
better stack traces when heap corruption may occur.
BUG=90884,91068,93191
TEST=See bug 93191 for repro steps. A crash report gets generated with a hopefully more-useful stack.
Originally landed: http://src.chromium.org/viewvc/chrome?view=rev&revision=97315
Reverted: http://src.chromium.org/viewvc/chrome?view=rev&revision=97322
Review URL: http://codereview.chromium.org/7670025
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@97351 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/process_util_unittest.cc')
-rw-r--r-- | base/process_util_unittest.cc | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/base/process_util_unittest.cc b/base/process_util_unittest.cc index 3b05d03..8a653d4 100644 --- a/base/process_util_unittest.cc +++ b/base/process_util_unittest.cc @@ -397,6 +397,21 @@ TEST_F(ProcessUtilTest, LaunchAsUser) { #endif // defined(OS_WIN) +#if defined(OS_MACOSX) + +TEST_F(ProcessUtilTest, MacTerminateOnHeapCorruption) { + // Note that base::EnableTerminationOnHeapCorruption() is called as part of + // test suite setup and does not need to be done again, else mach_override + // will fail. + + char buf[3]; + ASSERT_DEATH(free(buf), "being freed.*" + "\\*\\*\\* set a breakpoint in malloc_error_break to debug.*" + "Terminating process due to a potential for future heap corruption"); +} + +#endif // defined(OS_MACOSX) + #if defined(OS_POSIX) namespace { |