debugdap

package
v0.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 5, 2026 License: MIT Imports: 9 Imported by: 0

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

func Accept(ln net.Listener, cfg Config) error

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

func ListenAndServe(addr string, cfg Config) error

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.

func Serve

func Serve(conn io.ReadWriter, cfg Config) error

Serve runs one DAP session over conn until the client disconnects or the stream closes. It is the per-connection entry point (one Config-built session per 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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL