Skip to content

Commit c3bf6a7

Browse files
committed
Fix toggling all data breakpoints on/off
Also fix yet-another bug with empty data breakpoints lists not clearing previously set data breakpoints.
1 parent d472636 commit c3bf6a7

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

python3/vimspector/breakpoints.py

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,11 @@ def ToggleAllBreakpointsViewBreakpoint( self ):
328328
enabled += 1
329329
else:
330330
disabled += 1
331+
for dbp in self._line_breakpoints:
332+
if bp[ 'state' ] == 'ENABLED':
333+
enabled += 1
334+
else:
335+
disabled += 1
331336

332337
if enabled > disabled:
333338
new_state = 'DISABLED'
@@ -337,10 +342,11 @@ def ToggleAllBreakpointsViewBreakpoint( self ):
337342
for filename, bps in self._line_breakpoints.items():
338343
for bp in bps:
339344
bp[ 'state' ] = new_state
345+
for dbp in self._data_breakponts:
346+
dbp[ 'state' ] = new_state
340347

341348
# FIXME: We don't really handle 'DISABLED' state for function breakpoints,
342349
# so they are not touched
343-
# FIXME: Same for data breakpoints
344350
# FIXME: Same for exception breakpoints
345351
# FIXME: Same for instruction breakpoints
346352
self.UpdateUI()
@@ -622,7 +628,7 @@ def UpdatePostedBreakpoint( self,
622628
bp = self._FindPostedBreakpoint( conn, server_bp.get( 'id' ) )
623629
if bp is None:
624630
self._logger.warn( "Unexpected update to breakpoint with id %s:"
625-
"breakpiont not found. %s",
631+
"breakpoint not found. %s",
626632
server_bp.get( 'id' ),
627633
server_bp )
628634
# FIXME ? self.AddPostedBreakpoint( server_bp )
@@ -799,7 +805,7 @@ def ClearTemporaryBreakpoint( self, file_name, line_num ):
799805
# FIXME: We should use the _FindPostedBreakpoint here instead, as that's way
800806
# more accurate at this point. Some servers can now identifyt he breakpoint
801807
# ID that actually triggered too. For now, we still have
802-
# _UpdateServerBreakpoints change the _user_ breakpiont line and we check
808+
# _UpdateServerBreakpoints change the _user_ breakpoint line and we check
803809
# for that _here_, though we could check ['server_bp']['line']
804810
updates = False
805811
for bp, index in self._AllBreakpointsOnLine( file_name, line_num ):
@@ -839,7 +845,7 @@ def _UpdateServerBreakpoints( self, conn, breakpoints, bp_idxs ):
839845
is_temporary = bool( user_bp[ 'options' ].get( 'temporary' ) )
840846

841847
if not is_temporary:
842-
# We don't modify the 'user" breakpiont
848+
# We don't modify the 'user" breakpoint
843849
continue
844850

845851
# FIXME: Tempoarary instruction breakpoints would not have a line; we
@@ -1047,9 +1053,9 @@ def response_handler( conn, msg, bp_idxs = [] ):
10471053
# function breakpoint as well as every line breakpoint. We need to
10481054
# implement that:
10491055
# - pass the indices in here
1050-
# - make _FindPostedBreakpoint also search function breakpionts
1056+
# - make _FindPostedBreakpoint also search function breakpoints
10511057
# - make sure that ConnectionClosed also cleares the server_bp data for
1052-
# function breakpionts
1058+
# function breakpoints
10531059
# - make sure that we have tests for this, because i'm sure we don't!
10541060
for connection in self._connections:
10551061
self._awaiting_bp_responses += 1
@@ -1119,8 +1125,7 @@ def response_handler( conn, msg, bp_idxs = [] ):
11191125
failure_handler = response_received
11201126
)
11211127

1122-
if self._data_breakponts and self._server_capabilities[
1123-
'supportsDataBreakpoints' ]:
1128+
if self._server_capabilities.get( 'supportsDataBreakpoints' ):
11241129
connection: DebugAdapterConnection
11251130
for connection in self._connections:
11261131
breakpoints = []

0 commit comments

Comments
 (0)