(mode: SessionMode, interval: number = 100)
| 980 | // Runs a set of commands after a quiet time and is no other gdb transactions are happening |
| 981 | // Returning 'true' means the execution is going to continue |
| 982 | protected runPostStartSessionCommands(mode: SessionMode, interval: number = 100): Promise<boolean> { |
| 983 | let commands: string[] = []; |
| 984 | let shouldContinue = false; |
| 985 | switch (mode) { |
| 986 | case SessionMode.RESTART: |
| 987 | commands = this.args.postRestartSessionCommands || []; |
| 988 | break; |
| 989 | case SessionMode.RESET: |
| 990 | commands = this.args.postRestartSessionCommands || []; |
| 991 | break; |
| 992 | default: |
| 993 | commands = this.args.postStartSessionCommands || []; |
| 994 | break; |
| 995 | } |
| 996 | |
| 997 | if ((mode !== SessionMode.ATTACH) && this.args.noDebug) { |
| 998 | shouldContinue = true; |
| 999 | } else if (!this.args.breakAfterReset && (mode !== SessionMode.ATTACH) && (commands.length === 0)) { |
| 1000 | shouldContinue = true; |
| 1001 | } |
| 1002 | |
| 1003 | return new Promise<boolean>((resolve, reject) => { |
| 1004 | const doResolve = async () => { |
| 1005 | if (this.args.noDebug || (shouldContinue && this.isMIStatusStopped())) { |
| 1006 | if ((mode === SessionMode.RESET) || (mode === SessionMode.RESTART)) { |
| 1007 | this.sendDummyStackTrace = true; |
| 1008 | this.onInternalEvents.once('stack-trace-request', () => { |
| 1009 | this.sendDummyStackTrace = false; |
| 1010 | this.sendContinue(); |
| 1011 | }); |
| 1012 | this.startComplete(mode); |
| 1013 | } else { |
| 1014 | this.sendContinue(); |
| 1015 | } |
| 1016 | resolve(true); |
| 1017 | } else { |
| 1018 | resolve(!this.isMIStatusStopped()); |
| 1019 | } |
| 1020 | }; |
| 1021 | if ((commands.length > 0) || shouldContinue) { |
| 1022 | commands = commands.map(COMMAND_MAP); |
| 1023 | this.miDebugger.postStart(commands).then(() => { |
| 1024 | doResolve(); |
| 1025 | }, (e) => { |
| 1026 | const msg = `Error running post start/restart/reset commands ${e}`; |
| 1027 | this.sendEvent(new GenericCustomEvent('popup', {type: 'error', message: msg})); |
| 1028 | doResolve(); |
| 1029 | }); |
| 1030 | } else { |
| 1031 | resolve(false); |
| 1032 | } |
| 1033 | }); |
| 1034 | } |
| 1035 | |
| 1036 | public serverConsoleLog(msg: string) { |
| 1037 | const pid = this.miDebugger && this.miDebugger.pid > 0 ? this.miDebugger.pid : process.pid; |
no test coverage detected