vader/tools/dap
Types
DapProgram :: struct A compiled launch target. state == null marks a front-end failure: the
server then reports error as stderr output and terminates without running.
Fields
state: VmState | null Prepared VM state, or null when the target failed to compile.
entry_index: i32 Entry fn index for exec_entry (the named file's main).
error: string Human-readable diagnostics rendered on a compile failure ; "" on success.
Functions
run_dap_server :: fn(compile: fn(string) -> DapProgram) -> i32 Run the DAP server loop on stdio until disconnect (or EOF).
compile is injected by cli::cmd_dap so vader/tools/dap doesn't import
vader/tools/cli (which would close an import cycle): it maps a launch-target
path to its compiled DapProgram.
Parameters
| compile | fn(string) -> DapProgram | compiles a launch-target path to a DapProgram. |
Returns
i32 0 on a clean shutdown, 1 on a transport error.encode_response :: fn(seq: i32, request_seq: i32, command: string, success: bool, body: JsonValue) -> string Encode a DAP response frame body : { seq, type: "response", request_seq, success, command, body }.
Parameters
| seq | i32 | this message's monotonic sequence number. |
| request_seq | i32 | the seq of the request being answered. |
| command | string | the request's command (echoed back). |
| success | bool | whether the request succeeded. |
| body | JsonValue | command-specific result payload (use empty_body() when the command carries none). |
Returns
string the serialized JSON, ready for write_frame.encode_event :: fn(seq: i32, event: string, body: JsonValue) -> string Encode a DAP event frame body : { seq, type: "event", event, body }.
Parameters
| seq | i32 | this message's monotonic sequence number. |
| event | string | the event name (initialized, output, terminated, …). |
| body | JsonValue | event-specific payload (empty_body() when none). |
Returns
string the serialized JSON, ready for write_frame.empty_body :: fn() -> JsonValue An empty JSON object: the body for commands / events that carry none.
Returns
JsonValue