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/Debugger.h" |
13 #include "src/inspector/protocol/Forward.h" | 14 #include "src/inspector/protocol/Forward.h" |
14 #include "src/inspector/protocol/Runtime.h" | 15 #include "src/inspector/protocol/Runtime.h" |
15 #include "src/inspector/v8-debugger-script.h" | 16 #include "src/inspector/v8-debugger-script.h" |
16 #include "src/inspector/wasm-translation.h" | 17 #include "src/inspector/wasm-translation.h" |
17 | 18 |
18 #include "include/v8-inspector.h" | 19 #include "include/v8-inspector.h" |
19 | 20 |
20 namespace v8_inspector { | 21 namespace v8_inspector { |
21 | 22 |
22 struct ScriptBreakpoint; | 23 struct ScriptBreakpoint; |
23 class V8DebuggerAgentImpl; | 24 class V8DebuggerAgentImpl; |
24 class V8InspectorImpl; | 25 class V8InspectorImpl; |
25 class V8StackTraceImpl; | 26 class V8StackTraceImpl; |
26 | 27 |
27 using protocol::Response; | 28 using protocol::Response; |
| 29 using ScheduleStepIntoAsyncCallback = |
| 30 protocol::Debugger::Backend::ScheduleStepIntoAsyncCallback; |
28 | 31 |
29 class V8Debugger : public v8::debug::DebugDelegate { | 32 class V8Debugger : public v8::debug::DebugDelegate { |
30 public: | 33 public: |
31 V8Debugger(v8::Isolate*, V8InspectorImpl*); | 34 V8Debugger(v8::Isolate*, V8InspectorImpl*); |
32 ~V8Debugger(); | 35 ~V8Debugger(); |
33 | 36 |
34 bool enabled() const; | 37 bool enabled() const; |
35 | 38 |
36 String16 setBreakpoint(const ScriptBreakpoint&, int* actualLineNumber, | 39 String16 setBreakpoint(const ScriptBreakpoint&, int* actualLineNumber, |
37 int* actualColumnNumber); | 40 int* actualColumnNumber); |
38 void removeBreakpoint(const String16& breakpointId); | 41 void removeBreakpoint(const String16& breakpointId); |
39 void setBreakpointsActivated(bool); | 42 void setBreakpointsActivated(bool); |
40 bool breakpointsActivated() const { return m_breakpointsActivated; } | 43 bool breakpointsActivated() const { return m_breakpointsActivated; } |
41 | 44 |
42 v8::debug::ExceptionBreakState getPauseOnExceptionsState(); | 45 v8::debug::ExceptionBreakState getPauseOnExceptionsState(); |
43 void setPauseOnExceptionsState(v8::debug::ExceptionBreakState); | 46 void setPauseOnExceptionsState(v8::debug::ExceptionBreakState); |
44 bool canBreakProgram(); | 47 bool canBreakProgram(); |
45 void breakProgram(); | 48 void breakProgram(); |
46 void continueProgram(); | 49 void continueProgram(); |
47 | 50 |
48 void setPauseOnNextStatement(bool, int targetContextGroupId); | 51 void setPauseOnNextStatement(bool, int targetContextGroupId); |
49 void stepIntoStatement(int targetContextGroupId); | 52 void stepIntoStatement(int targetContextGroupId); |
50 void stepOverStatement(int targetContextGroupId); | 53 void stepOverStatement(int targetContextGroupId); |
51 void stepOutOfFunction(int targetContextGroupId); | 54 void stepOutOfFunction(int targetContextGroupId); |
| 55 void scheduleStepIntoAsync( |
| 56 std::unique_ptr<ScheduleStepIntoAsyncCallback> callback, |
| 57 int targetContextGroupId); |
52 | 58 |
53 Response setScriptSource( | 59 Response setScriptSource( |
54 const String16& sourceID, v8::Local<v8::String> newSource, bool dryRun, | 60 const String16& sourceID, v8::Local<v8::String> newSource, bool dryRun, |
55 protocol::Maybe<protocol::Runtime::ExceptionDetails>*, | 61 protocol::Maybe<protocol::Runtime::ExceptionDetails>*, |
56 JavaScriptCallFrames* newCallFrames, protocol::Maybe<bool>* stackChanged, | 62 JavaScriptCallFrames* newCallFrames, protocol::Maybe<bool>* stackChanged, |
57 bool* compileError); | 63 bool* compileError); |
58 JavaScriptCallFrames currentCallFrames(int limit = 0); | 64 JavaScriptCallFrames currentCallFrames(int limit = 0); |
59 | 65 |
60 // Each script inherits debug data from v8::Context where it has been | 66 // Each script inherits debug data from v8::Context where it has been |
61 // compiled. | 67 // compiled. |
(...skipping 11 matching lines...) Expand all Loading... |
73 V8StackTraceImpl* currentAsyncCallChain(); | 79 V8StackTraceImpl* currentAsyncCallChain(); |
74 void setAsyncCallStackDepth(V8DebuggerAgentImpl*, int); | 80 void setAsyncCallStackDepth(V8DebuggerAgentImpl*, int); |
75 std::unique_ptr<V8StackTraceImpl> createStackTrace(v8::Local<v8::StackTrace>); | 81 std::unique_ptr<V8StackTraceImpl> createStackTrace(v8::Local<v8::StackTrace>); |
76 std::unique_ptr<V8StackTraceImpl> captureStackTrace(bool fullStack); | 82 std::unique_ptr<V8StackTraceImpl> captureStackTrace(bool fullStack); |
77 | 83 |
78 v8::MaybeLocal<v8::Array> internalProperties(v8::Local<v8::Context>, | 84 v8::MaybeLocal<v8::Array> internalProperties(v8::Local<v8::Context>, |
79 v8::Local<v8::Value>); | 85 v8::Local<v8::Value>); |
80 | 86 |
81 void asyncTaskScheduled(const StringView& taskName, void* task, | 87 void asyncTaskScheduled(const StringView& taskName, void* task, |
82 bool recurring); | 88 bool recurring); |
83 void asyncTaskScheduled(const String16& taskName, void* task, bool recurring); | |
84 void asyncTaskCanceled(void* task); | 89 void asyncTaskCanceled(void* task); |
85 void asyncTaskStarted(void* task); | 90 void asyncTaskStarted(void* task); |
86 void asyncTaskFinished(void* task); | 91 void asyncTaskFinished(void* task); |
87 void allAsyncTasksCanceled(); | 92 void allAsyncTasksCanceled(); |
88 | 93 |
89 void muteScriptParsedEvents(); | 94 void muteScriptParsedEvents(); |
90 void unmuteScriptParsedEvents(); | 95 void unmuteScriptParsedEvents(); |
91 | 96 |
92 V8InspectorImpl* inspector() { return m_inspector; } | 97 V8InspectorImpl* inspector() { return m_inspector; } |
93 | 98 |
(...skipping 25 matching lines...) Expand all Loading... |
119 }; | 124 }; |
120 v8::MaybeLocal<v8::Value> getTargetScopes(v8::Local<v8::Context>, | 125 v8::MaybeLocal<v8::Value> getTargetScopes(v8::Local<v8::Context>, |
121 v8::Local<v8::Value>, | 126 v8::Local<v8::Value>, |
122 ScopeTargetKind); | 127 ScopeTargetKind); |
123 | 128 |
124 v8::MaybeLocal<v8::Value> functionScopes(v8::Local<v8::Context>, | 129 v8::MaybeLocal<v8::Value> functionScopes(v8::Local<v8::Context>, |
125 v8::Local<v8::Function>); | 130 v8::Local<v8::Function>); |
126 v8::MaybeLocal<v8::Value> generatorScopes(v8::Local<v8::Context>, | 131 v8::MaybeLocal<v8::Value> generatorScopes(v8::Local<v8::Context>, |
127 v8::Local<v8::Value>); | 132 v8::Local<v8::Value>); |
128 | 133 |
129 void asyncTaskCreated(void* task, void* parentTask); | 134 void asyncTaskCreatedForStack(void* task, void* parentTask); |
| 135 void asyncTaskScheduledForStack(const String16& taskName, void* task, |
| 136 bool recurring); |
| 137 void asyncTaskCanceledForStack(void* task); |
| 138 void asyncTaskStartedForStack(void* task); |
| 139 void asyncTaskFinishedForStack(void* task); |
| 140 |
130 void registerAsyncTaskIfNeeded(void* task); | 141 void registerAsyncTaskIfNeeded(void* task); |
131 | 142 |
132 // v8::debug::DebugEventListener implementation. | 143 // v8::debug::DebugEventListener implementation. |
133 void PromiseEventOccurred(v8::Local<v8::Context> context, | 144 void PromiseEventOccurred(v8::Local<v8::Context> context, |
134 v8::debug::PromiseDebugActionType type, int id, | 145 v8::debug::PromiseDebugActionType type, int id, |
135 int parentId, bool createdByUser) override; | 146 int parentId, bool createdByUser) override; |
136 void ScriptCompiled(v8::Local<v8::debug::Script> script, | 147 void ScriptCompiled(v8::Local<v8::debug::Script> script, |
137 bool has_compile_error) override; | 148 bool has_compile_error) override; |
138 void BreakProgramRequested(v8::Local<v8::Context> paused_context, | 149 void BreakProgramRequested(v8::Local<v8::Context> paused_context, |
139 v8::Local<v8::Object> exec_state, | 150 v8::Local<v8::Object> exec_state, |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 int m_lastTaskId; | 186 int m_lastTaskId; |
176 protocol::HashSet<void*> m_recurringTasks; | 187 protocol::HashSet<void*> m_recurringTasks; |
177 int m_maxAsyncCallStackDepth; | 188 int m_maxAsyncCallStackDepth; |
178 std::vector<void*> m_currentTasks; | 189 std::vector<void*> m_currentTasks; |
179 std::vector<std::unique_ptr<V8StackTraceImpl>> m_currentStacks; | 190 std::vector<std::unique_ptr<V8StackTraceImpl>> m_currentStacks; |
180 protocol::HashMap<V8DebuggerAgentImpl*, int> m_maxAsyncCallStackDepthMap; | 191 protocol::HashMap<V8DebuggerAgentImpl*, int> m_maxAsyncCallStackDepthMap; |
181 protocol::HashMap<void*, void*> m_parentTask; | 192 protocol::HashMap<void*, void*> m_parentTask; |
182 protocol::HashMap<void*, void*> m_firstNextTask; | 193 protocol::HashMap<void*, void*> m_firstNextTask; |
183 void* m_taskWithScheduledBreak = nullptr; | 194 void* m_taskWithScheduledBreak = nullptr; |
184 | 195 |
| 196 std::unique_ptr<ScheduleStepIntoAsyncCallback> m_stepIntoAsyncCallback; |
| 197 bool m_breakRequested = false; |
| 198 |
185 v8::debug::ExceptionBreakState m_pauseOnExceptionsState; | 199 v8::debug::ExceptionBreakState m_pauseOnExceptionsState; |
186 | 200 |
187 WasmTranslation m_wasmTranslation; | 201 WasmTranslation m_wasmTranslation; |
188 | 202 |
189 DISALLOW_COPY_AND_ASSIGN(V8Debugger); | 203 DISALLOW_COPY_AND_ASSIGN(V8Debugger); |
190 }; | 204 }; |
191 | 205 |
192 } // namespace v8_inspector | 206 } // namespace v8_inspector |
193 | 207 |
194 #endif // V8_INSPECTOR_V8DEBUGGER_H_ | 208 #endif // V8_INSPECTOR_V8DEBUGGER_H_ |
OLD | NEW |