From aeddd1751d91af2e186f7dea7ca274c7aeabc3a3 Mon Sep 17 00:00:00 2001 From: Sour Date: Sat, 30 Mar 2019 22:58:57 -0400 Subject: [PATCH] Debugger: Added break in/on features --- Core/DebugTypes.h | 1 + Core/Debugger.cpp | 22 +++- Core/Debugger.h | 1 + UI/Debugger/Config/DebugInfo.cs | 12 ++ UI/Debugger/frmBreakIn.cs | 57 +++++++++ UI/Debugger/frmBreakIn.designer.cs | 180 ++++++++++++++++++++++++++++ UI/Debugger/frmBreakIn.resx | 123 +++++++++++++++++++ UI/Debugger/frmBreakOn.cs | 41 +++++++ UI/Debugger/frmBreakOn.designer.cs | 127 ++++++++++++++++++++ UI/Debugger/frmBreakOn.resx | 123 +++++++++++++++++++ UI/Debugger/frmDbgPreferences.cs | 4 +- UI/Debugger/frmDebugger.Designer.cs | 3 - UI/Debugger/frmDebugger.cs | 6 + UI/Interop/DebugApi.cs | 1 + UI/UI.csproj | 18 +++ 15 files changed, 713 insertions(+), 6 deletions(-) create mode 100644 UI/Debugger/frmBreakIn.cs create mode 100644 UI/Debugger/frmBreakIn.designer.cs create mode 100644 UI/Debugger/frmBreakIn.resx create mode 100644 UI/Debugger/frmBreakOn.cs create mode 100644 UI/Debugger/frmBreakOn.designer.cs create mode 100644 UI/Debugger/frmBreakOn.resx diff --git a/Core/DebugTypes.h b/Core/DebugTypes.h index 4c80767..2188aec 100644 --- a/Core/DebugTypes.h +++ b/Core/DebugTypes.h @@ -211,4 +211,5 @@ enum class StepType CpuStepOut, CpuStepOver, PpuStep, + SpecificScanline, }; diff --git a/Core/Debugger.cpp b/Core/Debugger.cpp index a5ead4b..738739b 100644 --- a/Core/Debugger.cpp +++ b/Core/Debugger.cpp @@ -45,6 +45,7 @@ Debugger::Debugger(shared_ptr console) _cpuStepCount = -1; _ppuStepCount = -1; _breakAddress = -1; + _breakScanline = -1; _executionStopped = false; _breakRequestCount = 0; @@ -227,6 +228,12 @@ void Debugger::ProcessPpuCycle() SleepUntilResume(); } } + + if(cycle == 0 && scanline == _breakScanline) { + _cpuStepCount = 0; + _breakScanline = -1; + SleepUntilResume(); + } } void Debugger::SleepUntilResume() @@ -293,8 +300,9 @@ int32_t Debugger::EvaluateExpression(string expression, EvalResultType &resultTy void Debugger::Run() { _cpuStepCount = -1; - _breakAddress = -1; _ppuStepCount = -1; + _breakAddress = -1; + _breakScanline = -1; } void Debugger::Step(int32_t stepCount, StepType type) @@ -304,12 +312,14 @@ void Debugger::Step(int32_t stepCount, StepType type) _cpuStepCount = stepCount; _breakAddress = -1; _ppuStepCount = -1; + _breakScanline = -1; break; case StepType::CpuStepOut: _breakAddress = _callstackManager->GetReturnAddress(); _cpuStepCount = -1; _ppuStepCount = -1; + _breakScanline = -1; break; case StepType::CpuStepOver: @@ -318,11 +328,13 @@ void Debugger::Step(int32_t stepCount, StepType type) _breakAddress = (_prevProgramCounter & 0xFF0000) | (((_prevProgramCounter & 0xFFFF) + DisassemblyInfo::GetOperandSize(_prevOpCode, 0) + 1) & 0xFFFF); _cpuStepCount = -1; _ppuStepCount = -1; + _breakScanline = -1; } else { //For any other instruction, step over is the same as step into _cpuStepCount = 1; _breakAddress = -1; _ppuStepCount = -1; + _breakScanline = -1; } break; @@ -330,6 +342,14 @@ void Debugger::Step(int32_t stepCount, StepType type) _ppuStepCount = stepCount; _cpuStepCount = -1; _breakAddress = -1; + _breakScanline = -1; + break; + + case StepType::SpecificScanline: + _breakScanline = stepCount; + _ppuStepCount = -1; + _cpuStepCount = -1; + _breakAddress = -1; break; } } diff --git a/Core/Debugger.h b/Core/Debugger.h index 58e530a..6370561 100644 --- a/Core/Debugger.h +++ b/Core/Debugger.h @@ -51,6 +51,7 @@ private: atomic _cpuStepCount; atomic _ppuStepCount; atomic _breakAddress; + atomic _breakScanline; uint8_t _prevOpCode = 0; uint32_t _prevProgramCounter = 0; diff --git a/UI/Debugger/Config/DebugInfo.cs b/UI/Debugger/Config/DebugInfo.cs index aa093ea..380a1f4 100644 --- a/UI/Debugger/Config/DebugInfo.cs +++ b/UI/Debugger/Config/DebugInfo.cs @@ -21,6 +21,10 @@ namespace Mesen.GUI.Config public HexEditorInfo HexEditor = new HexEditorInfo(); public EventViewerInfo EventViewer = new EventViewerInfo(); + public int BreakOnValue = 0; + public int BreakInCount = 1; + public BreakInMetric BreakInMetric = BreakInMetric.CpuInstructions; + public bool ShowSelectionLength = false; public XmlColor CodeOpcodeColor = Color.FromArgb(22, 37, 37); @@ -52,4 +56,12 @@ namespace Mesen.GUI.Config Normal = 1, High = 2 } + + public enum BreakInMetric + { + CpuInstructions, + PpuCycles, + Scanlines, + Frames + } } diff --git a/UI/Debugger/frmBreakIn.cs b/UI/Debugger/frmBreakIn.cs new file mode 100644 index 0000000..a5115bb --- /dev/null +++ b/UI/Debugger/frmBreakIn.cs @@ -0,0 +1,57 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using Mesen.GUI.Config; +using Mesen.GUI.Forms; + +namespace Mesen.GUI.Debugger +{ + public partial class frmBreakIn : BaseConfigForm + { + public frmBreakIn() + { + InitializeComponent(); + + nudCount.Value = ConfigManager.Config.Debug.BreakInCount; + radCpuInstructions.Checked = ConfigManager.Config.Debug.BreakInMetric == BreakInMetric.CpuInstructions; + radPpuCycles.Checked = ConfigManager.Config.Debug.BreakInMetric == BreakInMetric.PpuCycles; + radScanlines.Checked = ConfigManager.Config.Debug.BreakInMetric == BreakInMetric.Scanlines; + radFrames.Checked = ConfigManager.Config.Debug.BreakInMetric == BreakInMetric.Frames; + } + + protected override void OnShown(EventArgs e) + { + base.OnShown(e); + nudCount.Focus(); + } + + protected override void OnFormClosed(FormClosedEventArgs e) + { + base.OnFormClosed(e); + if(this.DialogResult == DialogResult.OK) { + int count = (int)nudCount.Value; + ConfigManager.Config.Debug.BreakInCount = (int)count; + if(radCpuInstructions.Checked) { + DebugApi.Step(count, StepType.CpuStep); + ConfigManager.Config.Debug.BreakInMetric = BreakInMetric.CpuInstructions; + } else if(radPpuCycles.Checked) { + DebugApi.Step(count, StepType.PpuStep); + ConfigManager.Config.Debug.BreakInMetric = BreakInMetric.PpuCycles; + } else if(radScanlines.Checked) { + DebugApi.Step(count * 341, StepType.PpuStep); + ConfigManager.Config.Debug.BreakInMetric = BreakInMetric.Scanlines; + } else { + DebugApi.Step(count * 341 * 262, StepType.PpuStep); + ConfigManager.Config.Debug.BreakInMetric = BreakInMetric.Frames; + } + ConfigManager.ApplyChanges(); + } + } + } +} diff --git a/UI/Debugger/frmBreakIn.designer.cs b/UI/Debugger/frmBreakIn.designer.cs new file mode 100644 index 0000000..9367c28 --- /dev/null +++ b/UI/Debugger/frmBreakIn.designer.cs @@ -0,0 +1,180 @@ +using Mesen.GUI.Controls; + +namespace Mesen.GUI.Debugger +{ + partial class frmBreakIn + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if(disposing && (components != null)) { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + 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.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); + this.tableLayoutPanel1.SuspendLayout(); + this.SuspendLayout(); + // + // baseConfigPanel + // + this.baseConfigPanel.Location = new System.Drawing.Point(0, 70); + this.baseConfigPanel.Size = new System.Drawing.Size(333, 29); + // + // radFrames + // + 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.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.MinimumSize = new System.Drawing.Size(0, 21); + this.nudCount.Name = "nudCount"; + this.tableLayoutPanel1.SetRowSpan(this.nudCount, 2); + this.nudCount.Size = new System.Drawing.Size(70, 21); + this.nudCount.TabIndex = 3; + this.nudCount.Value = new decimal(new int[] { + 1, + 0, + 0, + 0}); + // + // radCpuInstructions + // + this.radCpuInstructions.AutoSize = true; + this.radCpuInstructions.Location = new System.Drawing.Point(134, 3); + 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.nudCount, 1, 0); + this.tableLayoutPanel1.Controls.Add(this.radFrames, 3, 2); + this.tableLayoutPanel1.Controls.Add(this.radCpuInstructions, 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(333, 99); + this.Controls.Add(this.tableLayoutPanel1); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; + this.Name = "frmBreakIn"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "Break In..."; + this.Controls.SetChildIndex(this.tableLayoutPanel1, 0); + this.Controls.SetChildIndex(this.baseConfigPanel, 0); + this.tableLayoutPanel1.ResumeLayout(false); + this.tableLayoutPanel1.PerformLayout(); + this.ResumeLayout(false); + + } + + #endregion + 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; + } +} \ No newline at end of file diff --git a/UI/Debugger/frmBreakIn.resx b/UI/Debugger/frmBreakIn.resx new file mode 100644 index 0000000..8766f29 --- /dev/null +++ b/UI/Debugger/frmBreakIn.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 17 + + \ No newline at end of file diff --git a/UI/Debugger/frmBreakOn.cs b/UI/Debugger/frmBreakOn.cs new file mode 100644 index 0000000..0ab71e9 --- /dev/null +++ b/UI/Debugger/frmBreakOn.cs @@ -0,0 +1,41 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using Mesen.GUI.Config; +using Mesen.GUI.Forms; + +namespace Mesen.GUI.Debugger +{ + public partial class frmBreakOn : BaseConfigForm + { + public frmBreakOn() + { + InitializeComponent(); + + nudCount.Value = ConfigManager.Config.Debug.BreakOnValue; + } + + protected override void OnShown(EventArgs e) + { + base.OnShown(e); + nudCount.Focus(); + } + + protected override void OnFormClosed(FormClosedEventArgs e) + { + base.OnFormClosed(e); + if(this.DialogResult == DialogResult.OK) { + int count = (int)nudCount.Value; + ConfigManager.Config.Debug.BreakOnValue = count; + DebugApi.Step(count, StepType.SpecificScanline); + ConfigManager.ApplyChanges(); + } + } + } +} diff --git a/UI/Debugger/frmBreakOn.designer.cs b/UI/Debugger/frmBreakOn.designer.cs new file mode 100644 index 0000000..316625e --- /dev/null +++ b/UI/Debugger/frmBreakOn.designer.cs @@ -0,0 +1,127 @@ +using Mesen.GUI.Controls; + +namespace Mesen.GUI.Debugger +{ + partial class frmBreakOn + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if(disposing && (components != null)) { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.nudCount = new Mesen.GUI.Controls.MesenNumericUpDown(); + this.lblBreakOn = new System.Windows.Forms.Label(); + this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); + this.tableLayoutPanel1.SuspendLayout(); + this.SuspendLayout(); + // + // baseConfigPanel + // + this.baseConfigPanel.Location = new System.Drawing.Point(0, 29); + this.baseConfigPanel.Size = new System.Drawing.Size(186, 29); + // + // nudCount + // + this.nudCount.DecimalPlaces = 0; + this.nudCount.Increment = new decimal(new int[] { + 1, + 0, + 0, + 0}); + this.nudCount.Location = new System.Drawing.Point(104, 3); + this.nudCount.Maximum = new decimal(new int[] { + 999, + 0, + 0, + 0}); + this.nudCount.MaximumSize = new System.Drawing.Size(10000, 20); + this.nudCount.Minimum = new decimal(new int[] { + 1, + 0, + 0, + -2147483648}); + 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[] { + 1, + 0, + 0, + 0}); + // + // lblBreakOn + // + this.lblBreakOn.AutoSize = true; + this.lblBreakOn.Location = new System.Drawing.Point(3, 5); + this.lblBreakOn.Margin = new System.Windows.Forms.Padding(3, 5, 3, 0); + this.lblBreakOn.Name = "lblBreakOn"; + this.tableLayoutPanel1.SetRowSpan(this.lblBreakOn, 2); + this.lblBreakOn.Size = new System.Drawing.Size(95, 13); + this.lblBreakOn.TabIndex = 0; + this.lblBreakOn.Text = "Break on scanline:"; + // + // 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.lblBreakOn, 0, 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 = 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(186, 58); + this.tableLayoutPanel1.TabIndex = 0; + // + // frmBreakOn + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(186, 58); + this.Controls.Add(this.tableLayoutPanel1); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; + this.Name = "frmBreakOn"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "Break On..."; + this.Controls.SetChildIndex(this.tableLayoutPanel1, 0); + this.Controls.SetChildIndex(this.baseConfigPanel, 0); + this.tableLayoutPanel1.ResumeLayout(false); + this.tableLayoutPanel1.PerformLayout(); + this.ResumeLayout(false); + + } + + #endregion + private MesenNumericUpDown nudCount; + private System.Windows.Forms.Label lblBreakOn; + private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; + } +} \ No newline at end of file diff --git a/UI/Debugger/frmBreakOn.resx b/UI/Debugger/frmBreakOn.resx new file mode 100644 index 0000000..8766f29 --- /dev/null +++ b/UI/Debugger/frmBreakOn.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 17 + + \ No newline at end of file diff --git a/UI/Debugger/frmDbgPreferences.cs b/UI/Debugger/frmDbgPreferences.cs index dc09184..a4dd14a 100644 --- a/UI/Debugger/frmDbgPreferences.cs +++ b/UI/Debugger/frmDbgPreferences.cs @@ -91,8 +91,8 @@ namespace Mesen.GUI.Debugger GetMember(nameof(DebuggerShortcutsConfig.RunPpuCycle)), GetMember(nameof(DebuggerShortcutsConfig.RunPpuScanline)), GetMember(nameof(DebuggerShortcutsConfig.RunPpuFrame)), - //GetMember(nameof(DebuggerShortcutsConfig.BreakIn)), - //GetMember(nameof(DebuggerShortcutsConfig.BreakOn)), + GetMember(nameof(DebuggerShortcutsConfig.BreakIn)), + GetMember(nameof(DebuggerShortcutsConfig.BreakOn)), //GetMember(nameof(DebuggerShortcutsConfig.FindOccurrences)), GetMember(nameof(DebuggerShortcutsConfig.GoToProgramCounter)), //GetMember(nameof(DebuggerShortcutsConfig.CodeWindow_SetNextStatement)), diff --git a/UI/Debugger/frmDebugger.Designer.cs b/UI/Debugger/frmDebugger.Designer.cs index 6581af4..238d726 100644 --- a/UI/Debugger/frmDebugger.Designer.cs +++ b/UI/Debugger/frmDebugger.Designer.cs @@ -258,21 +258,18 @@ // this.toolStripMenuItem8.Name = "toolStripMenuItem8"; this.toolStripMenuItem8.Size = new System.Drawing.Size(209, 6); - this.toolStripMenuItem8.Visible = false; // // mnuBreakIn // this.mnuBreakIn.Name = "mnuBreakIn"; this.mnuBreakIn.Size = new System.Drawing.Size(212, 22); this.mnuBreakIn.Text = "Break in..."; - this.mnuBreakIn.Visible = false; // // mnuBreakOn // this.mnuBreakOn.Name = "mnuBreakOn"; this.mnuBreakOn.Size = new System.Drawing.Size(212, 22); this.mnuBreakOn.Text = "Break on..."; - this.mnuBreakOn.Visible = false; // // searchToolStripMenuItem // diff --git a/UI/Debugger/frmDebugger.cs b/UI/Debugger/frmDebugger.cs index 3b561f6..bf9bd44 100644 --- a/UI/Debugger/frmDebugger.cs +++ b/UI/Debugger/frmDebugger.cs @@ -95,6 +95,9 @@ namespace Mesen.GUI.Debugger mnuFindNext.InitShortcut(this, nameof(DebuggerShortcutsConfig.FindNext)); mnuFindPrev.InitShortcut(this, nameof(DebuggerShortcutsConfig.FindPrev)); + mnuBreakIn.InitShortcut(this, nameof(DebuggerShortcutsConfig.BreakIn)); + mnuBreakOn.InitShortcut(this, nameof(DebuggerShortcutsConfig.BreakOn)); + mnuStepInto.Click += (s, e) => { DebugApi.Step(1); }; mnuStepOver.Click += (s, e) => { DebugApi.Step(1, StepType.CpuStepOver); }; mnuStepOut.Click += (s, e) => { DebugApi.Step(1, StepType.CpuStepOut); }; @@ -121,6 +124,9 @@ namespace Mesen.GUI.Debugger mnuFind.Click += (s, e) => { ctrlDisassemblyView.CodeViewer.OpenSearchBox(); }; mnuFindNext.Click += (s, e) => { ctrlDisassemblyView.CodeViewer.FindNext(); }; mnuFindPrev.Click += (s, e) => { ctrlDisassemblyView.CodeViewer.FindPrevious(); }; + + mnuBreakIn.Click += (s, e) => { using(frmBreakIn frm = new frmBreakIn()) { frm.ShowDialog(); } }; + mnuBreakOn.Click += (s, e) => { using(frmBreakOn frm = new frmBreakOn()) { frm.ShowDialog(); } }; } private void InitToolbar() diff --git a/UI/Interop/DebugApi.cs b/UI/Interop/DebugApi.cs index 2483843..10ab177 100644 --- a/UI/Interop/DebugApi.cs +++ b/UI/Interop/DebugApi.cs @@ -405,6 +405,7 @@ namespace Mesen.GUI CpuStepOut, CpuStepOver, PpuStep, + SpecificScanline, } public enum CdlFlags : byte diff --git a/UI/UI.csproj b/UI/UI.csproj index e414cdc..c5b5897 100644 --- a/UI/UI.csproj +++ b/UI/UI.csproj @@ -248,6 +248,18 @@ + + Form + + + frmBreakIn.cs + + + Form + + + frmBreakOn.cs + @@ -713,6 +725,12 @@ ctrlDisassemblyView.cs + + frmBreakIn.cs + + + frmBreakOn.cs + ctrlHexViewer.cs