Documentation
¶
Overview ¶
Package dap provides a small yottacode-owned Debug Adapter Protocol client. It delegates protocol structs and message framing to github.com/google/go-dap, while this package owns request correlation, event delivery, timeouts, and debug-adapter process teardown policy.
Index ¶
- Variables
- type Client
- func (c *Client) Attach(ctx context.Context, args map[string]any) error
- func (c *Client) Close(context.Context) error
- func (c *Client) ConfigurationDone(ctx context.Context) error
- func (c *Client) Continue(ctx context.Context, args godap.ContinueArguments) (godap.ContinueResponseBody, error)
- func (c *Client) Disconnect(ctx context.Context, args godap.DisconnectArguments) error
- func (c *Client) Done() <-chan error
- func (c *Client) Evaluate(ctx context.Context, args godap.EvaluateArguments) (godap.EvaluateResponseBody, error)
- func (c *Client) EventOverflow() bool
- func (c *Client) Events() <-chan godap.EventMessage
- func (c *Client) Initialize(ctx context.Context, args godap.InitializeRequestArguments) (godap.Capabilities, error)
- func (c *Client) Launch(ctx context.Context, args map[string]any) error
- func (c *Client) Next(ctx context.Context, args godap.NextArguments) error
- func (c *Client) Scopes(ctx context.Context, args godap.ScopesArguments) (godap.ScopesResponseBody, error)
- func (c *Client) SetBreakpoints(ctx context.Context, args godap.SetBreakpointsArguments) (godap.SetBreakpointsResponseBody, error)
- func (c *Client) StackTrace(ctx context.Context, args godap.StackTraceArguments) (godap.StackTraceResponseBody, error)
- func (c *Client) StepIn(ctx context.Context, args godap.StepInArguments) error
- func (c *Client) StepOut(ctx context.Context, args godap.StepOutArguments) error
- func (c *Client) Variables(ctx context.Context, args godap.VariablesArguments) (godap.VariablesResponseBody, error)
- type ClientOptions
- type Session
- type SessionOptions
Constants ¶
This section is empty.
Variables ¶
var ( // ErrRequestTimeout marks a DAP request that did not receive a response // before the configured request deadline. ErrRequestTimeout = errors.New("DAP request timed out") // ErrProtocolMalformed marks invalid DAP framing or a message that could not // be decoded by the go-dap protocol codec. ErrProtocolMalformed = errors.New("malformed DAP protocol message") // ErrSessionClosed marks attempts to use a client after its transport has // closed or after the adapter process has exited. ErrSessionClosed = errors.New("DAP session closed") )
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client speaks DAP over one bidirectional stream. It is safe for concurrent requests; asynchronous adapter events are delivered through Events.
func NewClient ¶
func NewClient(conn io.ReadWriteCloser, opts ClientOptions) (*Client, error)
NewClient starts the reader loop for conn and returns a DAP client bound to that transport. The caller remains responsible for closing process resources unless it uses StartSession.
func (*Client) Attach ¶
Attach connects to a debuggee through implementation-specific adapter arguments.
func (*Client) Close ¶
Close closes the underlying transport and releases pending requests. It does not send a DAP disconnect request; callers that need protocol-level teardown should call Disconnect first.
func (*Client) ConfigurationDone ¶
ConfigurationDone tells the adapter that breakpoint configuration is complete.
func (*Client) Continue ¶
func (c *Client) Continue(ctx context.Context, args godap.ContinueArguments) (godap.ContinueResponseBody, error)
Continue resumes execution for a thread.
func (*Client) Disconnect ¶
Disconnect requests protocol-level teardown from the debug adapter.
func (*Client) Done ¶
Done reports why the reader loop ended. A nil error means the client was closed intentionally.
func (*Client) Evaluate ¶
func (c *Client) Evaluate(ctx context.Context, args godap.EvaluateArguments) (godap.EvaluateResponseBody, error)
Evaluate evaluates an expression in the adapter-selected context.
func (*Client) EventOverflow ¶
EventOverflow reports whether any adapter events were dropped because the consumer fell behind. Lifecycle events are preserved preferentially.
func (*Client) Events ¶
func (c *Client) Events() <-chan godap.EventMessage
Events returns the asynchronous event stream from the debug adapter. The stream closes when the client closes or the adapter transport fails.
func (*Client) Initialize ¶
func (c *Client) Initialize(ctx context.Context, args godap.InitializeRequestArguments) (godap.Capabilities, error)
Initialize sends DAP initialize and returns the adapter capabilities.
func (*Client) Scopes ¶
func (c *Client) Scopes(ctx context.Context, args godap.ScopesArguments) (godap.ScopesResponseBody, error)
Scopes returns variable scopes for a stack frame.
func (*Client) SetBreakpoints ¶
func (c *Client) SetBreakpoints(ctx context.Context, args godap.SetBreakpointsArguments) (godap.SetBreakpointsResponseBody, error)
SetBreakpoints replaces breakpoints for one source file.
func (*Client) StackTrace ¶
func (c *Client) StackTrace(ctx context.Context, args godap.StackTraceArguments) (godap.StackTraceResponseBody, error)
StackTrace returns frames for a stopped thread.
func (*Client) Variables ¶
func (c *Client) Variables(ctx context.Context, args godap.VariablesArguments) (godap.VariablesResponseBody, error)
Variables returns children for a DAP variables reference.
type ClientOptions ¶
ClientOptions tunes request behavior for an already-open DAP transport.
type Session ¶
Session owns a debug adapter process and its DAP client. Closing the session first attempts protocol-level disconnect, then kills the process if needed.
func StartSession ¶
func StartSession(ctx context.Context, opts SessionOptions) (*Session, error)
StartSession starts a debug adapter process and wires its stdio to a Client.
type SessionOptions ¶
type SessionOptions struct {
Command string
Args []string
Dir string
Env []string
// StartupTimeout is reserved for future adapter readiness probing. The first
// initialize request currently proves protocol readiness and is bounded by
// RequestTimeout.
StartupTimeout time.Duration
RequestTimeout time.Duration
}
SessionOptions configures a supervised debug adapter process.