5 #ifndef V8_INSPECTOR_V8_DEBUGGER_AGENT_IMPL_H_ 6 #define V8_INSPECTOR_V8_DEBUGGER_AGENT_IMPL_H_ 9 #include <unordered_map> 12 #include "src/base/macros.h" 13 #include "src/debug/debug-interface.h" 14 #include "src/debug/interface-types.h" 15 #include "src/inspector/protocol/Debugger.h" 16 #include "src/inspector/protocol/Forward.h" 20 struct ScriptBreakpoint;
22 class V8DebuggerScript;
23 class V8InspectorImpl;
24 class V8InspectorSessionImpl;
27 using protocol::Maybe;
28 using protocol::Response;
32 enum BreakpointSource {
34 DebugCommandBreakpointSource,
35 MonitorCommandBreakpointSource
39 protocol::DictionaryValue* state);
44 Response enable(
String16* outDebuggerId)
override;
45 Response disable()
override;
46 Response setBreakpointsActive(
bool active)
override;
47 Response setSkipAllPauses(
bool skip)
override;
48 Response setBreakpointByUrl(
49 int lineNumber, Maybe<String16> optionalURL,
50 Maybe<String16> optionalURLRegex, Maybe<String16> optionalScriptHash,
51 Maybe<int> optionalColumnNumber, Maybe<String16> optionalCondition,
53 std::unique_ptr<protocol::Array<protocol::Debugger::Location>>* locations)
55 Response setBreakpoint(
56 std::unique_ptr<protocol::Debugger::Location>,
57 Maybe<String16> optionalCondition,
String16*,
58 std::unique_ptr<protocol::Debugger::Location>* actualLocation)
override;
59 Response setBreakpointOnFunctionCall(
const String16& functionObjectId,
60 Maybe<String16> optionalCondition,
62 Response removeBreakpoint(
const String16& breakpointId)
override;
63 Response continueToLocation(std::unique_ptr<protocol::Debugger::Location>,
64 Maybe<String16> targetCallFrames)
override;
65 Response getStackTrace(
66 std::unique_ptr<protocol::Runtime::StackTraceId> inStackTraceId,
67 std::unique_ptr<protocol::Runtime::StackTrace>* outStackTrace)
override;
68 Response searchInContent(
70 Maybe<bool> optionalCaseSensitive, Maybe<bool> optionalIsRegex,
71 std::unique_ptr<protocol::Array<protocol::Debugger::SearchMatch>>*)
73 Response getPossibleBreakpoints(
74 std::unique_ptr<protocol::Debugger::Location> start,
75 Maybe<protocol::Debugger::Location> end, Maybe<bool> restrictToFunction,
76 std::unique_ptr<protocol::Array<protocol::Debugger::BreakLocation>>*
78 Response setScriptSource(
81 Maybe<protocol::Array<protocol::Debugger::CallFrame>>* optOutCallFrames,
82 Maybe<bool>* optOutStackChanged,
83 Maybe<protocol::Runtime::StackTrace>* optOutAsyncStackTrace,
84 Maybe<protocol::Runtime::StackTraceId>* optOutAsyncStackTraceId,
85 Maybe<protocol::Runtime::ExceptionDetails>* optOutCompileError)
override;
86 Response restartFrame(
88 std::unique_ptr<protocol::Array<protocol::Debugger::CallFrame>>*
90 Maybe<protocol::Runtime::StackTrace>* asyncStackTrace,
91 Maybe<protocol::Runtime::StackTraceId>* asyncStackTraceId)
override;
92 Response getScriptSource(
const String16& scriptId,
94 Response pause()
override;
95 Response resume()
override;
96 Response stepOver()
override;
97 Response stepInto(Maybe<bool> inBreakOnAsyncCall)
override;
98 Response stepOut()
override;
99 void scheduleStepIntoAsync(
100 std::unique_ptr<ScheduleStepIntoAsyncCallback> callback)
override;
101 Response pauseOnAsyncCall(std::unique_ptr<protocol::Runtime::StackTraceId>
102 inParentStackTraceId)
override;
103 Response setPauseOnExceptions(
const String16& pauseState)
override;
104 Response evaluateOnCallFrame(
106 Maybe<String16> objectGroup, Maybe<bool> includeCommandLineAPI,
107 Maybe<bool> silent, Maybe<bool> returnByValue,
108 Maybe<bool> generatePreview, Maybe<bool> throwOnSideEffect,
109 Maybe<double> timeout,
110 std::unique_ptr<protocol::Runtime::RemoteObject>* result,
111 Maybe<protocol::Runtime::ExceptionDetails>*)
override;
112 Response setVariableValue(
113 int scopeNumber,
const String16& variableName,
114 std::unique_ptr<protocol::Runtime::CallArgument> newValue,
115 const String16& callFrame)
override;
116 Response setReturnValue(
117 std::unique_ptr<protocol::Runtime::CallArgument> newValue)
override;
118 Response setAsyncCallStackDepth(
int depth)
override;
119 Response setBlackboxPatterns(
120 std::unique_ptr<protocol::Array<String16>> patterns)
override;
121 Response setBlackboxedRanges(
123 std::unique_ptr<protocol::Array<protocol::Debugger::ScriptPosition>>
126 bool enabled()
const {
return m_enabled; }
130 BreakpointSource source);
132 BreakpointSource source);
133 void schedulePauseOnNextStatement(
135 std::unique_ptr<protocol::DictionaryValue> data);
136 void cancelPauseOnNextStatement();
137 void breakProgram(
const String16& breakReason,
138 std::unique_ptr<protocol::DictionaryValue> data);
144 const std::vector<v8::debug::BreakpointId>& hitBreakpoints,
145 v8::debug::ExceptionType exceptionType,
bool isUncaught,
146 bool isOOMBreak,
bool isAssert);
148 void didParseSource(std::unique_ptr<V8DebuggerScript>,
bool success);
150 bool isFunctionBlackboxed(
const String16& scriptId,
154 bool acceptsPause(
bool isOOMBreak)
const;
156 v8::Isolate* isolate() {
return m_isolate; }
161 Response currentCallFrames(
162 std::unique_ptr<protocol::Array<protocol::Debugger::CallFrame>>*);
163 std::unique_ptr<protocol::Runtime::StackTrace> currentAsyncStackTrace();
164 std::unique_ptr<protocol::Runtime::StackTraceId> currentExternalStackTrace();
165 std::unique_ptr<protocol::Runtime::StackTraceId> currentScheduledAsyncCall();
167 void setPauseOnExceptionsImpl(
int);
169 std::unique_ptr<protocol::Debugger::Location> setBreakpointImpl(
171 const String16& condition,
int lineNumber,
int columnNumber);
172 void setBreakpointImpl(
const String16& breakpointId,
175 void removeBreakpointImpl(
const String16& breakpointId);
176 void clearBreakDetails();
178 void internalSetAsyncCallStackDepth(
int);
179 void increaseCachedSkipStackGeneration();
181 Response setBlackboxPattern(
const String16& pattern);
182 void resetBlackboxedStateCache();
184 bool isPaused()
const;
187 std::unordered_map<String16, std::unique_ptr<V8DebuggerScript>>;
188 using BreakpointIdToDebuggerBreakpointIdsMap =
189 std::unordered_map<String16, std::vector<v8::debug::BreakpointId>>;
190 using DebuggerBreakpointIdToBreakpointIdMap =
191 std::unordered_map<v8::debug::BreakpointId, String16>;
197 protocol::DictionaryValue* m_state;
198 protocol::Debugger::Frontend m_frontend;
199 v8::Isolate* m_isolate;
200 ScriptsMap m_scripts;
201 BreakpointIdToDebuggerBreakpointIdsMap m_breakpointIdToDebuggerBreakpointIds;
202 DebuggerBreakpointIdToBreakpointIdMap m_debuggerBreakpointIdToBreakpointId;
204 std::deque<String16> m_failedToParseAnonymousScriptIds;
205 void cleanupOldFailedToParseAnonymousScriptsIfNeeded();
208 std::pair<String16, std::unique_ptr<protocol::DictionaryValue>>;
209 std::vector<BreakReason> m_breakReason;
211 void pushBreakDetails(
213 std::unique_ptr<protocol::DictionaryValue> breakAuxData);
214 void popBreakDetails();
216 bool m_skipAllPauses =
false;
217 bool m_breakpointsActive =
false;
219 std::unique_ptr<V8Regex> m_blackboxPattern;
220 std::unordered_map<String16, std::vector<std::pair<int, int>>>
221 m_blackboxedPositions;
226 String16 scopeType(v8::debug::ScopeIterator::ScopeType
type);
230 #endif // V8_INSPECTOR_V8_DEBUGGER_AGENT_IMPL_H_