Debugger: Added new break options in "Break In" dialog

This commit is contained in:
Sour 2018-02-16 19:33:20 -05:00
parent 1e896848e8
commit ad256e3c2e
4 changed files with 140 additions and 84 deletions

View file

@ -743,8 +743,7 @@ void Debugger::Step(uint32_t count)
void Debugger::StepCycles(uint32_t count)
{
//Run CPU for [count] CYCLES before breaking again
_stepCycleCount = _cpu->GetCycleCount() + count;
Run();
PpuStep(count * (_console->GetModel() == NesModel::NTSC ? 3 : 3.2));
}
void Debugger::StepOut()

View file

@ -175,7 +175,7 @@ namespace Mesen.GUI.Config
public int WindowHeight = -1;
public int BreakInCount = 1;
public bool BreakInPpuCycles = false;
public BreakInMetric BreakInMetric = BreakInMetric.CpuCycles;
public bool FindOccurrencesMatchCase = false;
public bool FindOccurrencesMatchWholeWord = false;
@ -264,6 +264,15 @@ namespace Mesen.GUI.Config
High = 2
}
public enum BreakInMetric
{
CpuCycles,
CpuInstructions,
PpuCycles,
Scanlines,
Frames
}
public class XmlColor
{
private Color _color = Color.Black;

View file

@ -29,96 +29,66 @@ namespace Mesen.GUI.Debugger
/// </summary>
private void InitializeComponent()
{
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.lblBreakIn = new System.Windows.Forms.Label();
this.flowLayoutPanel2 = new System.Windows.Forms.FlowLayoutPanel();
this.radCpuCycles = new System.Windows.Forms.RadioButton();
this.radFrames = new System.Windows.Forms.RadioButton();
this.nudCount = new Mesen.GUI.Controls.MesenNumericUpDown();
this.radCpuInstructions = new System.Windows.Forms.RadioButton();
this.radScanlines = new System.Windows.Forms.RadioButton();
this.lblBreakIn = new System.Windows.Forms.Label();
this.radPpuCycles = new System.Windows.Forms.RadioButton();
this.nudCount = new MesenNumericUpDown();
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.tableLayoutPanel1.SuspendLayout();
this.flowLayoutPanel2.SuspendLayout();
this.SuspendLayout();
//
// baseConfigPanel
//
this.baseConfigPanel.Location = new System.Drawing.Point(0, 48);
this.baseConfigPanel.Size = new System.Drawing.Size(240, 29);
this.baseConfigPanel.Location = new System.Drawing.Point(0, 70);
this.baseConfigPanel.Size = new System.Drawing.Size(333, 29);
//
// tableLayoutPanel1
// radCpuCycles
//
this.tableLayoutPanel1.ColumnCount = 3;
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 76F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel1.Controls.Add(this.lblBreakIn, 0, 0);
this.tableLayoutPanel1.Controls.Add(this.flowLayoutPanel2, 2, 0);
this.tableLayoutPanel1.Controls.Add(this.nudCount, 1, 0);
this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0);
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
this.tableLayoutPanel1.RowCount = 2;
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel1.Size = new System.Drawing.Size(240, 77);
this.tableLayoutPanel1.TabIndex = 0;
this.radCpuCycles.AutoSize = true;
this.radCpuCycles.Checked = true;
this.radCpuCycles.Location = new System.Drawing.Point(134, 3);
this.radCpuCycles.Name = "radCpuCycles";
this.radCpuCycles.Size = new System.Drawing.Size(81, 17);
this.radCpuCycles.TabIndex = 2;
this.radCpuCycles.TabStop = true;
this.radCpuCycles.Text = "CPU Cycles";
this.radCpuCycles.UseVisualStyleBackColor = true;
//
// lblBreakIn
// radFrames
//
this.lblBreakIn.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.lblBreakIn.AutoSize = true;
this.lblBreakIn.Location = new System.Drawing.Point(3, 16);
this.lblBreakIn.Name = "lblBreakIn";
this.lblBreakIn.Size = new System.Drawing.Size(49, 13);
this.lblBreakIn.TabIndex = 0;
this.lblBreakIn.Text = "Break in:";
//
// flowLayoutPanel2
//
this.flowLayoutPanel2.Controls.Add(this.radCpuInstructions);
this.flowLayoutPanel2.Controls.Add(this.radPpuCycles);
this.flowLayoutPanel2.Location = new System.Drawing.Point(131, 0);
this.flowLayoutPanel2.Margin = new System.Windows.Forms.Padding(0);
this.flowLayoutPanel2.Name = "flowLayoutPanel2";
this.flowLayoutPanel2.Size = new System.Drawing.Size(109, 45);
this.flowLayoutPanel2.TabIndex = 2;
//
// radCpuInstructions
//
this.radCpuInstructions.AutoSize = true;
this.radCpuInstructions.Checked = true;
this.radCpuInstructions.Location = new System.Drawing.Point(3, 3);
this.radCpuInstructions.Name = "radCpuInstructions";
this.radCpuInstructions.Size = new System.Drawing.Size(104, 17);
this.radCpuInstructions.TabIndex = 0;
this.radCpuInstructions.TabStop = true;
this.radCpuInstructions.Text = "CPU Instructions";
this.radCpuInstructions.UseVisualStyleBackColor = true;
//
// radPpuCycles
//
this.radPpuCycles.AutoSize = true;
this.radPpuCycles.Location = new System.Drawing.Point(3, 26);
this.radPpuCycles.Name = "radPpuCycles";
this.radPpuCycles.Size = new System.Drawing.Size(81, 17);
this.radPpuCycles.TabIndex = 1;
this.radPpuCycles.Text = "PPU Cycles";
this.radPpuCycles.UseVisualStyleBackColor = true;
this.radFrames.AutoSize = true;
this.radFrames.Location = new System.Drawing.Point(244, 49);
this.radFrames.Name = "radFrames";
this.radFrames.Size = new System.Drawing.Size(59, 17);
this.radFrames.TabIndex = 4;
this.radFrames.Text = "Frames";
this.radFrames.UseVisualStyleBackColor = true;
//
// nudCount
//
this.nudCount.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.nudCount.Location = new System.Drawing.Point(58, 12);
this.nudCount.DecimalPlaces = 0;
this.nudCount.Increment = new decimal(new int[] {
1,
0,
0,
0});
this.nudCount.Location = new System.Drawing.Point(58, 3);
this.nudCount.Maximum = new decimal(new int[] {
2000000000,
0,
0,
0});
this.nudCount.MaximumSize = new System.Drawing.Size(10000, 20);
this.nudCount.Minimum = new decimal(new int[] {
1,
0,
0,
0});
this.nudCount.Name = "nudCount";
this.tableLayoutPanel1.SetRowSpan(this.nudCount, 2);
this.nudCount.Size = new System.Drawing.Size(70, 20);
this.nudCount.TabIndex = 3;
this.nudCount.Value = new decimal(new int[] {
@ -126,12 +96,78 @@ namespace Mesen.GUI.Debugger
0,
0,
0});
//
// radCpuInstructions
//
this.radCpuInstructions.AutoSize = true;
this.radCpuInstructions.Location = new System.Drawing.Point(134, 26);
this.radCpuInstructions.Name = "radCpuInstructions";
this.radCpuInstructions.Size = new System.Drawing.Size(104, 17);
this.radCpuInstructions.TabIndex = 0;
this.radCpuInstructions.Text = "CPU Instructions";
this.radCpuInstructions.UseVisualStyleBackColor = true;
//
// radScanlines
//
this.radScanlines.AutoSize = true;
this.radScanlines.Location = new System.Drawing.Point(244, 26);
this.radScanlines.Name = "radScanlines";
this.radScanlines.Size = new System.Drawing.Size(71, 17);
this.radScanlines.TabIndex = 3;
this.radScanlines.Text = "Scanlines";
this.radScanlines.UseVisualStyleBackColor = true;
//
// lblBreakIn
//
this.lblBreakIn.AutoSize = true;
this.lblBreakIn.Location = new System.Drawing.Point(3, 5);
this.lblBreakIn.Margin = new System.Windows.Forms.Padding(3, 5, 3, 0);
this.lblBreakIn.Name = "lblBreakIn";
this.tableLayoutPanel1.SetRowSpan(this.lblBreakIn, 2);
this.lblBreakIn.Size = new System.Drawing.Size(49, 13);
this.lblBreakIn.TabIndex = 0;
this.lblBreakIn.Text = "Break in:";
//
// radPpuCycles
//
this.radPpuCycles.AutoSize = true;
this.radPpuCycles.Location = new System.Drawing.Point(244, 3);
this.radPpuCycles.Name = "radPpuCycles";
this.radPpuCycles.Size = new System.Drawing.Size(81, 17);
this.radPpuCycles.TabIndex = 1;
this.radPpuCycles.Text = "PPU Cycles";
this.radPpuCycles.UseVisualStyleBackColor = true;
//
// tableLayoutPanel1
//
this.tableLayoutPanel1.ColumnCount = 4;
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 76F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel1.Controls.Add(this.radPpuCycles, 3, 0);
this.tableLayoutPanel1.Controls.Add(this.lblBreakIn, 0, 0);
this.tableLayoutPanel1.Controls.Add(this.radScanlines, 3, 1);
this.tableLayoutPanel1.Controls.Add(this.radCpuInstructions, 2, 1);
this.tableLayoutPanel1.Controls.Add(this.nudCount, 1, 0);
this.tableLayoutPanel1.Controls.Add(this.radFrames, 3, 2);
this.tableLayoutPanel1.Controls.Add(this.radCpuCycles, 2, 0);
this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0);
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
this.tableLayoutPanel1.RowCount = 4;
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel1.Size = new System.Drawing.Size(333, 99);
this.tableLayoutPanel1.TabIndex = 0;
//
// frmBreakIn
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(240, 77);
this.ClientSize = new System.Drawing.Size(333, 99);
this.Controls.Add(this.tableLayoutPanel1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
this.Name = "frmBreakIn";
@ -141,19 +177,19 @@ namespace Mesen.GUI.Debugger
this.Controls.SetChildIndex(this.baseConfigPanel, 0);
this.tableLayoutPanel1.ResumeLayout(false);
this.tableLayoutPanel1.PerformLayout();
this.flowLayoutPanel2.ResumeLayout(false);
this.flowLayoutPanel2.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
private System.Windows.Forms.Label lblBreakIn;
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel2;
private System.Windows.Forms.RadioButton radCpuInstructions;
private System.Windows.Forms.RadioButton radPpuCycles;
private System.Windows.Forms.RadioButton radCpuCycles;
private System.Windows.Forms.RadioButton radFrames;
private MesenNumericUpDown nudCount;
private System.Windows.Forms.RadioButton radCpuInstructions;
private System.Windows.Forms.RadioButton radScanlines;
private System.Windows.Forms.Label lblBreakIn;
private System.Windows.Forms.RadioButton radPpuCycles;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
}
}

View file

@ -19,8 +19,11 @@ namespace Mesen.GUI.Debugger
InitializeComponent();
nudCount.Value = ConfigManager.Config.DebugInfo.BreakInCount;
radCpuInstructions.Checked = !ConfigManager.Config.DebugInfo.BreakInPpuCycles;
radPpuCycles.Checked = ConfigManager.Config.DebugInfo.BreakInPpuCycles;
radCpuInstructions.Checked = ConfigManager.Config.DebugInfo.BreakInMetric == BreakInMetric.CpuInstructions;
radCpuCycles.Checked = ConfigManager.Config.DebugInfo.BreakInMetric == BreakInMetric.CpuCycles;
radPpuCycles.Checked = ConfigManager.Config.DebugInfo.BreakInMetric == BreakInMetric.PpuCycles;
radScanlines.Checked = ConfigManager.Config.DebugInfo.BreakInMetric == BreakInMetric.Scanlines;
radFrames.Checked = ConfigManager.Config.DebugInfo.BreakInMetric == BreakInMetric.Frames;
}
protected override void OnShown(EventArgs e)
@ -33,15 +36,24 @@ namespace Mesen.GUI.Debugger
{
base.OnFormClosed(e);
if(this.DialogResult == DialogResult.OK) {
UInt32 count = (UInt32)nudCount.Value;
ConfigManager.Config.DebugInfo.BreakInCount = (int)count;
if(radCpuInstructions.Checked) {
InteropEmu.DebugStepCycles((UInt32)nudCount.Value);
InteropEmu.DebugStep(count);
ConfigManager.Config.DebugInfo.BreakInMetric = BreakInMetric.CpuInstructions;
} else if(radCpuCycles.Checked) {
InteropEmu.DebugStepCycles(count);
ConfigManager.Config.DebugInfo.BreakInMetric = BreakInMetric.CpuCycles;
} else if(radPpuCycles.Checked) {
InteropEmu.DebugPpuStep(count);
ConfigManager.Config.DebugInfo.BreakInMetric = BreakInMetric.PpuCycles;
} else if(radScanlines.Checked) {
InteropEmu.DebugPpuStep(count * 341);
ConfigManager.Config.DebugInfo.BreakInMetric = BreakInMetric.Scanlines;
} else {
InteropEmu.DebugPpuStep((UInt32)nudCount.Value);
InteropEmu.DebugPpuStep(count * 89342);
ConfigManager.Config.DebugInfo.BreakInMetric = BreakInMetric.Frames;
}
ConfigManager.Config.DebugInfo.BreakInCount = (int)nudCount.Value;
ConfigManager.Config.DebugInfo.BreakInPpuCycles = radPpuCycles.Checked;
ConfigManager.ApplyChanges();
}
}