gdb: Implement QRcmd (monitor) commands

monitor backtrace (mo bt)
monitor registers (mo reg)
monitor get info
This commit is contained in:
Coxxs
2025-06-23 06:18:34 +08:00
parent 7d189ab2c0
commit 009d319bc2
4 changed files with 144 additions and 4 deletions

View File

@ -4,6 +4,7 @@ using Ryujinx.HLE.HOS.Kernel.Memory;
using Ryujinx.HLE.HOS.Kernel.Threading;
using Ryujinx.HLE.Loaders.Elf;
using Ryujinx.Memory;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@ -17,7 +18,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Process
private readonly KProcess _owner;
private class Image
public class Image
{
public ulong BaseAddress { get; }
public ulong Size { get; }
@ -54,6 +55,15 @@ namespace Ryujinx.HLE.HOS.Kernel.Process
trace.AppendLine($"Process: {_owner.Name}, PID: {_owner.Pid}");
string ThreadName = thread.GetThreadName();
if (!String.IsNullOrEmpty(ThreadName))
{
trace.AppendLine($"Thread ID: {thread.ThreadUid} ({ThreadName})");
} else {
trace.AppendLine($"Thread ID: {thread.ThreadUid}");
}
void AppendTrace(ulong address)
{
if (AnalyzePointer(out PointerInfo info, address, thread))
@ -283,7 +293,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Process
return null;
}
private string GetGuessedNsoNameFromIndex(int index)
public string GetGuessedNsoNameFromIndex(int index)
{
if ((uint)index > 11)
{
@ -316,6 +326,16 @@ namespace Ryujinx.HLE.HOS.Kernel.Process
}
}
public List<Image> GetLoadedImages()
{
EnsureLoaded();
lock (_images)
{
return [.. _images];
}
}
private void EnsureLoaded()
{
if (Interlocked.CompareExchange(ref _loaded, 1, 0) == 0)