OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 the V8 project 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 #ifndef V8_INSPECTOR_V8DEBUGGER_H_ | 5 #ifndef V8_INSPECTOR_V8DEBUGGER_H_ |
6 #define V8_INSPECTOR_V8DEBUGGER_H_ | 6 #define V8_INSPECTOR_V8DEBUGGER_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "src/base/macros.h" | 10 #include "src/base/macros.h" |
11 #include "src/debug/debug-interface.h" | 11 #include "src/debug/debug-interface.h" |
12 #include "src/inspector/java-script-call-frame.h" | 12 #include "src/inspector/java-script-call-frame.h" |
13 #include "src/inspector/protocol/Forward.h" | 13 #include "src/inspector/protocol/Forward.h" |
14 #include "src/inspector/protocol/Runtime.h" | 14 #include "src/inspector/protocol/Runtime.h" |
15 #include "src/inspector/v8-debugger-script.h" | 15 #include "src/inspector/v8-debugger-script.h" |
16 #include "src/inspector/wasm-translation.h" | 16 #include "src/inspector/wasm-translation.h" |
17 | 17 |
18 #include "include/v8-inspector.h" | 18 #include "include/v8-inspector.h" |
19 | 19 |
20 namespace v8_inspector { | 20 namespace v8_inspector { |
21 | 21 |
22 struct ScriptBreakpoint; | 22 struct ScriptBreakpoint; |
23 class V8DebuggerAgentImpl; | 23 class V8DebuggerAgentImpl; |
24 class V8InspectorImpl; | 24 class V8InspectorImpl; |
25 class V8StackTraceImpl; | 25 class V8StackTraceImpl; |
26 | 26 |
27 using protocol::Response; | 27 using protocol::Response; |
28 | 28 |
29 class V8Debugger { | 29 class V8Debugger : public v8::debug::DebugEventListener { |
30 public: | 30 public: |
31 V8Debugger(v8::Isolate*, V8InspectorImpl*); | 31 V8Debugger(v8::Isolate*, V8InspectorImpl*); |
32 ~V8Debugger(); | 32 ~V8Debugger(); |
33 | 33 |
34 bool enabled() const; | 34 bool enabled() const; |
35 | 35 |
36 String16 setBreakpoint(const ScriptBreakpoint&, int* actualLineNumber, | 36 String16 setBreakpoint(const ScriptBreakpoint&, int* actualLineNumber, |
37 int* actualColumnNumber); | 37 int* actualColumnNumber); |
38 void removeBreakpoint(const String16& breakpointId); | 38 void removeBreakpoint(const String16& breakpointId); |
39 void setBreakpointsActivated(bool); | 39 void setBreakpointsActivated(bool); |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 | 105 |
106 static void v8OOMCallback(void* data); | 106 static void v8OOMCallback(void* data); |
107 | 107 |
108 static void breakProgramCallback(const v8::FunctionCallbackInfo<v8::Value>&); | 108 static void breakProgramCallback(const v8::FunctionCallbackInfo<v8::Value>&); |
109 void handleProgramBreak(v8::Local<v8::Context> pausedContext, | 109 void handleProgramBreak(v8::Local<v8::Context> pausedContext, |
110 v8::Local<v8::Object> executionState, | 110 v8::Local<v8::Object> executionState, |
111 v8::Local<v8::Value> exception, | 111 v8::Local<v8::Value> exception, |
112 v8::Local<v8::Array> hitBreakpoints, | 112 v8::Local<v8::Array> hitBreakpoints, |
113 bool isPromiseRejection = false, | 113 bool isPromiseRejection = false, |
114 bool isUncaught = false); | 114 bool isUncaught = false); |
115 static void v8DebugEventCallback(const v8::debug::EventDetails&); | |
116 v8::Local<v8::Value> callInternalGetterFunction(v8::Local<v8::Object>, | |
117 const char* functionName); | |
118 void handleV8DebugEvent(const v8::debug::EventDetails&); | |
119 static void v8AsyncTaskListener(v8::debug::PromiseDebugActionType type, | |
120 int id, void* data); | |
121 static void v8CompileEventListener(v8::Local<v8::debug::Script> script, | |
122 bool has_compile_error, void* data); | |
123 | 115 |
124 v8::Local<v8::Value> collectionEntries(v8::Local<v8::Context>, | 116 v8::Local<v8::Value> collectionEntries(v8::Local<v8::Context>, |
125 v8::Local<v8::Object>); | 117 v8::Local<v8::Object>); |
126 v8::Local<v8::Value> generatorObjectLocation(v8::Local<v8::Context>, | 118 v8::Local<v8::Value> generatorObjectLocation(v8::Local<v8::Context>, |
127 v8::Local<v8::Object>); | 119 v8::Local<v8::Object>); |
128 v8::Local<v8::Value> functionLocation(v8::Local<v8::Context>, | 120 v8::Local<v8::Value> functionLocation(v8::Local<v8::Context>, |
129 v8::Local<v8::Function>); | 121 v8::Local<v8::Function>); |
130 | 122 |
131 enum ScopeTargetKind { | 123 enum ScopeTargetKind { |
132 FUNCTION, | 124 FUNCTION, |
133 GENERATOR, | 125 GENERATOR, |
134 }; | 126 }; |
135 v8::MaybeLocal<v8::Value> getTargetScopes(v8::Local<v8::Context>, | 127 v8::MaybeLocal<v8::Value> getTargetScopes(v8::Local<v8::Context>, |
136 v8::Local<v8::Value>, | 128 v8::Local<v8::Value>, |
137 ScopeTargetKind); | 129 ScopeTargetKind); |
138 | 130 |
139 v8::MaybeLocal<v8::Value> functionScopes(v8::Local<v8::Context>, | 131 v8::MaybeLocal<v8::Value> functionScopes(v8::Local<v8::Context>, |
140 v8::Local<v8::Function>); | 132 v8::Local<v8::Function>); |
141 v8::MaybeLocal<v8::Value> generatorScopes(v8::Local<v8::Context>, | 133 v8::MaybeLocal<v8::Value> generatorScopes(v8::Local<v8::Context>, |
142 v8::Local<v8::Value>); | 134 v8::Local<v8::Value>); |
143 | 135 |
| 136 // v8::debug::DebugEventListener implementation. |
| 137 void PromiseEventOccurred(v8::debug::PromiseDebugActionType type, |
| 138 int id) override; |
| 139 void ScriptCompiled(v8::Local<v8::debug::Script> script, |
| 140 bool has_compile_error) override; |
| 141 void BreakProgramRequested(v8::Local<v8::Context> paused_context, |
| 142 v8::Local<v8::Object> exec_state, |
| 143 v8::Local<v8::Value> break_points_hit) override; |
| 144 void ExceptionThrown(v8::Local<v8::Context> paused_context, |
| 145 v8::Local<v8::Object> exec_state, |
| 146 v8::Local<v8::Value> exception, |
| 147 bool is_promise_rejection, bool is_uncaught) override; |
| 148 |
144 v8::Isolate* m_isolate; | 149 v8::Isolate* m_isolate; |
145 V8InspectorImpl* m_inspector; | 150 V8InspectorImpl* m_inspector; |
146 int m_enableCount; | 151 int m_enableCount; |
147 bool m_breakpointsActivated; | 152 bool m_breakpointsActivated; |
148 v8::Global<v8::Object> m_debuggerScript; | 153 v8::Global<v8::Object> m_debuggerScript; |
149 v8::Global<v8::Context> m_debuggerContext; | 154 v8::Global<v8::Context> m_debuggerContext; |
150 v8::Local<v8::Object> m_executionState; | 155 v8::Local<v8::Object> m_executionState; |
151 v8::Local<v8::Context> m_pausedContext; | 156 v8::Local<v8::Context> m_pausedContext; |
152 bool m_runningNestedMessageLoop; | 157 bool m_runningNestedMessageLoop; |
153 int m_ignoreScriptParsedEventsCounter; | 158 int m_ignoreScriptParsedEventsCounter; |
(...skipping 15 matching lines...) Expand all Loading... |
169 v8::debug::ExceptionBreakState m_pauseOnExceptionsState; | 174 v8::debug::ExceptionBreakState m_pauseOnExceptionsState; |
170 | 175 |
171 WasmTranslation m_wasmTranslation; | 176 WasmTranslation m_wasmTranslation; |
172 | 177 |
173 DISALLOW_COPY_AND_ASSIGN(V8Debugger); | 178 DISALLOW_COPY_AND_ASSIGN(V8Debugger); |
174 }; | 179 }; |
175 | 180 |
176 } // namespace v8_inspector | 181 } // namespace v8_inspector |
177 | 182 |
178 #endif // V8_INSPECTOR_V8DEBUGGER_H_ | 183 #endif // V8_INSPECTOR_V8DEBUGGER_H_ |
OLD | NEW |