@@ -124,11 +124,20 @@ private void LaunchInGdbDebugger(string file)
124124 {
125125 writer . WriteAttributeString ( "WorkingDirectory" , EscapePath ( debugConfig . WorkingDir ) ) ;
126126 // GDB won't search working directory by default, but this is expected on Windows.
127- writer . WriteAttributeString ( "AdditionalSOLibSearchPath" , debugConfig . WorkingDir ) ;
127+ string rustBinPath = RustBinPath ( ) ;
128+ string additionalPath ;
129+ if ( rustBinPath != null )
130+ additionalPath = rustBinPath + ";" + debugConfig . WorkingDir ;
131+ else
132+ additionalPath = debugConfig . WorkingDir ;
133+ writer . WriteAttributeString ( "AdditionalSOLibSearchPath" , additionalPath ) ;
128134 }
129135 else
130136 {
131137 writer . WriteAttributeString ( "WorkingDirectory" , EscapePath ( Path . GetDirectoryName ( file ) ) ) ;
138+ string rustBinPath = RustBinPath ( ) ;
139+ if ( rustBinPath != null )
140+ writer . WriteAttributeString ( "AdditionalSOLibSearchPath" , rustBinPath ) ;
132141 }
133142 // this affects the number of bytes the engine reads when disassembling commands,
134143 // x64 has the largest maximum command size, so it should be safe to use for x86 as well
@@ -155,10 +164,6 @@ private void LaunchInGdbDebugger(string file)
155164
156165 IVsDebugger4 vsDebugger = ( IVsDebugger4 ) project . GetService ( typeof ( SVsShellDebugger ) ) ;
157166 vsDebugger . LaunchDebugTargets4 ( ( uint ) targets . Length , targets , results ) ;
158-
159- // Type "gdb <command>" in the VS Command Window
160- var commandWnd = ( IVsCommandWindow ) project . GetService ( typeof ( SVsCommandWindow ) ) ;
161- commandWnd . ExecuteCommand ( "alias gdb Debug.GDBExec" ) ;
162167 }
163168
164169 private string GuessArchitecture ( )
@@ -247,21 +252,26 @@ private ProcessStartInfo CreateProcessStartInfo(string startupFile)
247252 return startInfo ;
248253 }
249254
250- private void InjectRustBinPath ( ProcessStartInfo startInfo )
255+ private string RustBinPath ( )
251256 {
252257 EnvDTE . Project proj = project . GetAutomationObject ( ) as EnvDTE . Project ;
253- if ( proj == null )
254- return ;
258+ if ( proj == null )
259+ return null ;
255260 string currentConfigName = Utilities . GetActiveConfigurationName ( proj ) ;
256- if ( currentConfigName == null )
257- return ;
258- ProjectConfig currentConfig = project . ConfigProvider . GetProjectConfiguration ( currentConfigName ) ;
259- if ( currentConfig == null )
260- return ;
261+ if ( currentConfigName == null )
262+ return null ;
263+ ProjectConfig currentConfig = project . ConfigProvider . GetProjectConfiguration ( currentConfigName ) ;
264+ if ( currentConfig == null )
265+ return null ;
261266 string currentTarget = currentConfig . GetConfigurationProperty ( "PlatformTarget" , true ) ;
262- if ( currentTarget == null )
263- currentTarget = Shared . Environment . DefaultTarget ;
264- string installPath = Shared . Environment . FindInstallPath ( currentTarget ) ;
267+ if ( currentTarget == null )
268+ currentTarget = Shared . Environment . DefaultTarget ;
269+ return Shared . Environment . FindInstallPath ( currentTarget ) ;
270+ }
271+
272+ private void InjectRustBinPath ( ProcessStartInfo startInfo )
273+ {
274+ string installPath = RustBinPath ( ) ;
265275 if ( installPath == null )
266276 return ;
267277 string envPath = Environment . GetEnvironmentVariable ( "PATH" ) ;
0 commit comments