| 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 #ifndef V8_BASE_DEBUG_STACK_TRACE_H_ | 8 #ifndef V8_BASE_DEBUG_STACK_TRACE_H_ |
| 9 #define V8_BASE_DEBUG_STACK_TRACE_H_ | 9 #define V8_BASE_DEBUG_STACK_TRACE_H_ |
| 10 | 10 |
| 11 #include <stddef.h> | 11 #include <stddef.h> |
| 12 | 12 |
| 13 #include <iosfwd> | 13 #include <iosfwd> |
| 14 #include <string> | 14 #include <string> |
| 15 | 15 |
| 16 #include "src/base/base-export.h" | |
| 17 #include "src/base/build_config.h" | 16 #include "src/base/build_config.h" |
| 18 | 17 |
| 19 #if V8_OS_POSIX | 18 #if V8_OS_POSIX |
| 20 #include <unistd.h> | 19 #include <unistd.h> |
| 21 #endif | 20 #endif |
| 22 | 21 |
| 23 #if V8_OS_WIN | 22 #if V8_OS_WIN |
| 24 struct _EXCEPTION_POINTERS; | 23 struct _EXCEPTION_POINTERS; |
| 25 struct _CONTEXT; | 24 struct _CONTEXT; |
| 26 #endif | 25 #endif |
| 27 | 26 |
| 28 namespace v8 { | 27 namespace v8 { |
| 29 namespace base { | 28 namespace base { |
| 30 namespace debug { | 29 namespace debug { |
| 31 | 30 |
| 32 // Enables stack dump to console output on exception and signals. | 31 // Enables stack dump to console output on exception and signals. |
| 33 // When enabled, the process will quit immediately. This is meant to be used in | 32 // When enabled, the process will quit immediately. This is meant to be used in |
| 34 // tests only! | 33 // tests only! |
| 35 V8_BASE_EXPORT bool EnableInProcessStackDumping(); | 34 bool EnableInProcessStackDumping(); |
| 36 V8_BASE_EXPORT void DisableSignalStackDump(); | 35 void DisableSignalStackDump(); |
| 37 | 36 |
| 38 // A stacktrace can be helpful in debugging. For example, you can include a | 37 // A stacktrace can be helpful in debugging. For example, you can include a |
| 39 // stacktrace member in a object (probably around #ifndef NDEBUG) so that you | 38 // stacktrace member in a object (probably around #ifndef NDEBUG) so that you |
| 40 // can later see where the given object was created from. | 39 // can later see where the given object was created from. |
| 41 class StackTrace { | 40 class StackTrace { |
| 42 public: | 41 public: |
| 43 // Creates a stacktrace from the current location. | 42 // Creates a stacktrace from the current location. |
| 44 StackTrace(); | 43 StackTrace(); |
| 45 | 44 |
| 46 // Creates a stacktrace from an existing array of instruction | 45 // Creates a stacktrace from an existing array of instruction |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 | 87 |
| 89 // The number of valid frames in |trace_|. | 88 // The number of valid frames in |trace_|. |
| 90 size_t count_; | 89 size_t count_; |
| 91 }; | 90 }; |
| 92 | 91 |
| 93 } // namespace debug | 92 } // namespace debug |
| 94 } // namespace base | 93 } // namespace base |
| 95 } // namespace v8 | 94 } // namespace v8 |
| 96 | 95 |
| 97 #endif // V8_BASE_DEBUG_STACK_TRACE_H_ | 96 #endif // V8_BASE_DEBUG_STACK_TRACE_H_ |
| OLD | NEW |