@@ -48,7 +48,7 @@ export class MI2 extends EventEmitter implements IBackend {
4848 }
4949 }
5050
51- load ( cwd : string , target : string , procArgs : string , separateConsole : string ) : Thenable < any > {
51+ load ( cwd : string , target : string , procArgs : string , separateConsole : string , autorun : string [ ] ) : Thenable < any > {
5252 if ( ! path . isAbsolute ( target ) )
5353 target = path . join ( cwd , target ) ;
5454 return new Promise ( ( resolve , reject ) => {
@@ -65,6 +65,7 @@ export class MI2 extends EventEmitter implements IBackend {
6565 if ( process . platform == "win32" ) {
6666 if ( separateConsole !== undefined )
6767 promises . push ( this . sendCommand ( "gdb-set new-console on" ) ) ;
68+ promises . push ( ...autorun . map ( value => { return this . sendUserInput ( value ) ; } ) ) ;
6869 Promise . all ( promises ) . then ( ( ) => {
6970 this . emit ( "debug-ready" ) ;
7071 resolve ( undefined ) ;
@@ -73,12 +74,14 @@ export class MI2 extends EventEmitter implements IBackend {
7374 if ( separateConsole !== undefined ) {
7475 linuxTerm . spawnTerminalEmulator ( separateConsole ) . then ( tty => {
7576 promises . push ( this . sendCommand ( "inferior-tty-set " + tty ) ) ;
77+ promises . push ( ...autorun . map ( value => { return this . sendUserInput ( value ) ; } ) ) ;
7678 Promise . all ( promises ) . then ( ( ) => {
7779 this . emit ( "debug-ready" ) ;
7880 resolve ( undefined ) ;
7981 } , reject ) ;
8082 } ) ;
8183 } else {
84+ promises . push ( ...autorun . map ( value => { return this . sendUserInput ( value ) ; } ) ) ;
8285 Promise . all ( promises ) . then ( ( ) => {
8386 this . emit ( "debug-ready" ) ;
8487 resolve ( undefined ) ;
@@ -88,7 +91,7 @@ export class MI2 extends EventEmitter implements IBackend {
8891 } ) ;
8992 }
9093
91- ssh ( args : SSHArguments , cwd : string , target : string , procArgs : string , separateConsole : string , attach : boolean ) : Thenable < any > {
94+ ssh ( args : SSHArguments , cwd : string , target : string , procArgs : string , separateConsole : string , attach : boolean , autorun : string [ ] ) : Thenable < any > {
9295 return new Promise ( ( resolve , reject ) => {
9396 this . isSSH = true ;
9497 this . sshReady = false ;
@@ -169,6 +172,7 @@ export class MI2 extends EventEmitter implements IBackend {
169172 promises . push ( this . sendCommand ( "target-attach " + target ) ) ;
170173 } else if ( procArgs && procArgs . length )
171174 promises . push ( this . sendCommand ( "exec-arguments " + procArgs ) ) ;
175+ promises . push ( ...autorun . map ( value => { return this . sendUserInput ( value ) ; } ) ) ;
172176 Promise . all ( promises ) . then ( ( ) => {
173177 this . emit ( "debug-ready" ) ;
174178 resolve ( undefined ) ;
@@ -222,7 +226,7 @@ export class MI2 extends EventEmitter implements IBackend {
222226 return cmds ;
223227 }
224228
225- attach ( cwd : string , executable : string , target : string ) : Thenable < any > {
229+ attach ( cwd : string , executable : string , target : string , autorun : string [ ] ) : Thenable < any > {
226230 return new Promise ( ( resolve , reject ) => {
227231 let args = [ ] ;
228232 if ( executable && ! path . isAbsolute ( executable ) )
@@ -244,14 +248,15 @@ export class MI2 extends EventEmitter implements IBackend {
244248 promises . push ( this . sendCommand ( "file-exec-and-symbols \"" + escape ( executable ) + "\"" ) ) ;
245249 promises . push ( this . sendCommand ( "target-attach " + target ) ) ;
246250 }
251+ promises . push ( ...autorun . map ( value => { return this . sendUserInput ( value ) ; } ) ) ;
247252 Promise . all ( promises ) . then ( ( ) => {
248253 this . emit ( "debug-ready" ) ;
249254 resolve ( undefined ) ;
250255 } , reject ) ;
251256 } ) ;
252257 }
253258
254- connect ( cwd : string , executable : string , target : string ) : Thenable < any > {
259+ connect ( cwd : string , executable : string , target : string , autorun : string [ ] ) : Thenable < any > {
255260 return new Promise ( ( resolve , reject ) => {
256261 let args = [ ] ;
257262 if ( executable && ! path . isAbsolute ( executable ) )
@@ -266,6 +271,7 @@ export class MI2 extends EventEmitter implements IBackend {
266271 this . process . on ( "error" , ( ( err ) => { this . emit ( "launcherror" , err ) ; } ) . bind ( this ) ) ;
267272 const promises = this . initCommands ( target , cwd , true ) ;
268273 promises . push ( this . sendCommand ( "target-select remote " + target ) ) ;
274+ promises . push ( ...autorun . map ( value => { return this . sendUserInput ( value ) ; } ) ) ;
269275 Promise . all ( promises ) . then ( ( ) => {
270276 this . emit ( "debug-ready" ) ;
271277 resolve ( undefined ) ;
0 commit comments