gdb: more cleanups

- convert GdbRegisters utilities into extensions on IExecutionContext

- add a Write/Read Register helper on Debugger that handles 32/64 bit instead of doing that for every usage of register reading/writing
This commit is contained in:
GreemDev
2025-10-18 03:01:21 -05:00
parent 2a2ab523cb
commit e11eff0f41
4 changed files with 26 additions and 33 deletions

View File

@@ -112,15 +112,22 @@ namespace Ryujinx.HLE.Debugger
}
}
internal bool WriteRegister(IExecutionContext ctx, int gdbRegId, StringStream ss) =>
IsProcess32Bit
? ctx.WriteRegister32(gdbRegId, ss)
: ctx.WriteRegister64(gdbRegId, ss);
internal string ReadRegister(IExecutionContext ctx, int gdbRegId) =>
IsProcess32Bit
? ctx.ReadRegister32(gdbRegId)
: ctx.ReadRegister64(gdbRegId);
public string GetStackTrace()
{
if (GThread == null)
return "No thread selected\n";
if (Process == null)
return "No application process found\n";
return Process.Debugger.GetGuestStackTrace(DebugProcess.GetThread(GThread.Value));
return Process?.Debugger?.GetGuestStackTrace(DebugProcess.GetThread(GThread.Value)) ?? "No application process found\n";
}
public string GetRegisters()
@@ -128,10 +135,7 @@ namespace Ryujinx.HLE.Debugger
if (GThread == null)
return "No thread selected\n";
if (Process == null)
return "No application process found\n";
return Process.Debugger.GetCpuRegisterPrintout(DebugProcess.GetThread(GThread.Value));
return Process?.Debugger?.GetCpuRegisterPrintout(DebugProcess.GetThread(GThread.Value)) ?? "No application process found\n";
}
public string GetMinidump()