View Source edb_dap_server (edb v0.4.0)

Handling of DAP requests, responses and events

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

Summary

Types

action()

-type action() ::
          {event, edb_dap_event:event()} |
          {reverse_request, edb_dap_reverse_request:request()} |
          terminate.

attach_type()

-type attach_type() ::
          #{request := attach, process_id := number()} |
          #{request := launch, process_id := number(), shell_process_id => number()}.

cast_request()

-type cast_request() ::
          {handle_message, edb_dap:request() | edb_dap:response()} |
          {handle_response, edb_dap:response()} |
          terminate.

client_info()

-type client_info() :: edb_dap_request_initialize:arguments().

error()

-type error() ::
          {method_not_found, edb_dap:command()} |
          {invalid_params, Reason :: binary()} |
          {user_error, Id :: integer(), Msg :: iodata()} |
          {internal_error,
           #{class := error | exit | throw, reason := term(), stacktrace := erlang:stacktrace()}}.

state()

-type state() ::
          #{state := started} |
          #{state := initialized, client_info := client_info()} |
          #{state := launching,
            client_info := client_info(),
            shell_process_id => number(),
            notification_ref := reference(),
            cwd := binary()} |
          #{state := configuring,
            type := attach_type(),
            client_info := client_info(),
            node := node(),
            cwd := binary()} |
          #{state := attached,
            type := attach_type(),
            client_info := client_info(),
            node := node(),
            cwd := binary(),
            subscription := edb:event_subscription()} |
          #{state := terminating}.

Functions

handle_call(Request, From, State)

-spec handle_call(term(), term(), state()) -> {noreply, state()} | {stop | reply, term(), state()}.

handle_cast/2

-spec handle_cast(cast_request(), state()) -> {noreply, state()} | {stop, normal, state()}.

handle_info/2

-spec handle_info(Event, state()) -> {noreply, state()}
                     when
                         Event ::
                             {reference(), edb_dap_internal_events:reverse_attach_result()} |
                             edb:event_envelope(edb:event()).

handle_message(Message)

-spec handle_message(Message) -> ok when Message :: edb_dap:request() | edb_dap:response().

init/1

-spec init(noargs) -> {ok, state()}.

start_link()

-spec start_link() -> {ok, pid()}.

terminate(Reason, State)

-spec terminate(Reason :: term(), state()) -> ok.