Add comments on debug stuff & fix warnings

This commit is contained in:
svc64 2023-10-06 15:53:17 +03:00
parent 65d7a16a87
commit 0c57663ea3
3 changed files with 28 additions and 7 deletions

View file

@ -177,6 +177,7 @@ namespace ARMeilleure.Instructions
ExecutionContext context = GetContext(); ExecutionContext context = GetContext();
// If debugging, we'll handle interrupts outside
if (Optimizations.EnableDebugging && context.Interrupted) if (Optimizations.EnableDebugging && context.Interrupted)
{ {
return false; return false;

View file

@ -102,10 +102,8 @@ namespace ARMeilleure.State
private readonly ExceptionCallback _undefinedCallback; private readonly ExceptionCallback _undefinedCallback;
internal int ShouldStep; internal int ShouldStep;
internal int DebugStopped; public ulong DebugPc { get; set; }
public Barrier StepBarrier { get; }
public ulong DebugPc; // This is only valid while debugging is enabled.
public Barrier StepBarrier = new Barrier(2);
public ExecutionContext( public ExecutionContext(
IJitMemoryAllocator allocator, IJitMemoryAllocator allocator,
@ -123,6 +121,7 @@ namespace ARMeilleure.State
_undefinedCallback = undefinedCallback; _undefinedCallback = undefinedCallback;
Running = true; Running = true;
StepBarrier = new Barrier(2);
_nativeContext.SetCounter(MinCountForCheck); _nativeContext.SetCounter(MinCountForCheck);
} }

View file

@ -115,10 +115,31 @@ namespace Ryujinx.Cpu
/// </remarks> /// </remarks>
void StopRunning(); void StopRunning();
// TODO: comments /// <summary>
/// Requests the thread to stop running temporarily and call <see cref="ExceptionCallbacks.InterruptCallback"/>.
/// </summary>
/// <remarks>
/// The thread might not pause immediately.
/// One must not assume that guest code is no longer being executed by the thread after calling this function.
/// After single stepping, the thread should signal and wait on <see cref="StepBarrier"/> twice to allow
/// changing the thread state after stepping.
/// </remarks>
void RequestDebugStep(); void RequestDebugStep();
ulong DebugPc { get; set; } /// <summary>
/// Step barrier
/// </summary>
/// <remarks>
/// Should be signaled and waited on twice after single-stepping.
/// </remarks>
Barrier StepBarrier { get; } Barrier StepBarrier { get; }
/// <summary>
/// Current Program Counter (for debugging).
/// </summary>
/// <remarks>
/// PC register for the debugger. Must not be accessed while the thread isn't stopped for debugging.
/// </remarks>
ulong DebugPc { get; set; }
} }
} }