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

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

Issue 2633803002: [inspector] implemented blackboxing inside v8 (Closed)
Patch Set: one more test 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
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 enum SkipPauseRequest { RequestNoSkip, RequestContinue };
33 RequestNoSkip,
34 RequestContinue,
35 RequestStepInto,
36 RequestStepOut,
37 RequestStepFrame
38 };
39 34
40 enum BreakpointSource { 35 enum BreakpointSource {
41 UserBreakpointSource, 36 UserBreakpointSource,
42 DebugCommandBreakpointSource, 37 DebugCommandBreakpointSource,
43 MonitorCommandBreakpointSource 38 MonitorCommandBreakpointSource
44 }; 39 };
45 40
46 V8DebuggerAgentImpl(V8InspectorSessionImpl*, protocol::FrontendChannel*, 41 V8DebuggerAgentImpl(V8InspectorSessionImpl*, protocol::FrontendChannel*,
47 protocol::DictionaryValue* state); 42 protocol::DictionaryValue* state);
48 ~V8DebuggerAgentImpl() override; 43 ~V8DebuggerAgentImpl() override;
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 std::unique_ptr<protocol::DictionaryValue> data); 122 std::unique_ptr<protocol::DictionaryValue> data);
128 void cancelPauseOnNextStatement(); 123 void cancelPauseOnNextStatement();
129 void breakProgram(const String16& breakReason, 124 void breakProgram(const String16& breakReason,
130 std::unique_ptr<protocol::DictionaryValue> data); 125 std::unique_ptr<protocol::DictionaryValue> data);
131 void breakProgramOnException(const String16& breakReason, 126 void breakProgramOnException(const String16& breakReason,
132 std::unique_ptr<protocol::DictionaryValue> data); 127 std::unique_ptr<protocol::DictionaryValue> data);
133 128
134 void reset(); 129 void reset();
135 130
136 // Interface for V8InspectorImpl 131 // Interface for V8InspectorImpl
137 SkipPauseRequest didPause(v8::Local<v8::Context>, 132 bool didPause(v8::Local<v8::Context>, v8::Local<v8::Value> exception,
dgozman 2017/01/19 21:49:14 shouldPause
kozy 2017/01/20 02:32:37 but I think main purpose of this method: send noti
138 v8::Local<v8::Value> exception, 133 const std::vector<String16>& hitBreakpoints,
139 const std::vector<String16>& hitBreakpoints, 134 bool isPromiseRejection, bool isUncaught, bool isOOMBreak);
140 bool isPromiseRejection, bool isUncaught,
141 bool isOOMBreak);
142 void didContinue(); 135 void didContinue();
143 void didParseSource(std::unique_ptr<V8DebuggerScript>, bool success); 136 void didParseSource(std::unique_ptr<V8DebuggerScript>, bool success);
144 void willExecuteScript(int scriptId); 137 void willExecuteScript(int scriptId);
145 void didExecuteScript(); 138 void didExecuteScript();
146 139
140 bool isBlackboxed(const String16& scriptId, const v8::debug::Location& start,
141 const v8::debug::Location& end);
142
147 v8::Isolate* isolate() { return m_isolate; } 143 v8::Isolate* isolate() { return m_isolate; }
148 144
149 private: 145 private:
150 void enableImpl(); 146 void enableImpl();
151 147
152 SkipPauseRequest shouldSkipExceptionPause(JavaScriptCallFrame* topCallFrame);
153 SkipPauseRequest shouldSkipStepPause(JavaScriptCallFrame* topCallFrame);
154
155 void schedulePauseOnNextStatementIfSteppingInto(); 148 void schedulePauseOnNextStatementIfSteppingInto();
156 149
157 Response currentCallFrames( 150 Response currentCallFrames(
158 std::unique_ptr<protocol::Array<protocol::Debugger::CallFrame>>*); 151 std::unique_ptr<protocol::Array<protocol::Debugger::CallFrame>>*);
159 std::unique_ptr<protocol::Runtime::StackTrace> currentAsyncStackTrace(); 152 std::unique_ptr<protocol::Runtime::StackTrace> currentAsyncStackTrace();
160 153
161 void changeJavaScriptRecursionLevel(int step); 154 void changeJavaScriptRecursionLevel(int step);
162 155
163 void setPauseOnExceptionsImpl(int); 156 void setPauseOnExceptionsImpl(int);
164 157
165 std::unique_ptr<protocol::Debugger::Location> resolveBreakpoint( 158 std::unique_ptr<protocol::Debugger::Location> resolveBreakpoint(
166 const String16& breakpointId, const ScriptBreakpoint&, BreakpointSource); 159 const String16& breakpointId, const ScriptBreakpoint&, BreakpointSource);
167 void removeBreakpointImpl(const String16& breakpointId); 160 void removeBreakpointImpl(const String16& breakpointId);
168 void clearBreakDetails(); 161 void clearBreakDetails();
169 162
170 bool isCurrentCallStackEmptyOrBlackboxed();
171 bool isTopPausedCallFrameBlackboxed();
172 bool isCallFrameWithUnknownScriptOrBlackboxed(JavaScriptCallFrame*);
173
174 void internalSetAsyncCallStackDepth(int); 163 void internalSetAsyncCallStackDepth(int);
175 void increaseCachedSkipStackGeneration(); 164 void increaseCachedSkipStackGeneration();
176 165
177 Response setBlackboxPattern(const String16& pattern); 166 Response setBlackboxPattern(const String16& pattern);
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 =
(...skipping 11 matching lines...) Expand all
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

Powered by Google App Engine
This is Rietveld 408576698