| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // Slightly adapted for inclusion in V8. | 5 // Slightly adapted for inclusion in V8. |
| 6 // Copyright 2016 the V8 project authors. All rights reserved. | 6 // Copyright 2016 the V8 project authors. All rights reserved. |
| 7 | 7 |
| 8 #include "src/base/debug/stack_trace.h" | 8 #include "src/base/debug/stack_trace.h" |
| 9 | 9 |
| 10 #include <windows.h> | 10 #include <windows.h> |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 | 161 |
| 162 void DisableSignalStackDump() { | 162 void DisableSignalStackDump() { |
| 163 g_dump_stack_in_signal_handler = false; | 163 g_dump_stack_in_signal_handler = false; |
| 164 } | 164 } |
| 165 | 165 |
| 166 // Disable optimizations for the StackTrace::StackTrace function. It is | 166 // Disable optimizations for the StackTrace::StackTrace function. It is |
| 167 // important to disable at least frame pointer optimization ("y"), since | 167 // important to disable at least frame pointer optimization ("y"), since |
| 168 // that breaks CaptureStackBackTrace() and prevents StackTrace from working | 168 // that breaks CaptureStackBackTrace() and prevents StackTrace from working |
| 169 // in Release builds (it may still be janky if other frames are using FPO, | 169 // in Release builds (it may still be janky if other frames are using FPO, |
| 170 // but at least it will make it further). | 170 // but at least it will make it further). |
| 171 #if defined(COMPILER_MSVC) | 171 #if defined(V8_CC_MSVC) |
| 172 #pragma optimize("", off) | 172 #pragma optimize("", off) |
| 173 #endif | 173 #endif |
| 174 | 174 |
| 175 StackTrace::StackTrace() { | 175 StackTrace::StackTrace() { |
| 176 // When walking our own stack, use CaptureStackBackTrace(). | 176 // When walking our own stack, use CaptureStackBackTrace(). |
| 177 count_ = CaptureStackBackTrace(0, arraysize(trace_), trace_, NULL); | 177 count_ = CaptureStackBackTrace(0, arraysize(trace_), trace_, NULL); |
| 178 } | 178 } |
| 179 | 179 |
| 180 #if defined(COMPILER_MSVC) | 180 #if defined(V8_CC_MSVC) |
| 181 #pragma optimize("", on) | 181 #pragma optimize("", on) |
| 182 #endif | 182 #endif |
| 183 | 183 |
| 184 StackTrace::StackTrace(EXCEPTION_POINTERS* exception_pointers) { | 184 StackTrace::StackTrace(EXCEPTION_POINTERS* exception_pointers) { |
| 185 InitTrace(exception_pointers->ContextRecord); | 185 InitTrace(exception_pointers->ContextRecord); |
| 186 } | 186 } |
| 187 | 187 |
| 188 StackTrace::StackTrace(const CONTEXT* context) { InitTrace(context); } | 188 StackTrace::StackTrace(const CONTEXT* context) { InitTrace(context); } |
| 189 | 189 |
| 190 void StackTrace::InitTrace(const CONTEXT* context_record) { | 190 void StackTrace::InitTrace(const CONTEXT* context_record) { |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 (*os) << "\n"; | 239 (*os) << "\n"; |
| 240 (*os) << "==== C stack trace ===============================\n"; | 240 (*os) << "==== C stack trace ===============================\n"; |
| 241 (*os) << "\n"; | 241 (*os) << "\n"; |
| 242 OutputTraceToStream(trace_, count_, os); | 242 OutputTraceToStream(trace_, count_, os); |
| 243 } | 243 } |
| 244 } | 244 } |
| 245 | 245 |
| 246 } // namespace debug | 246 } // namespace debug |
| 247 } // namespace base | 247 } // namespace base |
| 248 } // namespace v8 | 248 } // namespace v8 |
| OLD | NEW |