public static void ToggleBreakpoint(int address, bool toggleEnabled) { if (address >= 0) { Breakpoint breakpoint = BreakpointManager.GetMatchingBreakpoint(address); if (breakpoint != null) { if (toggleEnabled) { breakpoint.SetEnabled(!breakpoint.Enabled); } else { BreakpointManager.RemoveBreakpoint(breakpoint); } } else { breakpoint = new Breakpoint() { BreakOnExec = true, Address = (UInt32)address, IsAbsoluteAddress = false, Enabled = true }; BreakpointManager.AddBreakpoint(breakpoint); } } }
public static void ToggleBreakpoint(AddressInfo info) { if (info.Address < 0) { return; } Breakpoint breakpoint = BreakpointManager.GetMatchingBreakpoint(info); if (breakpoint != null) { BreakpointManager.RemoveBreakpoint(breakpoint); } else { breakpoint = new Breakpoint() { Enabled = true, BreakOnExec = true, Address = (UInt32)info.Address }; if (info.Type != SnesMemoryType.PrgRom) { breakpoint.BreakOnRead = true; breakpoint.BreakOnWrite = true; } breakpoint.MemoryType = info.Type; BreakpointManager.AddBreakpoint(breakpoint); } }
public static void ToggleBreakpoint(int relativeAddress, AddressTypeInfo info, bool toggleEnabled) { if (relativeAddress >= 0 || info.Address >= 0) { Breakpoint breakpoint = BreakpointManager.GetMatchingBreakpoint(relativeAddress, info); if (breakpoint != null) { if (toggleEnabled) { breakpoint.SetEnabled(!breakpoint.Enabled); } else { BreakpointManager.RemoveBreakpoint(breakpoint); } } else { if (info.Address < 0 || info.Type == AddressType.InternalRam) { breakpoint = new Breakpoint() { MemoryType = DebugMemoryType.CpuMemory, BreakOnExec = true, BreakOnRead = true, BreakOnWrite = true, Address = (UInt32)relativeAddress, Enabled = true }; } else { breakpoint = new Breakpoint() { Enabled = true, BreakOnExec = true, Address = (UInt32)info.Address }; if (info.Type != AddressType.PrgRom) { breakpoint.BreakOnRead = true; breakpoint.BreakOnWrite = true; } breakpoint.MemoryType = info.Type.ToMemoryType(); } BreakpointManager.AddBreakpoint(breakpoint); } } }
private void ctrlCodeViewer_MouseDown(object sender, MouseEventArgs e) { int address = ctrlCodeViewer.GetLineNumberAtPosition(e.Y); _lineBreakpoint = BreakpointManager.GetMatchingBreakpoint(address); if (e.Location.X < this.ctrlCodeViewer.CodeMargin / 5) { if (e.Button == System.Windows.Forms.MouseButtons.Left) { if (_lineBreakpoint == null) { Breakpoint bp = new Breakpoint(); bp.Address = (UInt32)address; bp.BreakOnExec = true; BreakpointManager.AddBreakpoint(bp); } else { BreakpointManager.RemoveBreakpoint(_lineBreakpoint); } } } }