OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <limits> | 5 #include <limits> |
6 #include <sstream> | 6 #include <sstream> |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/debug/stack_trace.h" | 9 #include "base/debug/stack_trace.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 char* pointer = new char[10]; | 137 char* pointer = new char[10]; |
138 delete pointer; | 138 delete pointer; |
139 return 2; | 139 return 2; |
140 } | 140 } |
141 | 141 |
142 // Regression test for StackDumpingSignalHandler async-signal unsafety. | 142 // Regression test for StackDumpingSignalHandler async-signal unsafety. |
143 // Combined with tcmalloc's debugallocation, that signal handler | 143 // Combined with tcmalloc's debugallocation, that signal handler |
144 // and e.g. mismatched new[]/delete would cause a hang because | 144 // and e.g. mismatched new[]/delete would cause a hang because |
145 // of re-entering malloc. | 145 // of re-entering malloc. |
146 TEST_F(StackTraceTest, AsyncSignalUnsafeSignalHandlerHang) { | 146 TEST_F(StackTraceTest, AsyncSignalUnsafeSignalHandlerHang) { |
147 ProcessHandle child = this->SpawnChild("MismatchedMallocChildProcess", false); | 147 ProcessHandle child = SpawnChild("MismatchedMallocChildProcess"); |
148 ASSERT_NE(kNullProcessHandle, child); | 148 ASSERT_NE(kNullProcessHandle, child); |
149 ASSERT_TRUE(WaitForSingleProcess(child, TestTimeouts::action_timeout())); | 149 ASSERT_TRUE(WaitForSingleProcess(child, TestTimeouts::action_timeout())); |
150 } | 150 } |
151 #endif // !defined(OS_IOS) | 151 #endif // !defined(OS_IOS) |
152 | 152 |
153 namespace { | 153 namespace { |
154 | 154 |
155 std::string itoa_r_wrapper(intptr_t i, size_t sz, int base, size_t padding) { | 155 std::string itoa_r_wrapper(intptr_t i, size_t sz, int base, size_t padding) { |
156 char buffer[1024]; | 156 char buffer[1024]; |
157 CHECK_LE(sz, sizeof(buffer)); | 157 CHECK_LE(sz, sizeof(buffer)); |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 EXPECT_EQ("688", itoa_r_wrapper(0x688, 128, 16, 1)); | 220 EXPECT_EQ("688", itoa_r_wrapper(0x688, 128, 16, 1)); |
221 EXPECT_EQ("688", itoa_r_wrapper(0x688, 128, 16, 2)); | 221 EXPECT_EQ("688", itoa_r_wrapper(0x688, 128, 16, 2)); |
222 EXPECT_EQ("688", itoa_r_wrapper(0x688, 128, 16, 3)); | 222 EXPECT_EQ("688", itoa_r_wrapper(0x688, 128, 16, 3)); |
223 EXPECT_EQ("0688", itoa_r_wrapper(0x688, 128, 16, 4)); | 223 EXPECT_EQ("0688", itoa_r_wrapper(0x688, 128, 16, 4)); |
224 EXPECT_EQ("00688", itoa_r_wrapper(0x688, 128, 16, 5)); | 224 EXPECT_EQ("00688", itoa_r_wrapper(0x688, 128, 16, 5)); |
225 } | 225 } |
226 #endif // defined(OS_POSIX) && !defined(OS_ANDROID) | 226 #endif // defined(OS_POSIX) && !defined(OS_ANDROID) |
227 | 227 |
228 } // namespace debug | 228 } // namespace debug |
229 } // namespace base | 229 } // namespace base |
OLD | NEW |