Debugger - add a cancel seek button

This commit is contained in:
adelikat 2015-01-21 23:04:47 +00:00
parent af451143bf
commit 69b2e51e7c
3 changed files with 46 additions and 4 deletions

View File

@ -77,6 +77,8 @@ namespace BizHawk.Client.EmuHawk.tools.Debugger
Breakpoints.Remove(seekBreakpoint);
UpdateValues();
}
ParentDebugger.DisableCancelSeekBtn();
}
public void UpdateValues()
@ -143,6 +145,17 @@ namespace BizHawk.Client.EmuHawk.tools.Debugger
});
}
public void RemoveCurrentSeek()
{
var seekBreakpoint = Breakpoints.FirstOrDefault(x => x.Name.StartsWith(SeekName));
if (seekBreakpoint != null)
{
Breakpoints.Remove(seekBreakpoint);
UpdateValues();
}
}
private IEnumerable<int> SelectedIndices
{
get { return BreakpointView.SelectedIndices.Cast<int>(); }

View File

@ -52,6 +52,7 @@
this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
this.SeekToBtn = new System.Windows.Forms.Button();
this.SeekToBox = new BizHawk.Client.EmuHawk.HexTextBox();
this.CancelSeekBtn = new System.Windows.Forms.Button();
this.menuStrip1.SuspendLayout();
this.RegistersGroupBox.SuspendLayout();
this.BreakpointsGroupBox.SuspendLayout();
@ -235,7 +236,7 @@
//
this.StepOutBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.StepOutBtn.Enabled = false;
this.StepOutBtn.Location = new System.Drawing.Point(680, 398);
this.StepOutBtn.Location = new System.Drawing.Point(680, 519);
this.StepOutBtn.Name = "StepOutBtn";
this.StepOutBtn.Size = new System.Drawing.Size(75, 23);
this.StepOutBtn.TabIndex = 10;
@ -247,7 +248,7 @@
//
this.StepIntoBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.StepIntoBtn.Enabled = false;
this.StepIntoBtn.Location = new System.Drawing.Point(680, 340);
this.StepIntoBtn.Location = new System.Drawing.Point(680, 461);
this.StepIntoBtn.Name = "StepIntoBtn";
this.StepIntoBtn.Size = new System.Drawing.Size(75, 23);
this.StepIntoBtn.TabIndex = 11;
@ -259,7 +260,7 @@
//
this.StepOverBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.StepOverBtn.Enabled = false;
this.StepOverBtn.Location = new System.Drawing.Point(680, 369);
this.StepOverBtn.Location = new System.Drawing.Point(680, 490);
this.StepOverBtn.Name = "StepOverBtn";
this.StepOverBtn.Size = new System.Drawing.Size(75, 23);
this.StepOverBtn.TabIndex = 12;
@ -269,6 +270,7 @@
//
// SeekToBtn
//
this.SeekToBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.SeekToBtn.Location = new System.Drawing.Point(680, 267);
this.SeekToBtn.Name = "SeekToBtn";
this.SeekToBtn.Size = new System.Drawing.Size(75, 23);
@ -279,6 +281,7 @@
//
// SeekToBox
//
this.SeekToBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.SeekToBox.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
this.SeekToBox.Location = new System.Drawing.Point(680, 297);
this.SeekToBox.Name = "SeekToBox";
@ -286,11 +289,23 @@
this.SeekToBox.Size = new System.Drawing.Size(75, 20);
this.SeekToBox.TabIndex = 14;
//
// CancelSeekBtn
//
this.CancelSeekBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.CancelSeekBtn.Location = new System.Drawing.Point(699, 323);
this.CancelSeekBtn.Name = "CancelSeekBtn";
this.CancelSeekBtn.Size = new System.Drawing.Size(56, 23);
this.CancelSeekBtn.TabIndex = 15;
this.CancelSeekBtn.Text = "Cancel";
this.CancelSeekBtn.UseVisualStyleBackColor = true;
this.CancelSeekBtn.Click += new System.EventHandler(this.CancelSeekBtn_Click);
//
// GenericDebugger
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(767, 560);
this.Controls.Add(this.CancelSeekBtn);
this.Controls.Add(this.SeekToBox);
this.Controls.Add(this.SeekToBtn);
this.Controls.Add(this.StepOverBtn);
@ -342,5 +357,6 @@
private System.Windows.Forms.ToolTip toolTip1;
private System.Windows.Forms.Button SeekToBtn;
private HexTextBox SeekToBox;
private System.Windows.Forms.Button CancelSeekBtn;
}
}

View File

@ -34,7 +34,7 @@ namespace BizHawk.Client.EmuHawk
private void EngageDebugger()
{
DisassemblyLines.Clear();
CancelSeekBtn.Enabled = false;
if (CanDisassemble)
{
try
@ -264,12 +264,25 @@ namespace BizHawk.Client.EmuHawk
}
}
public void DisableCancelSeekBtn()
{
CancelSeekBtn.Enabled = false;
}
private void SeekToBtn_Click(object sender, EventArgs e)
{
CancelSeekBtn.Enabled = true;
var pcVal = (uint)(SeekToBox.ToRawInt() ?? 0);
var pcBitSize = Debuggable.GetCpuFlagsAndRegisters()["PC"].BitSize;
BreakPointControl1.RemoveCurrentSeek();
BreakPointControl1.AddSeekBreakpoint(pcVal, pcBitSize);
BreakPointControl1.UpdateValues();
}
private void CancelSeekBtn_Click(object sender, EventArgs e)
{
BreakPointControl1.RemoveCurrentSeek();
CancelSeekBtn.Enabled = false;
}
}
}