Debugger Domain
The Debugger domain defines methods for accessing sources in the recording and navigating around the recording using breakpoints, stepping, and so forth.
All commands and events in this domain must include a sessionId
.
Methods
Events
Types
Methods
Debugger.blackboxSource #
Blackbox a source or a region in it. Resume commands like
findResumeTarget
will not return execution points in
blackboxed regions of a source.
parameters
- sourceId
-
SourceId
Source to blackbox.
- begin
-
SourceLocation
If specified, earlier locations will keep their blackbox state.
- end
-
SourceLocation
If specified, later locations will keep their blackbox state.
Debugger.findResumeTarget #
Find where to pause when running forward from a point.
NOTE: This command depends on the focus window, and if no target is found within the resolved focus window, an error will be thrown.
parameters
- point
-
Recording.ExecutionPoint
Point to start the resume from.
Return Object
- target
-
PauseDescription
Point where execution should pause.
Debugger.findReverseStepOverTarget #
Find where to pause when reverse-stepping from a point.
NOTE: This command depends on the focus window, and if no target is found within the resolved focus window, an error will be thrown.
parameters
- point
-
Recording.ExecutionPoint
Point to start reverse-stepping from.
Return Object
- target
-
PauseDescription
Point where execution should pause.
Debugger.findRewindTarget #
Find where to pause when rewinding from a point.
NOTE: This command depends on the focus window, and if no target is found within the resolved focus window, an error will be thrown.
parameters
- point
-
Recording.ExecutionPoint
Point to start rewinding from.
Return Object
- target
-
PauseDescription
Point where execution should pause.
Debugger.findSources #
Find all sources in the recording. Does not return until the recording is
fully processed. Before returning, newSources
events will be
emitted for every source in the recording.
Debugger.findStepInTarget #
Find where to pause when stepping from a point and stopping at the entry of any encountered call.
NOTE: This command depends on the focus window, and if no target is found within the resolved focus window, an error will be thrown.
parameters
- point
-
Recording.ExecutionPoint
Point to start stepping from.
Return Object
- target
-
PauseDescription
Point where execution should pause.
Debugger.findStepOutTarget #
Find where to pause when stepping out from a frame to the caller.
NOTE: This command depends on the focus window, and if no target is found within the resolved focus window, an error will be thrown.
parameters
- point
-
Recording.ExecutionPoint
Point to step out from.
Return Object
- target
-
PauseDescription
Point where execution should pause.
Debugger.findStepOverTarget #
Find where to pause when stepping from a point.
NOTE: This command depends on the focus window, and if no target is found within the resolved focus window, an error will be thrown.
parameters
- point
-
Recording.ExecutionPoint
Point to start stepping from.
Return Object
- target
-
PauseDescription
Point where execution should pause.
Debugger.getAllEventHandlerCounts #
Get all executed event types and their handler execution count
parameters
- range
-
Recording.PointRange
Any subrange of the recording to restrict the returned events to.
Return Object
- counts
-
array[ EventHandlerCount ]
The handler counts for all event types that occurred in the given range.
Debugger.getEventHandlerCount #
Get the number of times handlers for a type of event executed.
parameters
- eventType
-
EventHandlerType
Type of event to get the handler count for.
- range
-
Recording.PointRange
Any subrange of the recording to restrict the returned events to.
Return Object
- count
-
integer
How many times handlers for the event type executed.
Debugger.getEventHandlerCounts #
Get the number of times handlers for each given event type executed.
parameters
- eventTypes
-
array[ EventHandlerType ]
Type of event handler to get the count for.
- range
-
Recording.PointRange
Any subrange of the recording to restrict the returned events to.
Return Object
- counts
-
array[ EventHandlerCount ]
The handler counts for each event type requested.
Debugger.getHitCounts #
Get a HitCount object for each of the given locations in the given sourceId. Counts will only be computed for regions in the recording which are loaded.
parameters
- locations
-
array[ SameLineSourceLocations ]
Locations for which to retrieve hit counts. Can be chained with the return value of
Debugger.getPossibleBreakpoints
. - sourceId
-
string
Source to return breakpoint locations for.
- maxHits
-
number
Max number of hit counts to report for each location. For locations with many hits, reducing this number will make the command run faster.
- range
-
Recording.PointRange
Any subrange of the recording to restrict the hit counts to.
Return Object
- hits
-
array[ HitCount ]
Hit counts for the given locations.
Debugger.getMappedLocation #
Get the mapped location for a source location.
parameters
- location
-
Location
Return Object
- mappedLocation
-
MappedLocation
Debugger.getPossibleBreakpoints #
Get a compact representation of the locations where breakpoints can be set in a region of a source.
parameters
- sourceId
-
SourceId
Source to return breakpoint locations for.
- begin
-
SourceLocation
If specified, earlier breakpoint locations will be excluded.
- end
-
SourceLocation
If specified, later breakpoint locations will be excluded.
Return Object
- lineLocations
-
array[ SameLineSourceLocations ]
All unique breakpoint locations in the specified source and range, sorted in ascending order by line number, with each line's breakpoints sorted in ascending order by column.
Debugger.getScopeMap #
Get the mapping of generated to original variable names for the given location (which must be in a generated source).
parameters
- location
-
Location
Location in a generated source to fetch the scopemap for.
Return Object
- map
-
array[ VariableMapping ]
The mapping of generated to original variable names.
Debugger.getSourceContents #
Get the contents of a source. Unlike streamSourceContents
, the
entire contents of the file will be returned in the response.
parameters
- sourceId
-
SourceId
Source to fetch the contents for.
Return Object
- contents
-
string
Contents of the source.
- contentType
-
ContentType
Content type of the source contents.
Debugger.getSourceMap #
Get the sourcemap of a source.
parameters
- sourceId
-
SourceId
Source to fetch the sourcemap for.
Return Object
- contents
-
string
The sourcemap of the source (if there is one).
Debugger.getSourceOutline #
Get a description of all functions and classes in a source.
parameters
- sourceId
-
SourceId
Return Object
- classes
-
array[ ClassOutline ]
- functions
-
array[ FunctionOutline ]
Debugger.mapExpressionToGeneratedScope #
Given a JS expression, parse it and make a best-effort attempt to rewrite variable references from the names present in the given location's sourcemapped orginal scope to ones that are present in the underlying script.
NOTE: The location given must be a possible breakpoint location.
parameters
- expression
-
string
- location
-
Location
Return Object
- expression
-
string
Debugger.searchFunctions #
Get the function names that match a query.
parameters
- searchId
-
string
- query
-
string
- sourceIds
-
array[ SourceId ]
The sources to search (in the given order). If not specified, all sources will be searched.
Debugger.searchSourceContents #
parameters
- searchId
-
string
- query
-
string
- sourceIds
-
array[ SourceId ]
The sources to search (in the given order). If not specified, all sources will be searched.
- limit
-
number
The max number of matches to return. If the search generates more than this number of matches, an overflow flag will be present.
- useRegex
-
boolean
If
true
, the query string will be interpreted as a regular expression. - wholeWord
-
boolean
If
true
, the query string will be only match entire words - caseSensitive
-
boolean
If
true
, the query string will be treated as case-sensitive
Debugger.setBreakpoint #
Set a breakpoint at a location.
parameters
- location
-
Location
Location to set the breakpoint at.
- condition
-
string
Any condition which must evaluate to a non-falsy value for an execution point to hit the breakpoint.
Return Object
- breakpointId
-
BreakpointId
ID for the new breakpoint.
Debugger.streamSourceContents #
Similar to getSourceContents
but instead of returning the
entire contents this command will emit one sourceContentsInfo
event with details about the source contents, and
sourceContentsChunk
events with the contents of the file split
up into chunks of 10,000 code units.
parameters
- sourceId
-
SourceId
Source to fetch the contents for.
Debugger.unblackboxSource #
Unblackbox a source or a region in it.
parameters
- sourceId
-
SourceId
Source to unblackbox.
- begin
-
SourceLocation
If specified, earlier locations will keep their blackbox state.
- end
-
SourceLocation
If specified, later locations will keep their blackbox state.
Events
Debugger.newSource #
Describes a source in the recording.
parameters
- sourceId
-
SourceId
ID for the source.
- kind
-
SourceKind
Kind of the source.
- contentId
-
string
A string uniquely identifying this source's content. In most cases this will be same as the source's
contentHash
, but in the case of pretty printed files this will be a combination of identifying features about the inputs and process of pretty printing. - url
-
string
URL of the source. Omitted for dynamically generated sources (from eval etc.).
- generatedSourceIds
-
array[ SourceId ]
If this is an original source, the IDs of the sources which were generated from this one.
- contentHash
-
string
The hash of the source's content, computed using the XXHash3 algorithm. This is set for all sources except pretty printed ones. Note: This field has no advantage over
contentId
, and will eventually be removed.
Debugger.newSources #
Describes a subset of the sources in the recording.
parameters
- sources
-
array[ Source ]
Debugger.searchSourceContentsMatches #
parameters
- searchId
-
string
- matches
-
array[ SearchSourceContentsMatch ]
- overflow
-
boolean
If a limit was included with the request, this flag will be set to true for the last event emitted.
Debugger.sourceContentsChunk #
A single chunk of the source's contents. The chunk will be 10,000 code units long unless it is the last chunk in the file, in which case it will be equal to or shorter than 10,000.
parameters
- sourceId
-
SourceId
ID of the source that this event refers to.
- chunk
-
string
Contents of this chunk.
Debugger.sourceContentsInfo #
Specifies the number of lines in a file.
parameters
- sourceId
-
SourceId
ID of the source that this event refers to.
- codeUnitCount
-
number
Number of UTF-16 code units in this source file.
- lineCount
-
number
Number of lines in this source file.
- contentType
-
ContentType
Content type of the source.
Types
Debugger.ContentType #
Possible content types for sources.
text/javascript
, text/html
Type: string
Debugger.EventHandlerCount #
Type: object
properties
- type
-
EventHandlerType
The type of event.
- count
-
integer
The number of times this type of event occurred.
Debugger.FunctionOutline #
Type: SymbolOutline
properties
- parameters
-
array[ string ]
Descriptions of parameters, in the simplest case these are just the parameter names but they could also be more complex to describe destructuring or rest parameters and default values.
- body
-
SourceLocation
The location where the function's body begins.
- breakpointLocation
-
SourceLocation
A breakpoint location in the function body to use for fetching HitCounts
- className
-
string
The name of the class in which the function is defined (this doesn't necessarily imply that the function is a method of the class).
Debugger.HitCount #
A combination of a location and the number of times that location was hit during the execution of the currently loaded regions.
Type: object
properties
- location
-
Location
Location of the hits.
- hits
-
integer
Number of times this location was hit in loaded regions.
Debugger.MappedLocation #
A location in a generated source, along with corresponding locations in any original sources which the generated source was source mapped from. The generated location is the first element of the array.
Type: array
Debugger.PauseDescription #
Description of a point where execution can pause after running forward or backward through the recording.
Type: PointDescription
properties
- reason
-
PauseReason
Reason for pausing.
Debugger.PauseReason #
Reasons why execution can pause when running forward or backward through
the recording.
endpoint
: Ran to the beginning or end of the recording.
breakpoint
: Hit an installed breakpoint.
debuggerStatement
: Hit a debugger statement.
step
: Reached the target of a step operation.
endpoint
, breakpoint
, debuggerStatement
, step
Type: string
Debugger.PersistentObjectId #
Identifier for a JS object that persists through the lifetime of that object, unlike Pause.ObjectId which can use different IDs for the same JS object in different pauses.
Type: string
Debugger.PointDescription #
Description of an execution point.
Type: Recording.TimeStampedPoint
properties
- frame
-
MappedLocation
Location of the topmost frame, omitted if there are no frames on stack.
- frameDepth
-
number
Number of frames above the topmost frame, omitted if there are no frames on stack.
Debugger.SameLineSourceLocations #
Set of locations which are all on the same line of the same source.
Type: object
properties
- line
-
integer
Common line number for the locations.
- columns
-
array[ integer ]
Different column numbers for the locations.
Debugger.SearchSourceContentsMatch #
Type: object
properties
- location
-
Location
- context
-
string
Some snippet of text from around the match
- contextStart
-
SourceLocation
The beginning of the match within the context snippet
- contextEnd
-
SourceLocation
The end of the match within the context snippet
Debugger.Source #
Source file information.
Type: object
properties
- sourceId
-
SourceId
ID for the source.
- kind
-
SourceKind
Kind of the source.
- contentId
-
string
A string uniquely identifying this source's content. In most cases this will be same as the source's
contentHash
, but in the case of pretty printed files this will be a combination of identifying features about the inputs and process of pretty printing. - url
-
string
URL of the source. Omitted for dynamically generated sources (from eval etc.).
- generatedSourceIds
-
array[ SourceId ]
If this is an original source, the IDs of the sources which were generated from this one.
- contentHash
-
string
The hash of the source's content, computed using the XXHash3 algorithm. This is set for all sources except pretty printed ones. Note: This field has no advantage over
contentId
, and will eventually be removed.
Debugger.SourceKind #
Kind of a source.
inlineScript
: Inline contents of a script
element.
scriptSource
: Script loaded via the src
attribute
of a script
element.
other
: An unspecified kind of source. This does not include any
original sources.
html
: An entire HTML page containing one or more inline scripts.
This is an original source whose generated sources are the inline scripts.
sourceMapped
: An original source specified by a source map.
This will have a generated source associated with the source map.
The source map and its sources must have been
associated with the recording via Recording.addSourceMap
and
Recording.addOriginalSource
.
prettyPrinted
: An original source which was produced by pretty
printing the associated generated source. Pretty printed sources will
automatically be created for other sources which appear to contain minified
code, including HTML page sources. Source
objects will be
emitted for a pretty printed source before the generated source.
inlineScript
, scriptSource
, other
, html
, sourceMapped
, prettyPrinted
Type: string
Debugger.SourceLocation #
Location within a particular source.
Type: object
properties
- line
-
integer
1-indexed line in the source.
- column
-
integer
0-indexed column in the source.
Debugger.SymbolOutline #
Type: object
properties
- name
-
string
The name of the function or class, this may be inferred from an assignment.
- location
-
SourceLocationRange
Debugger.VariableMapping #
A variable mapping containing a generated and an original variable name.
Type: array