View Source edb_dap_id_mappings (edb v0.4.0)
An mapper of IDs for the debug adapter
The DAP protocol expects numeric ids for threads, frames, scopes, etc. These ids
are represented as number() in the JSON specification, and are expected to fit
in a 64-bit float. Some ids like thread_ids are expected to be unique across the
debugging session, while others (frame-ids, etc), need be unique only between
pauses. The specification recommends adapters to reset them on continue
requests.
For more details see https://microsoft.github.io/debug-adapter-protocol/overview
This module implements the mapping fo PIDs to thread-ids, etc, generically.
Summary
Types
An integer that fits in a 64-bit float. This is the requirement the DAP spec puts on ids.
Types
-type frame_scope_or_structured() :: frame_scope() | structured().
-type id() :: non_neg_integer().
An integer that fits in a 64-bit float. This is the requirement the DAP spec puts on ids.
-type pid_frame() :: #{pid := pid(), frame_no := non_neg_integer()}.
-type scope() :: locals | registers | messages.
-type state(A) :: id_mapping(A).
-type validator(A) :: fun((term()) -> {ok, A} | invalid).
Functions
-spec frame_scope_or_structured_to_var_reference(frame_scope_or_structured()) -> id().
-spec handle_call({get_id, A}, gen_server:from(), state(A)) -> {reply, id(), state(A)}; ({get_ids, [A]}, gen_server:from(), state(A)) -> {reply, #{A => id()}, state(A)}; ({from_id, id()}, gen_server:from(), state(A)) -> {reply, {ok, A} | {error, not_found}, state(A)}; (reset, gen_server:from(), state(A)) -> {reply, ok, state(A)}.
-spec reset() -> ok.
-spec start_link_frame_ids_server() -> gen_server:start_ret().
-spec start_link_thread_ids_server() -> gen_server:start_ret().
-spec start_link_var_reference_ids_server() -> gen_server:start_ret().
-spec var_reference_to_frame_scope_or_structured(id()) -> {ok, frame_scope_or_structured()} | {error, not_found}.