See merge request ryubing/ryujinx!171
This commit is contained in:
Coxxs 2025-10-16 19:53:51 -05:00 committed by GreemDev
parent 9aacf9b37b
commit 8e941e4a8f
4 changed files with 11 additions and 33 deletions

View File

@ -11,12 +11,9 @@ namespace Ryujinx.HLE.Debugger
{
public byte[] OriginalData { get; }
public bool IsStep { get; }
public Breakpoint(byte[] originalData, bool isStep)
public Breakpoint(byte[] originalData)
{
OriginalData = originalData;
IsStep = isStep;
}
}
@ -44,7 +41,7 @@ namespace Ryujinx.HLE.Debugger
/// <param name="length">The length of the instruction to replace.</param>
/// <param name="isStep">Indicates if this is a single-step breakpoint.</param>
/// <returns>True if the breakpoint was set successfully; otherwise, false.</returns>
public bool SetBreakPoint(ulong address, ulong length, bool isStep = false)
public bool SetBreakPoint(ulong address, ulong length)
{
if (_breakpoints.ContainsKey(address))
{
@ -71,7 +68,7 @@ namespace Ryujinx.HLE.Debugger
return false;
}
var breakpoint = new Breakpoint(originalInstruction, isStep);
var breakpoint = new Breakpoint(originalInstruction);
if (_breakpoints.TryAdd(address, breakpoint))
{
Logger.Debug?.Print(LogClass.GdbStub, $"Breakpoint set at 0x{address:X16}");
@ -124,30 +121,6 @@ namespace Ryujinx.HLE.Debugger
Logger.Debug?.Print(LogClass.GdbStub, "All breakpoints cleared.");
}
/// <summary>
/// Clears all currently set single-step software breakpoints.
/// </summary>
public void ClearAllStepBreakpoints()
{
var stepBreakpoints = _breakpoints.Where(p => p.Value.IsStep).ToList();
if (stepBreakpoints.Count == 0)
{
return;
}
foreach (var bp in stepBreakpoints)
{
if (_breakpoints.TryRemove(bp.Key, out Breakpoint removedBreakpoint))
{
WriteMemory(bp.Key, removedBreakpoint.OriginalData);
}
}
Logger.Debug?.Print(LogClass.GdbStub, "All step breakpoints cleared.");
}
private byte[] GetBreakInstruction(ulong length)
{
if (_debugger.IsProcessAarch32)

View File

@ -103,6 +103,10 @@ namespace Ryujinx.HLE.Debugger
{
Logger.Error?.Print(LogClass.GdbStub, "Error while processing GDB messages", e);
}
catch (ObjectDisposedException e)
{
Logger.Error?.Print(LogClass.GdbStub, "Error while processing GDB messages", e);
}
}
}
@ -304,6 +308,7 @@ namespace Ryujinx.HLE.Debugger
WriteStream = null;
ClientSocket.Close();
ClientSocket = null;
CommandProcessor = null;
BreakpointManager.ClearAll();
}

View File

@ -310,7 +310,7 @@ namespace Ryujinx.HLE.Debugger.Gdb
switch (type)
{
case "0": // Software breakpoint
if (!Commands.Debugger.BreakpointManager.SetBreakPoint(addr, len, false))
if (!Commands.Debugger.BreakpointManager.SetBreakPoint(addr, len))
{
Commands.ReplyError();
return;
@ -325,7 +325,7 @@ namespace Ryujinx.HLE.Debugger.Gdb
Commands.ReplyError();
return;
default:
Commands. ReplyError();
Commands.ReplyError();
return;
}
}

View File

@ -17,7 +17,7 @@ namespace Ryujinx.HLE.Debugger
private static string GetEmbeddedResourceContent(string resourceName)
{
Stream stream = System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("Ryujinx.HLE.Debugger.GdbXml." + resourceName);
Stream stream = System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("Ryujinx.HLE.Debugger.Gdb.Xml." + resourceName);
StreamReader reader = new StreamReader(stream);
string result = reader.ReadToEnd();
reader.Dispose();