Merge pull request #107 from puremourning/fixups
Improve workflow for launching vimspector from scripts
This commit is contained in:
commit
9c18f3e802
3 changed files with 53 additions and 10 deletions
|
|
@ -171,6 +171,12 @@ class DebugSession( object ):
|
||||||
# working directory.
|
# working directory.
|
||||||
'cwd': os.getcwd(),
|
'cwd': os.getcwd(),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Pretend that vars passed to the launch command were typed in by the user
|
||||||
|
# (they may have been in theory)
|
||||||
|
USER_CHOICES.update( launch_variables )
|
||||||
|
self._variables.update( launch_variables )
|
||||||
|
|
||||||
self._variables.update(
|
self._variables.update(
|
||||||
utils.ParseVariables( adapter.get( 'variables', {} ),
|
utils.ParseVariables( adapter.get( 'variables', {} ),
|
||||||
self._variables,
|
self._variables,
|
||||||
|
|
@ -180,12 +186,6 @@ class DebugSession( object ):
|
||||||
self._variables,
|
self._variables,
|
||||||
USER_CHOICES ) )
|
USER_CHOICES ) )
|
||||||
|
|
||||||
# Pretend that vars passed to the launch command were typed in by the user
|
|
||||||
# (they may have been in theory)
|
|
||||||
# TODO: Is it right that we do this _after_ ParseVariables, rather than
|
|
||||||
# before ?
|
|
||||||
USER_CHOICES.update( launch_variables )
|
|
||||||
self._variables.update( launch_variables )
|
|
||||||
|
|
||||||
utils.ExpandReferencesInDict( configuration,
|
utils.ExpandReferencesInDict( configuration,
|
||||||
self._variables,
|
self._variables,
|
||||||
|
|
@ -268,7 +268,6 @@ class DebugSession( object ):
|
||||||
return fct(self, *args, **kwargs)
|
return fct(self, *args, **kwargs)
|
||||||
return wrapper
|
return wrapper
|
||||||
|
|
||||||
@IfConnected
|
|
||||||
def OnChannelData( self, data ):
|
def OnChannelData( self, data ):
|
||||||
self._connection.OnData( data )
|
self._connection.OnData( data )
|
||||||
|
|
||||||
|
|
@ -279,7 +278,6 @@ class DebugSession( object ):
|
||||||
self._outputView.Print( 'server', data )
|
self._outputView.Print( 'server', data )
|
||||||
|
|
||||||
|
|
||||||
@IfConnected
|
|
||||||
def OnRequestTimeout( self, timer_id ):
|
def OnRequestTimeout( self, timer_id ):
|
||||||
self._connection.OnRequestTimeout( timer_id )
|
self._connection.OnRequestTimeout( timer_id )
|
||||||
|
|
||||||
|
|
@ -365,20 +363,25 @@ class DebugSession( object ):
|
||||||
def Pause( self ):
|
def Pause( self ):
|
||||||
self._stackTraceView.Pause()
|
self._stackTraceView.Pause()
|
||||||
|
|
||||||
|
@IfConnected
|
||||||
def ExpandVariable( self ):
|
def ExpandVariable( self ):
|
||||||
self._variablesView.ExpandVariable()
|
self._variablesView.ExpandVariable()
|
||||||
|
|
||||||
|
@IfConnected
|
||||||
def AddWatch( self, expression ):
|
def AddWatch( self, expression ):
|
||||||
self._variablesView.AddWatch( self._stackTraceView.GetCurrentFrame(),
|
self._variablesView.AddWatch( self._stackTraceView.GetCurrentFrame(),
|
||||||
expression )
|
expression )
|
||||||
|
|
||||||
|
@IfConnected
|
||||||
def EvaluateConsole( self, expression ):
|
def EvaluateConsole( self, expression ):
|
||||||
self._outputView.Evaluate( self._stackTraceView.GetCurrentFrame(),
|
self._outputView.Evaluate( self._stackTraceView.GetCurrentFrame(),
|
||||||
expression )
|
expression )
|
||||||
|
|
||||||
|
@IfConnected
|
||||||
def DeleteWatch( self ):
|
def DeleteWatch( self ):
|
||||||
self._variablesView.DeleteWatch()
|
self._variablesView.DeleteWatch()
|
||||||
|
|
||||||
|
@IfConnected
|
||||||
def ShowBalloon( self, winnr, expression ):
|
def ShowBalloon( self, winnr, expression ):
|
||||||
"""Proxy: ballonexpr -> variables.ShowBallon"""
|
"""Proxy: ballonexpr -> variables.ShowBallon"""
|
||||||
frame = self._stackTraceView.GetCurrentFrame()
|
frame = self._stackTraceView.GetCurrentFrame()
|
||||||
|
|
@ -397,6 +400,7 @@ class DebugSession( object ):
|
||||||
# Return variable aware function
|
# Return variable aware function
|
||||||
return self._variablesView.ShowBalloon( frame, expression )
|
return self._variablesView.ShowBalloon( frame, expression )
|
||||||
|
|
||||||
|
@IfConnected
|
||||||
def ExpandFrameOrThread( self ):
|
def ExpandFrameOrThread( self ):
|
||||||
self._stackTraceView.ExpandFrameOrThread()
|
self._stackTraceView.ExpandFrameOrThread()
|
||||||
|
|
||||||
|
|
@ -601,8 +605,10 @@ class DebugSession( object ):
|
||||||
self._outputView.RunJobWithOutput( 'Remote', cmd )
|
self._outputView.RunJobWithOutput( 'Remote', cmd )
|
||||||
else:
|
else:
|
||||||
if atttach_config[ 'pidSelect' ] == 'ask':
|
if atttach_config[ 'pidSelect' ] == 'ask':
|
||||||
pid = utils.AskForInput( 'Enter PID to attach to: ' )
|
prop = atttach_config[ 'pidProperty' ]
|
||||||
launch_config[ atttach_config[ 'pidProperty' ] ] = pid
|
if prop not in launch_config:
|
||||||
|
pid = utils.AskForInput( 'Enter PID to attach to: ' )
|
||||||
|
launch_config[ prop ] = pid
|
||||||
return
|
return
|
||||||
elif atttach_config[ 'pidSelect' ] == 'none':
|
elif atttach_config[ 'pidSelect' ] == 'none':
|
||||||
return
|
return
|
||||||
|
|
|
||||||
13
support/test/example/attach.vim
Normal file
13
support/test/example/attach.vim
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
if argc() < 2
|
||||||
|
echom 'Usage:' v:argv[ 0 ] 'processName binary'
|
||||||
|
cquit!
|
||||||
|
endif
|
||||||
|
|
||||||
|
setfiletype cpp
|
||||||
|
call vimspector#LaunchWithSettings( #{
|
||||||
|
\ configuration: "C++ - Attach Local Process",
|
||||||
|
\ processName: argv( 0 ),
|
||||||
|
\ binary: argv( 1 ),
|
||||||
|
\ } )
|
||||||
|
|
||||||
|
1,2argd
|
||||||
24
support/test/example/cpp.json
Normal file
24
support/test/example/cpp.json
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
{
|
||||||
|
"configurations": {
|
||||||
|
"C++ - Attach Local Process": {
|
||||||
|
"adapter": "vscode-cpptools",
|
||||||
|
"variables": {
|
||||||
|
"PID": {
|
||||||
|
"shell": [ "GetPIDForProcess", "${processName}" ]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"configuration": {
|
||||||
|
"name": "test",
|
||||||
|
"request": "attach",
|
||||||
|
"program": "${binary}",
|
||||||
|
"processId": "${PID}",
|
||||||
|
|
||||||
|
"type": "cppdbg",
|
||||||
|
"stopAtEntry": true,
|
||||||
|
"setupCommands": [
|
||||||
|
{ "text": "source ${initFile}", "ignoreFailures": true }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue