Debugger: Allow adding breakpoints on lines containing only a label definition
This commit is contained in:
parent
be2cd9a850
commit
774cf22f52
3 changed files with 26 additions and 4 deletions
|
@ -263,9 +263,16 @@ namespace Mesen.GUI.Debugger.Controls
|
|||
|
||||
public void ToggleBreakpoint(bool toggleEnabledFlag)
|
||||
{
|
||||
int relativeAddress = Viewer.CodeViewer.CurrentLine;
|
||||
AddressTypeInfo info = Viewer.GetAddressInfo(Viewer.CodeViewer.SelectedLine);
|
||||
int lineIndex = Viewer.CodeViewer.SelectedLine;
|
||||
int relativeAddress = Viewer.CodeViewer.GetLineNumber(lineIndex);
|
||||
if(relativeAddress < 0 && Viewer.CodeViewer.LineCount > lineIndex + 1) {
|
||||
//Current line has no address, try using the next line instead.
|
||||
//(Used when trying to set a breakpoint on a row containing only a label)
|
||||
lineIndex++;
|
||||
relativeAddress = Viewer.CodeViewer.GetLineNumber(lineIndex);
|
||||
}
|
||||
|
||||
AddressTypeInfo info = Viewer.GetAddressInfo(lineIndex);
|
||||
BreakpointManager.ToggleBreakpoint(relativeAddress, info, toggleEnabledFlag);
|
||||
}
|
||||
|
||||
|
|
|
@ -260,8 +260,16 @@ namespace Mesen.GUI.Debugger
|
|||
_tooltipManager.Close();
|
||||
|
||||
if(e.Button == MouseButtons.Left && e.Location.X < this.ctrlCodeViewer.CodeMargin / 4) {
|
||||
int relativeAddress = ctrlCodeViewer.GetLineNumberAtPosition(e.Y);
|
||||
AddressTypeInfo info = GetAddressInfo(ctrlCodeViewer.GetLineIndexAtPosition(e.Y));
|
||||
int lineIndex = ctrlCodeViewer.GetLineIndexAtPosition(e.Y);
|
||||
int relativeAddress = ctrlCodeViewer.GetLineNumber(lineIndex);
|
||||
if(relativeAddress < 0 && ctrlCodeViewer.LineCount > lineIndex + 1) {
|
||||
//Current line has no address, try using the next line instead.
|
||||
//(Used when trying to set a breakpoint on a row containing only a label)
|
||||
lineIndex++;
|
||||
relativeAddress = ctrlCodeViewer.GetLineNumber(lineIndex);
|
||||
}
|
||||
|
||||
AddressTypeInfo info = GetAddressInfo(lineIndex);
|
||||
BreakpointManager.ToggleBreakpoint(relativeAddress, info, false);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -226,6 +226,13 @@ namespace Mesen.GUI.Debugger.Controls
|
|||
AddressTypeInfo info = GetAddressInfo(ctrlCodeViewer.SelectedLine);
|
||||
if(info.Address >= 0) {
|
||||
BreakpointManager.ToggleBreakpoint(-1, info, false);
|
||||
} else {
|
||||
//Current line has no address, try using the next line instead.
|
||||
//(Used when trying to set a breakpoint on a row containing only a label)
|
||||
info = GetAddressInfo(ctrlCodeViewer.SelectedLine + 1);
|
||||
if(info.Address >= 0) {
|
||||
BreakpointManager.ToggleBreakpoint(-1, info, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue