| 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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 char* pointer = new char[10]; | 139 char* pointer = new char[10]; |
| 140 delete pointer; | 140 delete pointer; |
| 141 return 2; | 141 return 2; |
| 142 } | 142 } |
| 143 | 143 |
| 144 // Regression test for StackDumpingSignalHandler async-signal unsafety. | 144 // Regression test for StackDumpingSignalHandler async-signal unsafety. |
| 145 // Combined with tcmalloc's debugallocation, that signal handler | 145 // Combined with tcmalloc's debugallocation, that signal handler |
| 146 // and e.g. mismatched new[]/delete would cause a hang because | 146 // and e.g. mismatched new[]/delete would cause a hang because |
| 147 // of re-entering malloc. | 147 // of re-entering malloc. |
| 148 TEST_F(StackTraceTest, AsyncSignalUnsafeSignalHandlerHang) { | 148 TEST_F(StackTraceTest, AsyncSignalUnsafeSignalHandlerHang) { |
| 149 ProcessHandle child = SpawnChild("MismatchedMallocChildProcess"); | 149 Process child = SpawnChild("MismatchedMallocChildProcess"); |
| 150 ASSERT_NE(kNullProcessHandle, child); | 150 ASSERT_TRUE(child.IsValid()); |
| 151 ASSERT_TRUE(WaitForSingleProcess(child, TestTimeouts::action_timeout())); | 151 ASSERT_TRUE(WaitForSingleProcess(child.Handle(), |
| 152 TestTimeouts::action_timeout())); |
| 152 } | 153 } |
| 153 #endif // !defined(OS_IOS) | 154 #endif // !defined(OS_IOS) |
| 154 | 155 |
| 155 namespace { | 156 namespace { |
| 156 | 157 |
| 157 std::string itoa_r_wrapper(intptr_t i, size_t sz, int base, size_t padding) { | 158 std::string itoa_r_wrapper(intptr_t i, size_t sz, int base, size_t padding) { |
| 158 char buffer[1024]; | 159 char buffer[1024]; |
| 159 CHECK_LE(sz, sizeof(buffer)); | 160 CHECK_LE(sz, sizeof(buffer)); |
| 160 | 161 |
| 161 char* result = internal::itoa_r(i, buffer, sz, base, padding); | 162 char* result = internal::itoa_r(i, buffer, sz, base, padding); |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 EXPECT_EQ("688", itoa_r_wrapper(0x688, 128, 16, 1)); | 223 EXPECT_EQ("688", itoa_r_wrapper(0x688, 128, 16, 1)); |
| 223 EXPECT_EQ("688", itoa_r_wrapper(0x688, 128, 16, 2)); | 224 EXPECT_EQ("688", itoa_r_wrapper(0x688, 128, 16, 2)); |
| 224 EXPECT_EQ("688", itoa_r_wrapper(0x688, 128, 16, 3)); | 225 EXPECT_EQ("688", itoa_r_wrapper(0x688, 128, 16, 3)); |
| 225 EXPECT_EQ("0688", itoa_r_wrapper(0x688, 128, 16, 4)); | 226 EXPECT_EQ("0688", itoa_r_wrapper(0x688, 128, 16, 4)); |
| 226 EXPECT_EQ("00688", itoa_r_wrapper(0x688, 128, 16, 5)); | 227 EXPECT_EQ("00688", itoa_r_wrapper(0x688, 128, 16, 5)); |
| 227 } | 228 } |
| 228 #endif // defined(OS_POSIX) && !defined(OS_ANDROID) | 229 #endif // defined(OS_POSIX) && !defined(OS_ANDROID) |
| 229 | 230 |
| 230 } // namespace debug | 231 } // namespace debug |
| 231 } // namespace base | 232 } // namespace base |
| OLD | NEW |