DebuggerApi class
Debugger domain exposes JavaScript debugging capabilities. It allows setting and removing breakpoints, stepping through execution, exploring stack traces, etc.
Constructors
- DebuggerApi(Client _client)
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
-
onBreakpointResolved
→ Stream<
BreakpointResolvedEvent> -
Fired when breakpoint is resolved to an actual script and location.
Deprecated in favor of
resolvedBreakpointsin thescriptParsedevent.no setter -
onPaused
→ Stream<
PausedEvent> -
Fired when the virtual machine stopped on breakpoint or exception or any other stop criteria.
no setter
-
onResumed
→ Stream<
void> -
Fired when the virtual machine resumed execution.
no setter
-
onScriptFailedToParse
→ Stream<
ScriptFailedToParseEvent> -
Fired when virtual machine fails to parse the script.
no setter
-
onScriptParsed
→ Stream<
ScriptParsedEvent> -
Fired when virtual machine parses script. This event is also fired for all known and uncollected
scripts upon enabling debugger.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
continueToLocation(
Location location, {String? targetCallFrames}) → Future< void> -
Continues execution until specific location is reached.
locationLocation to continue to. -
disable(
) → Future< void> - Disables debugger for given page.
-
disassembleWasmModule(
ScriptId scriptId) → Future< DisassembleWasmModuleResult> -
scriptIdId of the script to disassemble -
enable(
{num? maxScriptsCacheSize}) → Future< UniqueDebuggerId> -
Enables debugger for the given page. Clients should not assume that the debugging has been
enabled until the result for this command is received.
maxScriptsCacheSizeThe maximum size in bytes of collected scripts (not referenced by other heap objects) the debugger can hold. Puts no limit if parameter is omitted. Returns: Unique identifier of the debugger. -
evaluateOnCallFrame(
CallFrameId callFrameId, String expression, {String? objectGroup, bool? includeCommandLineAPI, bool? silent, bool? returnByValue, bool? generatePreview, bool? throwOnSideEffect, TimeDelta? timeout}) → Future< EvaluateOnCallFrameResult> -
Evaluates expression on a given call frame.
callFrameIdCall frame identifier to evaluate on.expressionExpression to evaluate.objectGroupString object group name to put result into (allows rapid releasing resulting object handles usingreleaseObjectGroup).includeCommandLineAPISpecifies whether command line API should be available to the evaluated expression, defaults to false.silentIn silent mode exceptions thrown during evaluation are not reported and do not pause execution. OverridessetPauseOnExceptionstate.returnByValueWhether the result is expected to be a JSON object that should be sent by value.generatePreviewWhether preview should be generated for the result.throwOnSideEffectWhether to throw an exception if side effect cannot be ruled out during evaluation.timeoutTerminate execution after timing out (number of milliseconds). -
getPossibleBreakpoints(
Location start, {Location? end, bool? restrictToFunction}) → Future< List< BreakLocation> > -
Returns possible locations for breakpoint. scriptId in start and end range locations should be
the same.
startStart of range to search possible breakpoint locations in.endEnd of range to search possible breakpoint locations in (excluding). When not specified, end of scripts is used as end of range.restrictToFunctionOnly consider locations which are in the same (non-nested) function as start. Returns: List of the possible breakpoint locations. -
getScriptSource(
ScriptId scriptId) → Future< GetScriptSourceResult> -
Returns source for the script with given id.
scriptIdId of the script to get source for. -
getStackTrace(
StackTraceId stackTraceId) → Future< StackTraceData> -
Returns stack trace with given
stackTraceId. -
getWasmBytecode(
ScriptId scriptId) → Future< String> -
This command is deprecated. Use getScriptSource instead.
scriptIdId of the Wasm script to get source for. Returns: Script source. -
nextWasmDisassemblyChunk(
String streamId) → Future< WasmDisassemblyChunk> - Disassemble the next chunk of lines for the module corresponding to the stream. If disassembly is complete, this API will invalidate the streamId and return an empty chunk. Any subsequent calls for the now invalid stream will return errors. Returns: The next chunk of disassembly.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
pause(
) → Future< void> - Stops on the next JavaScript statement.
-
pauseOnAsyncCall(
StackTraceId parentStackTraceId) → Future< void> -
parentStackTraceIdDebugger will pause when async call with given stack trace is started. -
removeBreakpoint(
BreakpointId breakpointId) → Future< void> - Removes JavaScript breakpoint.
-
restartFrame(
CallFrameId callFrameId, {String? mode}) → Future< RestartFrameResult> -
Restarts particular call frame from the beginning. The old, deprecated
behavior of
restartFrameis to stay paused and allow further CDP commands after a restart was scheduled. This can cause problems with restarting, so we now continue execution immediatly after it has been scheduled until we reach the beginning of the restarted frame. -
resume(
{bool? terminateOnResume}) → Future< void> -
Resumes JavaScript execution.
terminateOnResumeSet to true to terminate execution upon resuming execution. In contrast to Runtime.terminateExecution, this will allows to execute further JavaScript (i.e. via evaluation) until execution of the paused code is actually resumed, at which point termination is triggered. If execution is currently not paused, this parameter has no effect. -
searchInContent(
ScriptId scriptId, String query, {bool? caseSensitive, bool? isRegex}) → Future< List< SearchMatch> > -
Searches for given string in script content.
scriptIdId of the script to search in.queryString to search for.caseSensitiveIf true, search is case sensitive.isRegexIf true, treats string parameter as regex. Returns: List of search matches. -
setAsyncCallStackDepth(
int maxDepth) → Future< void> -
Enables or disables async call stacks tracking.
maxDepthMaximum depth of async call stacks. Setting to0will effectively disable collecting async call stacks (default). -
setBlackboxedRanges(
ScriptId scriptId, List< ScriptPosition> positions) → Future<void> -
Makes backend skip steps in the script in blackboxed ranges. VM will try leave blacklisted
scripts by performing 'step in' several times, finally resorting to 'step out' if unsuccessful.
Positions array contains positions where blackbox state is changed. First interval isn't
blackboxed. Array should be sorted.
scriptIdId of the script. -
setBlackboxExecutionContexts(
List< String> uniqueIds) → Future<void> -
Replace previous blackbox execution contexts with passed ones. Forces backend to skip
stepping/pausing in scripts in these execution contexts. VM will try to leave blackboxed script by
performing 'step in' several times, finally resorting to 'step out' if unsuccessful.
uniqueIdsArray of execution context unique ids for the debugger to ignore. -
setBlackboxPatterns(
List< String> patterns, {bool? skipAnonymous}) → Future<void> -
Replace previous blackbox patterns with passed ones. Forces backend to skip stepping/pausing in
scripts with url matching one of the patterns. VM will try to leave blackboxed script by
performing 'step in' several times, finally resorting to 'step out' if unsuccessful.
patternsArray of regexps that will be used to check script url for blackbox state.skipAnonymousIf true, also ignore scripts with no source url. -
setBreakpoint(
Location location, {String? condition}) → Future< SetBreakpointResult> -
Sets JavaScript breakpoint at a given location.
locationLocation to set breakpoint in.conditionExpression to use as a breakpoint condition. When specified, debugger will only stop on the breakpoint if this expression evaluates to true. -
setBreakpointByUrl(
int lineNumber, {String? url, String? urlRegex, String? scriptHash, int? columnNumber, String? condition}) → Future< SetBreakpointByUrlResult> -
Sets JavaScript breakpoint at given location specified either by URL or URL regex. Once this
command is issued, all existing parsed scripts will have breakpoints resolved and returned in
locationsproperty. Further matching script parsing will result in subsequentbreakpointResolvedevents issued. This logical breakpoint will survive page reloads.lineNumberLine number to set breakpoint at.urlURL of the resources to set breakpoint on.urlRegexRegex pattern for the URLs of the resources to set breakpoints on. EitherurlorurlRegexmust be specified.scriptHashScript hash of the resources to set breakpoint on.columnNumberOffset in the line to set breakpoint at.conditionExpression to use as a breakpoint condition. When specified, debugger will only stop on the breakpoint if this expression evaluates to true. -
setBreakpointOnFunctionCall(
RemoteObjectId objectId, {String? condition}) → Future< BreakpointId> -
Sets JavaScript breakpoint before each call to the given function.
If another function was created from the same source as a given one,
calling it will also trigger the breakpoint.
objectIdFunction object id.conditionExpression to use as a breakpoint condition. When specified, debugger will stop on the breakpoint if this expression evaluates to true. Returns: Id of the created breakpoint for further reference. -
setBreakpointsActive(
bool active) → Future< void> -
Activates / deactivates all breakpoints on the page.
activeNew value for breakpoints active state. -
setInstrumentationBreakpoint(
String instrumentation) → Future< BreakpointId> -
Sets instrumentation breakpoint.
instrumentationInstrumentation name. Returns: Id of the created breakpoint for further reference. -
setPauseOnExceptions(
String state) → Future< void> -
Defines pause on exceptions state. Can be set to stop on all exceptions, uncaught exceptions,
or caught exceptions, no exceptions. Initial pause on exceptions state is
none.statePause on exceptions mode. -
setReturnValue(
CallArgument newValue) → Future< void> -
Changes return value in top frame. Available only at return break position.
newValueNew return value. -
setScriptSource(
ScriptId scriptId, String scriptSource, {bool? dryRun, bool? allowTopFrameEditing}) → Future< SetScriptSourceResult> - Edits JavaScript source live.
-
setSkipAllPauses(
bool skip) → Future< void> -
Makes page not interrupt on any pauses (breakpoint, exception, dom exception etc).
skipNew value for skip pauses state. -
setVariableValue(
int scopeNumber, String variableName, CallArgument newValue, CallFrameId callFrameId) → Future< void> -
Changes value of variable in a callframe. Object-based scopes are not supported and must be
mutated manually.
scopeNumber0-based number of scope as was listed in scope chain. Only 'local', 'closure' and 'catch' scope types are allowed. Other scopes could be manipulated manually.variableNameVariable name.newValueNew variable value.callFrameIdId of callframe that holds variable. -
stepInto(
{bool? breakOnAsyncCall, List< LocationRange> ? skipList}) → Future<void> -
Steps into the function call.
breakOnAsyncCallDebugger will pause on the execution of the first async task which was scheduled before next pause.skipListThe skipList specifies location ranges that should be skipped on step into. -
stepOut(
) → Future< void> - Steps out of the function call.
-
stepOver(
{List< LocationRange> ? skipList}) → Future<void> -
Steps over the statement.
skipListThe skipList specifies location ranges that should be skipped on step over. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited