5 #ifndef V8_INSPECTOR_V8_STACK_TRACE_IMPL_H_ 6 #define V8_INSPECTOR_V8_STACK_TRACE_IMPL_H_ 11 #include "include/v8-inspector.h" 12 #include "include/v8.h" 13 #include "src/base/macros.h" 14 #include "src/inspector/protocol/Runtime.h" 15 #include "src/inspector/string-16.h" 19 class AsyncStackTrace;
21 class WasmTranslation;
22 struct V8StackTraceId;
31 const String16& functionName()
const;
34 int lineNumber()
const;
35 int columnNumber()
const;
36 std::unique_ptr<protocol::Runtime::CallFrame> buildInspectorObject(
46 bool m_hasSourceURLComment;
51 static void setCaptureStackTraceForUncaughtExceptions(v8::Isolate*,
53 static int maxCallStackSizeToCapture;
54 static std::unique_ptr<V8StackTraceImpl> create(
V8Debugger*,
58 static std::unique_ptr<V8StackTraceImpl> capture(
V8Debugger*,
63 std::unique_ptr<protocol::Runtime::StackTrace> buildInspectorObjectImpl(
66 std::unique_ptr<protocol::Runtime::StackTrace> buildInspectorObjectImpl(
67 V8Debugger* debugger,
int maxAsyncDepth)
const;
71 std::unique_ptr<V8StackTrace> clone()
override;
72 StringView firstNonEmptySourceURL()
const override;
73 bool isEmpty()
const override;
75 int topLineNumber()
const override;
76 int topColumnNumber()
const override;
79 std::unique_ptr<protocol::Runtime::API::StackTrace> buildInspectorObject()
81 std::unique_ptr<StringBuffer> toString()
const override;
88 std::shared_ptr<AsyncStackTrace> asyncParent,
91 class StackFrameIterator {
100 std::vector<std::shared_ptr<StackFrame>>::const_iterator m_currentIt;
101 std::vector<std::shared_ptr<StackFrame>>::const_iterator m_currentEnd;
105 std::vector<std::shared_ptr<StackFrame>> m_frames;
107 std::weak_ptr<AsyncStackTrace> m_asyncParent;
115 static std::shared_ptr<AsyncStackTrace> capture(
V8Debugger*,
120 std::shared_ptr<AsyncStackTrace> stack);
122 std::unique_ptr<protocol::Runtime::StackTrace> buildInspectorObject(
123 V8Debugger* debugger,
int maxAsyncDepth)
const;
132 void setSuspendedTaskId(
void* task);
133 void* suspendedTaskId()
const;
135 int contextGroupId()
const;
136 const String16& description()
const;
137 std::weak_ptr<AsyncStackTrace> parent()
const;
138 bool isEmpty()
const;
139 const V8StackTraceId& externalParent()
const {
return m_externalParent; }
141 const std::vector<std::shared_ptr<StackFrame>>& frames()
const {
147 std::vector<std::shared_ptr<StackFrame>> frames,
148 std::shared_ptr<AsyncStackTrace> asyncParent,
151 int m_contextGroupId;
153 void* m_suspendedTaskId;
156 std::vector<std::shared_ptr<StackFrame>> m_frames;
157 std::weak_ptr<AsyncStackTrace> m_asyncParent;
165 #endif // V8_INSPECTOR_V8_STACK_TRACE_IMPL_H_