@@ -5,6 +5,7 @@ import { Breakpoint, IBackend, Variable, VariableObject, ValuesFormattingMode, M
55import { MINode } from './backend/mi_parse' ;
66import { expandValue , isExpandable } from './backend/gdb_expansion' ;
77import { MI2 } from './backend/mi2/mi2' ;
8+ import { execSync } from 'child_process' ;
89import * as systemPath from "path" ;
910import * as net from "net" ;
1011import * as os from "os" ;
@@ -17,10 +18,10 @@ class ExtendedVariable {
1718}
1819
1920class VariableScope {
20- constructor ( public readonly name : string , public readonly threadId : number , public readonly level : number ) {
21+ constructor ( public readonly name : string , public readonly threadId : number , public readonly level : number ) {
2122 }
2223
23- public static variableName ( handle : number , name : string ) : string {
24+ public static variableName ( handle : number , name : string ) : string {
2425 return `var_${ handle } _${ name } ` ;
2526 }
2627}
@@ -92,6 +93,17 @@ export class MI2DebugSession extends DebugSession {
9293 }
9394 }
9495
96+ // verifies that the specified command can be executed
97+ protected checkCommand ( debuggerName : string ) : boolean {
98+ try {
99+ const command = process . platform === 'win32' ? 'where' : 'command -v' ;
100+ execSync ( `${ command } ${ scriptName } ` , { stdio : 'ignore' } ) ;
101+ return true ;
102+ } catch ( error ) {
103+ return false ;
104+ }
105+ }
106+
95107 protected setValuesFormattingMode ( mode : ValuesFormattingMode ) {
96108 switch ( mode ) {
97109 case "disabled" :
@@ -728,7 +740,7 @@ export class MI2DebugSession extends DebugSession {
728740 id : 1 ,
729741 label : args . source . name ,
730742 column : args . column ,
731- line : args . line
743+ line : args . line
732744 } ]
733745 } ;
734746 this . sendResponse ( response ) ;
@@ -743,7 +755,7 @@ export class MI2DebugSession extends DebugSession {
743755
744756 protected setSourceFileMap ( configMap : { [ index : string ] : string } , fallbackGDB : string , fallbackIDE : string ) : void {
745757 if ( configMap === undefined ) {
746- this . sourceFileMap = new SourceFileMap ( { [ fallbackGDB ] : fallbackIDE } ) ;
758+ this . sourceFileMap = new SourceFileMap ( { [ fallbackGDB ] : fallbackIDE } ) ;
747759 } else {
748760 this . sourceFileMap = new SourceFileMap ( configMap , fallbackGDB ) ;
749761 }
0 commit comments