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.
This commit is contained in:
gambas 2021-12-30 14:21:15 +01:00
parent 2cbfa19117
commit 810a619c06
3 changed files with 45 additions and 40 deletions

View file

@ -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

View file

@ -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)

View file

@ -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