Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(15)

Side by Side Diff: base/debug/stack_trace_unittest.cc

Issue 2757123002: Cleaner fall-back stack capture for --enable-heap-profiling=native. (Closed)
Patch Set: Fix OS_NACL Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 && !defined(OS_WIN) 257 #if HAVE_TRACE_STACK_FRAME_POINTERS()
258 // Windows x64 binaries cannot be built with frame pointer, and MSVC doesn't 258
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 template <size_t Depth> 259 template <size_t Depth>
262 void NOINLINE ExpectStackFramePointers(const void** frames, 260 void NOINLINE ExpectStackFramePointers(const void** frames,
263 size_t max_depth) { 261 size_t max_depth) {
264 code_start: 262 code_start:
265 // Calling __builtin_frame_address() forces compiler to emit 263 // Calling __builtin_frame_address() forces compiler to emit
266 // frame pointers, even if they are not enabled. 264 // frame pointers, even if they are not enabled.
267 EXPECT_NE(nullptr, __builtin_frame_address(0)); 265 EXPECT_NE(nullptr, __builtin_frame_address(0));
268 ExpectStackFramePointers<Depth - 1>(frames, max_depth); 266 ExpectStackFramePointers<Depth - 1>(frames, max_depth);
269 267
270 constexpr size_t frame_index = Depth - 1; 268 constexpr size_t frame_index = Depth - 1;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 #if defined(OS_ANDROID) || defined(OS_MACOSX) 306 #if defined(OS_ANDROID) || defined(OS_MACOSX)
309 #define MAYBE_StackEnd StackEnd 307 #define MAYBE_StackEnd StackEnd
310 #else 308 #else
311 #define MAYBE_StackEnd DISABLED_StackEnd 309 #define MAYBE_StackEnd DISABLED_StackEnd
312 #endif 310 #endif
313 311
314 TEST_F(StackTraceTest, MAYBE_StackEnd) { 312 TEST_F(StackTraceTest, MAYBE_StackEnd) {
315 EXPECT_NE(0u, GetStackEnd()); 313 EXPECT_NE(0u, GetStackEnd());
316 } 314 }
317 315
318 #endif // HAVE_TRACE_STACK_FRAME_POINTERS && !defined(OS_WIN) 316 #endif // HAVE_TRACE_STACK_FRAME_POINTERS()
319 317
320 } // namespace debug 318 } // namespace debug
321 } // namespace base 319 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698