Add "run to cursor" support
We add a 'temporary' option to line breakpionts and try and clear any temporary breakpionts on the line we end up stopping on. This might not be art, but _probably_ works in almost all cases that matter. it's a bit hacky the way we have to push the reason around, but we don't know where we stopped until we actually get the stack trace response and SetCurrentFrame Move temporary breakpionts to match server response Also delete any existing ones when adding a new one and add tests for run-to-cursor. Only continue after we successfully set the breakpoints. This makes it work in go
This commit is contained in:
parent
0d112d70a0
commit
80985148e7
18 changed files with 693 additions and 205 deletions
|
|
@ -77,6 +77,7 @@ class DebugSession( object ):
|
|||
self._launch_complete = False
|
||||
self._on_init_complete_handlers = []
|
||||
self._server_capabilities = {}
|
||||
self.ClearTemporaryBreakpoints()
|
||||
|
||||
def Start( self, launch_variables = None ):
|
||||
# We mutate launch_variables, so don't mutate the default argument.
|
||||
|
|
@ -560,6 +561,13 @@ class DebugSession( object ):
|
|||
return response[ 'body' ][ 'targets' ]
|
||||
|
||||
|
||||
def RefreshSigns( self, file_name ):
|
||||
if self._connection:
|
||||
self._codeView.Refresh( file_name )
|
||||
else:
|
||||
self._breakpoints.Refresh( file_name )
|
||||
|
||||
|
||||
def _SetUpUI( self ):
|
||||
vim.command( 'tab split' )
|
||||
self._uiTab = vim.current.tabpage
|
||||
|
|
@ -622,7 +630,7 @@ class DebugSession( object ):
|
|||
self.SetCurrentFrame( None )
|
||||
|
||||
@RequiresUI()
|
||||
def SetCurrentFrame( self, frame ):
|
||||
def SetCurrentFrame( self, frame, reason = '' ):
|
||||
if not frame:
|
||||
self._stackTraceView.Clear()
|
||||
self._variablesView.Clear()
|
||||
|
|
@ -630,11 +638,16 @@ class DebugSession( object ):
|
|||
if not self._codeView.SetCurrentFrame( frame ):
|
||||
return False
|
||||
|
||||
if frame:
|
||||
self._variablesView.SetSyntax( self._codeView.current_syntax )
|
||||
self._stackTraceView.SetSyntax( self._codeView.current_syntax )
|
||||
self._variablesView.LoadScopes( frame )
|
||||
self._variablesView.EvaluateWatches()
|
||||
# the codeView.SetCurrentFrame already checked the frame was valid and
|
||||
# countained a valid source
|
||||
self._variablesView.SetSyntax( self._codeView.current_syntax )
|
||||
self._stackTraceView.SetSyntax( self._codeView.current_syntax )
|
||||
self._variablesView.LoadScopes( frame )
|
||||
self._variablesView.EvaluateWatches()
|
||||
|
||||
if reason == 'stopped':
|
||||
self._breakpoints.ClearTemporaryBreakpoint( frame[ 'source' ][ 'path' ],
|
||||
frame[ 'line' ] )
|
||||
|
||||
return True
|
||||
|
||||
|
|
@ -1165,8 +1178,22 @@ class DebugSession( object ):
|
|||
def ToggleBreakpoint( self, options ):
|
||||
return self._breakpoints.ToggleBreakpoint( options )
|
||||
|
||||
def SetLineBreakpoint( self, file_name, line_num, options ):
|
||||
return self._breakpoints.SetLineBreakpoint( file_name, line_num, options )
|
||||
def RunTo( self, file_name, line ):
|
||||
self.ClearTemporaryBreakpoints()
|
||||
self.SetLineBreakpoint( file_name,
|
||||
line,
|
||||
{ 'temporary': True },
|
||||
lambda: self.Continue() )
|
||||
|
||||
|
||||
def ClearTemporaryBreakpoints( self ):
|
||||
return self._breakpoints.ClearTemporaryBreakpoints()
|
||||
|
||||
def SetLineBreakpoint( self, file_name, line_num, options, then = None ):
|
||||
return self._breakpoints.SetLineBreakpoint( file_name,
|
||||
line_num,
|
||||
options,
|
||||
then )
|
||||
|
||||
def ClearLineBreakpoint( self, file_name, line_num ):
|
||||
return self._breakpoints.ClearLineBreakpoint( file_name, line_num )
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue