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 <list> | 8 #include <list> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "src/base/macros.h" | 11 #include "src/base/macros.h" |
12 #include "src/debug/debug-interface.h" | 12 #include "src/debug/debug-interface.h" |
13 #include "src/inspector/java-script-call-frame.h" | 13 #include "src/inspector/java-script-call-frame.h" |
14 #include "src/inspector/protocol/Debugger.h" | 14 #include "src/inspector/protocol/Debugger.h" |
15 #include "src/inspector/protocol/Forward.h" | 15 #include "src/inspector/protocol/Forward.h" |
16 #include "src/inspector/protocol/Runtime.h" | 16 #include "src/inspector/protocol/Runtime.h" |
17 #include "src/inspector/v8-debugger-script.h" | 17 #include "src/inspector/v8-debugger-script.h" |
18 #include "src/inspector/wasm-translation.h" | 18 #include "src/inspector/wasm-translation.h" |
19 | 19 |
20 #include "include/v8-inspector.h" | 20 #include "include/v8-inspector.h" |
21 | 21 |
22 namespace v8_inspector { | 22 namespace v8_inspector { |
23 | 23 |
24 class AsyncStackTrace; | 24 class AsyncStackTrace; |
25 struct ScriptBreakpoint; | 25 struct ScriptBreakpoint; |
| 26 class StackFrame; |
26 class V8Debugger; | 27 class V8Debugger; |
27 class V8DebuggerAgentImpl; | 28 class V8DebuggerAgentImpl; |
28 class V8InspectorImpl; | 29 class V8InspectorImpl; |
29 class V8StackTraceImpl; | 30 class V8StackTraceImpl; |
30 | 31 |
31 using protocol::Response; | 32 using protocol::Response; |
32 using ScheduleStepIntoAsyncCallback = | 33 using ScheduleStepIntoAsyncCallback = |
33 protocol::Debugger::Backend::ScheduleStepIntoAsyncCallback; | 34 protocol::Debugger::Backend::ScheduleStepIntoAsyncCallback; |
34 | 35 |
35 class V8Debugger : public v8::debug::DebugDelegate { | 36 class V8Debugger : public v8::debug::DebugDelegate { |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 | 79 |
79 bool isPaused() const { return m_runningNestedMessageLoop; } | 80 bool isPaused() const { return m_runningNestedMessageLoop; } |
80 v8::Local<v8::Context> pausedContext() { return m_pausedContext; } | 81 v8::Local<v8::Context> pausedContext() { return m_pausedContext; } |
81 | 82 |
82 int maxAsyncCallChainDepth() { return m_maxAsyncCallStackDepth; } | 83 int maxAsyncCallChainDepth() { return m_maxAsyncCallStackDepth; } |
83 void setAsyncCallStackDepth(V8DebuggerAgentImpl*, int); | 84 void setAsyncCallStackDepth(V8DebuggerAgentImpl*, int); |
84 | 85 |
85 std::shared_ptr<AsyncStackTrace> currentAsyncParent(); | 86 std::shared_ptr<AsyncStackTrace> currentAsyncParent(); |
86 std::shared_ptr<AsyncStackTrace> currentAsyncCreation(); | 87 std::shared_ptr<AsyncStackTrace> currentAsyncCreation(); |
87 | 88 |
| 89 std::shared_ptr<StackFrame> symbolize(v8::Local<v8::StackFrame> v8Frame); |
| 90 |
88 std::unique_ptr<V8StackTraceImpl> createStackTrace(v8::Local<v8::StackTrace>); | 91 std::unique_ptr<V8StackTraceImpl> createStackTrace(v8::Local<v8::StackTrace>); |
89 std::unique_ptr<V8StackTraceImpl> captureStackTrace(bool fullStack); | 92 std::unique_ptr<V8StackTraceImpl> captureStackTrace(bool fullStack); |
90 | 93 |
91 v8::MaybeLocal<v8::Array> internalProperties(v8::Local<v8::Context>, | 94 v8::MaybeLocal<v8::Array> internalProperties(v8::Local<v8::Context>, |
92 v8::Local<v8::Value>); | 95 v8::Local<v8::Value>); |
93 | 96 |
94 void asyncTaskScheduled(const StringView& taskName, void* task, | 97 void asyncTaskScheduled(const StringView& taskName, void* task, |
95 bool recurring); | 98 bool recurring); |
96 void asyncTaskCanceled(void* task); | 99 void asyncTaskCanceled(void* task); |
97 void asyncTaskStarted(void* task); | 100 void asyncTaskStarted(void* task); |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 std::vector<void*> m_currentTasks; | 198 std::vector<void*> m_currentTasks; |
196 std::vector<std::shared_ptr<AsyncStackTrace>> m_currentAsyncParent; | 199 std::vector<std::shared_ptr<AsyncStackTrace>> m_currentAsyncParent; |
197 std::vector<std::shared_ptr<AsyncStackTrace>> m_currentAsyncCreation; | 200 std::vector<std::shared_ptr<AsyncStackTrace>> m_currentAsyncCreation; |
198 | 201 |
199 void collectOldAsyncStacksIfNeeded(); | 202 void collectOldAsyncStacksIfNeeded(); |
200 void removeOldAsyncTasks(AsyncTaskToStackTrace& map); | 203 void removeOldAsyncTasks(AsyncTaskToStackTrace& map); |
201 int m_asyncStacksCount = 0; | 204 int m_asyncStacksCount = 0; |
202 // V8Debugger owns all the async stacks, while most of the other references | 205 // V8Debugger owns all the async stacks, while most of the other references |
203 // are weak, which allows to collect some stacks when there are too many. | 206 // are weak, which allows to collect some stacks when there are too many. |
204 std::list<std::shared_ptr<AsyncStackTrace>> m_allAsyncStacks; | 207 std::list<std::shared_ptr<AsyncStackTrace>> m_allAsyncStacks; |
| 208 std::map<int, std::weak_ptr<StackFrame>> m_framesCache; |
205 | 209 |
206 protocol::HashMap<V8DebuggerAgentImpl*, int> m_maxAsyncCallStackDepthMap; | 210 protocol::HashMap<V8DebuggerAgentImpl*, int> m_maxAsyncCallStackDepthMap; |
207 void* m_taskWithScheduledBreak = nullptr; | 211 void* m_taskWithScheduledBreak = nullptr; |
208 | 212 |
209 std::unique_ptr<ScheduleStepIntoAsyncCallback> m_stepIntoAsyncCallback; | 213 std::unique_ptr<ScheduleStepIntoAsyncCallback> m_stepIntoAsyncCallback; |
210 bool m_breakRequested = false; | 214 bool m_breakRequested = false; |
211 | 215 |
212 v8::debug::ExceptionBreakState m_pauseOnExceptionsState; | 216 v8::debug::ExceptionBreakState m_pauseOnExceptionsState; |
213 | 217 |
214 WasmTranslation m_wasmTranslation; | 218 WasmTranslation m_wasmTranslation; |
215 | 219 |
216 DISALLOW_COPY_AND_ASSIGN(V8Debugger); | 220 DISALLOW_COPY_AND_ASSIGN(V8Debugger); |
217 }; | 221 }; |
218 | 222 |
219 } // namespace v8_inspector | 223 } // namespace v8_inspector |
220 | 224 |
221 #endif // V8_INSPECTOR_V8DEBUGGER_H_ | 225 #endif // V8_INSPECTOR_V8DEBUGGER_H_ |
OLD | NEW |