13.5. Debug Adapter Protocol data structures
The DAP module implements the Debug Adapter Protocol (DAP) for integrating daslang with external debuggers. It provides the message types, serialization, and communication infrastructure needed for IDE debugging support.
All functions and symbols are in “dap” module, use require to get access to it.
require daslib/dap
13.5.1. Structures
- dap.InitializeRequestArguments
Arguments for the DAP initialize request.
- dap.DisconnectArguments
Arguments for the DAP disconnect request.
- Fields:
restart : bool - Whether to restart the debuggee after disconnecting.
terminateDebuggee : bool - Whether to terminate the debuggee when disconnecting.
suspendDebuggee : bool - Whether to suspend the debuggee when disconnecting.
- dap.Capabilities
Debugger capabilities reported in the initialize response.
- Fields:
supportsConfigurationDoneRequest : bool - Whether the adapter supports the configurationDone request.
supportsRestartRequest : bool - Whether the adapter supports the restart request.
supportTerminateDebuggee : bool - Whether the adapter supports terminating the debuggee.
supportsTerminateRequest : bool - Whether the adapter supports the terminate request.
supportsExceptionOptions : bool - Whether the adapter supports exception options.
supportsExceptionFilterOptions : bool - Whether the adapter supports exception filter options.
supportsDelayedStackTraceLoading : bool - Whether the adapter supports delayed stack trace loading.
supportsDataBreakpoints : bool - Whether the adapter supports data breakpoints.
- dap.DataBreakpoint
A data breakpoint that triggers on memory access.
- Fields:
dataId : string - Identifier for the data to watch.
accessType : string - Access type that triggers the breakpoint: read, write, or readWrite.
condition : string - Optional expression condition for the breakpoint.
hitCondition : string - Optional hit count condition for the breakpoint.
description : string - Human-readable description of the breakpoint.
enabled : bool - Whether the breakpoint is enabled.
- dap.SetDataBreakpointsArguments
Arguments for the setDataBreakpoints request.
- Fields:
breakpoints : array< DataBreakpoint> - Array of data breakpoints to set.
- dap.DataBreakpointInfoArguments
Arguments for the dataBreakpointInfo request.
- Fields:
variablesReference : double - Reference to the variable container.
name : string - Name of the variable.
- dap.DataBreakpointInfoResponse
Response body for the dataBreakpointInfo request.
- Fields:
dataId : string - Identifier for the data, used when setting a data breakpoint.
description : string - Human-readable description of the data.
- dap.SourceBreakpoint
A breakpoint specified by source location line number.
- Fields:
line : double - Line number of the breakpoint.
- dap.Source
A source file descriptor with name and path.
- Fields:
name : string - Short name of the source.
path : string - Full file-system path of the source.
- dap.SetBreakpointsArguments
Arguments for the setBreakpoints request.
- Fields:
source : Source - Source file for which breakpoints are set.
breakpoints : array< SourceBreakpoint> - Array of source breakpoints to set.
sourceModified : bool - Whether the source has been modified since last build.
- dap.Breakpoint
A breakpoint with verification status and location.
- Fields:
id : double - Unique identifier for the breakpoint.
verified : bool - Whether the breakpoint has been verified by the debugger.
source : Source - Source file containing the breakpoint.
line : double - Actual line number of the breakpoint.
message : string - Optional message about the breakpoint state.
- dap.SetBreakpointsResponse
Response body for the setBreakpoints request.
- Fields:
breakpoints : array< Breakpoint> - Array of breakpoints with their verification status.
- dap.Thread
A thread with an identifier and name.
- Fields:
id : double - Unique identifier for the thread.
name : string - Human-readable name of the thread.
- dap.ThreadsResponseBody
Response body for the threads request.
- Fields:
threads : array< Thread> - Array of threads.
- dap.StackTraceArguments
Arguments for the stackTrace request.
- Fields:
threadId : double - Thread for which to retrieve the stack trace.
startFrame : double - Index of the first frame to return.
levels : double - Maximum number of frames to return.
- dap.StackFrame
A stack frame with source location and identifier.
- Fields:
id : double - Unique identifier for the stack frame.
name : string - Name of the frame, typically the function name.
source : Source - Source file of the frame.
line : double - Line number in the source file.
column : double - Column number in the source file.
- dap.StackTraceResponseBody
Response body for the stackTrace request.
- Fields:
stackFrames : array< StackFrame> - Array of stack frames.
totalFrames : double - Total number of frames available.
- dap.ScopesArguments
Arguments for the scopes request.
- Fields:
frameId : double - Stack frame for which to retrieve scopes.
- dap.Scope
A named variable scope with a variables reference.
- Fields:
name : string - Name of the scope (e.g. Locals, Arguments).
variablesReference : double - Reference used to retrieve the variables of this scope.
- dap.ScopesResponseBody
Response body for the scopes request.
- Fields:
scopes : array< Scope> - Array of scopes for the given frame.
- dap.VariablesArguments
Arguments for the variables request.
- Fields:
variablesReference : double - Reference to the variable container to expand.
start : double - Start index of variables to return (for paging).
count : double - Number of variables to return (for paging).
- dap.Variable
A variable with name, value, and type information.
- Fields:
name : string - Name of the variable.
value : string - String representation of the variable’s value.
variablesReference : double - Reference to child variables, if any.
_type : string - Type of the variable.
indexedVariables : double - Number of indexed child variables.
- dap.VariablesResponseBody
Response body for the variables request.
- Fields:
variables : array< Variable> - Array of variables.
- dap.OutputEventBody
Body of the output event for debugger console messages.
- Fields:
category : string - Category of the output (e.g. console, stdout, stderr).
output : string - The output text.
- dap.ContinueArguments
Arguments for the continue request.
- Fields:
threadId : double - Thread to continue.
- dap.PauseArguments
Arguments for the pause request.
- Fields:
threadId : double - Thread to pause.
- dap.StepInArguments
Arguments for the stepIn request.
- Fields:
threadId : double - Thread to step into.
- dap.NextArguments
Arguments for the next (step over) request.
- Fields:
threadId : double - Thread to step over.
- dap.StepOutArguments
Arguments for the stepOut request.
- Fields:
threadId : double - Thread to step out of.
- dap.EvaluateArguments
Arguments for the evaluate request.
- Fields:
expression : string - Expression to evaluate.
frameId : double - Stack frame in which to evaluate the expression.
context : string - Context in which the expression is evaluated (e.g. watch, repl, hover).
- dap.EvaluateResponse
Response body for the evaluate request.
- Fields:
result : string - Type of the evaluation result.
_type : string - String representation of the evaluation result.
variablesReference : double - Reference to child variables of the result, if any.
indexedVariables : double - Number of indexed child variables in the result.
- dap.BreakpointEvent
Event body indicating a breakpoint status change.
- Fields:
reason : string - Reason for the event: changed, new, or removed.
breakpoint : Breakpoint - The breakpoint whose status changed.
- dap.ThreadEvent
Event body indicating a thread started or exited.
- Fields:
reason : string - Reason for the event: started or exited.
threadId : double - Thread identifier.
13.5.2. JSON deserialization
DataBreakpointInfoArguments (data: JsonValue?) : DataBreakpointInfoArguments
DisconnectArguments (data: JsonValue?) : DisconnectArguments
InitializeRequestArguments (data: JsonValue?) : InitializeRequestArguments
SetBreakpointsArguments (data: JsonValue?) : SetBreakpointsArguments
SetDataBreakpointsArguments (data: JsonValue?) : SetDataBreakpointsArguments
StackTraceArguments (data: JsonValue?) : StackTraceArguments
- dap.ContinueArguments(data: JsonValue?): ContinueArguments
Constructs a ContinueArguments from a JSON value.
- Arguments:
data : JsonValue?
- dap.DataBreakpoint(data: JsonValue?): DataBreakpoint
Constructs a DataBreakpoint from a JSON value.
- Arguments:
data : JsonValue?
- dap.DataBreakpointInfoArguments(data: JsonValue?): DataBreakpointInfoArguments
Constructs a DataBreakpointInfoArguments from a JSON value.
- Arguments:
data : JsonValue?
- dap.DisconnectArguments(data: JsonValue?): DisconnectArguments
Constructs a DisconnectArguments from a JSON value.
- Arguments:
data : JsonValue?
- dap.EvaluateArguments(data: JsonValue?): EvaluateArguments
Constructs an EvaluateArguments from a JSON value.
- Arguments:
data : JsonValue?
- dap.InitializeRequestArguments(data: JsonValue?): InitializeRequestArguments
Constructs an InitializeRequestArguments from a JSON value.
- Arguments:
data : JsonValue?
- dap.NextArguments(data: JsonValue?): NextArguments
Constructs a NextArguments from a JSON value.
- Arguments:
data : JsonValue?
- dap.PauseArguments(data: JsonValue?): PauseArguments
Constructs a PauseArguments from a JSON value.
- Arguments:
data : JsonValue?
- dap.ScopesArguments(data: JsonValue?): ScopesArguments
Constructs a ScopesArguments from a JSON value.
- Arguments:
data : JsonValue?
- dap.SetBreakpointsArguments(data: JsonValue?): SetBreakpointsArguments
Constructs a SetBreakpointsArguments from a JSON value, parsing source and breakpoints.
- Arguments:
data : JsonValue?
- dap.SetDataBreakpointsArguments(data: JsonValue?): SetDataBreakpointsArguments
Constructs a SetDataBreakpointsArguments from a JSON value, parsing the breakpoints array.
- Arguments:
data : JsonValue?
- dap.Source(data: JsonValue?): Source
Constructs a Source from a JSON value.
- Arguments:
data : JsonValue?
- dap.SourceBreakpoint(data: JsonValue?): SourceBreakpoint
Constructs a SourceBreakpoint from a JSON value.
- Arguments:
data : JsonValue?
- dap.StackTraceArguments(data: JsonValue?): StackTraceArguments
Constructs a StackTraceArguments from a JSON value.
- Arguments:
data : JsonValue?
- dap.StepInArguments(data: JsonValue?): StepInArguments
Constructs a StepInArguments from a JSON value.
- Arguments:
data : JsonValue?
- dap.StepOutArguments(data: JsonValue?): StepOutArguments
Constructs a StepOutArguments from a JSON value.
- Arguments:
data : JsonValue?
- dap.VariablesArguments(data: JsonValue?): VariablesArguments
Constructs a VariablesArguments from a JSON value.
- Arguments:
data : JsonValue?
13.5.3. JSON serialization
13.5.3.1. JV
- dap.JV(data: EvaluateResponse): JsonValue?
Converts an EvaluateResponse struct to its DAP JSON representation.
- Arguments:
data : EvaluateResponse
- dap.JV(data: Variable): JsonValue?
13.5.4. JSON field accessors
- dap.j_s(val: JsonValue?; defVal: string = ""): string
Returns the string value of a JSON value, or defVal if not a string.
- Arguments:
val : JsonValue?
defVal : string
- dap.job(val: JsonValue?; id: string; defVal: bool = false): bool
Returns a boolean JSON field by name, or defVal if not found.
- Arguments:
val : JsonValue?
id : string
defVal : bool
- dap.joj(val: JsonValue?; id: string): JsonValue?
Returns a nested JSON object field by name, or null if not found.
- Arguments:
val : JsonValue?
id : string
- dap.jon(val: JsonValue?; id: string; defVal: double = 0lf): double
Returns a numeric JSON field by name, or defVal if not found.
- Arguments:
val : JsonValue?
id : string
defVal : double
- dap.jos(val: JsonValue?; id: string; defVal: string = ""): string
Returns a string JSON field by name, or defVal if not found.
- Arguments:
val : JsonValue?
id : string
defVal : string