Documentation
¶
Overview ¶
Package debugdap exposes a luapure debug Session over the Debug Adapter Protocol (DAP), the protocol Visual Studio Code and other editors speak. A client attaches over TCP and drives breakpoints, stepping, stack/variable inspection and expression evaluation; the debuggee's source is served on demand, so the client needs no local copy. Like the rest of luapure it has no external dependencies — only the standard library and the luapure package.
DAP is not JSON-RPC: messages are length-prefixed (Content-Length headers, like LSP) and come in three kinds — request, response, event — and control is asynchronous (a continue request returns immediately; the matching stop arrives later as a 'stopped' event). This package implements that wire format directly (protocol.go) and an Adapter that maps it onto a luapure Session.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Accept ¶
Accept serves DAP connections from ln until it closes. Exposed so a host can listen itself (e.g. on a chosen port) and hand the listener over.
func ListenAndServe ¶
ListenAndServe accepts DAP connections on addr (e.g. ":4711") and serves each with cfg until the listener closes. Each connection is an independent debug session, so one client debugs one program at a time over its connection.
Types ¶
type Config ¶
type Config struct {
// NewState returns a fresh, library-loaded LState for each launched program.
NewState func() *luapure.LState
// Source resolves a program id to its Lua text — used to load a launched
// program and to answer DAP 'source' requests. May be nil if launches always
// carry their source inline (the 'program' launch arg as text via 'source').
Source luapure.SourceResolver
}
Config configures a DAP session.