@@ -161,11 +161,11 @@ class CppConfigurationProvider implements vscode.DebugConfigurationProvider {
161161 return false ;
162162 }
163163 if ( defaultConfig . name . startsWith ( "(Windows) " ) ) {
164- if ( command . includes ( "cl.exe" ) ) {
164+ if ( command . startsWith ( "cl.exe" ) ) {
165165 return true ;
166166 }
167167 } else {
168- if ( ! command . includes ( "cl.exe" ) ) {
168+ if ( ! command . startsWith ( "cl.exe" ) ) {
169169 return true ;
170170 }
171171 }
@@ -203,21 +203,26 @@ class CppConfigurationProvider implements vscode.DebugConfigurationProvider {
203203 let debuggerName : string ;
204204 if ( compilerName . startsWith ( "clang" ) ) {
205205 newConfig . MIMode = "lldb" ;
206- const suffixIndex : number = compilerName . indexOf ( "-" ) ;
207- const suffix : string = suffixIndex === - 1 ? "" : compilerName . substr ( suffixIndex ) ;
208- debuggerName = "lldb-mi" + suffix ;
206+ debuggerName = "lldb-mi" ;
207+ // Search for clang-8, clang-10, etc.
208+ if ( ( compilerName !== "clang-cl.exe" ) && ( compilerName !== "clang-cpp.exe" ) ) {
209+ const suffixIndex : number = compilerName . indexOf ( "-" ) ;
210+ if ( suffixIndex !== - 1 ) {
211+ const suffix : string = compilerName . substr ( suffixIndex ) ;
212+ debuggerName += suffix ;
213+ }
214+ }
215+ newConfig . type = "cppdbg" ;
209216 } else if ( compilerName === "cl.exe" ) {
210217 newConfig . miDebuggerPath = undefined ;
211218 newConfig . type = "cppvsdbg" ;
212219 return resolve ( newConfig ) ;
213220 } else {
214221 debuggerName = "gdb" ;
215222 }
216-
217223 if ( isWindows ) {
218- debuggerName += ".exe" ;
224+ debuggerName = debuggerName . endsWith ( ".exe" ) ? debuggerName : ( debuggerName + ".exe" ) ;
219225 }
220-
221226 const compilerDirname : string = path . dirname ( compilerPath ) ;
222227 const debuggerPath : string = path . join ( compilerDirname , debuggerName ) ;
223228 if ( isWindows ) {
0 commit comments