@@ -19,6 +19,7 @@ import * as path from "path";
1919import { MI2 } from './mi2' ;
2020import { CoverageStatus } from './coverage' ;
2121import { DebuggerSettings } from './settings' ;
22+ import * as log from './log' ;
2223
2324const STACK_HANDLES_START = 1000 ;
2425const VAR_HANDLES_START = 512 * 256 + 1000 ;
@@ -42,7 +43,7 @@ export interface LaunchRequestArguments extends DebugProtocol.LaunchRequestArgum
4243 sourceDirs : string [ ] ;
4344}
4445
45- export interface AttachRequestArguments extends DebugProtocol . LaunchRequestArguments {
46+ export interface AttachRequestArguments extends DebugProtocol . AttachRequestArguments {
4647 cwd : string | null ;
4748 target : string ;
4849 arguments : string ;
@@ -57,6 +58,14 @@ export interface AttachRequestArguments extends DebugProtocol.LaunchRequestArgum
5758
5859const settings = new DebuggerSettings ( ) ;
5960
61+ function initLogLevel ( verbose : boolean ) {
62+ if ( verbose ) {
63+ log . setLevel ( log . Level . Debug ) ;
64+ } else {
65+ log . setLevel ( log . Level . Info ) ;
66+ }
67+ }
68+
6069export class GDBDebugSession extends DebugSession {
6170 protected variableHandles = new Handles < string | VariableObject | ExtendedVariable > ( VAR_HANDLES_START ) ;
6271 protected variableHandlesReverse : { [ id : string ] : number } = { } ;
@@ -78,11 +87,13 @@ export class GDBDebugSession extends DebugSession {
7887 }
7988
8089 protected launchRequest ( response : DebugProtocol . LaunchResponse , args : LaunchRequestArguments ) : void {
90+ initLogLevel ( args . verbose ) ;
91+
8192 this . showCoverage = args . coverage ;
8293 this . started = false ;
8394 this . attached = false ;
8495
85- this . miDebugger = new MI2 ( settings . gdbPath , args . gdbargs , args . env , args . verbose , args . noDebug , args . gdbtty , settings . cobcrunPath , args . useCobcrun , args . sourceDirs ) ;
96+ this . miDebugger = new MI2 ( settings . gdbPath , args . gdbargs , args . env , args . noDebug , args . gdbtty , settings . cobcrunPath , args . useCobcrun , args . sourceDirs ) ;
8697 this . miDebugger . on ( "launcherror" , ( err : Error ) => this . launchError ( err ) ) ;
8798 this . miDebugger . on ( "quit" , ( ) => this . quitEvent ( ) ) ;
8899 this . miDebugger . on ( "exited-normally" , ( ) => this . quitEvent ( ) ) ;
@@ -123,6 +134,8 @@ export class GDBDebugSession extends DebugSession {
123134 }
124135
125136 protected attachRequest ( response : DebugProtocol . AttachResponse , args : AttachRequestArguments ) : void {
137+ initLogLevel ( args . verbose ) ;
138+
126139 if ( ! args . pid && ! args . remoteDebugger ) {
127140 this . sendErrorResponse (
128141 response ,
@@ -136,7 +149,7 @@ export class GDBDebugSession extends DebugSession {
136149 this . attached = true ;
137150 this . started = false ;
138151
139- this . miDebugger = new MI2 ( settings . gdbPath , args . gdbargs , args . env , args . verbose , false , false , "" , false , args . sourceDirs ) ;
152+ this . miDebugger = new MI2 ( settings . gdbPath , args . gdbargs , args . env , false , false , "" , false , args . sourceDirs ) ;
140153 this . miDebugger . on ( "launcherror" , ( err : Error ) => this . launchError ( err ) ) ;
141154 this . miDebugger . on ( "quit" , ( ) => this . quitEvent ( ) ) ;
142155 this . miDebugger . on ( "exited-normally" , ( ) => this . quitEvent ( ) ) ;
0 commit comments