src/domains/debugger

Search:
Group by:

This module provides a direct mapping of CDP events and commands for v1.3 (stable) of the Debugger Domain.

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

Types

Debugger {.pure.} = enum
  breakpointResolved = "Debugger.breakpointResolved",
  paused = "Debugger.paused", resumed = "Debugger.resumed",
  scriptFailedToParse = "Debugger.scriptFailedToParse",
  scriptParsed = "Debugger.scriptParsed"
Debugger Domain events

Procs

proc continueToLocation(tab: Tab; location: JsonNode): owned(Future[void]) {.
    ...stackTrace: false, raises: [Exception],
    tags: [RootEffect, WriteIOEffect, ReadIOEffect, TimeEffect], forbids: [].}
proc continueToLocation(tab: Tab; location: JsonNode; params: JsonNode): owned(
    Future[void]) {....stackTrace: false, raises: [Exception], tags: [RootEffect,
    WriteIOEffect, ReadIOEffect, TimeEffect], forbids: [].}

Debugger.continueToLocation

Continues execution until specific location is reached.

proc disableDebuggerDomain(tab: Tab): owned(Future[void]) {....stackTrace: false,
    raises: [Exception],
    tags: [RootEffect, WriteIOEffect, ReadIOEffect, TimeEffect], forbids: [].}

Debugger.disable

Disables debugger for given page.

proc enableDebuggerDomain(tab: Tab): Future[JsonNode] {....stackTrace: false,
    raises: [Exception, ValueError],
    tags: [RootEffect, WriteIOEffect, ReadIOEffect, TimeEffect], forbids: [].}

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.

proc evaluateOnCallFrame(tab: Tab; callFrameId: string; expression: string): Future[
    JsonNode] {....stackTrace: false, raises: [Exception, ValueError],
                tags: [RootEffect, WriteIOEffect, ReadIOEffect, TimeEffect],
                forbids: [].}
proc evaluateOnCallFrame(tab: Tab; callFrameId: string; expression: string;
                         params: JsonNode): Future[JsonNode] {.
    ...stackTrace: false, raises: [Exception, ValueError],
    tags: [RootEffect, WriteIOEffect, ReadIOEffect, TimeEffect], forbids: [].}

Debugger.evaluateOnCallFrame

Evaluates expression on a given call frame.

proc getPossibleBreakpoints(tab: Tab; start, params: JsonNode): Future[JsonNode] {.
    ...stackTrace: false, raises: [Exception, ValueError],
    tags: [RootEffect, WriteIOEffect, ReadIOEffect, TimeEffect], forbids: [].}

Debugger.getPossibleBreakpoints

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

proc getPossibleBreakpoints(tab: Tab; start: JsonNode): Future[JsonNode] {.
    ...stackTrace: false, raises: [Exception, ValueError],
    tags: [RootEffect, WriteIOEffect, ReadIOEffect, TimeEffect], forbids: [].}
proc getScriptSource(tab: Tab; scriptId: string): Future[JsonNode] {.
    ...stackTrace: false, raises: [Exception, ValueError],
    tags: [RootEffect, WriteIOEffect, ReadIOEffect, TimeEffect], forbids: [].}

Debugger.getScriptSource

Returns source for the script with given id.

proc pause(tab: Tab): owned(Future[void]) {....stackTrace: false,
    raises: [Exception],
    tags: [RootEffect, WriteIOEffect, ReadIOEffect, TimeEffect], forbids: [].}

Debugger.pause

Stops on the next JavaScript statement.

proc removeBreakpoint(tab: Tab; breakpointId: string): owned(Future[void]) {.
    ...stackTrace: false, raises: [Exception],
    tags: [RootEffect, WriteIOEffect, ReadIOEffect, TimeEffect], forbids: [].}

Debugger.removeBreakpoint

Removes JavaScript breakpoint.

proc restartFrame(tab: Tab; callFrameId: string): Future[JsonNode] {.
    ...stackTrace: false, raises: [Exception, ValueError],
    tags: [RootEffect, WriteIOEffect, ReadIOEffect, TimeEffect], forbids: [].}
proc restartFrame(tab: Tab; callFrameId: string; params: JsonNode): Future[
    JsonNode] {....stackTrace: false, raises: [Exception, ValueError],
                tags: [RootEffect, WriteIOEffect, ReadIOEffect, TimeEffect],
                forbids: [].}

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.

proc resume(tab: Tab): owned(Future[void]) {....stackTrace: false,
    raises: [Exception],
    tags: [RootEffect, WriteIOEffect, ReadIOEffect, TimeEffect], forbids: [].}
proc resume(tab: Tab; params: JsonNode): owned(Future[void]) {.
    ...stackTrace: false, raises: [Exception],
    tags: [RootEffect, WriteIOEffect, ReadIOEffect, TimeEffect], forbids: [].}

Debugger.resume

Resumes JavaScript execution.

proc searchInContent(tab: Tab; scriptId, query: string): Future[JsonNode] {.
    ...stackTrace: false, raises: [Exception, ValueError],
    tags: [RootEffect, WriteIOEffect, ReadIOEffect, TimeEffect], forbids: [].}
proc searchInContent(tab: Tab; scriptId, query: string; params: JsonNode): Future[
    JsonNode] {....stackTrace: false, raises: [Exception, ValueError],
                tags: [RootEffect, WriteIOEffect, ReadIOEffect, TimeEffect],
                forbids: [].}

Debugger.searchInContent

Searches for given string in script content.

proc setAsyncCallStackDepthDebuggerDomain(tab: Tab; maxDepth: int): owned(
    Future[void]) {....stackTrace: false, raises: [Exception], tags: [RootEffect,
    WriteIOEffect, ReadIOEffect, TimeEffect], forbids: [].}

Debugger.setAsyncCallStackDepth

Enables or disables async call stacks tracking.

proc setBreakpoint(tab: Tab; location: JsonNode): Future[JsonNode] {.
    ...stackTrace: false, raises: [Exception, ValueError],
    tags: [RootEffect, WriteIOEffect, ReadIOEffect, TimeEffect], forbids: [].}
proc setBreakpoint(tab: Tab; location: JsonNode; params: JsonNode): Future[
    JsonNode] {....stackTrace: false, raises: [Exception, ValueError],
                tags: [RootEffect, WriteIOEffect, ReadIOEffect, TimeEffect],
                forbids: [].}

Debugger.setBreakpoint

Sets JavaScript breakpoint at a given location.

proc setBreakpointByUrl(tab: Tab; lineNumber: int): Future[JsonNode] {.
    ...stackTrace: false, raises: [Exception, ValueError],
    tags: [RootEffect, WriteIOEffect, ReadIOEffect, TimeEffect], forbids: [].}
proc setBreakpointByUrl(tab: Tab; lineNumber: int; params: JsonNode): Future[
    JsonNode] {....stackTrace: false, raises: [Exception, ValueError],
                tags: [RootEffect, WriteIOEffect, ReadIOEffect, TimeEffect],
                forbids: [].}

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.

proc setBreakpointsActive(tab: Tab; active: bool): owned(Future[void]) {.
    ...stackTrace: false, raises: [Exception],
    tags: [RootEffect, WriteIOEffect, ReadIOEffect, TimeEffect], forbids: [].}

Debugger.setBreakpointsActive

Activates / deactivates all breakpoints on the page.

proc setInstrumentationBreakpoint(tab: Tab; instrumentation: string): Future[
    JsonNode] {....stackTrace: false, raises: [Exception, ValueError],
                tags: [RootEffect, WriteIOEffect, ReadIOEffect, TimeEffect],
                forbids: [].}

Debugger.setInstrumentationBreakpoint

Sets instrumentation breakpoint.

proc setPauseOnExceptions(tab: Tab; state: string): owned(Future[void]) {.
    ...stackTrace: false, raises: [Exception],
    tags: [RootEffect, WriteIOEffect, ReadIOEffect, TimeEffect], forbids: [].}

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.

proc setScriptSource(tab: Tab; scriptId, scriptSource: string): Future[JsonNode] {.
    ...stackTrace: false, raises: [Exception, ValueError],
    tags: [RootEffect, WriteIOEffect, ReadIOEffect, TimeEffect], forbids: [].}
proc setScriptSource(tab: Tab; scriptId, scriptSource: string; params: JsonNode): Future[
    JsonNode] {....stackTrace: false, raises: [Exception, ValueError],
                tags: [RootEffect, WriteIOEffect, ReadIOEffect, TimeEffect],
                forbids: [].}

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.

proc setSkipAllPauses(tab: Tab; skip: bool): owned(Future[void]) {.
    ...stackTrace: false, raises: [Exception],
    tags: [RootEffect, WriteIOEffect, ReadIOEffect, TimeEffect], forbids: [].}

Debugger.setSkipAllPauses

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

proc setVariableValue(tab: Tab; scopeNumber: int; variableName: string): Future[
    JsonNode] {....stackTrace: false, raises: [Exception, ValueError],
                tags: [RootEffect, WriteIOEffect, ReadIOEffect, TimeEffect],
                forbids: [].}
proc setVariableValue(tab: Tab; scopeNumber: int; variableName: string;
                      params: JsonNode): owned(Future[void]) {.
    ...stackTrace: false, raises: [Exception],
    tags: [RootEffect, WriteIOEffect, ReadIOEffect, TimeEffect], forbids: [].}

Debugger.setVariableValue

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

proc stepInto(tab: Tab): owned(Future[void]) {....stackTrace: false,
    raises: [Exception],
    tags: [RootEffect, WriteIOEffect, ReadIOEffect, TimeEffect], forbids: [].}
proc stepInto(tab: Tab; params: JsonNode): owned(Future[void]) {.
    ...stackTrace: false, raises: [Exception],
    tags: [RootEffect, WriteIOEffect, ReadIOEffect, TimeEffect], forbids: [].}

Debugger.stepInto

Steps into the function call.

proc stepOut(tab: Tab): owned(Future[void]) {....stackTrace: false,
    raises: [Exception],
    tags: [RootEffect, WriteIOEffect, ReadIOEffect, TimeEffect], forbids: [].}

Debugger.stepOut

Steps out of the function call.

proc stepOver(tab: Tab): owned(Future[void]) {....stackTrace: false,
    raises: [Exception],
    tags: [RootEffect, WriteIOEffect, ReadIOEffect, TimeEffect], forbids: [].}
proc stepOver(tab: Tab; params: JsonNode): owned(Future[void]) {.
    ...stackTrace: false, raises: [Exception],
    tags: [RootEffect, WriteIOEffect, ReadIOEffect, TimeEffect], forbids: [].}

Debugger.stepOver

Steps over the statement.