diff --git a/README.md b/README.md index 60c446c..36cdc75 100644 --- a/README.md +++ b/README.md @@ -728,7 +728,7 @@ See [my fork of TclProDebug](https://github.com/puremourning/TclProDebug) for in * C# - dotnet core -Requires `install_gadget.py --force-enable-c-sharp` +Requires `install_gadget.py --force-enable-csharp` ```json { @@ -748,7 +748,7 @@ Requires `install_gadget.py --force-enable-c-sharp` * C# - mono -Requires `install_gadget.py --force-enable-c-sharp`. +Requires `install_gadget.py --force-enable-csharp`. ***Known not to work.**** diff --git a/python3/vimspector/debug_session.py b/python3/vimspector/debug_session.py index 474e3d0..6f65a0b 100644 --- a/python3/vimspector/debug_session.py +++ b/python3/vimspector/debug_session.py @@ -171,6 +171,12 @@ class DebugSession( object ): # working directory. '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( utils.ParseVariables( adapter.get( 'variables', {} ), self._variables, @@ -180,12 +186,6 @@ class DebugSession( object ): self._variables, 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, self._variables, @@ -268,7 +268,6 @@ class DebugSession( object ): return fct(self, *args, **kwargs) return wrapper - @IfConnected def OnChannelData( self, data ): self._connection.OnData( data ) @@ -279,7 +278,6 @@ class DebugSession( object ): self._outputView.Print( 'server', data ) - @IfConnected def OnRequestTimeout( self, timer_id ): self._connection.OnRequestTimeout( timer_id ) @@ -365,20 +363,25 @@ class DebugSession( object ): def Pause( self ): self._stackTraceView.Pause() + @IfConnected def ExpandVariable( self ): self._variablesView.ExpandVariable() + @IfConnected def AddWatch( self, expression ): self._variablesView.AddWatch( self._stackTraceView.GetCurrentFrame(), expression ) + @IfConnected def EvaluateConsole( self, expression ): self._outputView.Evaluate( self._stackTraceView.GetCurrentFrame(), expression ) + @IfConnected def DeleteWatch( self ): self._variablesView.DeleteWatch() + @IfConnected def ShowBalloon( self, winnr, expression ): """Proxy: ballonexpr -> variables.ShowBallon""" frame = self._stackTraceView.GetCurrentFrame() @@ -397,6 +400,7 @@ class DebugSession( object ): # Return variable aware function return self._variablesView.ShowBalloon( frame, expression ) + @IfConnected def ExpandFrameOrThread( self ): self._stackTraceView.ExpandFrameOrThread() @@ -601,8 +605,10 @@ class DebugSession( object ): self._outputView.RunJobWithOutput( 'Remote', cmd ) else: if atttach_config[ 'pidSelect' ] == 'ask': - pid = utils.AskForInput( 'Enter PID to attach to: ' ) - launch_config[ atttach_config[ 'pidProperty' ] ] = pid + prop = atttach_config[ 'pidProperty' ] + if prop not in launch_config: + pid = utils.AskForInput( 'Enter PID to attach to: ' ) + launch_config[ prop ] = pid return elif atttach_config[ 'pidSelect' ] == 'none': return diff --git a/support/test/example/attach.vim b/support/test/example/attach.vim new file mode 100644 index 0000000..dda00a9 --- /dev/null +++ b/support/test/example/attach.vim @@ -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 diff --git a/support/test/example/cpp.json b/support/test/example/cpp.json new file mode 100644 index 0000000..ba52fcd --- /dev/null +++ b/support/test/example/cpp.json @@ -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 } + ] + } + } + } +}