Skip to content

Commit

Permalink
Fix toggling all data breakpoints on/off
Browse files Browse the repository at this point in the history
Also fix yet-another bug with empty data breakpoints lists not clearing
previously set data breakpoints.
  • Loading branch information
puremourning committed Dec 12, 2024
1 parent d472636 commit c3bf6a7
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions python3/vimspector/breakpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,11 @@ def ToggleAllBreakpointsViewBreakpoint( self ):
enabled += 1
else:
disabled += 1
for dbp in self._line_breakpoints:
if bp[ 'state' ] == 'ENABLED':
enabled += 1
else:
disabled += 1

if enabled > disabled:
new_state = 'DISABLED'
Expand All @@ -337,10 +342,11 @@ def ToggleAllBreakpointsViewBreakpoint( self ):
for filename, bps in self._line_breakpoints.items():
for bp in bps:
bp[ 'state' ] = new_state
for dbp in self._data_breakponts:
dbp[ 'state' ] = new_state

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

if not is_temporary:
# We don't modify the 'user" breakpiont
# We don't modify the 'user" breakpoint
continue

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

if self._data_breakponts and self._server_capabilities[
'supportsDataBreakpoints' ]:
if self._server_capabilities.get( 'supportsDataBreakpoints' ):
connection: DebugAdapterConnection
for connection in self._connections:
breakpoints = []
Expand Down

0 comments on commit c3bf6a7

Please sign in to comment.