Debugger: Allow double-click to work on unmapped labels/functions when CC65 integration is active (auto-switch to source view)
This commit is contained in:
parent
6ccd9b0a8e
commit
2058ded5ae
5 changed files with 43 additions and 22 deletions
|
@ -16,7 +16,7 @@ namespace Mesen.GUI.Debugger.Controls
|
|||
public partial class ctrlFunctionList : BaseControl
|
||||
{
|
||||
public event EventHandler OnFindOccurrence;
|
||||
public event EventHandler OnFunctionSelected;
|
||||
public event GoToDestinationEventHandler OnFunctionSelected;
|
||||
|
||||
private List<ListViewItem> _listItems = new List<ListViewItem>();
|
||||
private Dictionary<Int32, ListViewItem> _functions = new Dictionary<int, ListViewItem>();
|
||||
|
@ -134,10 +134,11 @@ namespace Mesen.GUI.Debugger.Controls
|
|||
{
|
||||
if(lstFunctions.SelectedIndices.Count > 0) {
|
||||
Int32 relativeAddress = (Int32)GetSelectedItem().SubItems[1].Tag;
|
||||
|
||||
if(relativeAddress >= 0) {
|
||||
OnFunctionSelected?.Invoke(relativeAddress, e);
|
||||
}
|
||||
Int32 absoluteAddress = (Int32)GetSelectedItem().SubItems[2].Tag;
|
||||
OnFunctionSelected?.Invoke(new GoToDestination() {
|
||||
AddressInfo = new AddressTypeInfo() { Address = absoluteAddress, Type = AddressType.PrgRom },
|
||||
CpuAddress = relativeAddress
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -204,7 +205,12 @@ namespace Mesen.GUI.Debugger.Controls
|
|||
|
||||
private void lstFunctions_SearchForVirtualItem(object sender, SearchForVirtualItemEventArgs e)
|
||||
{
|
||||
|
||||
for(int i = 0; i < _listItems.Count; i++) {
|
||||
if(_listItems[i].Text.StartsWith(e.Text, StringComparison.InvariantCultureIgnoreCase)) {
|
||||
e.Index = i;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ namespace Mesen.GUI.Debugger.Controls
|
|||
public partial class ctrlLabelList : BaseControl
|
||||
{
|
||||
public event EventHandler OnFindOccurrence;
|
||||
public event EventHandler OnLabelSelected;
|
||||
public event GoToDestinationEventHandler OnLabelSelected;
|
||||
|
||||
private List<ListViewItem> _listItems = new List<ListViewItem>();
|
||||
private int _sortColumn = 0;
|
||||
|
@ -178,10 +178,11 @@ namespace Mesen.GUI.Debugger.Controls
|
|||
{
|
||||
if(lstLabels.SelectedIndices.Count > 0) {
|
||||
Int32 relativeAddress = (Int32)GetSelectedItem().Tag;
|
||||
|
||||
if(relativeAddress >= 0) {
|
||||
OnLabelSelected?.Invoke(relativeAddress, e);
|
||||
}
|
||||
CodeLabel label = (CodeLabel)GetSelectedItem().SubItems[1].Tag;
|
||||
OnLabelSelected?.Invoke(new GoToDestination() {
|
||||
CpuAddress = relativeAddress,
|
||||
Label = label
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
4
GUI.NET/Debugger/frmDebugger.Designer.cs
generated
4
GUI.NET/Debugger/frmDebugger.Designer.cs
generated
|
@ -458,7 +458,7 @@ namespace Mesen.GUI.Debugger
|
|||
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);
|
||||
this.ctrlLabelList.OnLabelSelected += new GoToDestinationEventHandler(this.ctrlLabelList_OnLabelSelected);
|
||||
//
|
||||
// grpFunctions
|
||||
//
|
||||
|
@ -479,7 +479,7 @@ namespace Mesen.GUI.Debugger
|
|||
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);
|
||||
this.ctrlFunctionList.OnFunctionSelected += new GoToDestinationEventHandler(this.ctrlFunctionList_OnFunctionSelected);
|
||||
//
|
||||
// picWatchHelp
|
||||
//
|
||||
|
|
|
@ -1272,9 +1272,14 @@ namespace Mesen.GUI.Debugger
|
|||
this.UpdateDebugger(false);
|
||||
}
|
||||
|
||||
private void ctrlFunctionList_OnFunctionSelected(object relativeAddress, EventArgs e)
|
||||
private void ctrlFunctionList_OnFunctionSelected(GoToDestination dest)
|
||||
{
|
||||
LastCodeWindow.ScrollToLineNumber((Int32)relativeAddress);
|
||||
GoToDestination(LastCodeWindow, dest);
|
||||
}
|
||||
|
||||
private void ctrlLabelList_OnLabelSelected(GoToDestination dest)
|
||||
{
|
||||
GoToDestination(LastCodeWindow, dest);
|
||||
}
|
||||
|
||||
private void LabelManager_OnLabelUpdated(object sender, EventArgs e)
|
||||
|
@ -1285,11 +1290,6 @@ namespace Mesen.GUI.Debugger
|
|||
UpdateDebugger(false, false);
|
||||
}
|
||||
|
||||
private void ctrlLabelList_OnLabelSelected(object relativeAddress, EventArgs e)
|
||||
{
|
||||
LastCodeWindow.ScrollToLineNumber((Int32)relativeAddress);
|
||||
}
|
||||
|
||||
private void mnuResetWorkspace_Click(object sender, EventArgs e)
|
||||
{
|
||||
if(MessageBox.Show("This operation will empty the watch window, remove all breakpoints, and reset labels to their default state." + Environment.NewLine + "Are you sure?", "", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == DialogResult.OK) {
|
||||
|
@ -1767,8 +1767,20 @@ namespace Mesen.GUI.Debugger
|
|||
if(target is ctrlSourceViewer) {
|
||||
((ctrlSourceViewer)target).ScrollToFileLine(dest.File, dest.Line);
|
||||
}
|
||||
} else if(dest.Label != null && dest.Label.GetRelativeAddress() >= 0) {
|
||||
target.ScrollToAddress(new AddressTypeInfo() { Address = (int)dest.Label.Address, Type = dest.Label.AddressType });
|
||||
} else {
|
||||
AddressTypeInfo addressInfo = dest.AddressInfo;
|
||||
if(addressInfo == null && dest.Label != null) {
|
||||
addressInfo = new AddressTypeInfo() { Address = (int)dest.Label.Address, Type = dest.Label.AddressType };
|
||||
}
|
||||
|
||||
if(InteropEmu.DebugGetRelativeAddress((uint)addressInfo.Address, addressInfo.Type) < 0) {
|
||||
//Try to display the label in the source view if possible (when code is out of scope)
|
||||
if(ctrlSourceViewer.CurrentFile != null && !(target is ctrlSourceViewer)) {
|
||||
ctrlDebuggerCode_OnSwitchView(target);
|
||||
target = GetAlternateView(target);
|
||||
}
|
||||
}
|
||||
target.ScrollToAddress(addressInfo);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -328,6 +328,8 @@ namespace Mesen.GUI.Debugger
|
|||
}
|
||||
}
|
||||
|
||||
public delegate void GoToDestinationEventHandler(GoToDestination dest);
|
||||
|
||||
public struct GoToDestination
|
||||
{
|
||||
public CodeLabel Label;
|
||||
|
|
Loading…
Add table
Reference in a new issue