Debugger - Added shortcuts to jump to NMI/IRQ/Reset vectors

This commit is contained in:
Souryo 2016-01-10 09:21:07 -05:00
parent 1f19a71dbc
commit 7d0b9e8dd5
3 changed files with 125 additions and 67 deletions

View file

@ -377,7 +377,7 @@ namespace Mesen.GUI.Debugger
public int CurrentLine
{
get { return _lineNumbers[_cursorPosition]; }
get { return _lineNumbers.Length > _cursorPosition ? _lineNumbers[_cursorPosition] : 0; }
}
[Browsable(false)]

View file

@ -34,13 +34,19 @@
this.components = new System.ComponentModel.Container();
this.splitContainer = new System.Windows.Forms.SplitContainer();
this.tlpTop = new System.Windows.Forms.TableLayoutPanel();
this.ctrlDebuggerCode = new Mesen.GUI.Debugger.ctrlDebuggerCode();
this.contextMenuCode = new System.Windows.Forms.ContextMenuStrip(this.components);
this.mnuShowNextStatement = new System.Windows.Forms.ToolStripMenuItem();
this.mnuSetNextStatement = new System.Windows.Forms.ToolStripMenuItem();
this.ctrlConsoleStatus = new Mesen.GUI.Debugger.ctrlConsoleStatus();
this.ctrlDebuggerCodeSplit = new Mesen.GUI.Debugger.ctrlDebuggerCode();
this.tableLayoutPanel10 = new System.Windows.Forms.TableLayoutPanel();
this.grpWatch = new System.Windows.Forms.GroupBox();
this.ctrlWatch = new Mesen.GUI.Debugger.ctrlWatch();
this.grpBreakpoints = new System.Windows.Forms.GroupBox();
this.ctrlBreakpoints = new Mesen.GUI.Debugger.Controls.ctrlBreakpoints();
this.grpCallstack = new System.Windows.Forms.GroupBox();
this.ctrlCallstack = new Mesen.GUI.Debugger.Controls.ctrlCallstack();
this.menuStrip = new System.Windows.Forms.MenuStrip();
this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem3 = new System.Windows.Forms.ToolStripSeparator();
@ -85,12 +91,10 @@
this.lblChrAnalysis = new System.Windows.Forms.ToolStripStatusLabel();
this.lblChrAnalysisResult = new System.Windows.Forms.ToolStripStatusLabel();
this.tmrCdlRatios = new System.Windows.Forms.Timer(this.components);
this.ctrlDebuggerCode = new Mesen.GUI.Debugger.ctrlDebuggerCode();
this.ctrlConsoleStatus = new Mesen.GUI.Debugger.ctrlConsoleStatus();
this.ctrlDebuggerCodeSplit = new Mesen.GUI.Debugger.ctrlDebuggerCode();
this.ctrlWatch = new Mesen.GUI.Debugger.ctrlWatch();
this.ctrlBreakpoints = new Mesen.GUI.Debugger.Controls.ctrlBreakpoints();
this.ctrlCallstack = new Mesen.GUI.Debugger.Controls.ctrlCallstack();
this.mnuGoToAddress = new System.Windows.Forms.ToolStripMenuItem();
this.mnuGoToIrqHandler = new System.Windows.Forms.ToolStripMenuItem();
this.mnuGoToNmiHandler = new System.Windows.Forms.ToolStripMenuItem();
this.mnuGoToResetHandler = new System.Windows.Forms.ToolStripMenuItem();
((System.ComponentModel.ISupportInitialize)(this.splitContainer)).BeginInit();
this.splitContainer.Panel1.SuspendLayout();
this.splitContainer.Panel2.SuspendLayout();
@ -143,6 +147,19 @@
this.tlpTop.Size = new System.Drawing.Size(984, 412);
this.tlpTop.TabIndex = 2;
//
// ctrlDebuggerCode
//
this.ctrlDebuggerCode.Code = null;
this.ctrlDebuggerCode.ContextMenuStrip = this.contextMenuCode;
this.ctrlDebuggerCode.Dock = System.Windows.Forms.DockStyle.Fill;
this.ctrlDebuggerCode.Location = new System.Drawing.Point(3, 3);
this.ctrlDebuggerCode.Name = "ctrlDebuggerCode";
this.ctrlDebuggerCode.Size = new System.Drawing.Size(546, 406);
this.ctrlDebuggerCode.TabIndex = 2;
this.ctrlDebuggerCode.OnWatchAdded += new Mesen.GUI.Debugger.ctrlDebuggerCode.AddressEventHandler(this.ctrlDebuggerCode_OnWatchAdded);
this.ctrlDebuggerCode.OnSetNextStatement += new Mesen.GUI.Debugger.ctrlDebuggerCode.AddressEventHandler(this.ctrlDebuggerCode_OnSetNextStatement);
this.ctrlDebuggerCode.Enter += new System.EventHandler(this.ctrlDebuggerCode_Enter);
//
// contextMenuCode
//
this.contextMenuCode.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
@ -167,6 +184,28 @@
this.mnuSetNextStatement.Size = new System.Drawing.Size(258, 22);
this.mnuSetNextStatement.Text = "Set Next Statement";
//
// ctrlConsoleStatus
//
this.ctrlConsoleStatus.Dock = System.Windows.Forms.DockStyle.Top;
this.ctrlConsoleStatus.Location = new System.Drawing.Point(552, 0);
this.ctrlConsoleStatus.Margin = new System.Windows.Forms.Padding(0);
this.ctrlConsoleStatus.Name = "ctrlConsoleStatus";
this.ctrlConsoleStatus.Size = new System.Drawing.Size(432, 362);
this.ctrlConsoleStatus.TabIndex = 3;
//
// ctrlDebuggerCodeSplit
//
this.ctrlDebuggerCodeSplit.Code = null;
this.ctrlDebuggerCodeSplit.Dock = System.Windows.Forms.DockStyle.Fill;
this.ctrlDebuggerCodeSplit.Location = new System.Drawing.Point(555, 3);
this.ctrlDebuggerCodeSplit.Name = "ctrlDebuggerCodeSplit";
this.ctrlDebuggerCodeSplit.Size = new System.Drawing.Size(1, 406);
this.ctrlDebuggerCodeSplit.TabIndex = 4;
this.ctrlDebuggerCodeSplit.Visible = false;
this.ctrlDebuggerCodeSplit.OnWatchAdded += new Mesen.GUI.Debugger.ctrlDebuggerCode.AddressEventHandler(this.ctrlDebuggerCode_OnWatchAdded);
this.ctrlDebuggerCodeSplit.OnSetNextStatement += new Mesen.GUI.Debugger.ctrlDebuggerCode.AddressEventHandler(this.ctrlDebuggerCode_OnSetNextStatement);
this.ctrlDebuggerCodeSplit.Enter += new System.EventHandler(this.ctrlDebuggerCodeSplit_Enter);
//
// tableLayoutPanel10
//
this.tableLayoutPanel10.ColumnCount = 3;
@ -195,6 +234,14 @@
this.grpWatch.TabStop = false;
this.grpWatch.Text = "Watch";
//
// ctrlWatch
//
this.ctrlWatch.Dock = System.Windows.Forms.DockStyle.Fill;
this.ctrlWatch.Location = new System.Drawing.Point(3, 16);
this.ctrlWatch.Name = "ctrlWatch";
this.ctrlWatch.Size = new System.Drawing.Size(316, 123);
this.ctrlWatch.TabIndex = 0;
//
// grpBreakpoints
//
this.grpBreakpoints.Controls.Add(this.ctrlBreakpoints);
@ -206,6 +253,15 @@
this.grpBreakpoints.TabStop = false;
this.grpBreakpoints.Text = "Breakpoints";
//
// ctrlBreakpoints
//
this.ctrlBreakpoints.Dock = System.Windows.Forms.DockStyle.Fill;
this.ctrlBreakpoints.Location = new System.Drawing.Point(3, 16);
this.ctrlBreakpoints.Name = "ctrlBreakpoints";
this.ctrlBreakpoints.Size = new System.Drawing.Size(316, 123);
this.ctrlBreakpoints.TabIndex = 0;
this.ctrlBreakpoints.BreakpointNavigation += new System.EventHandler(this.ctrlBreakpoints_BreakpointNavigation);
//
// grpCallstack
//
this.grpCallstack.Controls.Add(this.ctrlCallstack);
@ -217,6 +273,15 @@
this.grpCallstack.TabStop = false;
this.grpCallstack.Text = "Callstack";
//
// ctrlCallstack
//
this.ctrlCallstack.Dock = System.Windows.Forms.DockStyle.Fill;
this.ctrlCallstack.Location = new System.Drawing.Point(3, 16);
this.ctrlCallstack.Name = "ctrlCallstack";
this.ctrlCallstack.Size = new System.Drawing.Size(316, 123);
this.ctrlCallstack.TabIndex = 0;
this.ctrlCallstack.FunctionSelected += new System.EventHandler(this.ctrlCallstack_FunctionSelected);
//
// menuStrip
//
this.menuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
@ -243,12 +308,12 @@
// toolStripMenuItem3
//
this.toolStripMenuItem3.Name = "toolStripMenuItem3";
this.toolStripMenuItem3.Size = new System.Drawing.Size(100, 6);
this.toolStripMenuItem3.Size = new System.Drawing.Size(149, 6);
//
// mnuClose
//
this.mnuClose.Name = "mnuClose";
this.mnuClose.Size = new System.Drawing.Size(103, 22);
this.mnuClose.Size = new System.Drawing.Size(152, 22);
this.mnuClose.Text = "Close";
this.mnuClose.Click += new System.EventHandler(this.mnuClose_Click);
//
@ -265,7 +330,7 @@
//
this.mnuSplitView.CheckOnClick = true;
this.mnuSplitView.Name = "mnuSplitView";
this.mnuSplitView.Size = new System.Drawing.Size(125, 22);
this.mnuSplitView.Size = new System.Drawing.Size(152, 22);
this.mnuSplitView.Text = "Split View";
this.mnuSplitView.Click += new System.EventHandler(this.mnuSplitView_Click);
//
@ -276,7 +341,7 @@
this.mnuDecreaseFontSize,
this.mnuResetFontSize});
this.fontSizeToolStripMenuItem.Name = "fontSizeToolStripMenuItem";
this.fontSizeToolStripMenuItem.Size = new System.Drawing.Size(125, 22);
this.fontSizeToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.fontSizeToolStripMenuItem.Text = "Text Size";
//
// mnuIncreaseFontSize
@ -436,11 +501,14 @@
//
// mnuGoTo
//
this.mnuGoTo.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.mnuGoToAddress,
this.mnuGoToIrqHandler,
this.mnuGoToNmiHandler,
this.mnuGoToResetHandler});
this.mnuGoTo.Name = "mnuGoTo";
this.mnuGoTo.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.G)));
this.mnuGoTo.Size = new System.Drawing.Size(196, 22);
this.mnuGoTo.Text = "Go To...";
this.mnuGoTo.Click += new System.EventHandler(this.mnuGoTo_Click);
//
// toolsToolStripMenuItem
//
@ -581,66 +649,34 @@
this.tmrCdlRatios.Interval = 300;
this.tmrCdlRatios.Tick += new System.EventHandler(this.tmrCdlRatios_Tick);
//
// ctrlDebuggerCode
// mnuGoToAddress
//
this.ctrlDebuggerCode.Code = null;
this.ctrlDebuggerCode.ContextMenuStrip = this.contextMenuCode;
this.ctrlDebuggerCode.Dock = System.Windows.Forms.DockStyle.Fill;
this.ctrlDebuggerCode.Location = new System.Drawing.Point(3, 3);
this.ctrlDebuggerCode.Name = "ctrlDebuggerCode";
this.ctrlDebuggerCode.Size = new System.Drawing.Size(546, 406);
this.ctrlDebuggerCode.TabIndex = 2;
this.ctrlDebuggerCode.OnWatchAdded += new Mesen.GUI.Debugger.ctrlDebuggerCode.AddressEventHandler(this.ctrlDebuggerCode_OnWatchAdded);
this.ctrlDebuggerCode.OnSetNextStatement += new Mesen.GUI.Debugger.ctrlDebuggerCode.AddressEventHandler(this.ctrlDebuggerCode_OnSetNextStatement);
this.ctrlDebuggerCode.Enter += new System.EventHandler(this.ctrlDebuggerCode_Enter);
this.mnuGoToAddress.Name = "mnuGoToAddress";
this.mnuGoToAddress.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.G)));
this.mnuGoToAddress.Size = new System.Drawing.Size(158, 22);
this.mnuGoToAddress.Text = "Address";
this.mnuGoToAddress.Click += new System.EventHandler(this.mnuGoToAddress_Click);
//
// ctrlConsoleStatus
// mnuGoToIrqHandler
//
this.ctrlConsoleStatus.Dock = System.Windows.Forms.DockStyle.Top;
this.ctrlConsoleStatus.Location = new System.Drawing.Point(552, 0);
this.ctrlConsoleStatus.Margin = new System.Windows.Forms.Padding(0);
this.ctrlConsoleStatus.Name = "ctrlConsoleStatus";
this.ctrlConsoleStatus.Size = new System.Drawing.Size(432, 362);
this.ctrlConsoleStatus.TabIndex = 3;
this.mnuGoToIrqHandler.Name = "mnuGoToIrqHandler";
this.mnuGoToIrqHandler.Size = new System.Drawing.Size(158, 22);
this.mnuGoToIrqHandler.Text = "IRQ Handler";
this.mnuGoToIrqHandler.Click += new System.EventHandler(this.mnuGoToIrqHandler_Click);
//
// ctrlDebuggerCodeSplit
// mnuGoToNmiHandler
//
this.ctrlDebuggerCodeSplit.Code = null;
this.ctrlDebuggerCodeSplit.Dock = System.Windows.Forms.DockStyle.Fill;
this.ctrlDebuggerCodeSplit.Location = new System.Drawing.Point(555, 3);
this.ctrlDebuggerCodeSplit.Name = "ctrlDebuggerCodeSplit";
this.ctrlDebuggerCodeSplit.Size = new System.Drawing.Size(1, 406);
this.ctrlDebuggerCodeSplit.TabIndex = 4;
this.ctrlDebuggerCodeSplit.Visible = false;
this.ctrlDebuggerCodeSplit.OnWatchAdded += new Mesen.GUI.Debugger.ctrlDebuggerCode.AddressEventHandler(this.ctrlDebuggerCode_OnWatchAdded);
this.ctrlDebuggerCodeSplit.OnSetNextStatement += new Mesen.GUI.Debugger.ctrlDebuggerCode.AddressEventHandler(this.ctrlDebuggerCode_OnSetNextStatement);
this.ctrlDebuggerCodeSplit.Enter += new System.EventHandler(this.ctrlDebuggerCodeSplit_Enter);
this.mnuGoToNmiHandler.Name = "mnuGoToNmiHandler";
this.mnuGoToNmiHandler.Size = new System.Drawing.Size(158, 22);
this.mnuGoToNmiHandler.Text = "NMI Handler";
this.mnuGoToNmiHandler.Click += new System.EventHandler(this.mnuGoToNmiHandler_Click);
//
// ctrlWatch
// mnuGoToResetHandler
//
this.ctrlWatch.Dock = System.Windows.Forms.DockStyle.Fill;
this.ctrlWatch.Location = new System.Drawing.Point(3, 16);
this.ctrlWatch.Name = "ctrlWatch";
this.ctrlWatch.Size = new System.Drawing.Size(316, 123);
this.ctrlWatch.TabIndex = 0;
//
// ctrlBreakpoints
//
this.ctrlBreakpoints.Dock = System.Windows.Forms.DockStyle.Fill;
this.ctrlBreakpoints.Location = new System.Drawing.Point(3, 16);
this.ctrlBreakpoints.Name = "ctrlBreakpoints";
this.ctrlBreakpoints.Size = new System.Drawing.Size(316, 123);
this.ctrlBreakpoints.TabIndex = 0;
this.ctrlBreakpoints.BreakpointNavigation += new System.EventHandler(this.ctrlBreakpoints_BreakpointNavigation);
//
// ctrlCallstack
//
this.ctrlCallstack.Dock = System.Windows.Forms.DockStyle.Fill;
this.ctrlCallstack.Location = new System.Drawing.Point(3, 16);
this.ctrlCallstack.Name = "ctrlCallstack";
this.ctrlCallstack.Size = new System.Drawing.Size(316, 123);
this.ctrlCallstack.TabIndex = 0;
this.ctrlCallstack.FunctionSelected += new System.EventHandler(this.ctrlCallstack_FunctionSelected);
this.mnuGoToResetHandler.Name = "mnuGoToResetHandler";
this.mnuGoToResetHandler.Size = new System.Drawing.Size(158, 22);
this.mnuGoToResetHandler.Text = "Reset Handler";
this.mnuGoToResetHandler.Click += new System.EventHandler(this.mnuGoToResetHandler_Click);
//
// frmDebugger
//
@ -735,5 +771,9 @@
private System.Windows.Forms.ToolStripMenuItem saveStrippedDataToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem saveUnusedDataToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem mnuDisableEnableBreakpoint;
private System.Windows.Forms.ToolStripMenuItem mnuGoToAddress;
private System.Windows.Forms.ToolStripMenuItem mnuGoToIrqHandler;
private System.Windows.Forms.ToolStripMenuItem mnuGoToNmiHandler;
private System.Windows.Forms.ToolStripMenuItem mnuGoToResetHandler;
}
}

View file

@ -237,11 +237,29 @@ namespace Mesen.GUI.Debugger
_lastCodeWindow = ctrlDebuggerCodeSplit;
}
private void mnuGoTo_Click(object sender, EventArgs e)
private void mnuGoToAddress_Click(object sender, EventArgs e)
{
_lastCodeWindow.GoToAddress();
}
private void mnuGoToIrqHandler_Click(object sender, EventArgs e)
{
int address = (InteropEmu.DebugGetMemoryValue(0xFFFF) << 8) | InteropEmu.DebugGetMemoryValue(0xFFFE);
_lastCodeWindow.ScrollToLineNumber(address);
}
private void mnuGoToNmiHandler_Click(object sender, EventArgs e)
{
int address = (InteropEmu.DebugGetMemoryValue(0xFFFD) << 8) | InteropEmu.DebugGetMemoryValue(0xFFFC);
_lastCodeWindow.ScrollToLineNumber(address);
}
private void mnuGoToResetHandler_Click(object sender, EventArgs e)
{
int address = (InteropEmu.DebugGetMemoryValue(0xFFFB) << 8) | InteropEmu.DebugGetMemoryValue(0xFFFA);
_lastCodeWindow.ScrollToLineNumber(address);
}
private void mnuIncreaseFontSize_Click(object sender, EventArgs e)
{
_lastCodeWindow.FontSize++;