Checking if autorun exists & has items before iterating on it
This commit is contained in:
parent
a480a4cf4a
commit
d6c55d4aa8
1 changed files with 12 additions and 9 deletions
21
src/gdb.ts
21
src/gdb.ts
|
|
@ -83,9 +83,10 @@ class MI2DebugSession extends DebugSession {
|
|||
this.attached = false;
|
||||
this.needContinue = false;
|
||||
this.gdbDebugger.load(args.cwd, args.target).then(() => {
|
||||
args.autorun.forEach(command => {
|
||||
this.gdbDebugger.sendUserInput(command);
|
||||
});
|
||||
if (args.autorun)
|
||||
args.autorun.forEach(command => {
|
||||
this.gdbDebugger.sendUserInput(command);
|
||||
});
|
||||
this.gdbDebugger.start().then(() => {
|
||||
this.sendResponse(response);
|
||||
});
|
||||
|
|
@ -98,17 +99,19 @@ class MI2DebugSession extends DebugSession {
|
|||
this.needContinue = true;
|
||||
if (args.remote) {
|
||||
this.gdbDebugger.connect(args.cwd, args.executable, args.target).then(() => {
|
||||
args.autorun.forEach(command => {
|
||||
this.gdbDebugger.sendUserInput(command);
|
||||
});
|
||||
if (args.autorun)
|
||||
args.autorun.forEach(command => {
|
||||
this.gdbDebugger.sendUserInput(command);
|
||||
});
|
||||
this.sendResponse(response);
|
||||
});
|
||||
}
|
||||
else {
|
||||
this.gdbDebugger.attach(args.cwd, args.executable, args.target).then(() => {
|
||||
args.autorun.forEach(command => {
|
||||
this.gdbDebugger.sendUserInput(command);
|
||||
});
|
||||
if (args.autorun)
|
||||
args.autorun.forEach(command => {
|
||||
this.gdbDebugger.sendUserInput(command);
|
||||
});
|
||||
this.sendResponse(response);
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue