@@ -257,11 +257,16 @@ export class CodeQLCliServer implements Disposable {
257257 */
258258 private async launchProcess ( ) : Promise < child_process . ChildProcessWithoutNullStreams > {
259259 const codeQlPath = await this . getCodeQlPath ( ) ;
260+ const args = [ ] ;
261+ if ( shouldDebugCliServer ( ) ) {
262+ args . push ( '-J=-agentlib:jdwp=transport=dt_socket,address=localhost:9012,server=n,suspend=y,quiet=y' ) ;
263+ }
264+
260265 return await spawnServer (
261266 codeQlPath ,
262267 'CodeQL CLI Server' ,
263268 [ 'execute' , 'cli-server' ] ,
264- [ ] ,
269+ args ,
265270 this . logger ,
266271 _data => { /**/ }
267272 ) ;
@@ -605,7 +610,7 @@ export class CodeQLCliServer implements Disposable {
605610 if ( target ) subcommandArgs . push ( '--target' , target ) ;
606611 if ( name ) subcommandArgs . push ( '--name' , name ) ;
607612 subcommandArgs . push ( archivePath ) ;
608-
613+
609614 return await this . runCodeQlCliCommand ( [ 'database' , 'unbundle' ] , subcommandArgs , `Extracting ${ archivePath } to directory ${ target } ` ) ;
610615 }
611616
@@ -1049,6 +1054,12 @@ export function shouldDebugQueryServer() {
10491054 && process . env . QUERY_SERVER_JAVA_DEBUG ?. toLocaleLowerCase ( ) !== 'false' ;
10501055}
10511056
1057+ export function shouldDebugCliServer ( ) {
1058+ return 'CLI_SERVER_JAVA_DEBUG' in process . env
1059+ && process . env . CLI_SERVER_JAVA_DEBUG !== '0'
1060+ && process . env . CLI_SERVER_JAVA_DEBUG ?. toLocaleLowerCase ( ) !== 'false' ;
1061+ }
1062+
10521063export class CliVersionConstraint {
10531064
10541065 /**
0 commit comments