Breakpoints - GUI improvements
This commit is contained in:
parent
b32047ac8b
commit
1f19a71dbc
12 changed files with 346 additions and 159 deletions
|
@ -9,6 +9,7 @@ namespace Mesen.GUI.Debugger
|
|||
{
|
||||
public class Breakpoint
|
||||
{
|
||||
|
||||
public bool BreakOnRead = false;
|
||||
public bool BreakOnWrite = false;
|
||||
public bool BreakOnReadVram = false;
|
||||
|
@ -24,6 +25,7 @@ namespace Mesen.GUI.Debugger
|
|||
public void SetEnabled(bool enabled)
|
||||
{
|
||||
Enabled = enabled;
|
||||
BreakpointManager.RefreshBreakpoints(this);
|
||||
}
|
||||
|
||||
public BreakpointType Type
|
||||
|
|
81
GUI.NET/Debugger/BreakpointManager.cs
Normal file
81
GUI.NET/Debugger/BreakpointManager.cs
Normal file
|
@ -0,0 +1,81 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Mesen.GUI.Debugger
|
||||
{
|
||||
public class BreakpointManager
|
||||
{
|
||||
private static List<Breakpoint> _breakpoints = new List<Breakpoint>();
|
||||
|
||||
public static event EventHandler BreakpointsChanged;
|
||||
public static List<Breakpoint> Breakpoints { get { return _breakpoints; } }
|
||||
|
||||
public static void RefreshBreakpoints(Breakpoint bp = null)
|
||||
{
|
||||
if(BreakpointsChanged != null) {
|
||||
BreakpointsChanged(bp, null);
|
||||
}
|
||||
|
||||
SetBreakpoints();
|
||||
}
|
||||
|
||||
public static void EditBreakpoint(Breakpoint bp)
|
||||
{
|
||||
new frmBreakpoint(bp).ShowDialog();
|
||||
RefreshBreakpoints(bp);
|
||||
}
|
||||
|
||||
public static void RemoveBreakpoint(Breakpoint bp)
|
||||
{
|
||||
Breakpoints.Remove(bp);
|
||||
RefreshBreakpoints(bp);
|
||||
}
|
||||
|
||||
public static void AddBreakpoint(Breakpoint bp)
|
||||
{
|
||||
Breakpoints.Add(bp);
|
||||
RefreshBreakpoints(bp);
|
||||
}
|
||||
|
||||
public static Breakpoint GetMatchingBreakpoint(int address)
|
||||
{
|
||||
return Breakpoints.FirstOrDefault<Breakpoint>((bp) => { return bp.Address == address; });
|
||||
}
|
||||
|
||||
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 SetBreakpoints()
|
||||
{
|
||||
List<InteropBreakpoint> breakpoints = new List<InteropBreakpoint>();
|
||||
foreach(Breakpoint bp in BreakpointManager.Breakpoints) {
|
||||
if(bp.Enabled) {
|
||||
breakpoints.Add(bp.ToInteropBreakpoint());
|
||||
}
|
||||
}
|
||||
InteropEmu.DebugSetBreakpoints(breakpoints.ToArray(), (UInt32)breakpoints.Count);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -37,6 +37,7 @@
|
|||
this.columnHeader2 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.columnHeader4 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.colLastColumn = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.mnuGoToLocation = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.contextMenuBreakpoints.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
|
@ -44,15 +45,16 @@
|
|||
//
|
||||
this.contextMenuBreakpoints.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.mnuAddBreakpoint,
|
||||
this.mnuRemoveBreakpoint});
|
||||
this.mnuRemoveBreakpoint,
|
||||
this.mnuGoToLocation});
|
||||
this.contextMenuBreakpoints.Name = "contextMenuWatch";
|
||||
this.contextMenuBreakpoints.Size = new System.Drawing.Size(142, 48);
|
||||
this.contextMenuBreakpoints.Size = new System.Drawing.Size(153, 92);
|
||||
this.contextMenuBreakpoints.Opening += new System.ComponentModel.CancelEventHandler(this.contextMenuBreakpoints_Opening);
|
||||
//
|
||||
// mnuAddBreakpoint
|
||||
//
|
||||
this.mnuAddBreakpoint.Name = "mnuAddBreakpoint";
|
||||
this.mnuAddBreakpoint.Size = new System.Drawing.Size(141, 22);
|
||||
this.mnuAddBreakpoint.Size = new System.Drawing.Size(152, 22);
|
||||
this.mnuAddBreakpoint.Text = "Add...";
|
||||
this.mnuAddBreakpoint.Click += new System.EventHandler(this.mnuAddBreakpoint_Click);
|
||||
//
|
||||
|
@ -60,7 +62,7 @@
|
|||
//
|
||||
this.mnuRemoveBreakpoint.Name = "mnuRemoveBreakpoint";
|
||||
this.mnuRemoveBreakpoint.ShortcutKeys = System.Windows.Forms.Keys.Delete;
|
||||
this.mnuRemoveBreakpoint.Size = new System.Drawing.Size(141, 22);
|
||||
this.mnuRemoveBreakpoint.Size = new System.Drawing.Size(152, 22);
|
||||
this.mnuRemoveBreakpoint.Text = "Remove";
|
||||
this.mnuRemoveBreakpoint.Click += new System.EventHandler(this.mnuRemoveBreakpoint_Click);
|
||||
//
|
||||
|
@ -112,6 +114,13 @@
|
|||
//
|
||||
this.colLastColumn.Text = "";
|
||||
//
|
||||
// mnuGoToLocation
|
||||
//
|
||||
this.mnuGoToLocation.Name = "mnuGoToLocation";
|
||||
this.mnuGoToLocation.Size = new System.Drawing.Size(152, 22);
|
||||
this.mnuGoToLocation.Text = "Go to location";
|
||||
this.mnuGoToLocation.Click += new System.EventHandler(this.mnuGoToLocation_Click);
|
||||
//
|
||||
// ctrlBreakpoints
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
|
@ -135,5 +144,6 @@
|
|||
private System.Windows.Forms.ToolStripMenuItem mnuRemoveBreakpoint;
|
||||
private System.Windows.Forms.ColumnHeader columnHeader3;
|
||||
private System.Windows.Forms.ColumnHeader columnHeader4;
|
||||
private System.Windows.Forms.ToolStripMenuItem mnuGoToLocation;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,12 +12,18 @@ namespace Mesen.GUI.Debugger.Controls
|
|||
{
|
||||
public partial class ctrlBreakpoints : UserControl
|
||||
{
|
||||
public event EventHandler BreakpointChanged;
|
||||
private List<Breakpoint> _breakpoints = new List<Breakpoint>();
|
||||
public event EventHandler BreakpointNavigation;
|
||||
|
||||
public ctrlBreakpoints()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
BreakpointManager.BreakpointsChanged += BreakpointManager_OnBreakpointChanged;
|
||||
}
|
||||
|
||||
void BreakpointManager_OnBreakpointChanged(object sender, EventArgs e)
|
||||
{
|
||||
RefreshList();
|
||||
}
|
||||
|
||||
protected override void OnLoad(EventArgs e)
|
||||
|
@ -26,61 +32,11 @@ namespace Mesen.GUI.Debugger.Controls
|
|||
AdjustColumnWidth();
|
||||
}
|
||||
|
||||
public void ToggleBreakpoint(int address, bool toggleEnabled)
|
||||
{
|
||||
if(address >= 0) {
|
||||
Breakpoint breakpoint = GetMatchingBreakpoint(address);
|
||||
if(breakpoint != null) {
|
||||
if(toggleEnabled) {
|
||||
breakpoint.Enabled = !breakpoint.Enabled;
|
||||
} else {
|
||||
_breakpoints.Remove(breakpoint);
|
||||
}
|
||||
} else {
|
||||
breakpoint = new Breakpoint() {
|
||||
BreakOnExec = true,
|
||||
Address = (UInt32)address,
|
||||
IsAbsoluteAddress = false,
|
||||
Enabled = true
|
||||
};
|
||||
_breakpoints.Add(breakpoint);
|
||||
}
|
||||
RefreshList();
|
||||
OnBreakpointChanged();
|
||||
}
|
||||
}
|
||||
|
||||
private Breakpoint GetMatchingBreakpoint(int address)
|
||||
{
|
||||
foreach(Breakpoint breakpoint in _breakpoints) {
|
||||
if(breakpoint.Address == address) {
|
||||
return breakpoint;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<Breakpoint> GetBreakpoints()
|
||||
{
|
||||
return _breakpoints;
|
||||
}
|
||||
|
||||
public void SetBreakpoints()
|
||||
{
|
||||
List<InteropBreakpoint> breakpoints = new List<InteropBreakpoint>();
|
||||
foreach(Breakpoint bp in GetBreakpoints()) {
|
||||
if(bp.Enabled) {
|
||||
breakpoints.Add(bp.ToInteropBreakpoint());
|
||||
}
|
||||
}
|
||||
InteropEmu.DebugSetBreakpoints(breakpoints.ToArray(), (UInt32)breakpoints.Count);
|
||||
}
|
||||
|
||||
private void RefreshList()
|
||||
{
|
||||
lstBreakpoints.ItemChecked -= new System.Windows.Forms.ItemCheckedEventHandler(lstBreakpoints_ItemChecked);
|
||||
lstBreakpoints.Items.Clear();
|
||||
foreach(Breakpoint breakpoint in _breakpoints) {
|
||||
foreach(Breakpoint breakpoint in BreakpointManager.Breakpoints) {
|
||||
string address = "$" + breakpoint.Address.ToString("X");
|
||||
if(breakpoint.IsAbsoluteAddress) {
|
||||
address = "[" + address + "]";
|
||||
|
@ -95,8 +51,6 @@ namespace Mesen.GUI.Debugger.Controls
|
|||
lstBreakpoints.Items.Add(item);
|
||||
}
|
||||
lstBreakpoints.ItemChecked += new System.Windows.Forms.ItemCheckedEventHandler(lstBreakpoints_ItemChecked);
|
||||
|
||||
SetBreakpoints();
|
||||
}
|
||||
|
||||
private void lstBreakpoints_ColumnWidthChanging(object sender, ColumnWidthChangingEventArgs e)
|
||||
|
@ -125,53 +79,46 @@ namespace Mesen.GUI.Debugger.Controls
|
|||
lstBreakpoints.ColumnWidthChanged += lstBreakpoints_ColumnWidthChanged;
|
||||
}
|
||||
|
||||
private void OnBreakpointChanged()
|
||||
{
|
||||
SetBreakpoints();
|
||||
if(BreakpointChanged != null) {
|
||||
BreakpointChanged(this, null);
|
||||
}
|
||||
}
|
||||
|
||||
private void lstBreakpoints_ItemChecked(object sender, ItemCheckedEventArgs e)
|
||||
{
|
||||
if(((Breakpoint)e.Item.Tag).Enabled != e.Item.Checked) {
|
||||
((Breakpoint)e.Item.Tag).SetEnabled(e.Item.Checked);
|
||||
OnBreakpointChanged();
|
||||
}
|
||||
}
|
||||
|
||||
private void lstBreakpoints_DoubleClick(object sender, EventArgs e)
|
||||
{
|
||||
if(lstBreakpoints.SelectedItems.Count > 0) {
|
||||
new frmBreakpoint(((Breakpoint)lstBreakpoints.SelectedItems[0].Tag)).ShowDialog();
|
||||
RefreshList();
|
||||
OnBreakpointChanged();
|
||||
BreakpointManager.EditBreakpoint(((Breakpoint)lstBreakpoints.SelectedItems[0].Tag));
|
||||
}
|
||||
}
|
||||
|
||||
private void mnuRemoveBreakpoint_Click(object sender, EventArgs e)
|
||||
{
|
||||
foreach(ListViewItem item in lstBreakpoints.SelectedItems) {
|
||||
_breakpoints.Remove((Breakpoint)item.Tag);
|
||||
BreakpointManager.RemoveBreakpoint((Breakpoint)item.Tag);
|
||||
}
|
||||
RefreshList();
|
||||
OnBreakpointChanged();
|
||||
}
|
||||
|
||||
private void mnuAddBreakpoint_Click(object sender, EventArgs e)
|
||||
{
|
||||
Breakpoint breakpoint = new Breakpoint();
|
||||
if(new frmBreakpoint(breakpoint).ShowDialog() == DialogResult.OK) {
|
||||
_breakpoints.Add(breakpoint);
|
||||
RefreshList();
|
||||
OnBreakpointChanged();
|
||||
BreakpointManager.AddBreakpoint(breakpoint);
|
||||
}
|
||||
}
|
||||
|
||||
private void mnuGoToLocation_Click(object sender, EventArgs e)
|
||||
{
|
||||
if(BreakpointNavigation != null) {
|
||||
BreakpointNavigation(lstBreakpoints.SelectedItems[0].Tag, null);
|
||||
}
|
||||
}
|
||||
|
||||
private void contextMenuBreakpoints_Opening(object sender, CancelEventArgs e)
|
||||
{
|
||||
mnuRemoveBreakpoint.Enabled = (lstBreakpoints.SelectedItems.Count > 0);
|
||||
mnuGoToLocation.Enabled = (lstBreakpoints.SelectedItems.Count == 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,7 +40,12 @@
|
|||
this.mnuAddToWatch = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolTip = new System.Windows.Forms.ToolTip(this.components);
|
||||
this.ctrlCodeViewer = new Mesen.GUI.Debugger.ctrlScrollableTextbox();
|
||||
this.contextMenuMargin = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||
this.mnuRemoveBreakpoint = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.mnuEditBreakpoint = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.mnuDisableBreakpoint = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.contextMenuCode.SuspendLayout();
|
||||
this.contextMenuMargin.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// contextMenuCode
|
||||
|
@ -130,7 +135,6 @@
|
|||
// ctrlCodeViewer
|
||||
//
|
||||
this.ctrlCodeViewer.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.ctrlCodeViewer.ContextMenuStrip = this.contextMenuCode;
|
||||
this.ctrlCodeViewer.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.ctrlCodeViewer.FontSize = 13F;
|
||||
this.ctrlCodeViewer.Location = new System.Drawing.Point(0, 0);
|
||||
|
@ -141,6 +145,38 @@
|
|||
this.ctrlCodeViewer.TabIndex = 1;
|
||||
this.ctrlCodeViewer.MouseUp += new System.Windows.Forms.MouseEventHandler(this.ctrlCodeViewer_MouseUp);
|
||||
this.ctrlCodeViewer.MouseMove += new System.Windows.Forms.MouseEventHandler(this.ctrlCodeViewer_MouseMove);
|
||||
this.ctrlCodeViewer.MouseDown += new System.Windows.Forms.MouseEventHandler(this.ctrlCodeViewer_MouseDown);
|
||||
//
|
||||
// contextMenuMargin
|
||||
//
|
||||
this.contextMenuMargin.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.mnuDisableBreakpoint,
|
||||
this.mnuRemoveBreakpoint,
|
||||
this.mnuEditBreakpoint});
|
||||
this.contextMenuMargin.Name = "contextMenuMargin";
|
||||
this.contextMenuMargin.Size = new System.Drawing.Size(178, 92);
|
||||
this.contextMenuMargin.Opening += new System.ComponentModel.CancelEventHandler(this.contextMenuMargin_Opening);
|
||||
//
|
||||
// mnuRemoveBreakpoint
|
||||
//
|
||||
this.mnuRemoveBreakpoint.Name = "mnuRemoveBreakpoint";
|
||||
this.mnuRemoveBreakpoint.Size = new System.Drawing.Size(177, 22);
|
||||
this.mnuRemoveBreakpoint.Text = "Remove breakpoint";
|
||||
this.mnuRemoveBreakpoint.Click += new System.EventHandler(this.mnuRemoveBreakpoint_Click);
|
||||
//
|
||||
// mnuEditBreakpoint
|
||||
//
|
||||
this.mnuEditBreakpoint.Name = "mnuEditBreakpoint";
|
||||
this.mnuEditBreakpoint.Size = new System.Drawing.Size(177, 22);
|
||||
this.mnuEditBreakpoint.Text = "Edit breakpoint";
|
||||
this.mnuEditBreakpoint.Click += new System.EventHandler(this.mnuEditBreakpoint_Click);
|
||||
//
|
||||
// mnuDisableBreakpoint
|
||||
//
|
||||
this.mnuDisableBreakpoint.Name = "mnuDisableBreakpoint";
|
||||
this.mnuDisableBreakpoint.Size = new System.Drawing.Size(177, 22);
|
||||
this.mnuDisableBreakpoint.Text = "Disable breakpoint";
|
||||
this.mnuDisableBreakpoint.Click += new System.EventHandler(this.mnuDisableBreakpoint_Click);
|
||||
//
|
||||
// ctrlDebuggerCode
|
||||
//
|
||||
|
@ -150,6 +186,7 @@
|
|||
this.Name = "ctrlDebuggerCode";
|
||||
this.Size = new System.Drawing.Size(379, 218);
|
||||
this.contextMenuCode.ResumeLayout(false);
|
||||
this.contextMenuMargin.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
@ -168,5 +205,9 @@
|
|||
private Mesen.GUI.Debugger.ctrlScrollableTextbox ctrlCodeViewer;
|
||||
private System.Windows.Forms.ToolStripMenuItem mnuShowLineNotes;
|
||||
private System.Windows.Forms.ToolStripMenuItem mnuShowCodeNotes;
|
||||
private System.Windows.Forms.ContextMenuStrip contextMenuMargin;
|
||||
private System.Windows.Forms.ToolStripMenuItem mnuRemoveBreakpoint;
|
||||
private System.Windows.Forms.ToolStripMenuItem mnuEditBreakpoint;
|
||||
private System.Windows.Forms.ToolStripMenuItem mnuDisableBreakpoint;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -136,13 +136,13 @@ namespace Mesen.GUI.Debugger
|
|||
return UInt32.Parse(hexAddress, System.Globalization.NumberStyles.AllowHexSpecifier);
|
||||
}
|
||||
|
||||
public void HighlightBreakpoints(List<Breakpoint> breakpoints)
|
||||
public void HighlightBreakpoints()
|
||||
{
|
||||
ctrlCodeViewer.ClearLineStyles();
|
||||
if(_currentActiveAddress.HasValue) {
|
||||
SetActiveAddress(_currentActiveAddress.Value);
|
||||
}
|
||||
foreach(Breakpoint breakpoint in breakpoints) {
|
||||
foreach(Breakpoint breakpoint in BreakpointManager.Breakpoints) {
|
||||
Color? fgColor = Color.White;
|
||||
Color? bgColor = null;
|
||||
Color? outlineColor = Color.FromArgb(140, 40, 40);
|
||||
|
@ -168,6 +168,12 @@ namespace Mesen.GUI.Debugger
|
|||
private Point _previousLocation;
|
||||
private void ctrlCodeViewer_MouseMove(object sender, MouseEventArgs e)
|
||||
{
|
||||
if(e.Location.X < this.ctrlCodeViewer.CodeMargin / 5) {
|
||||
this.ContextMenuStrip = contextMenuMargin;
|
||||
} else {
|
||||
this.ContextMenuStrip = contextMenuCode;
|
||||
}
|
||||
|
||||
if(_previousLocation != e.Location) {
|
||||
string word = GetWordUnderLocation(e.Location);
|
||||
if(word.StartsWith("$")) {
|
||||
|
@ -201,7 +207,52 @@ namespace Mesen.GUI.Debugger
|
|||
}
|
||||
}
|
||||
|
||||
Breakpoint _lineBreakpoint = null;
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#region Context Menu
|
||||
|
||||
private void contextMenuMargin_Opening(object sender, CancelEventArgs e)
|
||||
{
|
||||
if(_lineBreakpoint == null) {
|
||||
e.Cancel = true;
|
||||
} else {
|
||||
mnuDisableBreakpoint.Text = _lineBreakpoint.Enabled ? "Disable breakpoint" : "Enable breakpoint";
|
||||
}
|
||||
}
|
||||
|
||||
private void mnuRemoveBreakpoint_Click(object sender, EventArgs e)
|
||||
{
|
||||
BreakpointManager.RemoveBreakpoint(_lineBreakpoint);
|
||||
}
|
||||
|
||||
private void mnuEditBreakpoint_Click(object sender, EventArgs e)
|
||||
{
|
||||
BreakpointManager.EditBreakpoint(_lineBreakpoint);
|
||||
}
|
||||
|
||||
private void mnuDisableBreakpoint_Click(object sender, EventArgs e)
|
||||
{
|
||||
_lineBreakpoint.SetEnabled(!_lineBreakpoint.Enabled);
|
||||
}
|
||||
|
||||
private void contextMenuCode_Opening(object sender, CancelEventArgs e)
|
||||
{
|
||||
mnuShowNextStatement.Enabled = _currentActiveAddress.HasValue;
|
||||
|
|
|
@ -123,4 +123,7 @@
|
|||
<metadata name="toolTip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
<metadata name="contextMenuMargin.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>280, 15</value>
|
||||
</metadata>
|
||||
</root>
|
|
@ -24,6 +24,12 @@ namespace Mesen.GUI.Debugger
|
|||
remove { this.ctrlTextbox.MouseMove -= value; }
|
||||
}
|
||||
|
||||
public new event MouseEventHandler MouseDown
|
||||
{
|
||||
add { this.ctrlTextbox.MouseDown += value; }
|
||||
remove { this.ctrlTextbox.MouseDown -= value; }
|
||||
}
|
||||
|
||||
public ctrlScrollableTextbox()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
@ -75,11 +81,21 @@ namespace Mesen.GUI.Debugger
|
|||
return this.ctrlTextbox.GetLineIndex(lineNumber);
|
||||
}
|
||||
|
||||
public int GetLineIndexAtPosition(int yPos)
|
||||
{
|
||||
return this.ctrlTextbox.GetLineIndexAtPosition(yPos);
|
||||
}
|
||||
|
||||
public int GetLineNumber(int lineIndex)
|
||||
{
|
||||
return this.ctrlTextbox.GetLineNumber(lineIndex);
|
||||
}
|
||||
|
||||
public int GetLineNumberAtPosition(int yPos)
|
||||
{
|
||||
return this.GetLineNumber(this.GetLineIndexAtPosition(yPos));
|
||||
}
|
||||
|
||||
public void ScrollToLineIndex(int lineIndex)
|
||||
{
|
||||
this.ctrlTextbox.ScrollToLineIndex(lineIndex);
|
||||
|
@ -95,6 +111,11 @@ namespace Mesen.GUI.Debugger
|
|||
get { return this.ctrlTextbox.CurrentLine; }
|
||||
}
|
||||
|
||||
public int CodeMargin
|
||||
{
|
||||
get { return this.ctrlTextbox.CodeMargin; }
|
||||
}
|
||||
|
||||
protected override void OnMouseWheel(MouseEventArgs e)
|
||||
{
|
||||
base.OnMouseWheel(e);
|
||||
|
|
|
@ -248,7 +248,11 @@ namespace Mesen.GUI.Debugger
|
|||
|
||||
public int GetLineNumber(int lineIndex)
|
||||
{
|
||||
return _lineNumbers[lineIndex];
|
||||
if(_lineNumbers.Length <= lineIndex) {
|
||||
return 0;
|
||||
} else {
|
||||
return _lineNumbers[lineIndex];
|
||||
}
|
||||
}
|
||||
|
||||
public void ScrollToLineIndex(int lineIndex)
|
||||
|
@ -268,11 +272,29 @@ namespace Mesen.GUI.Debugger
|
|||
}
|
||||
}
|
||||
|
||||
public int CodeMargin
|
||||
{
|
||||
get
|
||||
{
|
||||
using(Graphics g = Graphics.FromHwnd(this.Handle)) {
|
||||
return this.GetMargin(g);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private int GetMargin(Graphics g)
|
||||
{
|
||||
return this.ShowLineNumbers ? (int)(g.MeasureString("W", this.Font).Width * 6) : 0;
|
||||
}
|
||||
|
||||
public int GetLineIndexAtPosition(int yPos)
|
||||
{
|
||||
int charIndex;
|
||||
int lineIndex;
|
||||
GetCharIndex(new Point(0, yPos), out charIndex, out lineIndex);
|
||||
return lineIndex;
|
||||
}
|
||||
|
||||
private bool GetCharIndex(Point position, out int charIndex, out int lineIndex)
|
||||
{
|
||||
charIndex = -1;
|
||||
|
|
148
GUI.NET/Debugger/frmDebugger.Designer.cs
generated
148
GUI.NET/Debugger/frmDebugger.Designer.cs
generated
|
@ -34,19 +34,13 @@
|
|||
this.components = new System.ComponentModel.Container();
|
||||
this.splitContainer = new System.Windows.Forms.SplitContainer();
|
||||
this.tlpTop = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.ctrlDebuggerCode = new Mesen.GUI.Debugger.ctrlDebuggerCode();
|
||||
this.contextMenuCode = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||
this.mnuShowNextStatement = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.mnuSetNextStatement = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.ctrlConsoleStatus = new Mesen.GUI.Debugger.ctrlConsoleStatus();
|
||||
this.ctrlDebuggerCodeSplit = new Mesen.GUI.Debugger.ctrlDebuggerCode();
|
||||
this.tableLayoutPanel10 = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.grpWatch = new System.Windows.Forms.GroupBox();
|
||||
this.ctrlWatch = new Mesen.GUI.Debugger.ctrlWatch();
|
||||
this.grpBreakpoints = new System.Windows.Forms.GroupBox();
|
||||
this.ctrlBreakpoints = new Mesen.GUI.Debugger.Controls.ctrlBreakpoints();
|
||||
this.grpCallstack = new System.Windows.Forms.GroupBox();
|
||||
this.ctrlCallstack = new Mesen.GUI.Debugger.Controls.ctrlCallstack();
|
||||
this.menuStrip = new System.Windows.Forms.MenuStrip();
|
||||
this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripMenuItem3 = new System.Windows.Forms.ToolStripSeparator();
|
||||
|
@ -65,6 +59,7 @@
|
|||
this.mnuStepOut = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.mnuToggleBreakpoint = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.mnuDisableEnableBreakpoint = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripMenuItem2 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.mnuRunOneFrame = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.searchToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
|
@ -90,7 +85,12 @@
|
|||
this.lblChrAnalysis = new System.Windows.Forms.ToolStripStatusLabel();
|
||||
this.lblChrAnalysisResult = new System.Windows.Forms.ToolStripStatusLabel();
|
||||
this.tmrCdlRatios = new System.Windows.Forms.Timer(this.components);
|
||||
this.mnuDisableEnableBreakpoint = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.ctrlDebuggerCode = new Mesen.GUI.Debugger.ctrlDebuggerCode();
|
||||
this.ctrlConsoleStatus = new Mesen.GUI.Debugger.ctrlConsoleStatus();
|
||||
this.ctrlDebuggerCodeSplit = new Mesen.GUI.Debugger.ctrlDebuggerCode();
|
||||
this.ctrlWatch = new Mesen.GUI.Debugger.ctrlWatch();
|
||||
this.ctrlBreakpoints = new Mesen.GUI.Debugger.Controls.ctrlBreakpoints();
|
||||
this.ctrlCallstack = new Mesen.GUI.Debugger.Controls.ctrlCallstack();
|
||||
((System.ComponentModel.ISupportInitialize)(this.splitContainer)).BeginInit();
|
||||
this.splitContainer.Panel1.SuspendLayout();
|
||||
this.splitContainer.Panel2.SuspendLayout();
|
||||
|
@ -143,19 +143,6 @@
|
|||
this.tlpTop.Size = new System.Drawing.Size(984, 412);
|
||||
this.tlpTop.TabIndex = 2;
|
||||
//
|
||||
// ctrlDebuggerCode
|
||||
//
|
||||
this.ctrlDebuggerCode.Code = null;
|
||||
this.ctrlDebuggerCode.ContextMenuStrip = this.contextMenuCode;
|
||||
this.ctrlDebuggerCode.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.ctrlDebuggerCode.Location = new System.Drawing.Point(3, 3);
|
||||
this.ctrlDebuggerCode.Name = "ctrlDebuggerCode";
|
||||
this.ctrlDebuggerCode.Size = new System.Drawing.Size(546, 406);
|
||||
this.ctrlDebuggerCode.TabIndex = 2;
|
||||
this.ctrlDebuggerCode.OnWatchAdded += new Mesen.GUI.Debugger.ctrlDebuggerCode.AddressEventHandler(this.ctrlDebuggerCode_OnWatchAdded);
|
||||
this.ctrlDebuggerCode.OnSetNextStatement += new Mesen.GUI.Debugger.ctrlDebuggerCode.AddressEventHandler(this.ctrlDebuggerCode_OnSetNextStatement);
|
||||
this.ctrlDebuggerCode.Enter += new System.EventHandler(this.ctrlDebuggerCode_Enter);
|
||||
//
|
||||
// contextMenuCode
|
||||
//
|
||||
this.contextMenuCode.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
|
@ -180,28 +167,6 @@
|
|||
this.mnuSetNextStatement.Size = new System.Drawing.Size(258, 22);
|
||||
this.mnuSetNextStatement.Text = "Set Next Statement";
|
||||
//
|
||||
// ctrlConsoleStatus
|
||||
//
|
||||
this.ctrlConsoleStatus.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.ctrlConsoleStatus.Location = new System.Drawing.Point(552, 0);
|
||||
this.ctrlConsoleStatus.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.ctrlConsoleStatus.Name = "ctrlConsoleStatus";
|
||||
this.ctrlConsoleStatus.Size = new System.Drawing.Size(432, 362);
|
||||
this.ctrlConsoleStatus.TabIndex = 3;
|
||||
//
|
||||
// ctrlDebuggerCodeSplit
|
||||
//
|
||||
this.ctrlDebuggerCodeSplit.Code = null;
|
||||
this.ctrlDebuggerCodeSplit.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.ctrlDebuggerCodeSplit.Location = new System.Drawing.Point(555, 3);
|
||||
this.ctrlDebuggerCodeSplit.Name = "ctrlDebuggerCodeSplit";
|
||||
this.ctrlDebuggerCodeSplit.Size = new System.Drawing.Size(1, 406);
|
||||
this.ctrlDebuggerCodeSplit.TabIndex = 4;
|
||||
this.ctrlDebuggerCodeSplit.Visible = false;
|
||||
this.ctrlDebuggerCodeSplit.OnWatchAdded += new Mesen.GUI.Debugger.ctrlDebuggerCode.AddressEventHandler(this.ctrlDebuggerCode_OnWatchAdded);
|
||||
this.ctrlDebuggerCodeSplit.OnSetNextStatement += new Mesen.GUI.Debugger.ctrlDebuggerCode.AddressEventHandler(this.ctrlDebuggerCode_OnSetNextStatement);
|
||||
this.ctrlDebuggerCodeSplit.Enter += new System.EventHandler(this.ctrlDebuggerCodeSplit_Enter);
|
||||
//
|
||||
// tableLayoutPanel10
|
||||
//
|
||||
this.tableLayoutPanel10.ColumnCount = 3;
|
||||
|
@ -230,14 +195,6 @@
|
|||
this.grpWatch.TabStop = false;
|
||||
this.grpWatch.Text = "Watch";
|
||||
//
|
||||
// ctrlWatch
|
||||
//
|
||||
this.ctrlWatch.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.ctrlWatch.Location = new System.Drawing.Point(3, 16);
|
||||
this.ctrlWatch.Name = "ctrlWatch";
|
||||
this.ctrlWatch.Size = new System.Drawing.Size(316, 123);
|
||||
this.ctrlWatch.TabIndex = 0;
|
||||
//
|
||||
// grpBreakpoints
|
||||
//
|
||||
this.grpBreakpoints.Controls.Add(this.ctrlBreakpoints);
|
||||
|
@ -249,15 +206,6 @@
|
|||
this.grpBreakpoints.TabStop = false;
|
||||
this.grpBreakpoints.Text = "Breakpoints";
|
||||
//
|
||||
// ctrlBreakpoints
|
||||
//
|
||||
this.ctrlBreakpoints.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.ctrlBreakpoints.Location = new System.Drawing.Point(3, 16);
|
||||
this.ctrlBreakpoints.Name = "ctrlBreakpoints";
|
||||
this.ctrlBreakpoints.Size = new System.Drawing.Size(316, 123);
|
||||
this.ctrlBreakpoints.TabIndex = 0;
|
||||
this.ctrlBreakpoints.BreakpointChanged += new System.EventHandler(this.ctrlBreakpoints_BreakpointChanged);
|
||||
//
|
||||
// grpCallstack
|
||||
//
|
||||
this.grpCallstack.Controls.Add(this.ctrlCallstack);
|
||||
|
@ -269,15 +217,6 @@
|
|||
this.grpCallstack.TabStop = false;
|
||||
this.grpCallstack.Text = "Callstack";
|
||||
//
|
||||
// ctrlCallstack
|
||||
//
|
||||
this.ctrlCallstack.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.ctrlCallstack.Location = new System.Drawing.Point(3, 16);
|
||||
this.ctrlCallstack.Name = "ctrlCallstack";
|
||||
this.ctrlCallstack.Size = new System.Drawing.Size(316, 123);
|
||||
this.ctrlCallstack.TabIndex = 0;
|
||||
this.ctrlCallstack.FunctionSelected += new System.EventHandler(this.ctrlCallstack_FunctionSelected);
|
||||
//
|
||||
// menuStrip
|
||||
//
|
||||
this.menuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
|
@ -439,6 +378,14 @@
|
|||
this.mnuToggleBreakpoint.Text = "Toggle Breakpoint";
|
||||
this.mnuToggleBreakpoint.Click += new System.EventHandler(this.mnuToggleBreakpoint_Click);
|
||||
//
|
||||
// mnuDisableEnableBreakpoint
|
||||
//
|
||||
this.mnuDisableEnableBreakpoint.Name = "mnuDisableEnableBreakpoint";
|
||||
this.mnuDisableEnableBreakpoint.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.F9)));
|
||||
this.mnuDisableEnableBreakpoint.Size = new System.Drawing.Size(258, 22);
|
||||
this.mnuDisableEnableBreakpoint.Text = "Disable/Enable Breakpoint";
|
||||
this.mnuDisableEnableBreakpoint.Click += new System.EventHandler(this.mnuDisableEnableBreakpoint_Click);
|
||||
//
|
||||
// toolStripMenuItem2
|
||||
//
|
||||
this.toolStripMenuItem2.Name = "toolStripMenuItem2";
|
||||
|
@ -634,13 +581,66 @@
|
|||
this.tmrCdlRatios.Interval = 300;
|
||||
this.tmrCdlRatios.Tick += new System.EventHandler(this.tmrCdlRatios_Tick);
|
||||
//
|
||||
// mnuDisableEnableBreakpoint
|
||||
// ctrlDebuggerCode
|
||||
//
|
||||
this.mnuDisableEnableBreakpoint.Name = "mnuDisableEnableBreakpoint";
|
||||
this.mnuDisableEnableBreakpoint.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.F9)));
|
||||
this.mnuDisableEnableBreakpoint.Size = new System.Drawing.Size(258, 22);
|
||||
this.mnuDisableEnableBreakpoint.Text = "Disable/Enable Breakpoint";
|
||||
this.mnuDisableEnableBreakpoint.Click += new System.EventHandler(this.mnuDisableEnableBreakpoint_Click);
|
||||
this.ctrlDebuggerCode.Code = null;
|
||||
this.ctrlDebuggerCode.ContextMenuStrip = this.contextMenuCode;
|
||||
this.ctrlDebuggerCode.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.ctrlDebuggerCode.Location = new System.Drawing.Point(3, 3);
|
||||
this.ctrlDebuggerCode.Name = "ctrlDebuggerCode";
|
||||
this.ctrlDebuggerCode.Size = new System.Drawing.Size(546, 406);
|
||||
this.ctrlDebuggerCode.TabIndex = 2;
|
||||
this.ctrlDebuggerCode.OnWatchAdded += new Mesen.GUI.Debugger.ctrlDebuggerCode.AddressEventHandler(this.ctrlDebuggerCode_OnWatchAdded);
|
||||
this.ctrlDebuggerCode.OnSetNextStatement += new Mesen.GUI.Debugger.ctrlDebuggerCode.AddressEventHandler(this.ctrlDebuggerCode_OnSetNextStatement);
|
||||
this.ctrlDebuggerCode.Enter += new System.EventHandler(this.ctrlDebuggerCode_Enter);
|
||||
//
|
||||
// ctrlConsoleStatus
|
||||
//
|
||||
this.ctrlConsoleStatus.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.ctrlConsoleStatus.Location = new System.Drawing.Point(552, 0);
|
||||
this.ctrlConsoleStatus.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.ctrlConsoleStatus.Name = "ctrlConsoleStatus";
|
||||
this.ctrlConsoleStatus.Size = new System.Drawing.Size(432, 362);
|
||||
this.ctrlConsoleStatus.TabIndex = 3;
|
||||
//
|
||||
// ctrlDebuggerCodeSplit
|
||||
//
|
||||
this.ctrlDebuggerCodeSplit.Code = null;
|
||||
this.ctrlDebuggerCodeSplit.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.ctrlDebuggerCodeSplit.Location = new System.Drawing.Point(555, 3);
|
||||
this.ctrlDebuggerCodeSplit.Name = "ctrlDebuggerCodeSplit";
|
||||
this.ctrlDebuggerCodeSplit.Size = new System.Drawing.Size(1, 406);
|
||||
this.ctrlDebuggerCodeSplit.TabIndex = 4;
|
||||
this.ctrlDebuggerCodeSplit.Visible = false;
|
||||
this.ctrlDebuggerCodeSplit.OnWatchAdded += new Mesen.GUI.Debugger.ctrlDebuggerCode.AddressEventHandler(this.ctrlDebuggerCode_OnWatchAdded);
|
||||
this.ctrlDebuggerCodeSplit.OnSetNextStatement += new Mesen.GUI.Debugger.ctrlDebuggerCode.AddressEventHandler(this.ctrlDebuggerCode_OnSetNextStatement);
|
||||
this.ctrlDebuggerCodeSplit.Enter += new System.EventHandler(this.ctrlDebuggerCodeSplit_Enter);
|
||||
//
|
||||
// ctrlWatch
|
||||
//
|
||||
this.ctrlWatch.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.ctrlWatch.Location = new System.Drawing.Point(3, 16);
|
||||
this.ctrlWatch.Name = "ctrlWatch";
|
||||
this.ctrlWatch.Size = new System.Drawing.Size(316, 123);
|
||||
this.ctrlWatch.TabIndex = 0;
|
||||
//
|
||||
// ctrlBreakpoints
|
||||
//
|
||||
this.ctrlBreakpoints.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.ctrlBreakpoints.Location = new System.Drawing.Point(3, 16);
|
||||
this.ctrlBreakpoints.Name = "ctrlBreakpoints";
|
||||
this.ctrlBreakpoints.Size = new System.Drawing.Size(316, 123);
|
||||
this.ctrlBreakpoints.TabIndex = 0;
|
||||
this.ctrlBreakpoints.BreakpointNavigation += new System.EventHandler(this.ctrlBreakpoints_BreakpointNavigation);
|
||||
//
|
||||
// ctrlCallstack
|
||||
//
|
||||
this.ctrlCallstack.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.ctrlCallstack.Location = new System.Drawing.Point(3, 16);
|
||||
this.ctrlCallstack.Name = "ctrlCallstack";
|
||||
this.ctrlCallstack.Size = new System.Drawing.Size(316, 123);
|
||||
this.ctrlCallstack.TabIndex = 0;
|
||||
this.ctrlCallstack.FunctionSelected += new System.EventHandler(this.ctrlCallstack_FunctionSelected);
|
||||
//
|
||||
// frmDebugger
|
||||
//
|
||||
|
|
|
@ -23,6 +23,9 @@ namespace Mesen.GUI.Debugger
|
|||
InitializeComponent();
|
||||
|
||||
_lastCodeWindow = ctrlDebuggerCode;
|
||||
|
||||
BreakpointManager.Breakpoints.Clear();
|
||||
BreakpointManager.BreakpointsChanged += BreakpointManager_BreakpointsChanged;
|
||||
}
|
||||
|
||||
protected override void OnLoad(EventArgs e)
|
||||
|
@ -118,13 +121,13 @@ namespace Mesen.GUI.Debugger
|
|||
|
||||
private void ToggleBreakpoint(bool toggleEnabled)
|
||||
{
|
||||
ctrlBreakpoints.ToggleBreakpoint(_lastCodeWindow.GetCurrentLine(), toggleEnabled);
|
||||
BreakpointManager.ToggleBreakpoint(_lastCodeWindow.GetCurrentLine(), toggleEnabled);
|
||||
}
|
||||
|
||||
private void RefreshBreakpoints()
|
||||
{
|
||||
ctrlDebuggerCodeSplit.HighlightBreakpoints(ctrlBreakpoints.GetBreakpoints());
|
||||
ctrlDebuggerCode.HighlightBreakpoints(ctrlBreakpoints.GetBreakpoints());
|
||||
ctrlDebuggerCodeSplit.HighlightBreakpoints();
|
||||
ctrlDebuggerCode.HighlightBreakpoints();
|
||||
}
|
||||
|
||||
private void OpenChildForm(Form frm)
|
||||
|
@ -219,7 +222,7 @@ namespace Mesen.GUI.Debugger
|
|||
OpenChildForm(new frmMemoryViewer());
|
||||
}
|
||||
|
||||
private void ctrlBreakpoints_BreakpointChanged(object sender, EventArgs e)
|
||||
private void BreakpointManager_BreakpointsChanged(object sender, EventArgs e)
|
||||
{
|
||||
RefreshBreakpoints();
|
||||
}
|
||||
|
@ -309,5 +312,10 @@ namespace Mesen.GUI.Debugger
|
|||
{
|
||||
InteropEmu.DebugResetCdlLog();
|
||||
}
|
||||
|
||||
private void ctrlBreakpoints_BreakpointNavigation(object sender, EventArgs e)
|
||||
{
|
||||
_lastCodeWindow.ScrollToLineNumber((int)((Breakpoint)sender).Address);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -101,6 +101,7 @@
|
|||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Debugger\Breakpoint.cs" />
|
||||
<Compile Include="Debugger\BreakpointManager.cs" />
|
||||
<Compile Include="Debugger\Controls\BaseScrollableTextboxUserControl.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
|
|
Loading…
Add table
Reference in a new issue