Move ProcessInfo and Minidump to HleProcessDebugger (ryubing/ryujinx!187)

See merge request ryubing/ryujinx!187
This commit is contained in:
Coxxs
2025-10-22 16:20:13 -05:00
committed by GreemDev
parent 91da244c02
commit 0c165c3f62
2 changed files with 120 additions and 54 deletions

View File

@@ -62,38 +62,16 @@ namespace Ryujinx.HLE.Debugger
public string GetMinidump()
{
StringBuilder response = new();
response.AppendLine("=== Begin Minidump ===\n");
response.AppendLine(GetProcessInfo());
if (Process is not { } kProcess)
return "No application process found\n";
foreach (KThread thread in GetThreads())
{
response.AppendLine($"=== Thread {thread.ThreadUid} ===");
try
{
string stackTrace = Process.Debugger.GetGuestStackTrace(thread);
response.AppendLine(stackTrace);
}
catch (Exception e)
{
response.AppendLine($"[Error getting stack trace: {e.Message}]");
}
if (kProcess.Debugger is not { } debugger)
return $"Error getting minidump: debugger is null\n";
try
{
string registers = Process.Debugger.GetCpuRegisterPrintout(thread);
response.AppendLine(registers);
}
catch (Exception e)
{
response.AppendLine($"[Error getting registers: {e.Message}]");
}
}
var response = debugger.GetMinidump();
response.AppendLine("=== End Minidump ===");
Logger.Info?.Print(LogClass.GdbStub, response.ToString());
return response.ToString();
Logger.Info?.Print(LogClass.GdbStub, response);
return response;
}
public string GetProcessInfo()
@@ -103,32 +81,10 @@ namespace Ryujinx.HLE.Debugger
if (Process is not { } kProcess)
return "No application process found\n";
StringBuilder sb = new();
if (kProcess.Debugger is not { } debugger)
return $"Error getting process info: debugger is null\n";
sb.AppendLine($"Program Id: 0x{kProcess.TitleId:x16}");
sb.AppendLine($"Application: {(kProcess.IsApplication ? 1 : 0)}");
sb.AppendLine("Layout:");
sb.AppendLine(
$" Alias: 0x{kProcess.MemoryManager.AliasRegionStart:x10} - 0x{kProcess.MemoryManager.AliasRegionEnd - 1:x10}");
sb.AppendLine(
$" Heap: 0x{kProcess.MemoryManager.HeapRegionStart:x10} - 0x{kProcess.MemoryManager.HeapRegionEnd - 1:x10}");
sb.AppendLine(
$" Aslr: 0x{kProcess.MemoryManager.AslrRegionStart:x10} - 0x{kProcess.MemoryManager.AslrRegionEnd - 1:x10}");
sb.AppendLine(
$" Stack: 0x{kProcess.MemoryManager.StackRegionStart:x10} - 0x{kProcess.MemoryManager.StackRegionEnd - 1:x10}");
sb.AppendLine("Modules:");
HleProcessDebugger debugger = kProcess.Debugger;
if (debugger != null)
{
foreach (HleProcessDebugger.Image image in debugger.GetLoadedImages())
{
ulong endAddress = image.BaseAddress + image.Size - 1;
sb.AppendLine($" 0x{image.BaseAddress:x10} - 0x{endAddress:x10} {image.Name}");
}
}
return sb.ToString();
return debugger.GetProcessInfoPrintout();
}
catch (Exception e)
{