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

Unified Diff: base/debug/stack_trace.h

Issue 2757123002: Cleaner fall-back stack capture for --enable-heap-profiling=native. (Closed)
Patch Set: Revert to non-function-style macro 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 side-by-side diff with in-line comments
Download patch
Index: base/debug/stack_trace.h
diff --git a/base/debug/stack_trace.h b/base/debug/stack_trace.h
index ab1d2ebe6a3c00244b5d09cb1e4fcadce16ab093..8bb369571302739d56b0873afc8ff5855448f14f 100644
--- a/base/debug/stack_trace.h
+++ b/base/debug/stack_trace.h
@@ -11,6 +11,7 @@
#include <string>
#include "base/base_export.h"
+#include "base/debug/debugging_flags.h"
#include "base/macros.h"
#include "build/build_config.h"
@@ -23,23 +24,27 @@ struct _EXCEPTION_POINTERS;
struct _CONTEXT;
#endif
-// TODO(699863): Clean up HAVE_TRACE_STACK_FRAME_POINTERS.
+// Fast stack trace capture using frame pointers is only available under POSIX
+// platforms, and only for certain architectures, and only when frame pointers
+// are enabled in the build.
#if defined(OS_POSIX)
+#if BUILDFLAG(ENABLE_PROFILING) || !defined(NDEBUG)
#if defined(__i386__) || defined(__x86_64__)
#define HAVE_TRACE_STACK_FRAME_POINTERS 1
#elif defined(__arm__) && !defined(__thumb__)
#define HAVE_TRACE_STACK_FRAME_POINTERS 1
-#else // defined(__arm__) && !defined(__thumb__)
+#else // defined(__arm__) && !defined(__thumb__)
#define HAVE_TRACE_STACK_FRAME_POINTERS 0
-#endif // defined(__arm__) && !defined(__thumb__)
+#endif // defined(__arm__) && !defined(__thumb__)
-#elif defined(OS_WIN)
-#define HAVE_TRACE_STACK_FRAME_POINTERS 1
+#else // BUILDFLAG(ENABLE_PROFILING) || !defined(NDEBUG)
+#define HAVE_TRACE_STACK_FRAME_POINTERS 0
+#endif // BUILDFLAG(ENABLE_PROFILING) || !defined(NDEBUG)
-#else // defined(OS_WIN)
+#else // defined(OS_POSIX)
#define HAVE_TRACE_STACK_FRAME_POINTERS 0
-#endif // defined(OS_WIN)
+#endif // defined(OS_POSIX)
namespace base {
namespace debug {
@@ -132,7 +137,6 @@ BASE_EXPORT size_t TraceStackFramePointers(const void** out_trace,
size_t max_depth,
size_t skip_initial);
-#if !defined(OS_WIN)
// Links stack frame |fp| to |parent_fp|, so that during stack unwinding
// TraceStackFramePointers() visits |parent_fp| after visiting |fp|.
// Both frame pointers must come from __builtin_frame_address().
@@ -182,7 +186,6 @@ class BASE_EXPORT ScopedStackFrameLinker {
DISALLOW_COPY_AND_ASSIGN(ScopedStackFrameLinker);
};
-#endif // !defined(OS_WIN)
#endif // HAVE_TRACE_STACK_FRAME_POINTERS

Powered by Google App Engine
This is Rietveld 408576698