2015-08-02 19:27:02 -04:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
2016-01-09 13:15:43 -05:00
|
|
|
|
using System.Runtime.InteropServices;
|
2015-08-02 19:27:02 -04:00
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
namespace Mesen.GUI.Debugger
|
|
|
|
|
{
|
|
|
|
|
public class Breakpoint
|
|
|
|
|
{
|
2016-01-10 00:33:33 -05:00
|
|
|
|
|
2016-01-09 13:15:43 -05:00
|
|
|
|
public bool BreakOnRead = false;
|
|
|
|
|
public bool BreakOnWrite = false;
|
|
|
|
|
public bool BreakOnReadVram = false;
|
|
|
|
|
public bool BreakOnWriteVram = false;
|
|
|
|
|
public bool BreakOnExec = true;
|
2015-08-02 19:27:02 -04:00
|
|
|
|
|
|
|
|
|
public bool Enabled = true;
|
|
|
|
|
public UInt32 Address;
|
2016-01-09 13:15:43 -05:00
|
|
|
|
public bool SpecificAddress = true;
|
|
|
|
|
public bool IsAbsoluteAddress = false;
|
|
|
|
|
public string Condition = "";
|
2015-08-02 19:27:02 -04:00
|
|
|
|
|
2016-01-09 13:15:43 -05:00
|
|
|
|
public void SetEnabled(bool enabled)
|
2015-08-02 19:27:02 -04:00
|
|
|
|
{
|
2016-01-09 13:15:43 -05:00
|
|
|
|
Enabled = enabled;
|
2016-01-10 00:33:33 -05:00
|
|
|
|
BreakpointManager.RefreshBreakpoints(this);
|
2015-08-02 19:27:02 -04:00
|
|
|
|
}
|
|
|
|
|
|
2016-01-09 13:15:43 -05:00
|
|
|
|
public BreakpointType Type
|
2015-08-02 19:27:02 -04:00
|
|
|
|
{
|
2016-01-09 13:15:43 -05:00
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
BreakpointType type = BreakpointType.Global;
|
|
|
|
|
if(BreakOnRead) {
|
|
|
|
|
type |= BreakpointType.Read;
|
|
|
|
|
}
|
|
|
|
|
if(BreakOnWrite) {
|
|
|
|
|
type |= BreakpointType.Write;
|
|
|
|
|
}
|
|
|
|
|
if(BreakOnExec) {
|
|
|
|
|
type |= BreakpointType.Execute;
|
|
|
|
|
}
|
|
|
|
|
if(BreakOnReadVram) {
|
|
|
|
|
type |= BreakpointType.ReadVram;
|
|
|
|
|
}
|
|
|
|
|
if(BreakOnWriteVram) {
|
|
|
|
|
type |= BreakpointType.WriteVram;
|
|
|
|
|
}
|
|
|
|
|
return type;
|
|
|
|
|
}
|
2015-08-02 19:27:02 -04:00
|
|
|
|
}
|
|
|
|
|
|
2016-01-09 13:15:43 -05:00
|
|
|
|
public InteropBreakpoint ToInteropBreakpoint()
|
2015-08-02 19:27:02 -04:00
|
|
|
|
{
|
2016-01-09 13:15:43 -05:00
|
|
|
|
InteropBreakpoint bp = new InteropBreakpoint() { Address = SpecificAddress ? (Int32)Address : -1, Type = Type, IsAbsoluteAddress = IsAbsoluteAddress };
|
|
|
|
|
bp.Condition = new byte[1000];
|
|
|
|
|
byte[] condition = Encoding.UTF8.GetBytes(Condition);
|
|
|
|
|
Array.Copy(condition, bp.Condition, condition.Length);
|
|
|
|
|
return bp;
|
2015-08-02 19:27:02 -04:00
|
|
|
|
}
|
|
|
|
|
}
|
2016-01-09 13:15:43 -05:00
|
|
|
|
}
|