protocol/debugger

⚙️ This module was generated from the Chrome DevTools Protocol version 1.3

Debugger Domain

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

📖 View this domain on the DevTools Protocol API Docs

Types

pub type BreakLocation {
  BreakLocation(
    script_id: runtime.ScriptId,
    line_number: Int,
    column_number: option.Option(Int),
    type_: option.Option(BreakLocationType),
  )
}

Constructors

  • BreakLocation(
      script_id: runtime.ScriptId,
      line_number: Int,
      column_number: option.Option(Int),
      type_: option.Option(BreakLocationType),
    )

    Arguments

    • script_id

      Script identifier as reported in the Debugger.scriptParsed.

    • line_number

      Line number in the script (0-based).

    • column_number

      Column number in the script (0-based).

This type is not part of the protocol spec, it has been generated dynamically to represent the possible values of the enum property type of BreakLocation

pub type BreakLocationType {
  BreakLocationTypeDebuggerStatement
  BreakLocationTypeCall
  BreakLocationTypeReturn
}

Constructors

  • BreakLocationTypeDebuggerStatement
  • BreakLocationTypeCall
  • BreakLocationTypeReturn

Breakpoint identifier.

pub type BreakpointId {
  BreakpointId(String)
}

Constructors

  • BreakpointId(String)

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

pub type CallFrame {
  CallFrame(
    call_frame_id: CallFrameId,
    function_name: String,
    function_location: option.Option(Location),
    location: Location,
    scope_chain: List(Scope),
    this: runtime.RemoteObject,
    return_value: option.Option(runtime.RemoteObject),
  )
}

Constructors

  • CallFrame(
      call_frame_id: CallFrameId,
      function_name: String,
      function_location: option.Option(Location),
      location: Location,
      scope_chain: List(Scope),
      this: runtime.RemoteObject,
      return_value: option.Option(runtime.RemoteObject),
    )

    Arguments

    • call_frame_id

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

    • function_name

      Name of the JavaScript function called on this call frame.

    • function_location

      Location in the source code.

    • location

      Location in the source code.

    • scope_chain

      Scope chain for this call frame.

    • this

      this object for this call frame.

    • return_value

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

Call frame identifier.

pub type CallFrameId {
  CallFrameId(String)
}

Constructors

  • CallFrameId(String)

This type is not part of the protocol spec, it has been generated dynamically to represent the possible values of the enum property targetCallFrames of continueToLocation

pub type ContinueToLocationTargetCallFrames {
  ContinueToLocationTargetCallFramesAny
  ContinueToLocationTargetCallFramesCurrent
}

Constructors

  • ContinueToLocationTargetCallFramesAny
  • ContinueToLocationTargetCallFramesCurrent

Debug symbols available for a wasm script.

pub type DebugSymbols {
  DebugSymbols(
    type_: DebugSymbolsType,
    external_url: option.Option(String),
  )
}

Constructors

  • DebugSymbols(
      type_: DebugSymbolsType,
      external_url: option.Option(String),
    )

    Arguments

    • type_

      Type of the debug symbols.

    • external_url

      URL of the external symbol source.

This type is not part of the protocol spec, it has been generated dynamically to represent the possible values of the enum property type of DebugSymbols

pub type DebugSymbolsType {
  DebugSymbolsTypeNone
  DebugSymbolsTypeSourceMap
  DebugSymbolsTypeEmbeddedDwarf
  DebugSymbolsTypeExternalDwarf
}

Constructors

  • DebugSymbolsTypeNone
  • DebugSymbolsTypeSourceMap
  • DebugSymbolsTypeEmbeddedDwarf
  • DebugSymbolsTypeExternalDwarf

This type is not part of the protocol spec, it has been generated dynamically to represent the response to the command evaluate_on_call_frame

pub type EvaluateOnCallFrameResponse {
  EvaluateOnCallFrameResponse(
    result: runtime.RemoteObject,
    exception_details: option.Option(runtime.ExceptionDetails),
  )
}

Constructors

  • EvaluateOnCallFrameResponse(
      result: runtime.RemoteObject,
      exception_details: option.Option(runtime.ExceptionDetails),
    )

    Arguments

    • result

      Object wrapper for the evaluation result.

    • exception_details

      Exception details.

This type is not part of the protocol spec, it has been generated dynamically to represent the response to the command get_possible_breakpoints

pub type GetPossibleBreakpointsResponse {
  GetPossibleBreakpointsResponse(locations: List(BreakLocation))
}

Constructors

  • GetPossibleBreakpointsResponse(locations: List(BreakLocation))

    Arguments

    • locations

      List of the possible breakpoint locations.

This type is not part of the protocol spec, it has been generated dynamically to represent the response to the command get_script_source

pub type GetScriptSourceResponse {
  GetScriptSourceResponse(
    script_source: String,
    bytecode: option.Option(String),
  )
}

Constructors

  • GetScriptSourceResponse(
      script_source: String,
      bytecode: option.Option(String),
    )

    Arguments

    • script_source

      Script source (empty in case of Wasm bytecode).

    • bytecode

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

Location in the source code.

pub type Location {
  Location(
    script_id: runtime.ScriptId,
    line_number: Int,
    column_number: option.Option(Int),
  )
}

Constructors

  • Location(
      script_id: runtime.ScriptId,
      line_number: Int,
      column_number: option.Option(Int),
    )

    Arguments

    • script_id

      Script identifier as reported in the Debugger.scriptParsed.

    • line_number

      Line number in the script (0-based).

    • column_number

      Column number in the script (0-based).

Scope description.

pub type Scope {
  Scope(
    type_: ScopeType,
    object: runtime.RemoteObject,
    name: option.Option(String),
    start_location: option.Option(Location),
    end_location: option.Option(Location),
  )
}

Constructors

  • Scope(
      type_: ScopeType,
      object: runtime.RemoteObject,
      name: option.Option(String),
      start_location: option.Option(Location),
      end_location: option.Option(Location),
    )

    Arguments

    • type_

      Scope type.

    • object

      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.

    • start_location

      Location in the source code where scope starts

    • end_location

      Location in the source code where scope ends

This type is not part of the protocol spec, it has been generated dynamically to represent the possible values of the enum property type of Scope

pub type ScopeType {
  ScopeTypeGlobal
  ScopeTypeLocal
  ScopeTypeWith
  ScopeTypeClosure
  ScopeTypeCatch
  ScopeTypeBlock
  ScopeTypeScript
  ScopeTypeEval
  ScopeTypeModule
  ScopeTypeWasmExpressionStack
}

Constructors

  • ScopeTypeGlobal
  • ScopeTypeLocal
  • ScopeTypeWith
  • ScopeTypeClosure
  • ScopeTypeCatch
  • ScopeTypeBlock
  • ScopeTypeScript
  • ScopeTypeEval
  • ScopeTypeModule
  • ScopeTypeWasmExpressionStack

Enum of possible script languages.

pub type ScriptLanguage {
  ScriptLanguageJavaScript
  ScriptLanguageWebAssembly
}

Constructors

  • ScriptLanguageJavaScript
  • ScriptLanguageWebAssembly

This type is not part of the protocol spec, it has been generated dynamically to represent the response to the command search_in_content

pub type SearchInContentResponse {
  SearchInContentResponse(result: List(SearchMatch))
}

Constructors

  • SearchInContentResponse(result: List(SearchMatch))

    Arguments

    • result

      List of search matches.

Search match for resource.

pub type SearchMatch {
  SearchMatch(line_number: Float, line_content: String)
}

Constructors

  • SearchMatch(line_number: Float, line_content: String)

    Arguments

    • line_number

      Line number in resource content.

    • line_content

      Line with match content.

This type is not part of the protocol spec, it has been generated dynamically to represent the response to the command set_breakpoint_by_url

pub type SetBreakpointByUrlResponse {
  SetBreakpointByUrlResponse(
    breakpoint_id: BreakpointId,
    locations: List(Location),
  )
}

Constructors

  • SetBreakpointByUrlResponse(
      breakpoint_id: BreakpointId,
      locations: List(Location),
    )

    Arguments

    • breakpoint_id

      Id of the created breakpoint for further reference.

    • locations

      List of the locations this breakpoint resolved into upon addition.

This type is not part of the protocol spec, it has been generated dynamically to represent the response to the command set_breakpoint

pub type SetBreakpointResponse {
  SetBreakpointResponse(
    breakpoint_id: BreakpointId,
    actual_location: Location,
  )
}

Constructors

  • SetBreakpointResponse(
      breakpoint_id: BreakpointId,
      actual_location: Location,
    )

    Arguments

    • breakpoint_id

      Id of the created breakpoint for further reference.

    • actual_location

      Location this breakpoint resolved into.

This type is not part of the protocol spec, it has been generated dynamically to represent the possible values of the enum property instrumentation of setInstrumentationBreakpoint

pub type SetInstrumentationBreakpointInstrumentation {
  SetInstrumentationBreakpointInstrumentationBeforeScriptExecution
  SetInstrumentationBreakpointInstrumentationBeforeScriptWithSourceMapExecution
}

Constructors

  • SetInstrumentationBreakpointInstrumentationBeforeScriptExecution
  • SetInstrumentationBreakpointInstrumentationBeforeScriptWithSourceMapExecution

This type is not part of the protocol spec, it has been generated dynamically to represent the response to the command set_instrumentation_breakpoint

pub type SetInstrumentationBreakpointResponse {
  SetInstrumentationBreakpointResponse(
    breakpoint_id: BreakpointId,
  )
}

Constructors

  • SetInstrumentationBreakpointResponse(breakpoint_id: BreakpointId)

    Arguments

    • breakpoint_id

      Id of the created breakpoint for further reference.

This type is not part of the protocol spec, it has been generated dynamically to represent the possible values of the enum property state of setPauseOnExceptions

pub type SetPauseOnExceptionsState {
  SetPauseOnExceptionsStateNone
  SetPauseOnExceptionsStateCaught
  SetPauseOnExceptionsStateUncaught
  SetPauseOnExceptionsStateAll
}

Constructors

  • SetPauseOnExceptionsStateNone
  • SetPauseOnExceptionsStateCaught
  • SetPauseOnExceptionsStateUncaught
  • SetPauseOnExceptionsStateAll

This type is not part of the protocol spec, it has been generated dynamically to represent the response to the command set_script_source

pub type SetScriptSourceResponse {
  SetScriptSourceResponse(
    exception_details: option.Option(runtime.ExceptionDetails),
  )
}

Constructors

  • SetScriptSourceResponse(
      exception_details: option.Option(runtime.ExceptionDetails),
    )

    Arguments

    • exception_details

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

Functions

pub fn continue_to_location(
  callback__: fn(String, Option(Json)) -> a,
  location location: Location,
  target_call_frames target_call_frames: Option(
    ContinueToLocationTargetCallFrames,
  ),
) -> a

Continues execution until specific location is reached.

Parameters:

  • location : Location to continue to.
  • target_call_frames

Returns:

pub fn disable(callback__: fn(String, Option(a)) -> b) -> b

Disables debugger for given page.

pub fn enable(callback__: fn(String, Option(a)) -> b) -> b

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

Parameters:

Returns:

pub fn evaluate_on_call_frame(
  callback__: fn(String, Option(Json)) ->
    Result(Dynamic, RequestError),
  call_frame_id call_frame_id: CallFrameId,
  expression expression: String,
  object_group object_group: Option(String),
  include_command_line_api include_command_line_api: Option(Bool),
  silent silent: Option(Bool),
  return_by_value return_by_value: Option(Bool),
  throw_on_side_effect throw_on_side_effect: Option(Bool),
) -> Result(EvaluateOnCallFrameResponse, RequestError)

Evaluates expression on a given call frame.

Parameters:

  • call_frame_id : Call frame identifier to evaluate on.
  • expression : Expression to evaluate.
  • object_group : String object group name to put result into (allows rapid releasing resulting object handles using releaseObjectGroup).
  • include_command_line_api : 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. Overrides setPauseOnException state.
  • return_by_value : Whether the result is expected to be a JSON object that should be sent by value.
  • throw_on_side_effect : Whether to throw an exception if side effect cannot be ruled out during evaluation.

Returns:

  • result : Object wrapper for the evaluation result.
  • exception_details : Exception details.
pub fn get_possible_breakpoints(
  callback__: fn(String, Option(Json)) ->
    Result(Dynamic, RequestError),
  start start: Location,
  end end: Option(Location),
  restrict_to_function restrict_to_function: Option(Bool),
) -> Result(GetPossibleBreakpointsResponse, RequestError)

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

Parameters:

  • 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.
  • restrict_to_function : Only consider locations which are in the same (non-nested) function as start.

Returns:

  • locations : List of the possible breakpoint locations.
pub fn get_script_source(
  callback__: fn(String, Option(Json)) ->
    Result(Dynamic, RequestError),
  script_id script_id: ScriptId,
) -> Result(GetScriptSourceResponse, RequestError)

Returns source for the script with given id.

Parameters:

  • script_id : Id of the script to get source for.

Returns:

  • script_source : Script source (empty in case of Wasm bytecode).
  • bytecode : Wasm bytecode. (Encoded as a base64 string when passed over JSON)
pub fn pause(callback__: fn(String, Option(a)) -> b) -> b

Stops on the next JavaScript statement.

pub fn remove_breakpoint(
  callback__: fn(String, Option(Json)) -> a,
  breakpoint_id breakpoint_id: BreakpointId,
) -> a

Removes JavaScript breakpoint.

Parameters:

  • breakpoint_id

Returns:

pub fn restart_frame(
  callback__: fn(String, Option(Json)) -> a,
  call_frame_id call_frame_id: CallFrameId,
) -> a

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:

  • call_frame_id : Call frame identifier to evaluate on.

Returns:

pub fn resume(
  callback__: fn(String, Option(Json)) -> a,
  terminate_on_resume terminate_on_resume: Option(Bool),
) -> a

Resumes JavaScript execution.

Parameters:

  • terminate_on_resume : 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.

Returns:

pub fn search_in_content(
  callback__: fn(String, Option(Json)) ->
    Result(Dynamic, RequestError),
  script_id script_id: ScriptId,
  query query: String,
  case_sensitive case_sensitive: Option(Bool),
  is_regex is_regex: Option(Bool),
) -> Result(SearchInContentResponse, RequestError)

Searches for given string in script content.

Parameters:

  • script_id : Id of the script to search in.
  • query : String to search for.
  • case_sensitive : If true, search is case sensitive.
  • is_regex : If true, treats string parameter as regex.

Returns:

  • result : List of search matches.
pub fn set_async_call_stack_depth(
  callback__: fn(String, Option(Json)) -> a,
  max_depth max_depth: Int,
) -> a

Enables or disables async call stacks tracking.

Parameters:

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

Returns:

pub fn set_breakpoint(
  callback__: fn(String, Option(Json)) ->
    Result(Dynamic, RequestError),
  location location: Location,
  condition condition: Option(String),
) -> Result(SetBreakpointResponse, RequestError)

Sets JavaScript breakpoint at a given location.

Parameters:

  • 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.

Returns:

  • breakpoint_id : Id of the created breakpoint for further reference.
  • actual_location : Location this breakpoint resolved into.
pub fn set_breakpoint_by_url(
  callback__: fn(String, Option(Json)) ->
    Result(Dynamic, RequestError),
  line_number line_number: Int,
  url url: Option(String),
  url_regex url_regex: Option(String),
  script_hash script_hash: Option(String),
  column_number column_number: Option(Int),
  condition condition: Option(String),
) -> Result(SetBreakpointByUrlResponse, RequestError)

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:

  • line_number : Line number to set breakpoint at.
  • url : URL of the resources to set breakpoint on.
  • url_regex : Regex pattern for the URLs of the resources to set breakpoints on. Either url or urlRegex must be specified.
  • script_hash : Script hash of the resources to set breakpoint on.
  • column_number : 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.

Returns:

  • breakpoint_id : Id of the created breakpoint for further reference.
  • locations : List of the locations this breakpoint resolved into upon addition.
pub fn set_breakpoints_active(
  callback__: fn(String, Option(Json)) -> a,
  active active: Bool,
) -> a

Activates / deactivates all breakpoints on the page.

Parameters:

  • active : New value for breakpoints active state.

Returns:

pub fn set_instrumentation_breakpoint(
  callback__: fn(String, Option(Json)) ->
    Result(Dynamic, RequestError),
  instrumentation instrumentation: SetInstrumentationBreakpointInstrumentation,
) -> Result(SetInstrumentationBreakpointResponse, RequestError)

Sets instrumentation breakpoint.

Parameters:

  • instrumentation : Instrumentation name.

Returns:

  • breakpoint_id : Id of the created breakpoint for further reference.
pub fn set_pause_on_exceptions(
  callback__: fn(String, Option(Json)) -> a,
  state state: SetPauseOnExceptionsState,
) -> a

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 : Pause on exceptions mode.

Returns:

pub fn set_script_source(
  callback__: fn(String, Option(Json)) ->
    Result(Dynamic, RequestError),
  script_id script_id: ScriptId,
  script_source script_source: String,
  dry_run dry_run: Option(Bool),
) -> Result(SetScriptSourceResponse, RequestError)

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:

  • script_id : Id of the script to edit.
  • script_source : New content of the script.
  • dry_run : If true the change will not actually be applied. Dry run may be used to get result description without actually modifying the code.

Returns:

  • exception_details : Exception details if any. Only present when status is CompileError.
pub fn set_skip_all_pauses(
  callback__: fn(String, Option(Json)) -> a,
  skip skip: Bool,
) -> a

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

Parameters:

  • skip : New value for skip pauses state.

Returns:

pub fn set_variable_value(
  callback__: fn(String, Option(Json)) -> a,
  scope_number scope_number: Int,
  variable_name variable_name: String,
  new_value new_value: CallArgument,
  call_frame_id call_frame_id: CallFrameId,
) -> a

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

Parameters:

  • scope_number : 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.
  • variable_name : Variable name.
  • new_value : New variable value.
  • call_frame_id : Id of callframe that holds variable.

Returns:

pub fn step_into(callback__: fn(String, Option(a)) -> b) -> b

Steps into the function call.

Parameters:

Returns:

pub fn step_out(callback__: fn(String, Option(a)) -> b) -> b

Steps out of the function call.

pub fn step_over(callback__: fn(String, Option(a)) -> b) -> b

Steps over the statement.

Parameters:

Returns:

Search Document