View Source edb_dap (edb v0.3.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
-type arguments() :: map().
-type body() :: map().
-type breakpointMode() :: #{mode := binary(), label := binary(), description => binary(), appliesTo => [breakpointModeApplicability()]}.
-type breakpointModeApplicability() :: source | exception | data | instruction.
-type breakpoints() :: #{breakpoints := [breakpoint()]}.
-type cancel_response() :: response().
-type capabilities() :: #{supportsConfigurationDoneRequest => boolean(), supportsFunctionBreakpoints => boolean(), supportsConditionalBreakpoints => boolean(), supportsHitConditionalBreakpoints => boolean(), supportsEvaluateForHovers => boolean(), exceptionBreakpointFilters => [exceptionBreakpointsFilter()], supportsStepBack => boolean(), supportsSetVariable => boolean(), supportsRestartFrame => boolean(), supportsGotoTargetsRequest => boolean(), supportsStepInTargetsRequest => boolean(), supportsCompletionsRequest => boolean(), completionTriggerCharacters => [binary()], supportsModulesRequest => boolean(), additionalModuleColumns => [columnDescriptor()], supportedChecksumAlgorithms => [checksumAlgorithm()], supportsRestartRequest => boolean(), supportsExceptionOptions => boolean(), supportsValueFormattingOptions => boolean(), supportsExceptionInfoRequest => boolean(), supportTerminateDebuggee => boolean(), supportSuspendDebuggee => boolean(), supportsDelayedStackTraceLoading => boolean(), supportsLoadedSourcesRequest => boolean(), supportsLogPoints => boolean(), supportsTerminateThreadsRequest => boolean(), supportsSetExpression => boolean(), supportsTerminateRequest => boolean(), supportsDataBreakpoints => boolean(), supportsReadMemoryRequest => boolean(), supportsWriteMemoryRequest => boolean(), supportsDisassembleRequest => boolean(), supportsCancelRequest => boolean(), supportsBreakpointLocationsRequest => boolean(), supportsClipboardContext => boolean(), supportsSteppingGranularity => boolean(), supportsInstructionBreakpoints => boolean(), supportsExceptionFilterOptions => boolean(), supportsSingleThreadExecutionRequests => boolean(), supportsDataBreakpointBytes => boolean(), breakpointModes => [breakpointMode()]}.
-type checksum() :: #{algorithm := checksumAlgorithm(), checksum := binary()}.
-type checksumAlgorithm() :: binary().
'MD5' | 'SHA1' | 'SHA256' | timestamp.
-type command() :: binary().
-type disconnect_response() :: #{success := boolean()}.
-type error_response() :: #{success := false, body => #{error => message()}}.
-type event() :: #{seq := seq(), type := event, event := event_type(), body => body()}.
-type event_type() :: binary().
-type exited_event_body() :: #{exitCode := number()}.
-opaque frame()
-type initialize_request_arguments() :: #{clientID => binary(), clientName => binary(), adapterID := binary(), locale => binary(), linesStartAt1 => boolean(), columnsStartAt1 => boolean(), pathFormat => path | uri, supportsVariableType => boolean(), supportsVariablePaging => boolean(), supportsRunInTerminalRequest => boolean(), supportsMemoryReferences => boolean(), supportsProgressReporting => boolean(), supportsInvalidatedEvent => boolean(), supportsMemoryEvent => boolean(), supportsArgsCanBeInterpretedByShell => boolean(), supportsStartDebuggingRequest => boolean()}.
-type initialize_response() :: #{success := boolean(), message => binary(), body => capabilities()}.
-type initialized_event_body() :: #{}.
-type launch_response() :: #{success := boolean()}.
-type next_request_arguments() :: #{threadId := number(), singleThread => boolean(), granularity => stepping_granularity()}.
-type protocol_message() :: #{seq := seq(), type := protocol_message_type()}.
-type protocol_message_type() :: request | response | event.
-type scopes_request_arguments() :: #{frameId := number()}.
-type seq() :: pos_integer().
-type set_breakpoints_request_arguments() :: #{source := source(), breakpoints => [sourceBreakpoint()], lines => [number()], sourceModified => boolean()}.
-type set_breakpoints_response() :: #{success := boolean(), message => binary(), body => breakpoints()}.
-type sourceBreakpoint() :: #{line := number(), column => number(), condition => binary(), hitCondition => binary(), logMessage => binary(), mode => binary()}.
erlfmt:ignore
-type stack_trace_request_arguments() :: #{threadId := thread_id(), startFrame => number(), levels => number(), format => stack_frame_format()}.
-type stack_trace_response() :: #{success := boolean(), message => binary(), body := #{stackFrames := [stack_frame()], totalFrames => number()}}.
-type step_out_request_arguments() :: #{threadId := number(), singleThread => boolean(), granularity => stepping_granularity()}.
-type stepping_granularity() :: statement | line | instruction.
-type terminated_event_body() :: #{restart => true | map()}.
-type thread_id() :: number().
-type threads() :: #{threads := [thread()]}.
-type threads_request_arguments() :: #{}.
-type value_format() :: #{hex => boolean()}.
-type variable() :: #{name := binary(), value := binary(), type => binary(), presentationHint => variable_presentation_hint(), evaluateName => binary(), variablesReference := number(), namedVariables => number(), indexedVariables => number(), memoryReference => binary(), declarationLocationReference => number(), valueLocationReference => number()}.
-type variables_request_arguments() :: #{variablesReference := number(), filter => binary(), start => number(), count => number(), format => value_format()}.
Functions
-spec build_error_response(number(), binary()) -> error_response().
-spec stack_frame(edb_dap_state:context(), pid(), edb:stack_frame()) -> stack_frame().
-spec thread_name(pid(), edb:process_info()) -> binary().
-spec to_binary(io_lib:chars()) -> binary().