Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(519)

Side by Side Diff: src/inspector/v8-debugger-agent-impl.h

Issue 2633803002: [inspector] implemented blackboxing inside v8 (Closed)
Patch Set: addressed comments Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/inspector/v8-debugger.cc ('k') | src/inspector/v8-debugger-agent-impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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_V8DEBUGGERAGENTIMPL_H_ 5 #ifndef V8_INSPECTOR_V8DEBUGGERAGENTIMPL_H_
6 #define V8_INSPECTOR_V8DEBUGGERAGENTIMPL_H_ 6 #define V8_INSPECTOR_V8DEBUGGERAGENTIMPL_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/interface-types.h"
11 #include "src/inspector/java-script-call-frame.h" 12 #include "src/inspector/java-script-call-frame.h"
12 #include "src/inspector/protocol/Debugger.h" 13 #include "src/inspector/protocol/Debugger.h"
13 #include "src/inspector/protocol/Forward.h" 14 #include "src/inspector/protocol/Forward.h"
14 15
15 namespace v8_inspector { 16 namespace v8_inspector {
16 17
17 struct ScriptBreakpoint; 18 struct ScriptBreakpoint;
18 class JavaScriptCallFrame; 19 class JavaScriptCallFrame;
19 class PromiseTracker; 20 class PromiseTracker;
20 class V8Debugger; 21 class V8Debugger;
21 class V8DebuggerScript; 22 class V8DebuggerScript;
22 class V8InspectorImpl; 23 class V8InspectorImpl;
23 class V8InspectorSessionImpl; 24 class V8InspectorSessionImpl;
24 class V8Regex; 25 class V8Regex;
25 class V8StackTraceImpl; 26 class V8StackTraceImpl;
26 27
27 using protocol::Maybe; 28 using protocol::Maybe;
28 using protocol::Response; 29 using protocol::Response;
29 30
30 class V8DebuggerAgentImpl : public protocol::Debugger::Backend { 31 class V8DebuggerAgentImpl : public protocol::Debugger::Backend {
31 public: 32 public:
32 enum SkipPauseRequest {
33 RequestNoSkip,
34 RequestContinue,
35 RequestStepInto,
36 RequestStepOut,
37 RequestStepFrame
38 };
39
40 enum BreakpointSource { 33 enum BreakpointSource {
41 UserBreakpointSource, 34 UserBreakpointSource,
42 DebugCommandBreakpointSource, 35 DebugCommandBreakpointSource,
43 MonitorCommandBreakpointSource 36 MonitorCommandBreakpointSource
44 }; 37 };
45 38
46 V8DebuggerAgentImpl(V8InspectorSessionImpl*, protocol::FrontendChannel*, 39 V8DebuggerAgentImpl(V8InspectorSessionImpl*, protocol::FrontendChannel*,
47 protocol::DictionaryValue* state); 40 protocol::DictionaryValue* state);
48 ~V8DebuggerAgentImpl() override; 41 ~V8DebuggerAgentImpl() override;
49 void restore(); 42 void restore();
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 std::unique_ptr<protocol::DictionaryValue> data); 120 std::unique_ptr<protocol::DictionaryValue> data);
128 void cancelPauseOnNextStatement(); 121 void cancelPauseOnNextStatement();
129 void breakProgram(const String16& breakReason, 122 void breakProgram(const String16& breakReason,
130 std::unique_ptr<protocol::DictionaryValue> data); 123 std::unique_ptr<protocol::DictionaryValue> data);
131 void breakProgramOnException(const String16& breakReason, 124 void breakProgramOnException(const String16& breakReason,
132 std::unique_ptr<protocol::DictionaryValue> data); 125 std::unique_ptr<protocol::DictionaryValue> data);
133 126
134 void reset(); 127 void reset();
135 128
136 // Interface for V8InspectorImpl 129 // Interface for V8InspectorImpl
137 SkipPauseRequest didPause(v8::Local<v8::Context>, 130 bool didPause(v8::Local<v8::Context>, v8::Local<v8::Value> exception,
138 v8::Local<v8::Value> exception, 131 const std::vector<String16>& hitBreakpoints,
139 const std::vector<String16>& hitBreakpoints, 132 bool isPromiseRejection, bool isUncaught, bool isOOMBreak);
140 bool isPromiseRejection, bool isUncaught,
141 bool isOOMBreak);
142 void didContinue(); 133 void didContinue();
143 void didParseSource(std::unique_ptr<V8DebuggerScript>, bool success); 134 void didParseSource(std::unique_ptr<V8DebuggerScript>, bool success);
144 void willExecuteScript(int scriptId); 135 void willExecuteScript(int scriptId);
145 void didExecuteScript(); 136 void didExecuteScript();
146 137
138 bool isFunctionBlackboxed(const String16& scriptId,
139 const v8::debug::Location& start,
140 const v8::debug::Location& end);
141
147 v8::Isolate* isolate() { return m_isolate; } 142 v8::Isolate* isolate() { return m_isolate; }
148 143
149 private: 144 private:
150 void enableImpl(); 145 void enableImpl();
151 146
152 SkipPauseRequest shouldSkipExceptionPause(JavaScriptCallFrame* topCallFrame);
153 SkipPauseRequest shouldSkipStepPause(JavaScriptCallFrame* topCallFrame);
154
155 void schedulePauseOnNextStatementIfSteppingInto(); 147 void schedulePauseOnNextStatementIfSteppingInto();
156 148
157 Response currentCallFrames( 149 Response currentCallFrames(
158 std::unique_ptr<protocol::Array<protocol::Debugger::CallFrame>>*); 150 std::unique_ptr<protocol::Array<protocol::Debugger::CallFrame>>*);
159 std::unique_ptr<protocol::Runtime::StackTrace> currentAsyncStackTrace(); 151 std::unique_ptr<protocol::Runtime::StackTrace> currentAsyncStackTrace();
160 152
161 void changeJavaScriptRecursionLevel(int step); 153 void changeJavaScriptRecursionLevel(int step);
162 154
163 void setPauseOnExceptionsImpl(int); 155 void setPauseOnExceptionsImpl(int);
164 156
165 std::unique_ptr<protocol::Debugger::Location> resolveBreakpoint( 157 std::unique_ptr<protocol::Debugger::Location> resolveBreakpoint(
166 const String16& breakpointId, const ScriptBreakpoint&, BreakpointSource); 158 const String16& breakpointId, const ScriptBreakpoint&, BreakpointSource);
167 void removeBreakpointImpl(const String16& breakpointId); 159 void removeBreakpointImpl(const String16& breakpointId);
168 void clearBreakDetails(); 160 void clearBreakDetails();
169 161
170 bool isCurrentCallStackEmptyOrBlackboxed();
171 bool isTopPausedCallFrameBlackboxed();
172 bool isCallFrameWithUnknownScriptOrBlackboxed(JavaScriptCallFrame*);
173
174 void internalSetAsyncCallStackDepth(int); 162 void internalSetAsyncCallStackDepth(int);
175 void increaseCachedSkipStackGeneration(); 163 void increaseCachedSkipStackGeneration();
176 164
177 Response setBlackboxPattern(const String16& pattern); 165 Response setBlackboxPattern(const String16& pattern);
166 void resetBlackboxedStateCache();
178 167
179 using ScriptsMap = 168 using ScriptsMap =
180 protocol::HashMap<String16, std::unique_ptr<V8DebuggerScript>>; 169 protocol::HashMap<String16, std::unique_ptr<V8DebuggerScript>>;
181 using BreakpointIdToDebuggerBreakpointIdsMap = 170 using BreakpointIdToDebuggerBreakpointIdsMap =
182 protocol::HashMap<String16, std::vector<String16>>; 171 protocol::HashMap<String16, std::vector<String16>>;
183 using DebugServerBreakpointToBreakpointIdAndSourceMap = 172 using DebugServerBreakpointToBreakpointIdAndSourceMap =
184 protocol::HashMap<String16, std::pair<String16, BreakpointSource>>; 173 protocol::HashMap<String16, std::pair<String16, BreakpointSource>>;
185 using MuteBreakpoins = protocol::HashMap<String16, std::pair<String16, int>>; 174 using MuteBreakpoins = protocol::HashMap<String16, std::pair<String16, int>>;
186 175
187 enum DebuggerStep { NoStep = 0, StepInto, StepOver, StepOut }; 176 enum DebuggerStep { NoStep = 0, StepInto, StepOver, StepOut };
188 177
189 V8InspectorImpl* m_inspector; 178 V8InspectorImpl* m_inspector;
190 V8Debugger* m_debugger; 179 V8Debugger* m_debugger;
191 V8InspectorSessionImpl* m_session; 180 V8InspectorSessionImpl* m_session;
192 bool m_enabled; 181 bool m_enabled;
193 protocol::DictionaryValue* m_state; 182 protocol::DictionaryValue* m_state;
194 protocol::Debugger::Frontend m_frontend; 183 protocol::Debugger::Frontend m_frontend;
195 v8::Isolate* m_isolate; 184 v8::Isolate* m_isolate;
196 v8::Global<v8::Context> m_pausedContext; 185 v8::Global<v8::Context> m_pausedContext;
197 JavaScriptCallFrames m_pausedCallFrames; 186 JavaScriptCallFrames m_pausedCallFrames;
198 ScriptsMap m_scripts; 187 ScriptsMap m_scripts;
199 BreakpointIdToDebuggerBreakpointIdsMap m_breakpointIdToDebuggerBreakpointIds; 188 BreakpointIdToDebuggerBreakpointIdsMap m_breakpointIdToDebuggerBreakpointIds;
200 DebugServerBreakpointToBreakpointIdAndSourceMap m_serverBreakpoints; 189 DebugServerBreakpointToBreakpointIdAndSourceMap m_serverBreakpoints;
201 String16 m_continueToLocationBreakpointId; 190 String16 m_continueToLocationBreakpointId;
202 String16 m_breakReason; 191 String16 m_breakReason;
203 std::unique_ptr<protocol::DictionaryValue> m_breakAuxData; 192 std::unique_ptr<protocol::DictionaryValue> m_breakAuxData;
204 DebuggerStep m_scheduledDebuggerStep; 193 DebuggerStep m_scheduledDebuggerStep;
205 bool m_skipNextDebuggerStepOut;
206 bool m_javaScriptPauseScheduled; 194 bool m_javaScriptPauseScheduled;
207 bool m_steppingFromFramework;
208 bool m_pausingOnNativeEvent;
209 195
210 int m_skippedStepFrameCount;
211 int m_recursionLevelForStepOut; 196 int m_recursionLevelForStepOut;
212 int m_recursionLevelForStepFrame;
213 bool m_skipAllPauses; 197 bool m_skipAllPauses;
214 198
215 std::unique_ptr<V8Regex> m_blackboxPattern; 199 std::unique_ptr<V8Regex> m_blackboxPattern;
216 protocol::HashMap<String16, std::vector<std::pair<int, int>>> 200 protocol::HashMap<String16, std::vector<std::pair<int, int>>>
217 m_blackboxedPositions; 201 m_blackboxedPositions;
218 202
219 DISALLOW_COPY_AND_ASSIGN(V8DebuggerAgentImpl); 203 DISALLOW_COPY_AND_ASSIGN(V8DebuggerAgentImpl);
220 }; 204 };
221 205
222 } // namespace v8_inspector 206 } // namespace v8_inspector
223 207
224 #endif // V8_INSPECTOR_V8DEBUGGERAGENTIMPL_H_ 208 #endif // V8_INSPECTOR_V8DEBUGGERAGENTIMPL_H_
OLDNEW
« no previous file with comments | « src/inspector/v8-debugger.cc ('k') | src/inspector/v8-debugger-agent-impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698