| 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 <stddef.h> | 5 #include <stddef.h> |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 #include <sstream> | 8 #include <sstream> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 EXPECT_EQ("00001", itoa_r_wrapper(1, 128, 10, 5)); | 248 EXPECT_EQ("00001", itoa_r_wrapper(1, 128, 10, 5)); |
| 249 EXPECT_EQ("688", itoa_r_wrapper(0x688, 128, 16, 0)); | 249 EXPECT_EQ("688", itoa_r_wrapper(0x688, 128, 16, 0)); |
| 250 EXPECT_EQ("688", itoa_r_wrapper(0x688, 128, 16, 1)); | 250 EXPECT_EQ("688", itoa_r_wrapper(0x688, 128, 16, 1)); |
| 251 EXPECT_EQ("688", itoa_r_wrapper(0x688, 128, 16, 2)); | 251 EXPECT_EQ("688", itoa_r_wrapper(0x688, 128, 16, 2)); |
| 252 EXPECT_EQ("688", itoa_r_wrapper(0x688, 128, 16, 3)); | 252 EXPECT_EQ("688", itoa_r_wrapper(0x688, 128, 16, 3)); |
| 253 EXPECT_EQ("0688", itoa_r_wrapper(0x688, 128, 16, 4)); | 253 EXPECT_EQ("0688", itoa_r_wrapper(0x688, 128, 16, 4)); |
| 254 EXPECT_EQ("00688", itoa_r_wrapper(0x688, 128, 16, 5)); | 254 EXPECT_EQ("00688", itoa_r_wrapper(0x688, 128, 16, 5)); |
| 255 } | 255 } |
| 256 #endif // defined(OS_POSIX) && !defined(OS_ANDROID) | 256 #endif // defined(OS_POSIX) && !defined(OS_ANDROID) |
| 257 | 257 |
| 258 // Windows x64 binaries cannot be built with frame pointer, and MSVC doesn't | 258 #if BUILDFLAG(CAN_UNWIND_WITH_FRAME_POINTERS) |
| 259 // provide intrinsics to query the frame pointer even for the x86 build, nor | |
| 260 // does it allow us to take the address of labels, so skip these under Windows. | |
| 261 #if BUILDFLAG(CAN_UNWIND_WITH_FRAME_POINTERS) && !defined(OS_WIN) | |
| 262 | 259 |
| 263 template <size_t Depth> | 260 template <size_t Depth> |
| 264 void NOINLINE ExpectStackFramePointers(const void** frames, | 261 void NOINLINE ExpectStackFramePointers(const void** frames, |
| 265 size_t max_depth) { | 262 size_t max_depth) { |
| 266 code_start: | 263 code_start: |
| 267 // Calling __builtin_frame_address() forces compiler to emit | 264 // Calling __builtin_frame_address() forces compiler to emit |
| 268 // frame pointers, even if they are not enabled. | 265 // frame pointers, even if they are not enabled. |
| 269 EXPECT_NE(nullptr, __builtin_frame_address(0)); | 266 EXPECT_NE(nullptr, __builtin_frame_address(0)); |
| 270 ExpectStackFramePointers<Depth - 1>(frames, max_depth); | 267 ExpectStackFramePointers<Depth - 1>(frames, max_depth); |
| 271 | 268 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 310 #if defined(OS_ANDROID) || defined(OS_MACOSX) | 307 #if defined(OS_ANDROID) || defined(OS_MACOSX) |
| 311 #define MAYBE_StackEnd StackEnd | 308 #define MAYBE_StackEnd StackEnd |
| 312 #else | 309 #else |
| 313 #define MAYBE_StackEnd DISABLED_StackEnd | 310 #define MAYBE_StackEnd DISABLED_StackEnd |
| 314 #endif | 311 #endif |
| 315 | 312 |
| 316 TEST_F(StackTraceTest, MAYBE_StackEnd) { | 313 TEST_F(StackTraceTest, MAYBE_StackEnd) { |
| 317 EXPECT_NE(0u, GetStackEnd()); | 314 EXPECT_NE(0u, GetStackEnd()); |
| 318 } | 315 } |
| 319 | 316 |
| 320 #endif // BUILDFLAG(CAN_UNWIND_WITH_FRAME_POINTERS) && !defined(OS_WIN) | 317 #endif // BUILDFLAG(CAN_UNWIND_WITH_FRAME_POINTERS) |
| 321 | 318 |
| 322 } // namespace debug | 319 } // namespace debug |
| 323 } // namespace base | 320 } // namespace base |
| OLD | NEW |