Debugger - Fix a lot of stuff regarding Breakpoints
This commit is contained in:
parent
98ad258966
commit
0e4a641a81
|
@ -19,13 +19,47 @@ namespace BizHawk.Client.EmuHawk
|
||||||
{
|
{
|
||||||
foreach (var breakpoint in this)
|
foreach (var breakpoint in this)
|
||||||
{
|
{
|
||||||
|
breakpoint.ReadOnly = false;
|
||||||
breakpoint.Active = false;
|
breakpoint.Active = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
base.Clear();
|
base.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: override all ways to remove
|
public new bool Remove(Breakpoint b)
|
||||||
|
{
|
||||||
|
var breakpoint = Find(x => x == b);
|
||||||
|
if (breakpoint != null)
|
||||||
|
{
|
||||||
|
breakpoint.ReadOnly = false;
|
||||||
|
breakpoint.Active = false;
|
||||||
|
}
|
||||||
|
return base.Remove(b);
|
||||||
|
}
|
||||||
|
|
||||||
|
public new void RemoveAt(int index)
|
||||||
|
{
|
||||||
|
if (index < Count)
|
||||||
|
{
|
||||||
|
var breakpoint = this[index];
|
||||||
|
breakpoint.ReadOnly = false;
|
||||||
|
breakpoint.Active = false;
|
||||||
|
base.RemoveAt(index);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public new int RemoveAll(Predicate<Breakpoint> match)
|
||||||
|
{
|
||||||
|
var removeCount = 0;
|
||||||
|
foreach (var breakpoint in this)
|
||||||
|
{
|
||||||
|
if (match(breakpoint))
|
||||||
|
{
|
||||||
|
Remove(breakpoint);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return removeCount;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Breakpoint
|
public class Breakpoint
|
||||||
|
@ -36,17 +70,13 @@ namespace BizHawk.Client.EmuHawk
|
||||||
public Breakpoint(bool readOnly, IDebuggable core, Action callBack, uint address, MemoryCallbackType type, bool enabled = true)
|
public Breakpoint(bool readOnly, IDebuggable core, Action callBack, uint address, MemoryCallbackType type, bool enabled = true)
|
||||||
{
|
{
|
||||||
_core = core;
|
_core = core;
|
||||||
|
Type = type;
|
||||||
Callback = callBack;
|
Callback = callBack;
|
||||||
Address = address;
|
Address = address;
|
||||||
Active = enabled;
|
|
||||||
Name = "Pause";
|
Name = "Pause";
|
||||||
ReadOnly = readOnly;
|
|
||||||
|
|
||||||
if (enabled)
|
Active = enabled;
|
||||||
{
|
ReadOnly = readOnly;
|
||||||
AddCallback();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Breakpoint(IDebuggable core, Action callBack, uint address, MemoryCallbackType type, bool enabled = true)
|
public Breakpoint(IDebuggable core, Action callBack, uint address, MemoryCallbackType type, bool enabled = true)
|
||||||
|
@ -55,12 +85,21 @@ namespace BizHawk.Client.EmuHawk
|
||||||
Type = type;
|
Type = type;
|
||||||
Callback = callBack;
|
Callback = callBack;
|
||||||
Address = address;
|
Address = address;
|
||||||
Active = enabled;
|
|
||||||
Name = "Pause";
|
Name = "Pause";
|
||||||
if (enabled)
|
|
||||||
{
|
Active = enabled;
|
||||||
AddCallback();
|
}
|
||||||
}
|
|
||||||
|
public Breakpoint(string name, bool readOnly, IDebuggable core, Action callBack, uint address, MemoryCallbackType type, bool enabled = true)
|
||||||
|
{
|
||||||
|
_core = core;
|
||||||
|
Type = type;
|
||||||
|
Callback = callBack;
|
||||||
|
Address = address;
|
||||||
|
Name = name;
|
||||||
|
|
||||||
|
Active = enabled;
|
||||||
|
ReadOnly = readOnly;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Action Callback { get; set; }
|
public Action Callback { get; set; }
|
||||||
|
@ -68,7 +107,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
public MemoryCallbackType Type { get; set; }
|
public MemoryCallbackType Type { get; set; }
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
|
|
||||||
public bool ReadOnly { get; private set; }
|
public bool ReadOnly { get; set; }
|
||||||
|
|
||||||
// Adds an existing callback
|
// Adds an existing callback
|
||||||
public Breakpoint(IDebuggable core, IMemoryCallback callback)
|
public Breakpoint(IDebuggable core, IMemoryCallback callback)
|
||||||
|
|
|
@ -98,11 +98,12 @@ namespace BizHawk.Client.EmuHawk.tools.Debugger
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void CheckForNewBreakpoints()
|
private void CheckForNewBreakpoints()
|
||||||
{
|
{
|
||||||
|
|
||||||
if (MCS != null)
|
if (MCS != null)
|
||||||
{
|
{
|
||||||
foreach (var callback in MCS)
|
foreach (var callback in MCS)
|
||||||
{
|
{
|
||||||
if (!Breakpoints.Any(b =>
|
if (!Breakpoints.Any(b =>
|
||||||
b.Type == callback.Type &&
|
b.Type == callback.Type &&
|
||||||
b.Address == callback.Address &&
|
b.Address == callback.Address &&
|
||||||
b.Name == callback.Name &&
|
b.Name == callback.Name &&
|
||||||
|
@ -174,14 +175,12 @@ namespace BizHawk.Client.EmuHawk.tools.Debugger
|
||||||
UpdateStatsLabel();
|
UpdateStatsLabel();
|
||||||
}
|
}
|
||||||
|
|
||||||
private const string SeekName = "Seek to PC ";
|
private const string SeekName = "Seek to PC 0x";
|
||||||
|
|
||||||
public void AddSeekBreakpoint(uint pcVal, int pcBitSize)
|
public void AddSeekBreakpoint(uint pcVal, int pcBitSize)
|
||||||
{
|
{
|
||||||
Breakpoints.Add(new Breakpoint(true, Core, SeekCallback, pcVal, MemoryCallbackType.Execute)
|
var Name = SeekName + pcVal.ToHexString(pcBitSize / 4);
|
||||||
{
|
Breakpoints.Add(new Breakpoint(Name, true, Core, SeekCallback, pcVal, MemoryCallbackType.Execute));
|
||||||
Name = SeekName + pcVal.ToHexString(pcBitSize / 4)
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RemoveCurrentSeek()
|
public void RemoveCurrentSeek()
|
||||||
|
|
Loading…
Reference in New Issue