// Copyright (C) 2026 SharpEmu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later using SharpEmu.Core.Cpu.Debugging; using SharpEmu.Debugger.Breakpoints; using SharpEmu.HLE; namespace SharpEmu.Debugger.Session; /// /// Describes a stop delivered to debugger clients: why the target stopped, /// where, and the register snapshot at that point. /// public sealed class DebugStopEvent { public DebugStopEvent( DebugStopReason reason, DebugRegisterFile registers, CpuDebugFrameKind frameKind, string frameLabel, Breakpoint? breakpoint = null, OrbisGen2Result? result = null, string? detail = null, string? opcodeBytes = null, CpuStallInfo? stallInfo = null) { Reason = reason; Registers = registers; FrameKind = frameKind; FrameLabel = frameLabel ?? string.Empty; Breakpoint = breakpoint; Result = result; Detail = detail; OpcodeBytes = opcodeBytes; StallInfo = stallInfo; } public DebugStopReason Reason { get; } /// The instruction pointer where the target stopped. public ulong Address => Registers.Rip; public DebugRegisterFile Registers { get; } public CpuDebugFrameKind FrameKind { get; } public string FrameLabel { get; } /// The breakpoint responsible for the stop, when applicable. public Breakpoint? Breakpoint { get; } /// /// The frame result for a stop; null for /// non-fault stops. /// public OrbisGen2Result? Result { get; } /// A human-readable summary of a fault, when applicable. public string? Detail { get; } /// /// A hex preview of the bytes at (the faulting /// instruction), when the stop is a fault and the bytes were readable. /// public string? OpcodeBytes { get; } /// Structured backend evidence for a stall stop. public CpuStallInfo? StallInfo { get; } }