Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Register ¶
func Register(lang languages.Language, cfg *LanguageConfig)
Register adds a language config to the DAP registry.
Types ¶
type BreakpointResult ¶
BreakpointResult represents a verified breakpoint.
type Client ¶
type Client interface {
// Launch starts a new debug target process.
Launch(ctx context.Context, program string, args []string, env map[string]string) error
// Attach connects to an already-running process.
Attach(ctx context.Context, pid int) error
// SetBreakpoints sets breakpoints for a file, replacing any previous ones.
SetBreakpoints(ctx context.Context, file string, lines []int) ([]BreakpointResult, error)
// SetFunctionBreakpoints sets breakpoints by function name.
SetFunctionBreakpoints(ctx context.Context, names []string) ([]BreakpointResult, error)
// Continue resumes execution until next breakpoint or termination.
Continue(ctx context.Context, threadID int) error
// Next steps over one source line.
Next(ctx context.Context, threadID int) error
// StepIn steps into a function call.
StepIn(ctx context.Context, threadID int) error
// StepOut steps out of the current function.
StepOut(ctx context.Context, threadID int) error
// Pause suspends execution of a thread.
Pause(ctx context.Context, threadID int) error
// Threads returns all threads in the debuggee.
Threads(ctx context.Context) ([]ThreadInfo, error)
// StackTrace returns the call stack for a thread.
StackTrace(ctx context.Context, threadID int) ([]StackFrame, error)
// Scopes returns the variable scopes for a stack frame.
Scopes(ctx context.Context, frameID int) ([]Scope, error)
// Variables returns child variables for a variablesReference.
Variables(ctx context.Context, ref int) ([]Variable, error)
// Evaluate evaluates an expression in the context of a frame.
Evaluate(ctx context.Context, frameID int, expression string) (*Variable, error)
// OnStopped registers a callback for stopped events.
OnStopped(handler func(StoppedEvent))
// OnOutput registers a callback for output events.
OnOutput(handler func(OutputEvent))
// OnTerminated registers a callback for when the debuggee exits.
OnTerminated(handler func())
// Close terminates the debug session and shuts down the adapter.
Close(ctx context.Context) error
}
Client is a language-agnostic DAP client interface. Implementations talk to a debug adapter (e.g. dlv dap, debugpy) running inside a companion environment (Docker, Nix, or local).
type LanguageConfig ¶
type LanguageConfig struct {
// CompanionImage returns the Docker image for this language companion.
// May return nil if the language can run locally or via Nix.
CompanionImage func(ctx context.Context) (*resources.DockerImage, error)
// DAPBinary is the debug adapter binary (e.g. "dlv").
DAPBinary string
// DAPListenArgs returns the arguments to start the DAP server on a given port.
// Never hardcode a port.
DAPListenArgs func(port int) []string
// LanguageID is the language identifier (e.g. "go", "python").
LanguageID string
// SetupRunner is an optional hook to configure the companion runner
// before Init (e.g. mount caches). May be nil.
// Uses the CompanionRunner interface -- works with any backend.
SetupRunner func(ctx context.Context, runner runners.CompanionRunner, sourceDir string)
}
LanguageConfig holds per-language settings for the DAP companion.
type OutputEvent ¶
OutputEvent is emitted when the debuggee produces output.
type StackFrame ¶
StackFrame represents a frame in a call stack.
type StoppedEvent ¶
type StoppedEvent struct {
ThreadID int
Reason string // "breakpoint", "step", "exception", "pause"
}
StoppedEvent is emitted when the debuggee stops.
type ThreadInfo ¶
ThreadInfo represents a thread in the debuggee.
Click to show internal directories.
Click to hide internal directories.