Chrome DevTools

Debugger Domain

Debugger domain exposes JavaScript debugging capabilities. It allows setting and removing breakpoints, stepping through execution, exploring stack traces, etc.

Methods

Events

Types

Methods

Chrome DevTools

Debugger.continueToLocation #

Continues execution until specific location is reached.

Parameters

location
Location

Location to continue to.

targetCallFrames
Optional
string

Allowed values: any, current


HermesHermes (Legacy)React NativeChrome DevTools

Debugger.disable #

Disables debugger for given page.

Handles Debugger.disable request @cdp Debugger.disable If domain is already disabled, will return success.


HermesHermes (Legacy)React NativeChrome DevTools

Debugger.enable #

Enables debugger for the given page. Clients should not assume that the debugging has been enabled until the result for this command is received.

Handles Debugger.enable request @cdp Debugger.enable If domain is already enabled, will return success.

Parameters

maxScriptsCacheSize
Optional
number

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.

Experimental

Return object

debuggerId
Runtime.UniqueDebuggerId

Unique identifier of the debugger.

Experimental

HermesHermes (Legacy)Chrome DevTools

Debugger.evaluateOnCallFrame #

Evaluates expression on a given call frame.

In V8, @cdp Debugger.evaluateOnCallFrame populates the result field with the exception value.

Parameters

callFrameId
CallFrameId

Call frame identifier to evaluate on.

expression
string

Expression to evaluate.

objectGroup
Optional
string

String object group name to put result into (allows rapid releasing resulting object handles using releaseObjectGroup).

includeCommandLineAPI
Optional
boolean

Specifies whether command line API should be available to the evaluated expression, defaults to false.

silent
Optional
boolean

In silent mode exceptions thrown during evaluation are not reported and do not pause execution. Overrides setPauseOnException state.

returnByValue
Optional
boolean

Whether the result is expected to be a JSON object that should be sent by value.

generatePreview
Optional
boolean

Whether preview should be generated for the result.

Experimental
throwOnSideEffect
Optional
boolean

Whether to throw an exception if side effect cannot be ruled out during evaluation.

timeout
Optional
Runtime.TimeDelta

Terminate execution after timing out (number of milliseconds).

Experimental

Return object

result
Runtime.RemoteObject

Object wrapper for the evaluation result.

exceptionDetails
Optional
Runtime.ExceptionDetails

Exception details.


Chrome DevTools

Debugger.getPossibleBreakpoints #

Returns possible locations for breakpoint. scriptId in start and end range locations should be the same.

Parameters

start
Location

Start of range to search possible breakpoint locations in.

end
Optional
Location

End of range to search possible breakpoint locations in (excluding). When not specified, end of scripts is used as end of range.

restrictToFunction
Optional
boolean

Only consider locations which are in the same (non-nested) function as start.

Return object

locations
array[ BreakLocation ]

List of the possible breakpoint locations.


Chrome DevTools

Debugger.getScriptSource #

Returns source for the script with given id.

Parameters

scriptId
Runtime.ScriptId

Id of the script to get source for.

Return object

scriptSource
string

Script source (empty in case of Wasm bytecode).

bytecode
Optional
string

Wasm bytecode. (Encoded as a base64 string when passed over JSON)


HermesHermes (Legacy)Chrome DevTools

Debugger.pause #

Stops on the next JavaScript statement.


HermesHermes (Legacy)Chrome DevTools

Debugger.removeBreakpoint #

Removes JavaScript breakpoint.

Parameters

breakpointId

Chrome DevTools

Debugger.restartFrame #

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.

To stay back-wards compatible, restartFrame now expects a mode parameter to be present. If the mode parameter is missing, restartFrame errors out.

The various return values are deprecated and callFrames is always empty. Use the call frames from the Debugger#paused events instead, that fires once V8 pauses at the beginning of the restarted function.

Parameters

callFrameId
CallFrameId

Call frame identifier to evaluate on.

mode
Optional
string

The mode parameter must be present and set to 'StepInto', otherwise restartFrame will error out.

Allowed values: StepInto

Experimental

Return object

callFrames
array[ CallFrame ]

New stack trace.

Deprecated
asyncStackTrace
Optional
Runtime.StackTrace

Async stack trace, if any.

Deprecated
asyncStackTraceId
Optional
Runtime.StackTraceId

Async stack trace, if any.

Deprecated

HermesHermes (Legacy)React NativeChrome DevTools

Debugger.resume #

Resumes JavaScript execution.

Parameters

terminateOnResume
Optional
boolean

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.


Chrome DevTools

Debugger.searchInContent #

Searches for given string in script content.

Parameters

scriptId
Runtime.ScriptId

Id of the script to search in.

query
string

String to search for.

caseSensitive
Optional
boolean

If true, search is case sensitive.

isRegex
Optional
boolean

If true, treats string parameter as regex.

Return object

result
array[ SearchMatch ]

List of search matches.


Chrome DevTools

Debugger.setAsyncCallStackDepth #

Enables or disables async call stacks tracking.

Parameters

maxDepth
integer

Maximum depth of async call stacks. Setting to 0 will effectively disable collecting async call stacks (default).


HermesHermes (Legacy)Chrome DevTools

Debugger.setBreakpoint #

Sets JavaScript breakpoint at a given location.

Parameters

location
Location

Location to set breakpoint in.

condition
Optional
string

Expression to use as a breakpoint condition. When specified, debugger will only stop on the breakpoint if this expression evaluates to true.

Return object

breakpointId
BreakpointId

Id of the created breakpoint for further reference.

actualLocation
Location

Location this breakpoint resolved into.


HermesHermes (Legacy)Chrome DevTools

Debugger.setBreakpointByUrl #

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 subsequent breakpointResolved events issued. This logical breakpoint will survive page reloads.

Parameters

lineNumber
integer

Line number to set breakpoint at.

url
Optional
string

URL of the resources to set breakpoint on.

urlRegex
Optional
string

Regex pattern for the URLs of the resources to set breakpoints on. Either url or urlRegex must be specified.

scriptHash
Optional
string

Script hash of the resources to set breakpoint on.

columnNumber
Optional
integer

Offset in the line to set breakpoint at.

condition
Optional
string

Expression to use as a breakpoint condition. When specified, debugger will only stop on the breakpoint if this expression evaluates to true.

Return object

breakpointId
BreakpointId

Id of the created breakpoint for further reference.

locations
array[ Location ]

List of the locations this breakpoint resolved into upon addition.


HermesHermes (Legacy)Chrome DevTools

Debugger.setBreakpointsActive #

Activates / deactivates all breakpoints on the page.

Handles Debugger.setBreakpointsActive @cdp Debugger.setBreakpointsActive Allowed even if domain is not enabled.

Parameters

active
boolean

New value for breakpoints active state.


Hermes (Legacy)Chrome DevTools

Debugger.setInstrumentationBreakpoint #

Sets instrumentation breakpoint.

Parameters

instrumentation
string

Instrumentation name.

Allowed values: beforeScriptExecution, beforeScriptWithSourceMapExecution

Return object

breakpointId
BreakpointId

Id of the created breakpoint for further reference.


HermesHermes (Legacy)Chrome DevTools

Debugger.setPauseOnExceptions #

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.

Parameters

state
string

Pause on exceptions mode.

Allowed values: none, caught, uncaught, all


Chrome DevTools

Debugger.setScriptSource #

Edits JavaScript source live.

In general, functions that are currently on the stack can not be edited with a single exception: If the edited function is the top-most stack frame and that is the only activation of that function on the stack. In this case the live edit will be successful and a Debugger.restartFrame for the top-most function is automatically triggered.

Parameters

scriptId
Runtime.ScriptId

Id of the script to edit.

scriptSource
string

New content of the script.

dryRun
Optional
boolean

If true the change will not actually be applied. Dry run may be used to get result description without actually modifying the code.

allowTopFrameEditing
Optional
boolean

If true, then scriptSource is allowed to change the function on top of the stack as long as the top-most stack frame is the only activation of that function.

Experimental

Return object

callFrames
Optional
array[ CallFrame ]

New stack trace in case editing has happened while VM was stopped.

Deprecated
stackChanged
Optional
boolean

Whether current call stack was modified after applying the changes.

Deprecated
asyncStackTrace
Optional
Runtime.StackTrace

Async stack trace, if any.

Deprecated
asyncStackTraceId
Optional
Runtime.StackTraceId

Async stack trace, if any.

Deprecated
status
string

Whether the operation was successful or not. Only Ok denotes a successful live edit while the other enum variants denote why the live edit failed.

Allowed values: Ok, CompileError, BlockedByActiveGenerator, BlockedByActiveFunction, BlockedByTopLevelEsModuleChange

Experimental
exceptionDetails
Optional
Runtime.ExceptionDetails

Exception details if any. Only present when status is CompileError.


Chrome DevTools

Debugger.setSkipAllPauses #

Makes page not interrupt on any pauses (breakpoint, exception, dom exception etc).

Parameters

skip
boolean

New value for skip pauses state.


Chrome DevTools

Debugger.setVariableValue #

Changes value of variable in a callframe. Object-based scopes are not supported and must be mutated manually.

Parameters

scopeNumber
integer

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
string

Variable name.

newValue
Runtime.CallArgument

New variable value.

callFrameId
CallFrameId

Id of callframe that holds variable.


HermesHermes (Legacy)Chrome DevTools

Debugger.stepInto #

Steps into the function call.

Parameters

breakOnAsyncCall
Optional
boolean

Debugger will pause on the execution of the first async task which was scheduled before next pause.

Experimental
skipList
Optional
array[ LocationRange ]

The skipList specifies location ranges that should be skipped on step into.

Experimental

HermesHermes (Legacy)Chrome DevTools

Debugger.stepOut #

Steps out of the function call.


HermesHermes (Legacy)React NativeChrome DevTools

Debugger.stepOver #

Steps over the statement.

Parameters

skipList
Optional
array[ LocationRange ]

The skipList specifies location ranges that should be skipped on step over.

Experimental

Chrome DevTools

Debugger.getWasmBytecode Deprecated#

This command is deprecated. Use getScriptSource instead.

Parameters

scriptId
Runtime.ScriptId

Id of the Wasm script to get source for.

Return object

bytecode
string

Script source. (Encoded as a base64 string when passed over JSON)


Chrome DevTools

Debugger.disassembleWasmModule Experimental#

Parameters

scriptId
Runtime.ScriptId

Id of the script to disassemble

Return object

streamId
Optional
string

For large modules, return a stream from which additional chunks of disassembly can be read successively.

totalNumberOfLines
integer

The total number of lines in the disassembly text.

functionBodyOffsets
array[ integer ]

The offsets of all function bodies, in the format [start1, end1, start2, end2, ...] where all ends are exclusive.

chunk
WasmDisassemblyChunk

The first chunk of disassembly.


Chrome DevTools

Debugger.getStackTrace Experimental#

Returns stack trace with given stackTraceId.

Parameters

Return object


Chrome DevTools

Debugger.nextWasmDisassemblyChunk Experimental#

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.

Parameters

streamId
string

Return object

chunk
WasmDisassemblyChunk

The next chunk of disassembly.


Chrome DevTools

Debugger.setBlackboxedRanges Experimental#

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.

Parameters

scriptId
Runtime.ScriptId

Id of the script.

positions

Chrome DevTools

Debugger.setBlackboxPatterns Experimental#

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.

Parameters

patterns
array[ string ]

Array of regexps that will be used to check script url for blackbox state.


Chrome DevTools

Debugger.setBreakpointOnFunctionCall Experimental#

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.

Parameters

objectId
Runtime.RemoteObjectId

Function object id.

condition
Optional
string

Expression to use as a breakpoint condition. When specified, debugger will stop on the breakpoint if this expression evaluates to true.

Return object

breakpointId
BreakpointId

Id of the created breakpoint for further reference.


Chrome DevTools

Debugger.setReturnValue Experimental#

Changes return value in top frame. Available only at return break position.

Parameters

newValue
Runtime.CallArgument

New return value.


Chrome DevTools

Debugger.pauseOnAsyncCall ExperimentalDeprecated#

Parameters

parentStackTraceId
Runtime.StackTraceId

Debugger will pause when async call with given stack trace is started.

Events

HermesHermes (Legacy)React NativeChrome DevTools

Debugger.breakpointResolved #

Fired when breakpoint is resolved to an actual script and location.

Parameters

breakpointId
BreakpointId

Breakpoint unique identifier.

location
Location

Actual breakpoint location.


HermesHermes (Legacy)Chrome DevTools

Debugger.paused #

Fired when the virtual machine stopped on breakpoint or exception or any other stop criteria.

Although the documentation lists the "data" field as optional for the @cdp Debugger.paused event: https://chromedevtools.github.io/devtools-protocol/tot/Debugger/#event-paused it is accessed unconditionally by the front-end when the pause reason is "exception". "data" is passed in as "auxData" via: https://github.com/facebookexperimental/rn-chrome-devtools-frontend/blob/9a23d4c7c4c2d1a3d9e913af38d6965f474c4284/front_end/core/sdk/DebuggerModel.ts#L994 and "auxData" stored in a DebuggerPausedDetails instance: https://github.com/facebookexperimental/rn-chrome-devtools-frontend/blob/9a23d4c7c4c2d1a3d9e913af38d6965f474c4284/front_end/core/sdk/DebuggerModel.ts#L642 which then has its fields accessed in: https://github.com/facebookexperimental/rn-chrome-devtools-frontend/blob/main/front_end/panels/sources/DebuggerPausedMessage.ts#L225 If the "data" ("auxData") object is absent, accessing its fields will throw, breaking the display of pause information. Thus, we always populate "data" with an object. The "data" field has no schema in the protocol metadata that we use to generate message structures, so we need to manually construct a JSON object here. The structure expected by the front-end (specifically, the "description" field) can be inferred from the field access at the URL above. The front-end does gracefully handle missing fields on the "data" object, so we can consider the "description" field optional.

Parameters

callFrames
array[ CallFrame ]

Call stack the virtual machine stopped on.

reason
string

Pause reason.

Allowed values: ambiguous, assert, CSPViolation, debugCommand, DOM, EventListener, exception, instrumentation, OOM, other, promiseRejection, XHR, step

data
Optional
object

Object containing break-specific auxiliary properties.

hitBreakpoints
Optional
array[ string ]

Hit breakpoints IDs

asyncStackTrace
Optional
Runtime.StackTrace

Async stack trace, if any.

asyncStackTraceId
Optional
Runtime.StackTraceId

Async stack trace, if any.

Experimental
asyncCallStackTraceId
Optional
Runtime.StackTraceId

Never present, will be removed.

ExperimentalDeprecated

HermesHermes (Legacy)Chrome DevTools

Debugger.resumed #

Fired when the virtual machine resumed execution.


Chrome DevTools

Debugger.scriptFailedToParse #

Fired when virtual machine fails to parse the script.

Parameters

scriptId
Runtime.ScriptId

Identifier of the script parsed.

url
string

URL or name of the script parsed (if any).

startLine
integer

Line offset of the script within the resource with given URL (for script tags).

startColumn
integer

Column offset of the script within the resource with given URL.

endLine
integer

Last line of the script.

endColumn
integer

Length of the last line of the script.

executionContextId
Runtime.ExecutionContextId

Specifies script creation context.

hash
string

Content hash of the script, SHA-256.

executionContextAuxData
Optional
object

Embedder-specific auxiliary data likely matching {isDefault: boolean, type: 'default'|'isolated'|'worker', frameId: string}

sourceMapURL
Optional
string

URL of source map associated with script (if any).

hasSourceURL
Optional
boolean

True, if this script has sourceURL.

isModule
Optional
boolean

True, if this script is ES6 module.

length
Optional
integer

This script length.

stackTrace
Optional
Runtime.StackTrace

JavaScript top stack frame of where the script parsed event was triggered if available.

Experimental
codeOffset
Optional
integer

If the scriptLanguage is WebAssembly, the code section offset in the module.

Experimental
scriptLanguage
Optional
Debugger.ScriptLanguage

The language of the script.

Experimental
embedderName
Optional
string

The name the embedder supplied for this script.

Experimental

HermesHermes (Legacy)React NativeChrome DevTools

Debugger.scriptParsed #

Fired when virtual machine parses script. This event is also fired for all known and uncollected scripts upon enabling debugger.

Parameters

scriptId
Runtime.ScriptId

Identifier of the script parsed.

url
string

URL or name of the script parsed (if any).

startLine
integer

Line offset of the script within the resource with given URL (for script tags).

startColumn
integer

Column offset of the script within the resource with given URL.

endLine
integer

Last line of the script.

endColumn
integer

Length of the last line of the script.

executionContextId
Runtime.ExecutionContextId

Specifies script creation context.

hash
string

Content hash of the script, SHA-256.

executionContextAuxData
Optional
object

Embedder-specific auxiliary data likely matching {isDefault: boolean, type: 'default'|'isolated'|'worker', frameId: string}

isLiveEdit
Optional
boolean

True, if this script is generated as a result of the live edit operation.

Experimental
sourceMapURL
Optional
string

URL of source map associated with script (if any).

hasSourceURL
Optional
boolean

True, if this script has sourceURL.

isModule
Optional
boolean

True, if this script is ES6 module.

length
Optional
integer

This script length.

stackTrace
Optional
Runtime.StackTrace

JavaScript top stack frame of where the script parsed event was triggered if available.

Experimental
codeOffset
Optional
integer

If the scriptLanguage is WebAssembly, the code section offset in the module.

Experimental
scriptLanguage
Optional
Debugger.ScriptLanguage

The language of the script.

Experimental
debugSymbols
Optional
Debugger.DebugSymbols

If the scriptLanguage is WebASsembly, the source of debug symbols for the module.

Experimental
embedderName
Optional
string

The name the embedder supplied for this script.

Experimental

Types

Chrome DevTools

Debugger.BreakLocation #

Type: object

Properties

scriptId
Runtime.ScriptId

Script identifier as reported in the Debugger.scriptParsed.

lineNumber
integer

Line number in the script (0-based).

columnNumber
Optional
integer

Column number in the script (0-based).

type
Optional
string

Allowed values: debuggerStatement, call, return


HermesHermes (Legacy)Chrome DevTools

Debugger.BreakpointId #

Breakpoint identifier.

Type: string


HermesHermes (Legacy)Chrome DevTools

Debugger.CallFrame #

JavaScript call frame. Array of call frames form the call stack.

Type: object

Properties

callFrameId
CallFrameId

Call frame identifier. This identifier is only valid while the virtual machine is paused.

functionName
string

Name of the JavaScript function called on this call frame.

functionLocation
Optional
Location

Location in the source code.

location
Location

Location in the source code.

url
string

JavaScript script name or url. Deprecated in favor of using the location.scriptId to resolve the URL via a previously sent Debugger.scriptParsed event.

Deprecated
scopeChain
array[ Scope ]

Scope chain for this call frame.

this
Runtime.RemoteObject

this object for this call frame.

returnValue
Optional
Runtime.RemoteObject

The value being returned, if the function is at return point.

canBeRestarted
Optional
boolean

Valid only while the VM is paused and indicates whether this frame can be restarted or not. Note that a true value here does not guarantee that Debugger#restartFrame with this CallFrameId will be successful, but it is very likely.

Experimental

HermesHermes (Legacy)Chrome DevTools

Debugger.CallFrameId #

Call frame identifier.

Type: string


Chrome DevTools

Debugger.DebugSymbols #

Debug symbols available for a wasm script.

Type: object

Properties

type
string

Type of the debug symbols.

Allowed values: None, SourceMap, EmbeddedDWARF, ExternalDWARF

externalURL
Optional
string

URL of the external symbol source.


HermesHermes (Legacy)Chrome DevTools

Debugger.Location #

Location in the source code.

Type: object

Properties

scriptId
Runtime.ScriptId

Script identifier as reported in the Debugger.scriptParsed.

lineNumber
integer

Line number in the script (0-based).

columnNumber
Optional
integer

Column number in the script (0-based).


HermesHermes (Legacy)Chrome DevTools

Debugger.Scope #

Scope description.

Type: object

Properties

type
string

Scope type.

Allowed values: global, local, with, closure, catch, block, script, eval, module, wasm-expression-stack

object
Runtime.RemoteObject

Object representing the scope. For global and with scopes it represents the actual object; for the rest of the scopes, it is artificial transient object enumerating scope variables as its properties.

name
Optional
string
startLocation
Optional
Location

Location in the source code where scope starts

endLocation
Optional
Location

Location in the source code where scope ends


Chrome DevTools

Debugger.ScriptLanguage #

Enum of possible script languages.

Type: string

Allowed values: JavaScript, WebAssembly


Chrome DevTools

Debugger.SearchMatch #

Search match for resource.

Type: object

Properties

lineNumber
number

Line number in resource content.

lineContent
string

Line with match content.


Chrome DevTools

Debugger.LocationRange Experimental#

Location range within one script.

Type: object

Properties


Chrome DevTools

Debugger.ScriptPosition Experimental#

Location in the source code.

Type: object

Properties

lineNumber
integer
columnNumber
integer

Chrome DevTools

Debugger.WasmDisassemblyChunk Experimental#

Type: object

Properties

lines
array[ string ]

The next chunk of disassembled lines.

bytecodeOffsets
array[ integer ]

The bytecode offsets describing the start of each line.