Documentation
¶
Overview ¶
Package client implements the debugger's connection to a debug server. It dials the server's TCP port, switches the connection to JSON mode, and then exposes two streams: in-order command responses and pushed watch/break events. The package has no UI dependencies.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is one server connection. Commands are matched to responses by order: the server executes one command at a time and emits exactly one resp or error line per command, so the oldest pending command owns the next response line.
func Dial ¶
Dial connects to a debug server, switches it to JSON mode, and starts the reader. The mode switch doubles as a handshake: if the expected mode response does not arrive within the timeout, the endpoint is not a debug server and Dial fails.
func (*Client) Close ¶
func (c *Client) Close()
Close tears the connection down. It is safe to call more than once and concurrently with in-flight commands, which complete with errors.
func (*Client) Do ¶
Do queues one command line and returns a channel that delivers its response exactly once. On a dead connection the response is an immediate error. A line containing a newline is rejected: it would reach the server as multiple commands and desynchronize the in-order response matching.
type Event ¶
type Event struct {
Kind string `json:"type"`
Frame uint64 `json:"frame"`
Addr uint32 `json:"addr"`
Width int `json:"width"`
Prev uint32 `json:"prev"`
Cur uint32 `json:"cur"`
Cond string `json:"cond"`
}
Event is one pushed watch or break notification. Kind is "watch" or "break". Cond is the break condition and is empty for watches. A break event means emulation is now paused.
type Response ¶
type Response struct {
Data json.RawMessage
Err error
}
Response is the outcome of one command. Err is set for both server-reported errors and connection failures; Data is the resp envelope payload otherwise.