// Copyright (C) 2026 SharpEmu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later namespace SharpEmu.Debugger.Protocol; /// /// Frames debugger traffic on a connection. A protocol turns bytes into /// objects and serialises /// replies plus asynchronous events (stops, resumes, termination) back to the /// client. Swapping the implementation (line-delimited JSON today, a GDB remote /// serial stub later) leaves the session and server untouched. /// public interface IDebugProtocol { /// A short protocol name reported in the handshake. string Name { get; } /// /// Reads the next request, or null at end of stream. Parse failures are /// surfaced as a request with a reserved error command rather than throwing. /// Task ReadRequestAsync(TextReader reader, CancellationToken cancellationToken); /// Writes a reply to a request. Task WriteResponseAsync(TextWriter writer, DebugResponse response, CancellationToken cancellationToken); /// Writes an unsolicited event (for example a stop notification). Task WriteEventAsync( TextWriter writer, string eventName, IReadOnlyDictionary data, CancellationToken cancellationToken); }