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.
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.
location
Location to continue to. -
disable(
) → Future< void> - Disables debugger for given page.
-
disassembleWasmModule(
ScriptId scriptId) → Future< DisassembleWasmModuleResult> -
scriptId
Id 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.
maxScriptsCacheSize
The 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.
callFrameId
Call frame identifier to evaluate on.expression
Expression to evaluate.objectGroup
String object group name to put result into (allows rapid releasing resulting object handles usingreleaseObjectGroup
).includeCommandLineAPI
Specifies whether command line API should be available to the evaluated expression, defaults to false.silent
In silent mode exceptions thrown during evaluation are not reported and do not pause execution. OverridessetPauseOnException
state.returnByValue
Whether the result is expected to be a JSON object that should be sent by value.generatePreview
Whether preview should be generated for the result.throwOnSideEffect
Whether to throw an exception if side effect cannot be ruled out during evaluation.timeout
Terminate 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.
start
Start of range to search possible breakpoint locations in.end
End of range to search possible breakpoint locations in (excluding). When not specified, end of scripts is used as end of range.restrictToFunction
Only 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.
scriptId
Id 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.
scriptId
Id 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> -
parentStackTraceId
Debugger 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
restartFrame
is 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.
terminateOnResume
Set 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.
scriptId
Id of the script to search in.query
String to search for.caseSensitive
If true, search is case sensitive.isRegex
If true, treats string parameter as regex. Returns: List of search matches. -
setAsyncCallStackDepth(
int maxDepth) → Future< void> -
Enables or disables async call stacks tracking.
maxDepth
Maximum depth of async call stacks. Setting to0
will 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.
scriptId
Id of the script. -
setBlackboxPatterns(
List< String> patterns) → 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.
patterns
Array of regexps that will be used to check script url for blackbox state. -
setBreakpoint(
Location location, {String? condition}) → Future< SetBreakpointResult> -
Sets JavaScript breakpoint at a given location.
location
Location to set breakpoint in.condition
Expression 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
locations
property. Further matching script parsing will result in subsequentbreakpointResolved
events issued. This logical breakpoint will survive page reloads.lineNumber
Line number to set breakpoint at.url
URL of the resources to set breakpoint on.urlRegex
Regex pattern for the URLs of the resources to set breakpoints on. Eitherurl
orurlRegex
must be specified.scriptHash
Script hash of the resources to set breakpoint on.columnNumber
Offset in the line to set breakpoint at.condition
Expression 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.
objectId
Function object id.condition
Expression 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.
active
New value for breakpoints active state. -
setInstrumentationBreakpoint(
String instrumentation) → Future< BreakpointId> -
Sets instrumentation breakpoint.
instrumentation
Instrumentation 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
.state
Pause on exceptions mode. -
setReturnValue(
CallArgument newValue) → Future< void> -
Changes return value in top frame. Available only at return break position.
newValue
New 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).
skip
New 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.
scopeNumber
0-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.variableName
Variable name.newValue
New variable value.callFrameId
Id of callframe that holds variable. -
stepInto(
{bool? breakOnAsyncCall, List< LocationRange> ? skipList}) → Future<void> -
Steps into the function call.
breakOnAsyncCall
Debugger will pause on the execution of the first async task which was scheduled before next pause.skipList
The 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.
skipList
The 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