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