From 91353d776b02073367f80d5e18c35434d7b0b934 Mon Sep 17 00:00:00 2001 From: adelikat Date: Wed, 10 Dec 2014 22:47:09 +0000 Subject: [PATCH] Debugger - basic showing and adding of breakpoints, including pre-existing ones --- .../tools/Debugger/Breakpoint.cs | 17 ++++-- .../Debugger/BreakpointControl.Designer.cs | 54 +++++++++++-------- .../tools/Debugger/BreakpointControl.cs | 8 ++- .../tools/Debugger/GenericDebugger.cs | 1 + 4 files changed, 52 insertions(+), 28 deletions(-) diff --git a/BizHawk.Client.EmuHawk/tools/Debugger/Breakpoint.cs b/BizHawk.Client.EmuHawk/tools/Debugger/Breakpoint.cs index 2abbb0102e..06d6826ee6 100644 --- a/BizHawk.Client.EmuHawk/tools/Debugger/Breakpoint.cs +++ b/BizHawk.Client.EmuHawk/tools/Debugger/Breakpoint.cs @@ -40,7 +40,7 @@ namespace BizHawk.Client.EmuHawk Callback = callBack; Address = address; Active = enabled; - + Name = "Pause"; if (enabled) { AddCallback(); @@ -48,8 +48,19 @@ namespace BizHawk.Client.EmuHawk } public Action Callback { get; set; } - public uint Address { get; set; } + public uint? Address { get; set; } public MemoryCallbackType Type { get; set; } + public string Name { get; set; } + + // Adds an existing callback + public Breakpoint(IDebuggable core, IMemoryCallback callback) + { + _core = core; + Callback = callback.Callback; + Address = callback.Address; + Type = callback.Type; + Name = callback.Name; + } public bool Active { @@ -76,7 +87,7 @@ namespace BizHawk.Client.EmuHawk private void AddCallback() { - _core.MemoryCallbacks.Add(new MemoryCallback(Type, "Pause", Callback, Address)); + _core.MemoryCallbacks.Add(new MemoryCallback(Type, Name, Callback, Address)); } private void RemoveCallback() diff --git a/BizHawk.Client.EmuHawk/tools/Debugger/BreakpointControl.Designer.cs b/BizHawk.Client.EmuHawk/tools/Debugger/BreakpointControl.Designer.cs index cb5935872f..612a7b16e4 100644 --- a/BizHawk.Client.EmuHawk/tools/Debugger/BreakpointControl.Designer.cs +++ b/BizHawk.Client.EmuHawk/tools/Debugger/BreakpointControl.Designer.cs @@ -28,13 +28,36 @@ /// private void InitializeComponent() { + this.AddBreakpointButton = new System.Windows.Forms.Button(); + this.RemoveBreakpointButton = new System.Windows.Forms.Button(); this.BreakpointView = new BizHawk.Client.EmuHawk.VirtualListView(); this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.columnHeader2 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.AddBreakpointButton = new System.Windows.Forms.Button(); - this.RemoveBreakpointButton = new System.Windows.Forms.Button(); + this.columnHeader3 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.SuspendLayout(); // + // AddBreakpointButton + // + this.AddBreakpointButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.AddBreakpointButton.Location = new System.Drawing.Point(0, 387); + this.AddBreakpointButton.Name = "AddBreakpointButton"; + this.AddBreakpointButton.Size = new System.Drawing.Size(60, 23); + this.AddBreakpointButton.TabIndex = 6; + this.AddBreakpointButton.Text = "&Add"; + this.AddBreakpointButton.UseVisualStyleBackColor = true; + this.AddBreakpointButton.Click += new System.EventHandler(this.AddBreakpointButton_Click); + // + // RemoveBreakpointButton + // + this.RemoveBreakpointButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.RemoveBreakpointButton.Location = new System.Drawing.Point(130, 387); + this.RemoveBreakpointButton.Name = "RemoveBreakpointButton"; + this.RemoveBreakpointButton.Size = new System.Drawing.Size(60, 23); + this.RemoveBreakpointButton.TabIndex = 7; + this.RemoveBreakpointButton.Text = "&Remove"; + this.RemoveBreakpointButton.UseVisualStyleBackColor = true; + this.RemoveBreakpointButton.Click += new System.EventHandler(this.RemoveBreakpointButton_Click); + // // BreakpointView // this.BreakpointView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) @@ -44,7 +67,8 @@ this.BreakpointView.CheckBoxes = true; this.BreakpointView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { this.columnHeader1, - this.columnHeader2}); + this.columnHeader2, + this.columnHeader3}); this.BreakpointView.Font = new System.Drawing.Font("Courier New", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.BreakpointView.FullRowSelect = true; this.BreakpointView.GridLines = true; @@ -71,27 +95,10 @@ this.columnHeader2.Text = "Type"; this.columnHeader2.Width = 103; // - // AddBreakpointButton + // columnHeader3 // - this.AddBreakpointButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.AddBreakpointButton.Location = new System.Drawing.Point(0, 387); - this.AddBreakpointButton.Name = "AddBreakpointButton"; - this.AddBreakpointButton.Size = new System.Drawing.Size(60, 23); - this.AddBreakpointButton.TabIndex = 6; - this.AddBreakpointButton.Text = "&Add"; - this.AddBreakpointButton.UseVisualStyleBackColor = true; - this.AddBreakpointButton.Click += new System.EventHandler(this.AddBreakpointButton_Click); - // - // RemoveBreakpointButton - // - this.RemoveBreakpointButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.RemoveBreakpointButton.Location = new System.Drawing.Point(130, 387); - this.RemoveBreakpointButton.Name = "RemoveBreakpointButton"; - this.RemoveBreakpointButton.Size = new System.Drawing.Size(60, 23); - this.RemoveBreakpointButton.TabIndex = 7; - this.RemoveBreakpointButton.Text = "&Remove"; - this.RemoveBreakpointButton.UseVisualStyleBackColor = true; - this.RemoveBreakpointButton.Click += new System.EventHandler(this.RemoveBreakpointButton_Click); + this.columnHeader3.Text = "Name"; + this.columnHeader3.Width = 80; // // BreakpointControl // @@ -114,5 +121,6 @@ private System.Windows.Forms.ColumnHeader columnHeader2; private System.Windows.Forms.Button AddBreakpointButton; private System.Windows.Forms.Button RemoveBreakpointButton; + private System.Windows.Forms.ColumnHeader columnHeader3; } } diff --git a/BizHawk.Client.EmuHawk/tools/Debugger/BreakpointControl.cs b/BizHawk.Client.EmuHawk/tools/Debugger/BreakpointControl.cs index 7b7cc52871..c1fad566d7 100644 --- a/BizHawk.Client.EmuHawk/tools/Debugger/BreakpointControl.cs +++ b/BizHawk.Client.EmuHawk/tools/Debugger/BreakpointControl.cs @@ -42,6 +42,9 @@ namespace BizHawk.Client.EmuHawk.tools.Debugger case 1: text = Breakpoints[index].Type.ToString(); break; + case 2: + text = Breakpoints[index].Name; + break; } } @@ -65,9 +68,10 @@ namespace BizHawk.Client.EmuHawk.tools.Debugger { foreach (var callback in Core.MemoryCallbacks) { - Breakpoints.Add(new Breakpoint(Core, callback.Callback, callback.Address ?? 0 /*TODO*/,callback.Type, true)); + Breakpoints.Add(new Breakpoint(Core, callback)); } + BreakpointView.ItemCount = Breakpoints.Count; BreakpointView.Refresh(); } else @@ -83,7 +87,7 @@ namespace BizHawk.Client.EmuHawk.tools.Debugger private void AddBreakpointButton_Click(object sender, EventArgs e) { - var b = new AddBreakpointDialog(); // TODO: rename and move this widget + var b = new AddBreakpointDialog(); if (b.ShowDialog() == DialogResult.OK) { Breakpoints.Add(Core, b.Address, b.BreakType); diff --git a/BizHawk.Client.EmuHawk/tools/Debugger/GenericDebugger.cs b/BizHawk.Client.EmuHawk/tools/Debugger/GenericDebugger.cs index 7edcf289f3..7608d4daa0 100644 --- a/BizHawk.Client.EmuHawk/tools/Debugger/GenericDebugger.cs +++ b/BizHawk.Client.EmuHawk/tools/Debugger/GenericDebugger.cs @@ -81,6 +81,7 @@ namespace BizHawk.Client.EmuHawk BreakPointControl1.Core = Core; BreakPointControl1.ParentDebugger = this; + BreakPointControl1.GenerateUI(); } private void DisengageDebugger()