5#ifndef V8_INSPECTOR_V8_DEBUGGER_AGENT_IMPL_H_
6#define V8_INSPECTOR_V8_DEBUGGER_AGENT_IMPL_H_
10#include <unordered_map>
16#include "src/inspector/protocol/Debugger.h"
17#include "src/inspector/protocol/Forward.h"
21struct ScriptBreakpoint;
22class DisassemblyCollectorImpl;
24class V8DebuggerScript;
26class V8InspectorSessionImpl;
29using protocol::Response;
40 protocol::DictionaryValue* state);
48 Response
enable(std::optional<double> maxScriptsCacheSize,
54 int lineNumber, std::optional<String16> optionalURL,
55 std::optional<String16> optionalURLRegex,
56 std::optional<String16> optionalScriptHash,
57 std::optional<int> optionalColumnNumber,
58 std::optional<String16> optionalCondition,
String16*,
59 std::unique_ptr<protocol::Array<protocol::Debugger::Location>>* locations)
62 std::unique_ptr<protocol::Debugger::Location>,
63 std::optional<String16> optionalCondition,
String16*,
64 std::unique_ptr<protocol::Debugger::Location>* actualLocation)
override;
67 std::optional<String16> optionalCondition,
73 std::unique_ptr<protocol::Debugger::Location>,
74 std::optional<String16> targetCallFrames)
override;
76 std::unique_ptr<protocol::Runtime::StackTraceId> inStackTraceId,
77 std::unique_ptr<protocol::Runtime::StackTrace>* outStackTrace)
override;
80 std::optional<bool> optionalCaseSensitive,
81 std::optional<bool> optionalIsRegex,
82 std::unique_ptr<protocol::Array<protocol::Debugger::SearchMatch>>*)
85 std::unique_ptr<protocol::Debugger::Location>
start,
86 std::unique_ptr<protocol::Debugger::Location>
end,
87 std::optional<bool> restrictToFunction,
88 std::unique_ptr<protocol::Array<protocol::Debugger::BreakLocation>>*
92 std::optional<bool> dryRun, std::optional<bool> allowTopFrameEditing,
93 std::unique_ptr<protocol::Array<protocol::Debugger::CallFrame>>*
95 std::optional<bool>* optOutStackChanged,
96 std::unique_ptr<protocol::Runtime::StackTrace>* optOutAsyncStackTrace,
97 std::unique_ptr<protocol::Runtime::StackTraceId>* optOutAsyncStackTraceId,
99 std::unique_ptr<protocol::Runtime::ExceptionDetails>* optOutCompileError)
102 const String16& callFrameId, std::optional<String16> mode,
103 std::unique_ptr<protocol::Array<protocol::Debugger::CallFrame>>*
105 std::unique_ptr<protocol::Runtime::StackTrace>* asyncStackTrace,
106 std::unique_ptr<protocol::Runtime::StackTraceId>* asyncStackTraceId)
109 std::optional<protocol::Binary>* bytecode)
override;
111 const String16& in_scriptId, std::optional<String16>* out_streamId,
112 int* out_totalNumberOfLines,
113 std::unique_ptr<protocol::Array<int>>* out_functionBodyOffsets,
114 std::unique_ptr<protocol::Debugger::WasmDisassemblyChunk>* out_chunk)
118 std::unique_ptr<protocol::Debugger::WasmDisassemblyChunk>* out_chunk)
122 Response
pause()
override;
123 Response
resume(std::optional<bool> terminateOnResume)
override;
125 std::unique_ptr<protocol::Array<protocol::Debugger::LocationRange>>
126 inSkipList)
override;
128 std::optional<bool> inBreakOnAsyncCall,
129 std::unique_ptr<protocol::Array<protocol::Debugger::LocationRange>>
130 inSkipList)
override;
133 inParentStackTraceId)
override;
137 std::optional<String16> objectGroup,
138 std::optional<bool> includeCommandLineAPI, std::optional<bool> silent,
139 std::optional<bool> returnByValue, std::optional<bool> generatePreview,
140 std::optional<bool> throwOnSideEffect, std::optional<double> timeout,
141 std::unique_ptr<protocol::Runtime::RemoteObject>*
result,
142 std::unique_ptr<protocol::Runtime::ExceptionDetails>*)
override;
144 int scopeNumber,
const String16& variableName,
145 std::unique_ptr<protocol::Runtime::CallArgument> newValue,
146 const String16& callFrame)
override;
148 std::unique_ptr<protocol::Runtime::CallArgument> newValue)
override;
151 std::unique_ptr<protocol::Array<String16>> patterns,
152 std::optional<bool> skipAnonymous)
override;
154 std::unique_ptr<protocol::Array<String16>> uniqueIds)
override;
157 std::unique_ptr<protocol::Array<protocol::Debugger::ScriptPosition>>
169 std::unique_ptr<protocol::DictionaryValue> data);
172 std::unique_ptr<protocol::DictionaryValue> data);
181 const std::vector<v8::debug::BreakpointId>& hitBreakpoints,
185 void didParseSource(std::unique_ptr<V8DebuggerScript>,
bool success);
204 std::unique_ptr<protocol::Array<protocol::Debugger::CallFrame>>*);
217 const std::vector<V8DebuggerScript*>& scripts);
230 protocol::Array<protocol::Debugger::LocationRange>& skipList);
233 std::unordered_map<String16, std::unique_ptr<V8DebuggerScript>>;
235 std::unordered_map<String16, std::vector<v8::debug::BreakpointId>>;
237 std::unordered_map<v8::debug::BreakpointId, String16>;
256 std::map<String16, std::unique_ptr<DisassemblyCollectorImpl>>
268 return source.length() *
sizeof(
UChar) + bytecode.size();
274 std::pair<String16, std::unique_ptr<protocol::DictionaryValue>>;
279 std::unique_ptr<protocol::DictionaryValue> breakAuxData);
288 std::unordered_map<String16, std::vector<std::pair<int, int>>>
290 std::unordered_map<String16, std::vector<std::pair<int, int>>>
m_skipList;
Response setBlackboxPatterns(std::unique_ptr< protocol::Array< String16 > > patterns, std::optional< bool > skipAnonymous) override
Response setVariableValue(int scopeNumber, const String16 &variableName, std::unique_ptr< protocol::Runtime::CallArgument > newValue, const String16 &callFrame) override
Response setSkipAllPauses(bool skip) override
std::unordered_map< String16, std::unique_ptr< V8DebuggerScript > > ScriptsMap
Response searchInContent(const String16 &scriptId, const String16 &query, std::optional< bool > optionalCaseSensitive, std::optional< bool > optionalIsRegex, std::unique_ptr< protocol::Array< protocol::Debugger::SearchMatch > > *) override
Response disable() override
Response resume(std::optional< bool > terminateOnResume) override
void removeBreakpointFor(v8::Local< v8::Function > function, BreakpointSource source)
V8InspectorSessionImpl * m_session
void cancelPauseOnNextStatement()
Response setBreakpointOnFunctionCall(const String16 &functionObjectId, std::optional< String16 > optionalCondition, String16 *outBreakpointId) override
V8DebuggerAgentImpl & operator=(const V8DebuggerAgentImpl &)=delete
bool m_skipAnonymousScripts
std::unique_ptr< V8Regex > m_blackboxPattern
void resetBlackboxedStateCache()
void schedulePauseOnNextStatement(const String16 &breakReason, std::unique_ptr< protocol::DictionaryValue > data)
std::map< String16, std::unique_ptr< DisassemblyCollectorImpl > > m_wasmDisassemblies
void internalSetAsyncCallStackDepth(int)
Response enable(std::optional< double > maxScriptsCacheSize, String16 *outDebuggerId) override
V8DebuggerAgentImpl(const V8DebuggerAgentImpl &)=delete
Response setPauseOnExceptions(const String16 &pauseState) override
Response setBreakpointByUrl(int lineNumber, std::optional< String16 > optionalURL, std::optional< String16 > optionalURLRegex, std::optional< String16 > optionalScriptHash, std::optional< int > optionalColumnNumber, std::optional< String16 > optionalCondition, String16 *, std::unique_ptr< protocol::Array< protocol::Debugger::Location > > *locations) override
Response removeBreakpoint(const String16 &breakpointId) override
V8InspectorImpl * m_inspector
Response getScriptSource(const String16 &scriptId, String16 *scriptSource, std::optional< protocol::Binary > *bytecode) override
void ScriptCollected(const V8DebuggerScript *script)
std::vector< BreakReason > m_breakReason
std::unique_ptr< protocol::Runtime::StackTraceId > currentExternalStackTrace()
std::unordered_map< String16, std::vector< std::pair< int, int > > > m_blackboxedPositions
void removeBreakpointImpl(const String16 &breakpointId, const std::vector< V8DebuggerScript * > &scripts)
void setScriptInstrumentationBreakpointIfNeeded(V8DebuggerScript *script)
std::deque< CachedScript > m_cachedScripts
Response setBreakpointsActive(bool active) override
Response continueToLocation(std::unique_ptr< protocol::Debugger::Location >, std::optional< String16 > targetCallFrames) override
void increaseCachedSkipStackGeneration()
Response setInstrumentationBreakpoint(const String16 &instrumentation, String16 *outBreakpointId) override
@ MonitorCommandBreakpointSource
@ DebugCommandBreakpointSource
void setPauseOnExceptionsImpl(int)
std::unordered_map< v8::debug::BreakpointId, String16 > DebuggerBreakpointIdToBreakpointIdMap
size_t m_maxScriptCacheSize
Response getStackTrace(std::unique_ptr< protocol::Runtime::StackTraceId > inStackTraceId, std::unique_ptr< protocol::Runtime::StackTrace > *outStackTrace) override
Response disassembleWasmModule(const String16 &in_scriptId, std::optional< String16 > *out_streamId, int *out_totalNumberOfLines, std::unique_ptr< protocol::Array< int > > *out_functionBodyOffsets, std::unique_ptr< protocol::Debugger::WasmDisassemblyChunk > *out_chunk) override
std::unordered_map< String16, std::vector< v8::debug::BreakpointId > > BreakpointIdToDebuggerBreakpointIdsMap
std::unique_ptr< protocol::Debugger::Location > setBreakpointImpl(const String16 &breakpointId, const String16 &scriptId, const String16 &condition, int lineNumber, int columnNumber)
size_t m_nextWasmDisassemblyStreamId
Response setScriptSource(const String16 &inScriptId, const String16 &inScriptSource, std::optional< bool > dryRun, std::optional< bool > allowTopFrameEditing, std::unique_ptr< protocol::Array< protocol::Debugger::CallFrame > > *optOutCallFrames, std::optional< bool > *optOutStackChanged, std::unique_ptr< protocol::Runtime::StackTrace > *optOutAsyncStackTrace, std::unique_ptr< protocol::Runtime::StackTraceId > *optOutAsyncStackTraceId, String16 *outStatus, std::unique_ptr< protocol::Runtime::ExceptionDetails > *optOutCompileError) override
Response stepOver(std::unique_ptr< protocol::Array< protocol::Debugger::LocationRange > > inSkipList) override
BreakpointIdToDebuggerBreakpointIdsMap m_breakpointIdToDebuggerBreakpointIds
Response pauseOnAsyncCall(std::unique_ptr< protocol::Runtime::StackTraceId > inParentStackTraceId) override
Response setBreakpoint(std::unique_ptr< protocol::Debugger::Location >, std::optional< String16 > optionalCondition, String16 *, std::unique_ptr< protocol::Debugger::Location > *actualLocation) override
Response setBlackboxExecutionContexts(std::unique_ptr< protocol::Array< String16 > > uniqueIds) override
bool isFunctionBlackboxed(const String16 &scriptId, const v8::debug::Location &start, const v8::debug::Location &end)
Response getPossibleBreakpoints(std::unique_ptr< protocol::Debugger::Location > start, std::unique_ptr< protocol::Debugger::Location > end, std::optional< bool > restrictToFunction, std::unique_ptr< protocol::Array< protocol::Debugger::BreakLocation > > *locations) override
void pushBreakDetails(const String16 &breakReason, std::unique_ptr< protocol::DictionaryValue > breakAuxData)
void didPauseOnInstrumentation(v8::debug::BreakpointId instrumentationId)
bool instrumentationFinished()
Response setReturnValue(std::unique_ptr< protocol::Runtime::CallArgument > newValue) override
Response setBlackboxedRanges(const String16 &scriptId, std::unique_ptr< protocol::Array< protocol::Debugger::ScriptPosition > > positions) override
void setBreakpointFor(v8::Local< v8::Function > function, v8::Local< v8::String > condition, BreakpointSource source)
Response stepInto(std::optional< bool > inBreakOnAsyncCall, std::unique_ptr< protocol::Array< protocol::Debugger::LocationRange > > inSkipList) override
Response restartFrame(const String16 &callFrameId, std::optional< String16 > mode, std::unique_ptr< protocol::Array< protocol::Debugger::CallFrame > > *newCallFrames, std::unique_ptr< protocol::Runtime::StackTrace > *asyncStackTrace, std::unique_ptr< protocol::Runtime::StackTraceId > *asyncStackTraceId) override
V8DebuggerAgentImpl(V8InspectorSessionImpl *, protocol::FrontendChannel *, protocol::DictionaryValue *state)
Response evaluateOnCallFrame(const String16 &callFrameId, const String16 &expression, std::optional< String16 > objectGroup, std::optional< bool > includeCommandLineAPI, std::optional< bool > silent, std::optional< bool > returnByValue, std::optional< bool > generatePreview, std::optional< bool > throwOnSideEffect, std::optional< double > timeout, std::unique_ptr< protocol::Runtime::RemoteObject > *result, std::unique_ptr< protocol::Runtime::ExceptionDetails > *) override
std::unordered_set< String16 > m_blackboxedExecutionContexts
Response processSkipList(protocol::Array< protocol::Debugger::LocationRange > &skipList)
void didPause(int contextId, v8::Local< v8::Value > exception, const std::vector< v8::debug::BreakpointId > &hitBreakpoints, v8::debug::ExceptionType exceptionType, bool isUncaught, v8::debug::BreakReasons breakReasons)
std::pair< String16, std::unique_ptr< protocol::DictionaryValue > > BreakReason
protocol::Debugger::Frontend m_frontend
Response getWasmBytecode(const String16 &scriptId, protocol::Binary *bytecode) override
void breakProgram(const String16 &breakReason, std::unique_ptr< protocol::DictionaryValue > data)
Response setBlackboxPattern(const String16 &pattern)
bool acceptsPause(bool isOOMBreak) const
std::unordered_map< String16, std::vector< std::pair< int, int > > > m_skipList
bool m_instrumentationFinished
std::unique_ptr< protocol::Runtime::StackTrace > currentAsyncStackTrace()
~V8DebuggerAgentImpl() override
Response nextWasmDisassemblyChunk(const String16 &in_streamId, std::unique_ptr< protocol::Debugger::WasmDisassemblyChunk > *out_chunk) override
EnableState m_enableState
void didParseSource(std::unique_ptr< V8DebuggerScript >, bool success)
Response currentCallFrames(std::unique_ptr< protocol::Array< protocol::Debugger::CallFrame > > *)
protocol::DictionaryValue * m_state
Response setAsyncCallStackDepth(int depth) override
Response stepOut() override
size_t m_cachedScriptSize
bool shouldBeSkipped(const String16 &scriptId, int line, int column)
Response pause() override
DebuggerBreakpointIdToBreakpointIdMap m_debuggerBreakpointIdToBreakpointId
ZoneVector< RpoNumber > & result
std::vector< uint8_t > bytecode