Skip to content

Commit 22e1b13

Browse files
committed
Rationalise allThreadsContinued
DAP retcon'd the behaviour of the continued event's allThreadsContinued key to match the response to the Contnue request, i.e. to assume that all threads are continued unless explicitly told otherwise. This seems to make it consistent with step events.
1 parent 5e24df8 commit 22e1b13

File tree

2 files changed

+25
-45
lines changed

2 files changed

+25
-45
lines changed

python3/vimspector/debug_session.py

Lines changed: 19 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -803,9 +803,13 @@ def _DetectSessionFile( self,
803803
return None
804804

805805

806-
@CurrentSession()
807-
@IfConnected()
808-
def StepOver( self, **kwargs ):
806+
def _CurrentSteppingGranularity( self ):
807+
if self._disassemblyView and self._disassemblyView.IsCurrent():
808+
return 'instruction'
809+
return 'statement'
810+
811+
812+
def _DoStep( self, kind, **kwargs ):
809813
threadId = self._stackTraceView.GetCurrentThreadId()
810814
if threadId is None:
811815
return
@@ -818,59 +822,28 @@ def handler( *_ ):
818822
'threadId': threadId,
819823
'granularity': self._CurrentSteppingGranularity(),
820824
}
825+
821826
arguments.update( kwargs )
822827
self._connection.DoRequest( handler, {
823-
'command': 'next',
828+
'command': kind,
824829
'arguments': arguments,
825830
} )
826831

832+
827833
@CurrentSession()
828834
@IfConnected()
829-
def StepInto( self, **kwargs ):
830-
threadId = self._stackTraceView.GetCurrentThreadId()
831-
if threadId is None:
832-
return
833-
834-
def handler( *_ ):
835-
self._stackTraceView.OnContinued( self, { 'threadId': threadId } )
836-
self.ClearCurrentPC()
835+
def StepOver( self, **kwargs ):
836+
self._DoStep( 'next', **kwargs )
837837

838-
arguments = {
839-
'threadId': threadId,
840-
'granularity': self._CurrentSteppingGranularity(),
841-
}
842-
arguments.update( kwargs )
843-
self._connection.DoRequest( handler, {
844-
'command': 'stepIn',
845-
'arguments': arguments,
846-
} )
838+
@CurrentSession()
839+
@IfConnected()
840+
def StepInto( self, **kwargs ):
841+
self._DoStep( 'stepIn', **kwargs )
847842

848843
@CurrentSession()
849844
@IfConnected()
850845
def StepOut( self, **kwargs ):
851-
threadId = self._stackTraceView.GetCurrentThreadId()
852-
if threadId is None:
853-
return
854-
855-
def handler( *_ ):
856-
self._stackTraceView.OnContinued( self, { 'threadId': threadId } )
857-
self.ClearCurrentPC()
858-
859-
arguments = {
860-
'threadId': threadId,
861-
'granularity': self._CurrentSteppingGranularity(),
862-
}
863-
arguments.update( kwargs )
864-
self._connection.DoRequest( handler, {
865-
'command': 'stepOut',
866-
'arguments': arguments,
867-
} )
868-
869-
def _CurrentSteppingGranularity( self ):
870-
if self._disassemblyView and self._disassemblyView.IsCurrent():
871-
return 'instruction'
872-
873-
return 'statement'
846+
self._DoStep( 'stepOut', **kwargs )
874847

875848
@CurrentSession()
876849
def Continue( self ):
@@ -884,6 +857,8 @@ def Continue( self ):
884857
return
885858

886859
def handler( msg ):
860+
# By deafult, Continue is assumed to continue all threads, unless it
861+
# specifically says otherwise
887862
self._stackTraceView.OnContinued( self, {
888863
'threadId': threadId,
889864
'allThreadsContinued': ( msg.get( 'body' ) or {} ).get(

python3/vimspector/stack_trace.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -578,6 +578,11 @@ def PauseContinueThread( self ):
578578

579579
def OnContinued( self, debug_session, event = None ):
580580
threadId = None
581+
# It's assumed that all threads are continued for continued event, continue
582+
# response and _all other_ step events (step in, step out, step over) etc.
583+
# *unless* the event explicitly says otherwise.
584+
# This _seems to be_ the only reasonable interpretation of the
585+
# specification, although it's extremely unclear.
581586
allThreadsContinued = True
582587
session = self.FindSession( debug_session )
583588

@@ -586,7 +591,7 @@ def OnContinued( self, debug_session, event = None ):
586591

587592
if event is not None:
588593
threadId = event[ 'threadId' ]
589-
allThreadsContinued = event.get( 'allThreadsContinued', False )
594+
allThreadsContinued = event.get( 'allThreadsContinued', True )
590595

591596
for thread in session.threads:
592597
if allThreadsContinued:

0 commit comments

Comments
 (0)