Correctly handle the 'continue' response when continuing a specific thread

This commit is contained in:
Ben Jackson 2020-11-21 18:12:34 +00:00
commit 82307ff1ba
2 changed files with 17 additions and 7 deletions

View file

@ -477,8 +477,13 @@ class DebugSession( object ):
utils.UserMessage( 'No current thread', persist = True ) utils.UserMessage( 'No current thread', persist = True )
return return
def handler( *_ ): def handler( msg ):
self._stackTraceView.OnContinued( { 'threadId': threadId } ) self._stackTraceView.OnContinued( {
'threadId': threadId,
'allThreadsContinued': ( msg.get( 'body' ) or {} ).get(
'allThreadsContinued',
True )
} )
self._codeView.SetCurrentFrame( None ) self._codeView.SetCurrentFrame( None )
self._connection.DoRequest( handler, { self._connection.DoRequest( handler, {

View file

@ -192,14 +192,15 @@ class StackTraceView( object ):
self.LoadThreads( *self._pending_thread_request ) self.LoadThreads( *self._pending_thread_request )
return return
self._requesting_threads = StackTraceView.ThreadRequestState.NO
self._pending_thread_request = None
if not ( message.get( 'body' ) or {} ).get( 'threads' ): if not ( message.get( 'body' ) or {} ).get( 'threads' ):
# This is a protocol error. It is required to return at least one! # This is a protocol error. It is required to return at least one!
utils.UserMessage( 'Protocol error: Server returned no threads', utils.UserMessage( 'Protocol error: Server returned no threads',
persist = False, persist = False,
error = True ) error = True )
return
self._requesting_threads = StackTraceView.ThreadRequestState.NO
self._pending_thread_request = None
existing_threads = self._threads[ : ] existing_threads = self._threads[ : ]
self._threads.clear() self._threads.clear()
@ -367,14 +368,18 @@ class StackTraceView( object ):
return do_jump() return do_jump()
def PauseContinueThread( self ): def PauseContinueThread( self ):
thread = self._GetSelectedThread() thread = self._GetSelectedThread()
if thread is None: if thread is None:
utils.UserMessage( 'No thread selected' ) utils.UserMessage( 'No thread selected' )
elif thread.state == Thread.PAUSED: elif thread.state == Thread.PAUSED:
self._session._connection.DoRequest( 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', 'command': 'continue',
'arguments': { 'arguments': {