// Copyright (C) 2026 SharpEmu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
namespace SharpEmu.Debugger.Session;
///
/// The inspection and control surface a debugger front-end (for example a
/// network server) drives. Register and memory accessors succeed only while the
/// target is ; they return false
/// otherwise so callers never read torn state from a running guest.
///
public interface IDebugTarget
{
/// The current execution state.
DebuggerRunState State { get; }
/// The most recent stop, or null if the target has not stopped yet.
DebugStopEvent? LastStop { get; }
/// Reads the integer register file. Fails unless paused.
bool TryGetRegisters(out DebugRegisterFile registers);
/// Writes a single register. Fails unless paused.
bool TrySetRegister(DebugRegisterId id, ulong value);
/// Reads guest memory into . Fails unless paused.
bool TryReadMemory(ulong address, Span destination);
/// Writes guest memory from . Fails unless paused.
bool TryWriteMemory(ulong address, ReadOnlySpan source);
/// Reads a 128-bit XMM register. Fails unless paused.
bool TryReadXmm(int registerIndex, out ulong low, out ulong high);
///
/// Resumes a paused target. Returns false when the target was not paused.
///
bool Continue();
///
/// Resumes a paused target and stops again at the next frame boundary.
/// Returns false when the target was not paused.
///
bool StepFrame();
///
/// Requests that a running target stop at the next frame boundary. Has no
/// effect if the target is already paused or terminated.
///
void RequestPause();
}