Debugger: Add "Go to all" in memory viewer

This commit is contained in:
Sour 2019-01-01 14:22:04 -05:00
parent d8008093b7
commit 1c0921624f
8 changed files with 142 additions and 66 deletions

View file

@ -221,7 +221,7 @@ namespace Mesen.GUI.Config
return "";
} else {
string keyString = new KeysConverter().ConvertToString(keys);
return keyString.Replace("+None", "").Replace("Oemplus", "+").Replace("Oemtilde", "Tilde").Replace("OemMinus", "-").Replace("Cancel", "Break").Replace("Escape", "Esc");
return keyString.Replace("+None", "").Replace("Oemcomma", ",").Replace("Oemplus", "+").Replace("Oemtilde", "Tilde").Replace("OemMinus", "-").Replace("Cancel", "Break").Replace("Escape", "Esc");
}
}

View file

@ -182,12 +182,13 @@ namespace Mesen.GUI.Debugger.Controls
int currentAddr = (int)(this.ctrlHexBox.CurrentLine - 1) * this.ctrlHexBox.BytesPerLine;
address.Address = (UInt32)currentAddr;
frmGoToLine frm = new frmGoToLine(address, (_byteProvider.Length - 1).ToString("X").Length);
frm.StartPosition = FormStartPosition.Manual;
Point topLeft = this.PointToScreen(new Point(0, 0));
frm.Location = new Point(topLeft.X + (this.Width - frm.Width) / 2, topLeft.Y + (this.Height - frm.Height) / 2);
if(frm.ShowDialog() == DialogResult.OK) {
GoToAddress((int)address.Address);
using(frmGoToLine frm = new frmGoToLine(address, (_byteProvider.Length - 1).ToString("X").Length)) {
frm.StartPosition = FormStartPosition.Manual;
Point topLeft = this.PointToScreen(new Point(0, 0));
frm.Location = new Point(topLeft.X + (this.Width - frm.Width) / 2, topLeft.Y + (this.Height - frm.Height) / 2);
if(frm.ShowDialog() == DialogResult.OK) {
GoToAddress((int)address.Address);
}
}
}

View file

@ -109,6 +109,7 @@ namespace Mesen.GUI.Debugger
this.mnuGoToResetHandler = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem23 = new System.Windows.Forms.ToolStripSeparator();
this.mnuGoToProgramCount = new System.Windows.Forms.ToolStripMenuItem();
this.mnuGoToAll = new System.Windows.Forms.ToolStripMenuItem();
this.mnuOptions = new System.Windows.Forms.ToolStripMenuItem();
this.mnuDisassemblyOptions = new System.Windows.Forms.ToolStripMenuItem();
this.mnuDisassemble = new System.Windows.Forms.ToolStripMenuItem();
@ -215,7 +216,7 @@ namespace Mesen.GUI.Debugger
this.ctrlPpuMemoryMapping = new Mesen.GUI.Debugger.Controls.ctrlMemoryMapping();
this.ctrlCpuMemoryMapping = new Mesen.GUI.Debugger.Controls.ctrlMemoryMapping();
this.tsToolbar = new Mesen.GUI.Controls.ctrlMesenToolStrip();
this.mnuGoToAll = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem29 = new System.Windows.Forms.ToolStripSeparator();
((System.ComponentModel.ISupportInitialize)(this.splitContainer)).BeginInit();
this.splitContainer.Panel1.SuspendLayout();
this.splitContainer.Panel2.SuspendLayout();
@ -260,7 +261,7 @@ namespace Mesen.GUI.Debugger
this.splitContainer.Panel2.Controls.Add(this.tableLayoutPanel10);
this.splitContainer.Panel2MinSize = 100;
this.splitContainer.Size = new System.Drawing.Size(1075, 570);
this.splitContainer.SplitterDistance = 407;
this.splitContainer.SplitterDistance = 404;
this.splitContainer.SplitterWidth = 7;
this.splitContainer.TabIndex = 1;
this.splitContainer.TabStop = false;
@ -284,7 +285,7 @@ namespace Mesen.GUI.Debugger
//
this.ctrlSplitContainerTop.Panel2.Controls.Add(this.tlpFunctionLabelLists);
this.ctrlSplitContainerTop.Panel2MinSize = 150;
this.ctrlSplitContainerTop.Size = new System.Drawing.Size(1075, 407);
this.ctrlSplitContainerTop.Size = new System.Drawing.Size(1075, 404);
this.ctrlSplitContainerTop.SplitterDistance = 750;
this.ctrlSplitContainerTop.SplitterWidth = 7;
this.ctrlSplitContainerTop.TabIndex = 3;
@ -305,8 +306,8 @@ namespace Mesen.GUI.Debugger
this.tlpTop.Name = "tlpTop";
this.tlpTop.RowCount = 1;
this.tlpTop.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tlpTop.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 407F));
this.tlpTop.Size = new System.Drawing.Size(750, 407);
this.tlpTop.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 404F));
this.tlpTop.Size = new System.Drawing.Size(750, 404);
this.tlpTop.TabIndex = 2;
//
// panel1
@ -317,7 +318,7 @@ namespace Mesen.GUI.Debugger
this.panel1.Location = new System.Drawing.Point(3, 0);
this.panel1.Margin = new System.Windows.Forms.Padding(3, 0, 3, 0);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(286, 407);
this.panel1.Size = new System.Drawing.Size(286, 404);
this.panel1.TabIndex = 5;
//
// ctrlSourceViewer
@ -326,7 +327,7 @@ namespace Mesen.GUI.Debugger
this.ctrlSourceViewer.Dock = System.Windows.Forms.DockStyle.Fill;
this.ctrlSourceViewer.Location = new System.Drawing.Point(0, 0);
this.ctrlSourceViewer.Name = "ctrlSourceViewer";
this.ctrlSourceViewer.Size = new System.Drawing.Size(286, 407);
this.ctrlSourceViewer.Size = new System.Drawing.Size(286, 404);
this.ctrlSourceViewer.SymbolProvider = null;
this.ctrlSourceViewer.TabIndex = 7;
this.ctrlSourceViewer.Visible = false;
@ -339,7 +340,7 @@ namespace Mesen.GUI.Debugger
this.ctrlDebuggerCode.Location = new System.Drawing.Point(0, 0);
this.ctrlDebuggerCode.Name = "ctrlDebuggerCode";
this.ctrlDebuggerCode.ShowMemoryValues = false;
this.ctrlDebuggerCode.Size = new System.Drawing.Size(286, 407);
this.ctrlDebuggerCode.Size = new System.Drawing.Size(286, 404);
this.ctrlDebuggerCode.SymbolProvider = null;
this.ctrlDebuggerCode.TabIndex = 2;
this.ctrlDebuggerCode.OnEditCode += new Mesen.GUI.Debugger.ctrlDebuggerCode.AssemblerEventHandler(this.ctrlDebuggerCode_OnEditCode);
@ -353,7 +354,7 @@ namespace Mesen.GUI.Debugger
this.panel2.Location = new System.Drawing.Point(292, 0);
this.panel2.Margin = new System.Windows.Forms.Padding(0, 0, 3, 0);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(1, 407);
this.panel2.Size = new System.Drawing.Size(1, 404);
this.panel2.TabIndex = 6;
//
// ctrlSourceViewerSplit
@ -362,7 +363,7 @@ namespace Mesen.GUI.Debugger
this.ctrlSourceViewerSplit.Dock = System.Windows.Forms.DockStyle.Fill;
this.ctrlSourceViewerSplit.Location = new System.Drawing.Point(0, 0);
this.ctrlSourceViewerSplit.Name = "ctrlSourceViewerSplit";
this.ctrlSourceViewerSplit.Size = new System.Drawing.Size(1, 407);
this.ctrlSourceViewerSplit.Size = new System.Drawing.Size(1, 404);
this.ctrlSourceViewerSplit.SymbolProvider = null;
this.ctrlSourceViewerSplit.TabIndex = 8;
this.ctrlSourceViewerSplit.Visible = false;
@ -375,7 +376,7 @@ namespace Mesen.GUI.Debugger
this.ctrlDebuggerCodeSplit.Location = new System.Drawing.Point(0, 0);
this.ctrlDebuggerCodeSplit.Name = "ctrlDebuggerCodeSplit";
this.ctrlDebuggerCodeSplit.ShowMemoryValues = false;
this.ctrlDebuggerCodeSplit.Size = new System.Drawing.Size(1, 407);
this.ctrlDebuggerCodeSplit.Size = new System.Drawing.Size(1, 404);
this.ctrlDebuggerCodeSplit.SymbolProvider = null;
this.ctrlDebuggerCodeSplit.TabIndex = 4;
this.ctrlDebuggerCodeSplit.Visible = false;
@ -395,7 +396,7 @@ namespace Mesen.GUI.Debugger
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(458, 407);
this.tableLayoutPanel1.Size = new System.Drawing.Size(458, 404);
this.tableLayoutPanel1.TabIndex = 7;
//
// ctrlConsoleStatus
@ -419,7 +420,7 @@ namespace Mesen.GUI.Debugger
this.tlpVerticalLayout.Name = "tlpVerticalLayout";
this.tlpVerticalLayout.RowCount = 1;
this.tlpVerticalLayout.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tlpVerticalLayout.Size = new System.Drawing.Size(458, 7);
this.tlpVerticalLayout.Size = new System.Drawing.Size(458, 4);
this.tlpVerticalLayout.TabIndex = 4;
//
// tlpFunctionLabelLists
@ -435,16 +436,16 @@ namespace Mesen.GUI.Debugger
this.tlpFunctionLabelLists.RowCount = 2;
this.tlpFunctionLabelLists.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tlpFunctionLabelLists.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tlpFunctionLabelLists.Size = new System.Drawing.Size(318, 407);
this.tlpFunctionLabelLists.Size = new System.Drawing.Size(318, 404);
this.tlpFunctionLabelLists.TabIndex = 5;
//
// grpLabels
//
this.grpLabels.Controls.Add(this.ctrlLabelList);
this.grpLabels.Dock = System.Windows.Forms.DockStyle.Fill;
this.grpLabels.Location = new System.Drawing.Point(3, 206);
this.grpLabels.Location = new System.Drawing.Point(3, 205);
this.grpLabels.Name = "grpLabels";
this.grpLabels.Size = new System.Drawing.Size(312, 198);
this.grpLabels.Size = new System.Drawing.Size(312, 196);
this.grpLabels.TabIndex = 6;
this.grpLabels.TabStop = false;
this.grpLabels.Text = "Labels";
@ -454,7 +455,7 @@ namespace Mesen.GUI.Debugger
this.ctrlLabelList.Dock = System.Windows.Forms.DockStyle.Fill;
this.ctrlLabelList.Location = new System.Drawing.Point(3, 16);
this.ctrlLabelList.Name = "ctrlLabelList";
this.ctrlLabelList.Size = new System.Drawing.Size(306, 179);
this.ctrlLabelList.Size = new System.Drawing.Size(306, 177);
this.ctrlLabelList.TabIndex = 0;
this.ctrlLabelList.OnFindOccurrence += new System.EventHandler(this.ctrlLabelList_OnFindOccurrence);
this.ctrlLabelList.OnLabelSelected += new System.EventHandler(this.ctrlLabelList_OnLabelSelected);
@ -465,7 +466,7 @@ namespace Mesen.GUI.Debugger
this.grpFunctions.Dock = System.Windows.Forms.DockStyle.Fill;
this.grpFunctions.Location = new System.Drawing.Point(3, 3);
this.grpFunctions.Name = "grpFunctions";
this.grpFunctions.Size = new System.Drawing.Size(312, 197);
this.grpFunctions.Size = new System.Drawing.Size(312, 196);
this.grpFunctions.TabIndex = 5;
this.grpFunctions.TabStop = false;
this.grpFunctions.Text = "Functions";
@ -475,7 +476,7 @@ namespace Mesen.GUI.Debugger
this.ctrlFunctionList.Dock = System.Windows.Forms.DockStyle.Fill;
this.ctrlFunctionList.Location = new System.Drawing.Point(3, 16);
this.ctrlFunctionList.Name = "ctrlFunctionList";
this.ctrlFunctionList.Size = new System.Drawing.Size(306, 178);
this.ctrlFunctionList.Size = new System.Drawing.Size(306, 177);
this.ctrlFunctionList.TabIndex = 0;
this.ctrlFunctionList.OnFindOccurrence += new System.EventHandler(this.ctrlFunctionList_OnFindOccurrence);
this.ctrlFunctionList.OnFunctionSelected += new System.EventHandler(this.ctrlFunctionList_OnFunctionSelected);
@ -506,7 +507,7 @@ namespace Mesen.GUI.Debugger
this.tableLayoutPanel10.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel10.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel10.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel10.Size = new System.Drawing.Size(1075, 156);
this.tableLayoutPanel10.Size = new System.Drawing.Size(1075, 159);
this.tableLayoutPanel10.TabIndex = 0;
//
// grpWatch
@ -515,7 +516,7 @@ namespace Mesen.GUI.Debugger
this.grpWatch.Dock = System.Windows.Forms.DockStyle.Fill;
this.grpWatch.Location = new System.Drawing.Point(3, 3);
this.grpWatch.Name = "grpWatch";
this.grpWatch.Size = new System.Drawing.Size(352, 150);
this.grpWatch.Size = new System.Drawing.Size(352, 153);
this.grpWatch.TabIndex = 2;
this.grpWatch.TabStop = false;
this.grpWatch.Text = "Watch";
@ -525,7 +526,7 @@ namespace Mesen.GUI.Debugger
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(346, 131);
this.ctrlWatch.Size = new System.Drawing.Size(346, 134);
this.ctrlWatch.TabIndex = 0;
//
// grpBreakpoints
@ -534,7 +535,7 @@ namespace Mesen.GUI.Debugger
this.grpBreakpoints.Dock = System.Windows.Forms.DockStyle.Fill;
this.grpBreakpoints.Location = new System.Drawing.Point(361, 3);
this.grpBreakpoints.Name = "grpBreakpoints";
this.grpBreakpoints.Size = new System.Drawing.Size(352, 150);
this.grpBreakpoints.Size = new System.Drawing.Size(352, 153);
this.grpBreakpoints.TabIndex = 3;
this.grpBreakpoints.TabStop = false;
this.grpBreakpoints.Text = "Breakpoints";
@ -544,7 +545,7 @@ namespace Mesen.GUI.Debugger
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(346, 131);
this.ctrlBreakpoints.Size = new System.Drawing.Size(346, 134);
this.ctrlBreakpoints.TabIndex = 0;
this.ctrlBreakpoints.BreakpointNavigation += new System.EventHandler(this.ctrlBreakpoints_BreakpointNavigation);
//
@ -554,7 +555,7 @@ namespace Mesen.GUI.Debugger
this.grpCallstack.Dock = System.Windows.Forms.DockStyle.Fill;
this.grpCallstack.Location = new System.Drawing.Point(719, 3);
this.grpCallstack.Name = "grpCallstack";
this.grpCallstack.Size = new System.Drawing.Size(353, 150);
this.grpCallstack.Size = new System.Drawing.Size(353, 153);
this.grpCallstack.TabIndex = 4;
this.grpCallstack.TabStop = false;
this.grpCallstack.Text = "Call Stack";
@ -564,7 +565,7 @@ namespace Mesen.GUI.Debugger
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(347, 131);
this.ctrlCallstack.Size = new System.Drawing.Size(347, 134);
this.ctrlCallstack.TabIndex = 0;
this.ctrlCallstack.FunctionSelected += new System.EventHandler(this.ctrlCallstack_FunctionSelected);
//
@ -914,13 +915,14 @@ namespace Mesen.GUI.Debugger
// searchToolStripMenuItem
//
this.searchToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.mnuGoToAll,
this.toolStripMenuItem29,
this.mnuFind,
this.mnuFindNext,
this.mnuFindPrev,
this.toolStripMenuItem9,
this.mnuFindAllOccurrences,
this.mnuGoTo,
this.mnuGoToAll});
this.mnuGoTo});
this.searchToolStripMenuItem.Name = "searchToolStripMenuItem";
this.searchToolStripMenuItem.Size = new System.Drawing.Size(54, 20);
this.searchToolStripMenuItem.Text = "Search";
@ -1021,6 +1023,13 @@ namespace Mesen.GUI.Debugger
this.mnuGoToProgramCount.Text = "Program Counter";
this.mnuGoToProgramCount.Click += new System.EventHandler(this.mnuGoToProgramCount_Click);
//
// mnuGoToAll
//
this.mnuGoToAll.Name = "mnuGoToAll";
this.mnuGoToAll.Size = new System.Drawing.Size(183, 22);
this.mnuGoToAll.Text = "Go to All";
this.mnuGoToAll.Click += new System.EventHandler(this.mnuGoToAll_Click);
//
// mnuOptions
//
this.mnuOptions.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
@ -1906,12 +1915,10 @@ namespace Mesen.GUI.Debugger
this.tsToolbar.Text = "toolStrip1";
this.tsToolbar.Visible = false;
//
// mnuGoToAll
// toolStripMenuItem29
//
this.mnuGoToAll.Name = "mnuGoToAll";
this.mnuGoToAll.Size = new System.Drawing.Size(183, 22);
this.mnuGoToAll.Text = "Go to All";
this.mnuGoToAll.Click += new System.EventHandler(this.mnuGoToAll_Click);
this.toolStripMenuItem29.Name = "toolStripMenuItem29";
this.toolStripMenuItem29.Size = new System.Drawing.Size(180, 6);
//
// frmDebugger
//
@ -2149,5 +2156,6 @@ namespace Mesen.GUI.Debugger
private System.Windows.Forms.ToolStripMenuItem mnuEnableSubInstructionBreakpoints;
private System.Windows.Forms.ToolStripSeparator toolStripMenuItem28;
private System.Windows.Forms.ToolStripMenuItem mnuGoToAll;
private System.Windows.Forms.ToolStripSeparator toolStripMenuItem29;
}
}

View file

@ -1730,7 +1730,7 @@ namespace Mesen.GUI.Debugger
private void mnuGoToAll_Click(object sender, EventArgs e)
{
using(frmGoToAll frm = new frmGoToAll()) {
using(frmGoToAll frm = new frmGoToAll(false, true)) {
if(frm.ShowDialog() == DialogResult.OK) {
frmGoToAll.GoToDestination dest = frm.Destination;

View file

@ -121,12 +121,12 @@
<value>17, 17</value>
</metadata>
<metadata name="menuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 56</value>
<value>107, 17</value>
</metadata>
<metadata name="statusStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 95</value>
<value>215, 17</value>
</metadata>
<metadata name="tsToolbar.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 134</value>
<value>324, 17</value>
</metadata>
</root>

View file

@ -21,14 +21,18 @@ namespace Mesen.GUI.Debugger
private int _selectedResult = 0;
private int _resultCount = 0;
private Ld65DbgImporter _symbolProvider;
private bool _allowOutOfScope;
private bool _showFilesAndConstants;
public GoToDestination Destination { get; private set; }
public frmGoToAll()
public frmGoToAll(bool allowOutOfScope, bool showFilesAndConstants)
{
InitializeComponent();
_symbolProvider = DebugWorkspaceManager.SymbolProvider;
_allowOutOfScope = allowOutOfScope;
_showFilesAndConstants = showFilesAndConstants;
tlpResults.SuspendLayout();
for(int i = 0; i < MaxResultCount; i++) {
@ -130,18 +134,20 @@ namespace Mesen.GUI.Debugger
if(!string.IsNullOrWhiteSpace(searchString)) {
if(_symbolProvider != null) {
foreach(Ld65DbgImporter.FileInfo file in _symbolProvider.Files.Values) {
if(file.Name.ToLower().Contains(searchString)) {
searchResults.Add(new SearchResultInfo() {
Caption = Path.GetFileName(file.Name),
AbsoluteAddress = -1,
MemoryType = AddressType.InternalRam,
SearchResultType = SearchResultType.File,
Filename = file.Name,
FileLineNumber = 0,
RelativeAddress = -1,
CodeLabel = null
});
if(_showFilesAndConstants) {
foreach(Ld65DbgImporter.FileInfo file in _symbolProvider.Files.Values) {
if(file.Name.ToLower().Contains(searchString)) {
searchResults.Add(new SearchResultInfo() {
Caption = Path.GetFileName(file.Name),
AbsoluteAddress = -1,
MemoryType = AddressType.InternalRam,
SearchResultType = SearchResultType.File,
Filename = file.Name,
FileLineNumber = 0,
RelativeAddress = -1,
CodeLabel = null
});
}
}
}
@ -152,6 +158,10 @@ namespace Mesen.GUI.Debugger
int value = 0;
int relAddress = -1;
bool isConstant = addressInfo == null;
if(!_showFilesAndConstants && isConstant) {
continue;
}
if(addressInfo != null) {
value = InteropEmu.DebugGetMemoryValue(addressInfo.Type.ToMemoryType(), (uint)addressInfo.Address);
relAddress = InteropEmu.DebugGetRelativeAddress((uint)addressInfo.Address, addressInfo.Type);
@ -201,7 +211,7 @@ namespace Mesen.GUI.Debugger
MemoryType = label.AddressType,
SearchResultType = resultType,
Filename = "",
Disabled = relativeAddress < 0,
Disabled = !_allowOutOfScope && relativeAddress < 0,
RelativeAddress = relativeAddress,
CodeLabel = label
});
@ -275,7 +285,14 @@ namespace Mesen.GUI.Debugger
if(_resultCount > 0) {
SearchResultInfo searchResult = _results[_selectedResult].Tag as SearchResultInfo;
if(!searchResult.Disabled) {
Destination = new GoToDestination() { Label = searchResult.CodeLabel, File = searchResult.Filename, Line = searchResult.FileLineNumber };
AddressTypeInfo addressInfo = new AddressTypeInfo() { Address = searchResult.AbsoluteAddress, Type = searchResult.MemoryType };
Destination = new GoToDestination() {
AddressInfo = addressInfo,
CpuAddress = addressInfo.Address >= 0 ? InteropEmu.DebugGetRelativeAddress((UInt32)addressInfo.Address, addressInfo.Type) : -1,
Label = searchResult.CodeLabel,
File = searchResult.Filename,
Line = searchResult.FileLineNumber
};
DialogResult = DialogResult.OK;
Close();
}
@ -285,6 +302,7 @@ namespace Mesen.GUI.Debugger
public struct GoToDestination
{
public CodeLabel Label;
public AddressTypeInfo AddressInfo;
public int CpuAddress;
public string File;
public int Line;

View file

@ -107,6 +107,8 @@
this.ctrlMemoryAccessCounters = new Mesen.GUI.Debugger.Controls.ctrlMemoryAccessCounters();
this.tpgProfiler = new System.Windows.Forms.TabPage();
this.ctrlProfiler = new Mesen.GUI.Debugger.Controls.ctrlProfiler();
this.mnuGoToAll = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem14 = new System.Windows.Forms.ToolStripSeparator();
this.flowLayoutPanel1.SuspendLayout();
this.menuStrip1.SuspendLayout();
this.tabMain.SuspendLayout();
@ -656,10 +658,12 @@
// toolStripMenuItem1
//
this.toolStripMenuItem1.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.mnuGoToAll,
this.mnuGoTo,
this.toolStripMenuItem14,
this.mnuFind,
this.mnuFindNext,
this.mnuFindPrev,
this.mnuGoTo});
this.mnuFindPrev});
this.toolStripMenuItem1.Name = "toolStripMenuItem1";
this.toolStripMenuItem1.Size = new System.Drawing.Size(54, 20);
this.toolStripMenuItem1.Text = "Search";
@ -668,7 +672,7 @@
//
this.mnuFind.Image = global::Mesen.GUI.Properties.Resources.Find;
this.mnuFind.Name = "mnuFind";
this.mnuFind.Size = new System.Drawing.Size(145, 22);
this.mnuFind.Size = new System.Drawing.Size(152, 22);
this.mnuFind.Text = "Find...";
this.mnuFind.Click += new System.EventHandler(this.mnuFind_Click);
//
@ -676,7 +680,7 @@
//
this.mnuFindNext.Image = global::Mesen.GUI.Properties.Resources.NextArrow;
this.mnuFindNext.Name = "mnuFindNext";
this.mnuFindNext.Size = new System.Drawing.Size(145, 22);
this.mnuFindNext.Size = new System.Drawing.Size(152, 22);
this.mnuFindNext.Text = "Find Next";
this.mnuFindNext.Click += new System.EventHandler(this.mnuFindNext_Click);
//
@ -684,14 +688,14 @@
//
this.mnuFindPrev.Image = global::Mesen.GUI.Properties.Resources.PreviousArrow;
this.mnuFindPrev.Name = "mnuFindPrev";
this.mnuFindPrev.Size = new System.Drawing.Size(145, 22);
this.mnuFindPrev.Size = new System.Drawing.Size(152, 22);
this.mnuFindPrev.Text = "Find Previous";
this.mnuFindPrev.Click += new System.EventHandler(this.mnuFindPrev_Click);
//
// mnuGoTo
//
this.mnuGoTo.Name = "mnuGoTo";
this.mnuGoTo.Size = new System.Drawing.Size(145, 22);
this.mnuGoTo.Size = new System.Drawing.Size(152, 22);
this.mnuGoTo.Text = "Go To...";
this.mnuGoTo.Click += new System.EventHandler(this.mnuGoTo_Click);
//
@ -772,6 +776,18 @@
this.ctrlProfiler.Size = new System.Drawing.Size(606, 343);
this.ctrlProfiler.TabIndex = 0;
//
// mnuGoToAll
//
this.mnuGoToAll.Name = "mnuGoToAll";
this.mnuGoToAll.Size = new System.Drawing.Size(152, 22);
this.mnuGoToAll.Text = "Go to All";
this.mnuGoToAll.Click += new System.EventHandler(this.mnuGoToAll_Click);
//
// toolStripMenuItem14
//
this.toolStripMenuItem14.Name = "toolStripMenuItem14";
this.toolStripMenuItem14.Size = new System.Drawing.Size(149, 6);
//
// frmMemoryViewer
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -876,5 +892,7 @@
private System.Windows.Forms.ToolStripMenuItem mnuSelectFont;
private System.Windows.Forms.ToolStripSeparator toolStripMenuItem13;
private System.Windows.Forms.ToolStripMenuItem mnuByteEditingMode;
private System.Windows.Forms.ToolStripMenuItem mnuGoToAll;
private System.Windows.Forms.ToolStripSeparator toolStripMenuItem14;
}
}

View file

@ -35,6 +35,8 @@ namespace Mesen.GUI.Debugger
{
base.OnLoad(e);
DebugWorkspaceManager.AutoLoadDbgFiles(true);
this._selectedTab = this.tabMain.SelectedTab;
DebugInfo config = ConfigManager.Config.DebugInfo;
@ -129,6 +131,7 @@ namespace Mesen.GUI.Debugger
mnuRefresh.InitShortcut(this, nameof(DebuggerShortcutsConfig.Refresh));
mnuGoToAll.InitShortcut(this, nameof(DebuggerShortcutsConfig.GoToAll));
mnuGoTo.InitShortcut(this, nameof(DebuggerShortcutsConfig.GoTo));
mnuFind.InitShortcut(this, nameof(DebuggerShortcutsConfig.Find));
mnuFindNext.InitShortcut(this, nameof(DebuggerShortcutsConfig.FindNext));
@ -197,7 +200,30 @@ namespace Mesen.GUI.Debugger
cboMemoryType.SetEnumValue(memoryType);
ctrlHexViewer.GoToAddress(address);
}
public void GoToAll()
{
using(frmGoToAll frm = new frmGoToAll(true, false)) {
if(frm.ShowDialog() == DialogResult.OK) {
frmGoToAll.GoToDestination dest = frm.Destination;
tabMain.SelectedTab = tpgMemoryViewer;
if(_memoryType == DebugMemoryType.CpuMemory && dest.CpuAddress >= 0) {
ctrlHexViewer.GoToAddress(dest.CpuAddress);
} else {
DebugMemoryType memType = dest.AddressInfo.Type.ToMemoryType();
if(memType == DebugMemoryType.InternalRam) {
//There is no specific "tab" for the internal ram, show it in the cpu memory tab
memType = DebugMemoryType.CpuMemory;
}
cboMemoryType.SetEnumValue(memType);
ctrlHexViewer.GoToAddress(dest.AddressInfo.Address);
}
}
}
}
private void InitTblMappings()
{
DebugWorkspace workspace = DebugWorkspaceManager.GetWorkspace();
@ -353,6 +379,11 @@ namespace Mesen.GUI.Debugger
this.ctrlHexViewer.GoToAddress();
}
private void mnuGoToAll_Click(object sender, EventArgs e)
{
this.GoToAll();
}
private void mnuIncreaseFontSize_Click(object sender, EventArgs e)
{
this.ctrlHexViewer.TextZoom += 10;