From 82307ff1ba78b54997a4101d4e3553edba947e11 Mon Sep 17 00:00:00 2001 From: Ben Jackson Date: Sat, 21 Nov 2020 18:12:34 +0000 Subject: [PATCH] Correctly handle the 'continue' response when continuing a specific thread --- python3/vimspector/debug_session.py | 9 +++++++-- python3/vimspector/stack_trace.py | 15 ++++++++++----- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/python3/vimspector/debug_session.py b/python3/vimspector/debug_session.py index c6a1f72..b5387ee 100644 --- a/python3/vimspector/debug_session.py +++ b/python3/vimspector/debug_session.py @@ -477,8 +477,13 @@ class DebugSession( object ): utils.UserMessage( 'No current thread', persist = True ) return - def handler( *_ ): - self._stackTraceView.OnContinued( { 'threadId': threadId } ) + def handler( msg ): + self._stackTraceView.OnContinued( { + 'threadId': threadId, + 'allThreadsContinued': ( msg.get( 'body' ) or {} ).get( + 'allThreadsContinued', + True ) + } ) self._codeView.SetCurrentFrame( None ) self._connection.DoRequest( handler, { diff --git a/python3/vimspector/stack_trace.py b/python3/vimspector/stack_trace.py index a0b4734..23ddb0d 100644 --- a/python3/vimspector/stack_trace.py +++ b/python3/vimspector/stack_trace.py @@ -192,14 +192,15 @@ class StackTraceView( object ): self.LoadThreads( *self._pending_thread_request ) return + self._requesting_threads = StackTraceView.ThreadRequestState.NO + self._pending_thread_request = None + if not ( message.get( 'body' ) or {} ).get( 'threads' ): # This is a protocol error. It is required to return at least one! utils.UserMessage( 'Protocol error: Server returned no threads', persist = False, error = True ) - - self._requesting_threads = StackTraceView.ThreadRequestState.NO - self._pending_thread_request = None + return existing_threads = self._threads[ : ] self._threads.clear() @@ -367,14 +368,18 @@ class StackTraceView( object ): return do_jump() - def PauseContinueThread( self ): thread = self._GetSelectedThread() if thread is None: utils.UserMessage( 'No thread selected' ) elif thread.state == Thread.PAUSED: self._session._connection.DoRequest( - lambda *_: self.OnContinued( { 'threadId': thread.id } ), + lambda msg: self.OnContinued( { + 'threadId': thread.id, + 'allThreadsContinued': ( msg.get( 'body' ) or {} ).get( + 'allThreadsContinued', + True ) + } ), { 'command': 'continue', 'arguments': {