diff --git a/python3/vimspector/debug_session.py b/python3/vimspector/debug_session.py index afa210a0..297924d2 100644 --- a/python3/vimspector/debug_session.py +++ b/python3/vimspector/debug_session.py @@ -803,9 +803,13 @@ def _DetectSessionFile( self, return None - @CurrentSession() - @IfConnected() - def StepOver( self, **kwargs ): + def _CurrentSteppingGranularity( self ): + if self._disassemblyView and self._disassemblyView.IsCurrent(): + return 'instruction' + return 'statement' + + + def _DoStep( self, kind, **kwargs ): threadId = self._stackTraceView.GetCurrentThreadId() if threadId is None: return @@ -818,59 +822,28 @@ def handler( *_ ): 'threadId': threadId, 'granularity': self._CurrentSteppingGranularity(), } + arguments.update( kwargs ) self._connection.DoRequest( handler, { - 'command': 'next', + 'command': kind, 'arguments': arguments, } ) + @CurrentSession() @IfConnected() - def StepInto( self, **kwargs ): - threadId = self._stackTraceView.GetCurrentThreadId() - if threadId is None: - return - - def handler( *_ ): - self._stackTraceView.OnContinued( self, { 'threadId': threadId } ) - self.ClearCurrentPC() + def StepOver( self, **kwargs ): + self._DoStep( 'next', **kwargs ) - arguments = { - 'threadId': threadId, - 'granularity': self._CurrentSteppingGranularity(), - } - arguments.update( kwargs ) - self._connection.DoRequest( handler, { - 'command': 'stepIn', - 'arguments': arguments, - } ) + @CurrentSession() + @IfConnected() + def StepInto( self, **kwargs ): + self._DoStep( 'stepIn', **kwargs ) @CurrentSession() @IfConnected() def StepOut( self, **kwargs ): - threadId = self._stackTraceView.GetCurrentThreadId() - if threadId is None: - return - - def handler( *_ ): - self._stackTraceView.OnContinued( self, { 'threadId': threadId } ) - self.ClearCurrentPC() - - arguments = { - 'threadId': threadId, - 'granularity': self._CurrentSteppingGranularity(), - } - arguments.update( kwargs ) - self._connection.DoRequest( handler, { - 'command': 'stepOut', - 'arguments': arguments, - } ) - - def _CurrentSteppingGranularity( self ): - if self._disassemblyView and self._disassemblyView.IsCurrent(): - return 'instruction' - - return 'statement' + self._DoStep( 'stepOut', **kwargs ) @CurrentSession() def Continue( self ): @@ -884,6 +857,8 @@ def Continue( self ): return def handler( msg ): + # By deafult, Continue is assumed to continue all threads, unless it + # specifically says otherwise self._stackTraceView.OnContinued( self, { 'threadId': threadId, 'allThreadsContinued': ( msg.get( 'body' ) or {} ).get( diff --git a/python3/vimspector/stack_trace.py b/python3/vimspector/stack_trace.py index 2bac73d6..16ec565e 100644 --- a/python3/vimspector/stack_trace.py +++ b/python3/vimspector/stack_trace.py @@ -578,6 +578,11 @@ def PauseContinueThread( self ): def OnContinued( self, debug_session, event = None ): threadId = None + # It's assumed that all threads are continued for continued event, continue + # response and _all other_ step events (step in, step out, step over) etc. + # *unless* the event explicitly says otherwise. + # This _seems to be_ the only reasonable interpretation of the + # specification, although it's extremely unclear. allThreadsContinued = True session = self.FindSession( debug_session ) @@ -586,7 +591,7 @@ def OnContinued( self, debug_session, event = None ): if event is not None: threadId = event[ 'threadId' ] - allThreadsContinued = event.get( 'allThreadsContinued', False ) + allThreadsContinued = event.get( 'allThreadsContinued', True ) for thread in session.threads: if allThreadsContinued: