Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 19 additions & 44 deletions python3/vimspector/debug_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 ):
Expand All @@ -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(
Expand Down
7 changes: 6 additions & 1 deletion python3/vimspector/stack_trace.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 )

Expand All @@ -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:
Expand Down
Loading