@@ -151,30 +151,35 @@ export async function getDebugConfigurationFromCache(cache: CMakeCache, target:
151
151
}
152
152
153
153
if ( ! debuggerPathOverride ) {
154
- const clang_compiler_regex = / ( c l a n g [ \+ ] { 0 , 2 } ) + (? ! - c l ) / gi;
155
154
// Look for a debugger, in the following order:
156
- const cpptoolsExtension = vscode . extensions . getExtension ( 'ms-vscode.cpptools' ) ;
157
- const cpptoolsDebuggerPath = cpptoolsExtension ? path . join ( cpptoolsExtension . extensionPath , "debugAdapters" , "lldb-mi" , "bin" , "lldb-mi" ) : undefined ;
158
- let clang_debugger_path = compiler_path . replace ( clang_compiler_regex , 'lldb-mi' ) ;
159
- // 1. lldb-mi in the compiler path
160
- if ( ( clang_debugger_path . search ( new RegExp ( 'lldb-mi' ) ) != - 1 ) && await checkDebugger ( clang_debugger_path ) ) {
161
- return createLLDBDebugConfiguration ( clang_debugger_path , target ) ;
162
- } else if ( cpptoolsDebuggerPath && await checkDebugger ( cpptoolsDebuggerPath ) ) {
163
- // 2. lldb-mi installed by CppTools
164
- return createLLDBDebugConfiguration ( cpptoolsDebuggerPath , target ) ;
165
- } else {
166
- // 3. gdb in the compiler path
167
- clang_debugger_path = compiler_path . replace ( clang_compiler_regex , 'gdb' ) ;
168
- if ( ( clang_debugger_path . search ( new RegExp ( 'gdb' ) ) != - 1 ) && await checkDebugger ( clang_debugger_path ) ) {
169
- return createGDBDebugConfiguration ( clang_debugger_path , target ) ;
170
- } else {
171
- // 4. lldb in the compiler path
172
- clang_debugger_path = compiler_path . replace ( clang_compiler_regex , 'lldb' ) ;
173
- if ( ( clang_debugger_path . search ( new RegExp ( 'lldb' ) ) != - 1 ) && await checkDebugger ( clang_debugger_path ) ) {
174
- return createLLDBDebugConfiguration ( clang_debugger_path , target ) ;
175
- }
155
+ // 1. LLDB-MI
156
+ const clang_compiler_regex = / ( c l a n g [ \+ ] { 0 , 2 } ) + (? ! - c l ) / gi;
157
+ let mi_debugger_path = compiler_path . replace ( clang_compiler_regex , 'lldb-mi' ) ;
158
+ if ( ( mi_debugger_path . search ( new RegExp ( 'lldb-mi' ) ) != - 1 ) ) {
159
+ const cpptoolsExtension = vscode . extensions . getExtension ( 'ms-vscode.cpptools' ) ;
160
+ const cpptoolsDebuggerPath = cpptoolsExtension ? path . join ( cpptoolsExtension . extensionPath , "debugAdapters" , "lldb-mi" , "bin" , "lldb-mi" ) : undefined ;
161
+ // 1a. lldb-mi in the compiler path
162
+ if ( await checkDebugger ( mi_debugger_path ) ) {
163
+ return createLLDBDebugConfiguration ( mi_debugger_path , target ) ;
164
+ }
165
+
166
+ // 1b. lldb-mi installed by CppTools
167
+ if ( cpptoolsDebuggerPath && await checkDebugger ( cpptoolsDebuggerPath ) ) {
168
+ return createLLDBDebugConfiguration ( cpptoolsDebuggerPath , target ) ;
176
169
}
177
170
}
171
+
172
+ // 2. gdb in the compiler path
173
+ mi_debugger_path = compiler_path . replace ( clang_compiler_regex , 'gdb' ) ;
174
+ if ( ( mi_debugger_path . search ( new RegExp ( 'gdb' ) ) != - 1 ) && await checkDebugger ( mi_debugger_path ) ) {
175
+ return createGDBDebugConfiguration ( mi_debugger_path , target ) ;
176
+ }
177
+
178
+ // 3. lldb in the compiler path
179
+ mi_debugger_path = compiler_path . replace ( clang_compiler_regex , 'lldb' ) ;
180
+ if ( ( mi_debugger_path . search ( new RegExp ( 'lldb' ) ) != - 1 ) && await checkDebugger ( mi_debugger_path ) ) {
181
+ return createLLDBDebugConfiguration ( mi_debugger_path , target ) ;
182
+ }
178
183
}
179
184
180
185
const debugger_name = platform == 'darwin' ? 'lldb' : 'gdb' ;
0 commit comments