From 810a619c06c05a4f7eac129ac6eed53e874dff9e Mon Sep 17 00:00:00 2001 From: gambas Date: Thu, 30 Dec 2021 14:21:15 +0100 Subject: [PATCH] Debugger: Fix breakpoint management. [DEVELOPMENT ENVIRONMENT] * BUG: Debugger: Removing a breakpoint is always possible. * BUG: Debugger: Incorrect breakpoints (on commented or void lines) are removed when the debugger starts only. --- app/src/gambas3/.src/Debug/Breakpoints.module | 2 + app/src/gambas3/.src/Debug/FDebugInfo.class | 46 +++++++++++-------- .../gambas3/.src/Editor/Code/FEditor.class | 37 +++++++-------- 3 files changed, 45 insertions(+), 40 deletions(-) diff --git a/app/src/gambas3/.src/Debug/Breakpoints.module b/app/src/gambas3/.src/Debug/Breakpoints.module index e38374a64..eaa45220f 100644 --- a/app/src/gambas3/.src/Debug/Breakpoints.module +++ b/app/src/gambas3/.src/Debug/Breakpoints.module @@ -43,6 +43,7 @@ Public Sub Load(hModule As FEditor) ' Next hEditor.Breakpoints = aBreakpoints + hModule.CheckBreakpoints() 'hEditor.DisabledBreakpoints = aDisabled End @@ -61,6 +62,7 @@ Private Sub Synchronize() sClass = hForm.Name hEditor = hForm.GetEditor() + hForm.CheckBreakpoints() aBreakpoints = hEditor.Breakpoints If aBreakpoints.Count = 0 Then diff --git a/app/src/gambas3/.src/Debug/FDebugInfo.class b/app/src/gambas3/.src/Debug/FDebugInfo.class index b24d3b7b3..4cc9b8cc7 100644 --- a/app/src/gambas3/.src/Debug/FDebugInfo.class +++ b/app/src/gambas3/.src/Debug/FDebugInfo.class @@ -390,29 +390,34 @@ End Public Sub wizDebug_Click() - If Design.IsRunning() Then - Select Case wizDebug.Index - Case TAB_CONSOLE - FOutput.SetFocus - End Select - Return - Endif + ' If Design.IsRunning() Then + ' Select Case wizDebug.Index + ' Case TAB_CONSOLE + ' FOutput.SetFocus + ' End Select + ' Return + ' Endif Select Case wizDebug.Index Case TAB_DEBUG - DefineVariable($sLastLocal, $sLastObject) - RefreshBreakpoints + If Design.IsRunning() Then + DefineVariable($sLastLocal, $sLastObject) + RefreshBreakpoints + Endif Case TAB_CONSOLE If FMain.IsDebugVisible() Then FOutput.SetFocus - Case TAB_COMPILATION Case TAB_TASK - If Not $aTask Then - UpdateTask - Else - timTask_Timer + If Not Design.IsRunning() Then + If Not $aTask Then + UpdateTask + Else + timTask_Timer + Endif Endif Case TAB_SEARCH - FSearch.RefreshBrowse + If Not Design.IsRunning() Then + FSearch.RefreshBrowse + Endif End Select End @@ -760,7 +765,7 @@ End Public Sub OnVisibilityChange() - If IsSearchListVisible() Then FSearch.RefreshBrowse + RefreshTabs() End @@ -798,10 +803,13 @@ Private Sub RefreshBreakpoints() End -Public Sub RefreshTabs(sPath As String, (sName) As String) +Public Sub RefreshTabs(Optional sPath As String, (sName) As String) - RefreshTask(sPath) + If Not Project.Path Or If Project.IsFake() Then Return + If Not FMain.IsDebugVisible() Then Return + If sPath Then RefreshTask(sPath) RefreshBreakpoints + If IsSearchListVisible() Then FSearch.RefreshBrowse End @@ -1765,7 +1773,7 @@ Public Sub panDebug_Arrange() End -Public Sub lvwBreakpoint_Select() +Public Sub lvwBreakpoint_Click() Project.Goto(lvwBreakpoint.Key) diff --git a/app/src/gambas3/.src/Editor/Code/FEditor.class b/app/src/gambas3/.src/Editor/Code/FEditor.class index c85aac63a..ce09ab17d 100644 --- a/app/src/gambas3/.src/Editor/Code/FEditor.class +++ b/app/src/gambas3/.src/Editor/Code/FEditor.class @@ -1173,18 +1173,6 @@ Public Function CanSetBreakpoint(iLine As Integer) As Boolean End -' Public Sub CheckBreakpoints() -' -' Dim iLine As Integer -' -' If Project.IsFake() Then Return -' For Each iLine In $hEditor.Breakpoints -' If Not CanSetBreakpoint(iLine) Then SetBreakpoint(iLine, False, False) -' Next -' -' End -' - Public Sub mnuComment_Click() Dim iStartLine As Integer @@ -2654,13 +2642,27 @@ End Public Sub ToggleBreakpoint(Y As Integer) - If Design.IsRunning() Then Return - If Not CanSetBreakpoint(Y) Then Return + If Design.IsRunning() Then Return + + If Not $hEditor[Y].Breakpoint Then + If Not CanSetBreakpoint(Y) Then Return + Endif + $hEditor[Y].Breakpoint = Not $hEditor[Y].Breakpoint Design.SetBreakpoint(Me.Name, Y, $hEditor[Y].Breakpoint) End +Public Sub CheckBreakpoints() + + Dim Y As Integer + + For Each Y In $hEditor.Breakpoints + If Not CanSetBreakpoint(Y) Then ToggleBreakpoint(Y) + Next + +End + Public Sub Editors_Margin() ToggleBreakpoint(Last.Line) @@ -2706,13 +2708,6 @@ Public Sub ShowErrorMessage(sMsg As String, (sIcon) As String) End -' Public Sub timProc_Timer() -' -' CheckBreakpoints -' timProc.Enabled = False -' -' End - Private Sub SetComboProcText(sProc As String) btnProc.Text = sProc