From 8112f906b72146a8ddab02d43d3951a78cc34696 Mon Sep 17 00:00:00 2001 From: Souryo Date: Sun, 5 Jun 2016 10:53:41 -0400 Subject: [PATCH] Debugger: Changed callstack to look like watch/breakpoint list --- .../Controls/ctrlCallstack.Designer.cs | 34 ++++++++++++++----- GUI.NET/Debugger/Controls/ctrlCallstack.cs | 11 ++++-- 2 files changed, 34 insertions(+), 11 deletions(-) diff --git a/GUI.NET/Debugger/Controls/ctrlCallstack.Designer.cs b/GUI.NET/Debugger/Controls/ctrlCallstack.Designer.cs index 5a9862d6..0932ffea 100644 --- a/GUI.NET/Debugger/Controls/ctrlCallstack.Designer.cs +++ b/GUI.NET/Debugger/Controls/ctrlCallstack.Designer.cs @@ -28,16 +28,22 @@ private void InitializeComponent() { this.lstCallstack = new System.Windows.Forms.ListView(); - this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.colFunctionAddress = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.colStackAddr = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.colRomOffset = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.SuspendLayout(); // // lstCallstack // this.lstCallstack.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { - this.columnHeader1}); + this.colFunctionAddress, + this.colStackAddr, + this.colRomOffset}); this.lstCallstack.Dock = System.Windows.Forms.DockStyle.Fill; - this.lstCallstack.Font = new System.Drawing.Font("Consolas", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.lstCallstack.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None; + this.lstCallstack.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.lstCallstack.FullRowSelect = true; + this.lstCallstack.GridLines = true; + this.lstCallstack.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable; this.lstCallstack.Location = new System.Drawing.Point(0, 0); this.lstCallstack.MultiSelect = false; this.lstCallstack.Name = "lstCallstack"; @@ -47,9 +53,20 @@ this.lstCallstack.View = System.Windows.Forms.View.Details; this.lstCallstack.DoubleClick += new System.EventHandler(this.lstCallstack_DoubleClick); // - // columnHeader1 + // colFunctionAddress // - this.columnHeader1.Width = 256; + this.colFunctionAddress.Text = "Subroutine Addr"; + this.colFunctionAddress.Width = 100; + // + // colStackAddr + // + this.colStackAddr.Text = "PC Addr"; + this.colStackAddr.Width = 79; + // + // colRomOffset + // + this.colRomOffset.Text = "ROM Addr."; + this.colRomOffset.Width = 110; // // ctrlCallstack // @@ -65,7 +82,8 @@ #endregion private System.Windows.Forms.ListView lstCallstack; - private System.Windows.Forms.ColumnHeader columnHeader1; - + private System.Windows.Forms.ColumnHeader colFunctionAddress; + private System.Windows.Forms.ColumnHeader colStackAddr; + private System.Windows.Forms.ColumnHeader colRomOffset; } } diff --git a/GUI.NET/Debugger/Controls/ctrlCallstack.cs b/GUI.NET/Debugger/Controls/ctrlCallstack.cs index a456f133..21a0f0e8 100644 --- a/GUI.NET/Debugger/Controls/ctrlCallstack.cs +++ b/GUI.NET/Debugger/Controls/ctrlCallstack.cs @@ -32,6 +32,7 @@ namespace Mesen.GUI.Debugger.Controls this.lstCallstack.Items.Clear(); int subStartAddr = -1; + ListViewItem item; for(int i = 0, len = _relativeCallstack.Length; i < len; i+=2) { int jsrAddr = _relativeCallstack[i]; bool unmappedAddress = false; @@ -43,18 +44,22 @@ namespace Mesen.GUI.Debugger.Controls } } - string startAddr = subStartAddr >= 0 ? subStartAddr.ToString("X4") : "----"; + string startAddr = subStartAddr >= 0 ? subStartAddr.ToString("X4") : "--------"; if(_relativeCallstack[i] == -2) { break; } subStartAddr = _relativeCallstack[i+1]; - ListViewItem item = this.lstCallstack.Items.Insert(0, "$" + startAddr + " @ $" + jsrAddr.ToString("X4") + " [$" + _absoluteCallstack[i].ToString("X4") + "]"); + item = this.lstCallstack.Items.Insert(0, "$" + startAddr); + item.SubItems.Add("@ $" + jsrAddr.ToString("X4")); + item.SubItems.Add("[$" + _absoluteCallstack[i].ToString("X4") + "]"); + if(unmappedAddress) { item.ForeColor = Color.Gray; item.Font = new Font(item.Font, FontStyle.Italic); } } - this.lstCallstack.Items.Insert(0, "$" + subStartAddr.ToString("X4") + " @ $" + _programCounter.ToString("X4")); + item = this.lstCallstack.Items.Insert(0, "$" + (subStartAddr >= 0 ? subStartAddr.ToString("X4") : "--------")); + item.SubItems.Add("@ $" + _programCounter.ToString("X4")); } private void lstCallstack_DoubleClick(object sender, EventArgs e)