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 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 EXPECT_EQ("00001", itoa_r_wrapper(1, 128, 10, 5)); | 247 EXPECT_EQ("00001", itoa_r_wrapper(1, 128, 10, 5)); |
248 EXPECT_EQ("688", itoa_r_wrapper(0x688, 128, 16, 0)); | 248 EXPECT_EQ("688", itoa_r_wrapper(0x688, 128, 16, 0)); |
249 EXPECT_EQ("688", itoa_r_wrapper(0x688, 128, 16, 1)); | 249 EXPECT_EQ("688", itoa_r_wrapper(0x688, 128, 16, 1)); |
250 EXPECT_EQ("688", itoa_r_wrapper(0x688, 128, 16, 2)); | 250 EXPECT_EQ("688", itoa_r_wrapper(0x688, 128, 16, 2)); |
251 EXPECT_EQ("688", itoa_r_wrapper(0x688, 128, 16, 3)); | 251 EXPECT_EQ("688", itoa_r_wrapper(0x688, 128, 16, 3)); |
252 EXPECT_EQ("0688", itoa_r_wrapper(0x688, 128, 16, 4)); | 252 EXPECT_EQ("0688", itoa_r_wrapper(0x688, 128, 16, 4)); |
253 EXPECT_EQ("00688", itoa_r_wrapper(0x688, 128, 16, 5)); | 253 EXPECT_EQ("00688", itoa_r_wrapper(0x688, 128, 16, 5)); |
254 } | 254 } |
255 #endif // defined(OS_POSIX) && !defined(OS_ANDROID) | 255 #endif // defined(OS_POSIX) && !defined(OS_ANDROID) |
256 | 256 |
257 #if HAVE_TRACE_STACK_FRAME_POINTERS | 257 #if HAVE_TRACE_STACK_FRAME_POINTERS && !defined(OS_WIN) |
258 | 258 // Windows x64 binaries cannot be built with frame pointer, and MSVC doesn't |
| 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. |
259 template <size_t Depth> | 261 template <size_t Depth> |
260 void NOINLINE ExpectStackFramePointers(const void** frames, | 262 void NOINLINE ExpectStackFramePointers(const void** frames, |
261 size_t max_depth) { | 263 size_t max_depth) { |
262 code_start: | 264 code_start: |
263 // Calling __builtin_frame_address() forces compiler to emit | 265 // Calling __builtin_frame_address() forces compiler to emit |
264 // frame pointers, even if they are not enabled. | 266 // frame pointers, even if they are not enabled. |
265 EXPECT_NE(nullptr, __builtin_frame_address(0)); | 267 EXPECT_NE(nullptr, __builtin_frame_address(0)); |
266 ExpectStackFramePointers<Depth - 1>(frames, max_depth); | 268 ExpectStackFramePointers<Depth - 1>(frames, max_depth); |
267 | 269 |
268 constexpr size_t frame_index = Depth - 1; | 270 constexpr size_t frame_index = Depth - 1; |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 #if defined(OS_ANDROID) || defined(OS_MACOSX) | 308 #if defined(OS_ANDROID) || defined(OS_MACOSX) |
307 #define MAYBE_StackEnd StackEnd | 309 #define MAYBE_StackEnd StackEnd |
308 #else | 310 #else |
309 #define MAYBE_StackEnd DISABLED_StackEnd | 311 #define MAYBE_StackEnd DISABLED_StackEnd |
310 #endif | 312 #endif |
311 | 313 |
312 TEST_F(StackTraceTest, MAYBE_StackEnd) { | 314 TEST_F(StackTraceTest, MAYBE_StackEnd) { |
313 EXPECT_NE(0u, GetStackEnd()); | 315 EXPECT_NE(0u, GetStackEnd()); |
314 } | 316 } |
315 | 317 |
316 #endif // HAVE_TRACE_STACK_FRAME_POINTERS | 318 #endif // HAVE_TRACE_STACK_FRAME_POINTERS && !defined(OS_WIN) |
317 | 319 |
318 } // namespace debug | 320 } // namespace debug |
319 } // namespace base | 321 } // namespace base |
OLD | NEW |