Index: base/debug/stack_trace_win.cc |
=================================================================== |
--- base/debug/stack_trace_win.cc (revision 98490) |
+++ base/debug/stack_trace_win.cc (working copy) |
@@ -135,11 +135,24 @@ |
} // namespace |
+// Disable optimizations for the StackTrace::StackTrace function. It is |
+// important to disable at least frame pointer optimization ("y"), since |
+// that breaks CaptureStackBackTrace() and prevents StackTrace from working |
+// in Release builds (it may still be janky if other frames are using FPO, |
+// but at least it will make it further). |
+#if defined(COMPILER_MSVC) |
+#pragma optimize("", off) |
+#endif |
+ |
StackTrace::StackTrace() { |
// When walking our own stack, use CaptureStackBackTrace(). |
count_ = CaptureStackBackTrace(0, arraysize(trace_), trace_, NULL); |
} |
+#if defined(COMPILER_MSVC) |
+#pragma optimize("", on) |
+#endif |
+ |
StackTrace::StackTrace(EXCEPTION_POINTERS* exception_pointers) { |
// When walking an exception stack, we need to use StackWalk64(). |
count_ = 0; |