mirror of
https://git.ryujinx.app/ryubing/ryujinx.git
synced 2025-10-18 23:24:37 +00:00
gdb: Cleanup (ryubing/ryujinx!171)
See merge request ryubing/ryujinx!171
This commit is contained in:
parent
9aacf9b37b
commit
8e941e4a8f
@ -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)
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user