View Source edb_dap (edb v0.4.0)

Support for the DAP Protocol

The Debug Adapter Protocol (DAP) defines the abstract protocol used between a development tool (e.g. IDE or editor) and a debugger, using JSON-RPC as the underlying transport protocol.

This module implements the types and functions required to encode and decode messages to and from the DAP protocol.

For the full specification, please refer to:

https://microsoft.github.io/debug-adapter-protocol/specification

Summary

Types

arguments()

-type arguments() :: map().

body()

-type body() :: map().

checksum()

-type checksum() :: #{algorithm := checksumAlgorithm(), checksum := binary()}.

checksumAlgorithm()

-type checksumAlgorithm() :: 'MD5' | 'SHA1' | 'SHA256' | timestamp.

command()

-type command() :: binary().

error_response()

-type error_response() :: #{success := false, body => #{error => message()}}.

event()

-type event() :: #{seq := seq(), type := event, event := event_type(), body => body()}.

event_type()

-type event_type() :: binary().

frame()

-opaque frame()

message()

-type message() ::
          #{id := number(),
            format := binary(),
            variables => #{binary() => binary()},
            sendTelemetry => boolean(),
            showUser => boolean(),
            url => binary(),
            urlLabel => binary()}.

protocol_message()

-type protocol_message() :: #{seq := seq(), type := protocol_message_type()}.

protocol_message_type()

-type protocol_message_type() :: request | response | event.

request()

-type request() :: #{seq := seq(), type := request, command := command(), arguments => arguments()}.

response()

-type response() ::
          #{seq := seq(),
            type := response,
            request_seq := seq(),
            success := boolean(),
            command := command(),
            message => binary(),
            body => body()}.

seq()

-type seq() :: pos_integer().

source()

-type source() ::
          #{name => binary(),
            path => binary(),
            sourceReference => number(),
            presentationHint => normal | emphasize | deemphasize,
            origin => binary(),
            sources => [source()],
            adapterData => map(),
            checksums => [checksum()]}.

stepping_granularity()

-type stepping_granularity() :: statement | line | instruction.

thread_id()

-type thread_id() :: number().

Functions

decode_frames(Data)

-spec decode_frames(binary()) -> {[frame()], binary()}.

encode_frame/1

-spec encode_frame(frame()) -> binary().

frame(Message)

-spec frame(request() | response() | event()) -> frame().

to_binary(String)

-spec to_binary(io_lib:chars()) -> binary().

unframe/1

-spec unframe(frame()) -> request() | response().