Debugger: Added break in/on features

This commit is contained in:
Sour 2019-03-30 22:58:57 -04:00
parent 351fc39e4b
commit aeddd1751d
15 changed files with 713 additions and 6 deletions

View file

@ -211,4 +211,5 @@ enum class StepType
CpuStepOut,
CpuStepOver,
PpuStep,
SpecificScanline,
};

View file

@ -45,6 +45,7 @@ Debugger::Debugger(shared_ptr<Console> 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;
}
}

View file

@ -51,6 +51,7 @@ private:
atomic<int32_t> _cpuStepCount;
atomic<int32_t> _ppuStepCount;
atomic<int32_t> _breakAddress;
atomic<int32_t> _breakScanline;
uint8_t _prevOpCode = 0;
uint32_t _prevProgramCounter = 0;

View file

@ -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
}
}

57
UI/Debugger/frmBreakIn.cs Normal file
View file

@ -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();
}
}
}
}

180
UI/Debugger/frmBreakIn.designer.cs generated Normal file
View file

@ -0,0 +1,180 @@
using Mesen.GUI.Controls;
namespace Mesen.GUI.Debugger
{
partial class frmBreakIn
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if(disposing && (components != null)) {
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
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;
}
}

123
UI/Debugger/frmBreakIn.resx Normal file
View file

@ -0,0 +1,123 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="toolTip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>

41
UI/Debugger/frmBreakOn.cs Normal file
View file

@ -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();
}
}
}
}

127
UI/Debugger/frmBreakOn.designer.cs generated Normal file
View file

@ -0,0 +1,127 @@
using Mesen.GUI.Controls;
namespace Mesen.GUI.Debugger
{
partial class frmBreakOn
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if(disposing && (components != null)) {
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
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;
}
}

123
UI/Debugger/frmBreakOn.resx Normal file
View file

@ -0,0 +1,123 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="toolTip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>

View file

@ -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)),

View file

@ -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
//

View file

@ -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()

View file

@ -405,6 +405,7 @@ namespace Mesen.GUI
CpuStepOut,
CpuStepOver,
PpuStep,
SpecificScanline,
}
public enum CdlFlags : byte

View file

@ -248,6 +248,18 @@
<Compile Include="Debugger\Code\CpuLineStyleProvider.cs" />
<Compile Include="Debugger\Code\IDisassemblyManager.cs" />
<Compile Include="Debugger\Config\DebuggerShortcutsConfig.cs" />
<Compile Include="Debugger\frmBreakIn.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Debugger\frmBreakIn.designer.cs">
<DependentUpon>frmBreakIn.cs</DependentUpon>
</Compile>
<Compile Include="Debugger\frmBreakOn.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Debugger\frmBreakOn.designer.cs">
<DependentUpon>frmBreakOn.cs</DependentUpon>
</Compile>
<Compile Include="Debugger\Workspace\DebugWorkspace.cs" />
<Compile Include="Debugger\Config\EventViewerInfo.cs" />
<Compile Include="Debugger\Config\HexEditorInfo.cs" />
@ -713,6 +725,12 @@
<EmbeddedResource Include="Debugger\Controls\ctrlDisassemblyView.resx">
<DependentUpon>ctrlDisassemblyView.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Debugger\frmBreakIn.resx">
<DependentUpon>frmBreakIn.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Debugger\frmBreakOn.resx">
<DependentUpon>frmBreakOn.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Debugger\MemoryTools\ctrlHexViewer.resx">
<DependentUpon>ctrlHexViewer.cs</DependentUpon>
</EmbeddedResource>