Debugger - add context menu item on Disassembler "Add Breakpoint" that will add an execute breakpoint on the selected address

This commit is contained in:
adelikat 2015-02-06 00:41:50 +00:00
parent e020574b8d
commit 8427a9db7e
4 changed files with 61 additions and 11 deletions

View File

@ -142,6 +142,15 @@ namespace BizHawk.Client.EmuHawk.tools.Debugger
UpdateStatsLabel();
}
public void AddBreakpoint(uint address, MemoryCallbackType type)
{
Breakpoints.Add(Core, address, type);
BreakpointView.ItemCount = Breakpoints.Count;
UpdateBreakpointRemoveButton();
UpdateStatsLabel();
}
private void AddBreakpointButton_Click(object sender, EventArgs e)
{
var b = new AddBreakpointDialog

View File

@ -37,6 +37,8 @@
this.StepIntoMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.StepOverMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.StepOutMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
this.RefreshMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.RegistersGroupBox = new System.Windows.Forms.GroupBox();
this.RegisterPanel = new BizHawk.Client.EmuHawk.RegisterBoxControl();
this.BreakpointsGroupBox = new System.Windows.Forms.GroupBox();
@ -54,12 +56,13 @@
this.SeekToBtn = new System.Windows.Forms.Button();
this.SeekToBox = new BizHawk.Client.EmuHawk.HexTextBox();
this.CancelSeekBtn = new System.Windows.Forms.Button();
this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
this.RefreshMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.DisassemblerContextMenu = new System.Windows.Forms.ContextMenuStrip(this.components);
this.AddBreakpointContextMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.menuStrip1.SuspendLayout();
this.RegistersGroupBox.SuspendLayout();
this.BreakpointsGroupBox.SuspendLayout();
this.DisassemblerBox.SuspendLayout();
this.DisassemblerContextMenu.SuspendLayout();
this.SuspendLayout();
//
// menuStrip1
@ -130,6 +133,19 @@
this.StepOutMenuItem.Text = "Step Ou&t";
this.StepOutMenuItem.Click += new System.EventHandler(this.StepOutMenuItem_Click);
//
// toolStripSeparator1
//
this.toolStripSeparator1.Name = "toolStripSeparator1";
this.toolStripSeparator1.Size = new System.Drawing.Size(174, 6);
//
// RefreshMenuItem
//
this.RefreshMenuItem.Name = "RefreshMenuItem";
this.RefreshMenuItem.ShortcutKeys = System.Windows.Forms.Keys.F5;
this.RefreshMenuItem.Size = new System.Drawing.Size(177, 22);
this.RefreshMenuItem.Text = "Refresh";
this.RefreshMenuItem.Click += new System.EventHandler(this.RefreshMenuItem_Click);
//
// RegistersGroupBox
//
this.RegistersGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
@ -225,6 +241,7 @@
this.DisassemblerView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.Address,
this.Instruction});
this.DisassemblerView.ContextMenuStrip = this.DisassemblerContextMenu;
this.DisassemblerView.FullRowSelect = true;
this.DisassemblerView.GridLines = true;
this.DisassemblerView.ItemCount = 0;
@ -319,18 +336,20 @@
this.CancelSeekBtn.UseVisualStyleBackColor = true;
this.CancelSeekBtn.Click += new System.EventHandler(this.CancelSeekBtn_Click);
//
// toolStripSeparator1
// DisassemblerContextMenu
//
this.toolStripSeparator1.Name = "toolStripSeparator1";
this.toolStripSeparator1.Size = new System.Drawing.Size(174, 6);
this.DisassemblerContextMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.AddBreakpointContextMenuItem});
this.DisassemblerContextMenu.Name = "DisassemblerContextMenu";
this.DisassemblerContextMenu.Size = new System.Drawing.Size(157, 26);
this.DisassemblerContextMenu.Opening += new System.ComponentModel.CancelEventHandler(this.DisassemblerContextMenu_Opening);
//
// RefreshMenuItem
// AddBreakpointContextMenuItem
//
this.RefreshMenuItem.Name = "RefreshMenuItem";
this.RefreshMenuItem.ShortcutKeys = System.Windows.Forms.Keys.F5;
this.RefreshMenuItem.Size = new System.Drawing.Size(177, 22);
this.RefreshMenuItem.Text = "Refresh";
this.RefreshMenuItem.Click += new System.EventHandler(this.RefreshMenuItem_Click);
this.AddBreakpointContextMenuItem.Name = "AddBreakpointContextMenuItem";
this.AddBreakpointContextMenuItem.Size = new System.Drawing.Size(156, 22);
this.AddBreakpointContextMenuItem.Text = "Add Breakpoint";
this.AddBreakpointContextMenuItem.Click += new System.EventHandler(this.AddBreakpointContextMenuItem_Click);
//
// GenericDebugger
//
@ -360,6 +379,7 @@
this.BreakpointsGroupBox.ResumeLayout(false);
this.DisassemblerBox.ResumeLayout(false);
this.DisassemblerBox.PerformLayout();
this.DisassemblerContextMenu.ResumeLayout(false);
this.ResumeLayout(false);
this.PerformLayout();
@ -393,5 +413,7 @@
private System.Windows.Forms.Button ToPCBtn;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator1;
private System.Windows.Forms.ToolStripMenuItem RefreshMenuItem;
private System.Windows.Forms.ContextMenuStrip DisassemblerContextMenu;
private System.Windows.Forms.ToolStripMenuItem AddBreakpointContextMenuItem;
}
}

View File

@ -194,5 +194,21 @@ namespace BizHawk.Client.EmuHawk
{
FullUpdate();
}
private void DisassemblerContextMenu_Opening(object sender, EventArgs e)
{
AddBreakpointContextMenuItem.Enabled = DisassemblerView.SelectedIndices.Count > 0;
}
private void AddBreakpointContextMenuItem_Click(object sender, EventArgs e)
{
var indices = DisassemblerView.SelectedIndices;
if (indices.Count > 0)
{
var line = DisassemblyLines[indices[0]];
BreakPointControl1.AddBreakpoint(line.Address, Emulation.Common.MemoryCallbackType.Execute);
}
}
}
}

View File

@ -120,6 +120,9 @@
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="DisassemblerContextMenu.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>229, 17</value>
</metadata>
<metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>132, 17</value>
</metadata>