5#ifndef V8_INSPECTOR_V8_DEBUGGER_H_
6#define V8_INSPECTOR_V8_DEBUGGER_H_
11#include <unordered_map>
12#include <unordered_set>
18#include "src/inspector/protocol/Debugger.h"
19#include "src/inspector/protocol/Forward.h"
20#include "src/inspector/protocol/Runtime.h"
29class V8DebuggerAgentImpl;
31class V8RuntimeAgentImpl;
32class V8StackTraceImpl;
47using protocol::Response;
49 protocol::Runtime::Backend::TerminateExecutionCallback;
73 bool terminateOnResume =
false);
82 std::unique_ptr<TerminateExecutionCallback>
callback);
86 std::unique_ptr<protocol::Debugger::Location>,
88 bool restartFrame(
int targetContextGroupId,
int callFrameOrdinal);
144 std::shared_ptr<AsyncStackTrace>* asyncParent,
148 std::shared_ptr<AsyncStackTrace>
stackTraceFor(
int contextGroupId,
162 size_t initial_heap_limit);
170 const std::vector<v8::debug::BreakpointId>& hitBreakpoints,
173 bool isUncaught =
false);
193 bool recurring,
bool skipTopFrame =
false);
206 bool isBlackboxed)
override;
208 bool has_compile_error)
override;
211 const std::vector<v8::debug::BreakpointId>& break_points_hit,
224 int column)
override;
227 bool exception_thrown,
271 code = code * 31 +
key.scriptId;
272 code = code * 31 +
key.lineNumber;
273 code = code * 31 +
key.columnNumber;
278 std::unordered_map<CachedStackFrameKey, std::weak_ptr<StackFrame>,
279 CachedStackFrameKey::Hash, CachedStackFrameKey::Equal>
283 std::unordered_map<void*, std::weak_ptr<AsyncStackTrace>>;
297 std::unordered_map<int, std::weak_ptr<AsyncStackTrace>>;
323 std::unordered_map<uintptr_t, std::weak_ptr<AsyncStackTrace>>;
ActionAfterInstrumentation
bool m_terminateExecutionReported
void terminateExecution(v8::Local< v8::Context > context, std::unique_ptr< TerminateExecutionCallback > callback)
static void terminateExecutionCompletedCallbackIgnoringData(v8::Isolate *isolate, void *)
std::unique_ptr< V8StackTraceImpl > createStackTrace(v8::Local< v8::StackTrace >)
bool m_requestedPauseAfterInstrumentation
v8::debug::ExceptionBreakState getPauseOnExceptionsState()
std::shared_ptr< StackFrame > symbolize(v8::Local< v8::StackFrame > v8Frame)
std::shared_ptr< AsyncStackTrace > stackTraceFor(int contextGroupId, const V8StackTraceId &id)
std::unordered_map< void *, std::weak_ptr< AsyncStackTrace > > AsyncTaskToStackTrace
v8::MaybeLocal< v8::Value > generatorScopes(v8::Local< v8::Context >, v8::Local< v8::Value >)
V8Debugger & operator=(const V8Debugger &)=delete
void asyncTaskCanceledForStack(void *task)
bool isPausedInContextGroup(int contextGroupId) const
void quitMessageLoopIfAgentsFinishedInstrumentation()
int maxAsyncCallChainDepth()
std::unordered_map< CachedStackFrameKey, std::weak_ptr< StackFrame >, CachedStackFrameKey::Hash, CachedStackFrameKey::Equal > m_cachedStackFrames
std::unordered_map< uintptr_t, std::weak_ptr< AsyncStackTrace > > StoredStackTraces
void asyncTaskCanceled(void *task)
ActionAfterInstrumentation BreakOnInstrumentation(v8::Local< v8::Context > paused_context, v8::debug::BreakpointId) override
void externalAsyncTaskStarted(const V8StackTraceId &parent)
void removeBreakpoint(v8::debug::BreakpointId id)
size_t m_maxAsyncCallStacks
bool m_externalAsyncTaskPauseRequested
void setPauseOnNextCall(bool, int targetContextGroupId)
bool m_taskWithScheduledBreakPauseRequested
void asyncTaskStarted(void *task)
v8::Local< v8::Array > queryObjects(v8::Local< v8::Context > context, v8::Local< v8::Object > prototype)
bool IsFunctionBlackboxed(v8::Local< v8::debug::Script > script, const v8::debug::Location &start, const v8::debug::Location &end) override
internal::V8DebuggerId debuggerIdFor(int contextGroupId)
std::unordered_map< V8DebuggerAgentImpl *, int > m_maxAsyncCallStackDepthMap
int m_ignoreScriptParsedEventsCounter
v8::debug::ExceptionBreakState m_pauseOnExceptionsState
std::unique_ptr< V8StackTraceImpl > captureStackTrace(bool fullStack)
v8::MaybeLocal< v8::Array > internalProperties(v8::Local< v8::Context >, v8::Local< v8::Value >)
void stepOutOfFunction(int targetContextGroupId)
int maxCallStackSizeToCapture() const
std::vector< std::unique_ptr< V8DebuggerScript > > getCompiledScripts(int contextGroupId, V8DebuggerAgentImpl *agent)
v8::MaybeLocal< v8::Value > getTargetScopes(v8::Local< v8::Context >, v8::Local< v8::Value >, ScopeTargetKind)
void AsyncEventOccurred(v8::debug::DebugAsyncActionType type, int id, bool isBlackboxed) override
int m_targetContextGroupId
std::unordered_map< int, std::weak_ptr< AsyncStackTrace > > StackTraceToAsyncParent
void interruptAndBreak(int targetContextGroupId)
v8::MaybeLocal< v8::Array > privateMethods(v8::Local< v8::Context > context, v8::Local< v8::Value > value)
void installTerminateExecutionCallbacks(v8::Local< v8::Context > context)
void unmuteScriptParsedEvents()
void continueProgram(int targetContextGroupId, bool terminateOnResume=false)
void asyncTaskScheduledForStack(const StringView &taskName, void *task, bool recurring, bool skipTopFrame=false)
std::list< std::shared_ptr< AsyncStackTrace > > m_allAsyncStacks
V8StackTraceId storeCurrentStackTrace(const StringView &description)
std::unique_ptr< TerminateExecutionCallback > m_terminateExecutionCallback
void dumpAsyncTaskStacksStateForTest()
void setMaxCallStackSizeToCapture(V8RuntimeAgentImpl *, int)
V8Debugger(v8::Isolate *, V8InspectorImpl *)
void asyncTaskFinishedForStack(void *task)
void * m_taskWithScheduledBreak
void handleProgramBreak(v8::Local< v8::Context > pausedContext, v8::Local< v8::Value > exception, const std::vector< v8::debug::BreakpointId > &hitBreakpoints, v8::debug::BreakReasons break_reasons, v8::debug::ExceptionType exception_type=v8::debug::kException, bool isUncaught=false)
std::unordered_map< V8RuntimeAgentImpl *, int > m_maxCallStackSizeToCaptureMap
v8::Global< v8::Context > m_terminateExecutionCallbackContext
bool isInInstrumentationPause() const
void asyncTaskFinishedForStepping(void *task)
void allAsyncTasksCanceled()
StackTraceToExternalParent m_externalParents
void BreakpointConditionEvaluated(v8::Local< v8::Context > context, v8::debug::BreakpointId breakpoint_id, bool exception_thrown, v8::Local< v8::Value > exception) override
std::unordered_set< void * > m_recurringTasks
bool addInternalObject(v8::Local< v8::Context > context, v8::Local< v8::Object > object, V8InternalValueType type)
void externalAsyncTaskFinished(const V8StackTraceId &parent)
bool hasScheduledBreakOnNextFunctionCall() const
int currentContextGroupId()
V8InspectorImpl * m_inspector
uintptr_t storeStackTrace(std::shared_ptr< AsyncStackTrace > stack)
void ExceptionThrown(v8::Local< v8::Context > paused_context, v8::Local< v8::Value > exception, v8::Local< v8::Value > promise, bool is_uncaught, v8::debug::ExceptionType exception_type) override
StoredStackTraces m_storedStackTraces
void clearContinueToLocation()
bool m_instrumentationPause
void setBreakpointsActive(bool)
v8::MaybeLocal< v8::Array > collectionsEntries(v8::Local< v8::Context > context, v8::Local< v8::Value > value)
int m_continueToLocationBreakpointId
void requestPauseAfterInstrumentation()
StackTraceToAsyncParent m_asyncParents
int m_pausedContextGroupId
bool ShouldBeSkipped(v8::Local< v8::debug::Script > script, int line, int column) override
void ScriptCompiled(v8::Local< v8::debug::Script > script, bool is_live_edited, bool has_compile_error) override
std::shared_ptr< AsyncStackTrace > currentAsyncParent()
std::vector< V8StackTraceId > m_currentExternalParent
void asyncTaskCandidateForStepping(void *task)
void setAsyncCallStackDepth(V8DebuggerAgentImpl *, int)
String16 m_continueToLocationTargetCallFrames
int m_maxAsyncCallStackDepth
size_t m_originalHeapLimit
bool m_pauseOnNextCallRequested
void asyncTaskStartedForStepping(void *task)
void breakProgram(int targetContextGroupId)
int m_maxCallStackSizeToCapture
std::deque< std::pair< int, V8StackTraceId > > StackTraceToExternalParent
std::unique_ptr< V8StackTraceImpl > m_continueToLocationStack
uintptr_t m_lastStackTraceId
void asyncTaskCanceledForStepping(void *task)
AsyncTaskToStackTrace m_asyncTaskStacks
static size_t nearHeapLimitCallback(void *data, size_t current_heap_limit, size_t initial_heap_limit)
V8StackTraceId currentExternalParent()
v8::MaybeLocal< v8::Value > functionScopes(v8::Local< v8::Context >, v8::Local< v8::Function >)
V8InspectorImpl * inspector()
std::vector< void * > m_currentTasks
void stepIntoStatement(int targetContextGroupId, bool breakOnAsyncCall)
void asyncStackTraceCaptured(int id)
void asyncTaskScheduled(const StringView &taskName, void *task, bool recurring)
v8::Isolate * isolate() const
void BreakProgramRequested(v8::Local< v8::Context > paused_context, const std::vector< v8::debug::BreakpointId > &break_points_hit, v8::debug::BreakReasons break_reasons) override
void asyncTaskFinished(void *task)
void muteScriptParsedEvents()
void collectOldAsyncStacksIfNeeded()
std::unordered_map< int, internal::V8DebuggerId > m_contextGroupIdToDebuggerId
std::vector< std::shared_ptr< AsyncStackTrace > > m_currentAsyncParent
int m_breakpointsActiveCount
void stepOverStatement(int targetContextGroupId)
bool shouldContinueToCurrentLocation()
void setPauseOnExceptionsState(v8::debug::ExceptionBreakState)
void asyncParentFor(int stackTraceId, std::shared_ptr< AsyncStackTrace > *asyncParent, V8StackTraceId *externalParent) const
bool restartFrame(int targetContextGroupId, int callFrameOrdinal)
void breakProgramOnAssert(int targetContextGroupId)
void setMaxAsyncTaskStacksForTest(int limit)
Response continueToLocation(int targetContextGroupId, V8DebuggerScript *script, std::unique_ptr< protocol::Debugger::Location >, const String16 &targetCallFramess)
void asyncTaskStartedForStack(void *task)
V8Debugger(const V8Debugger &)=delete
static void terminateExecutionCompletedCallback(v8::Isolate *isolate)
protocol::Runtime::Backend::TerminateExecutionCallback TerminateExecutionCallback
bool operator()(CachedStackFrameKey const &a, CachedStackFrameKey const &b) const
size_t operator()(CachedStackFrameKey const &key) const
WrapSerializationOptions serializationOptions
v8::Global< v8::Object > additionalParameters
std::unique_ptr< ValueMirror > key