(mode: SessionMode)
| 783 | } |
| 784 | |
| 785 | private finishStartSequence(mode: SessionMode): Promise<void> { |
| 786 | return new Promise<void>(async (resolve) => { |
| 787 | try { |
| 788 | if ((mode === SessionMode.ATTACH) || (mode === SessionMode.LAUNCH)) { |
| 789 | const swoRttCommands = this.serverController.swoAndRTTCommands(); |
| 790 | for (const cmd of swoRttCommands) { |
| 791 | await this.miDebugger.sendCommand(cmd); |
| 792 | } |
| 793 | } |
| 794 | } |
| 795 | catch (e) { |
| 796 | const msg = `SWO/RTT Initialization failed: ${e}`; |
| 797 | this.handleMsg('stderr', msg); |
| 798 | this.sendEvent(new GenericCustomEvent('popup', {type: 'error', message: msg})); |
| 799 | } |
| 800 | if (!this.args.noDebug && (mode !== SessionMode.ATTACH) && this.args.runToEntryPoint) { |
| 801 | this.miDebugger.sendCommand(`break-insert -t --function ${this.args.runToEntryPoint}`).then(() => { |
| 802 | this.miDebugger.once('generic-stopped', () => { |
| 803 | resolve(); |
| 804 | }); |
| 805 | this.startCompleteForReset(mode, false); |
| 806 | this.sendContinue(); |
| 807 | }, (err) => { |
| 808 | // If failed to set the temporary breakpoint (e.g. function does not exist) |
| 809 | // complete the launch as if the breakpoint had not being defined |
| 810 | this.handleMsg('log', `launch.json: Unable to set temporary breakpoint "runToEntryPoint":"${this.args.runToEntryPoint}".` + |
| 811 | 'Function may not exist or out of breakpoints? ' + err.toString() + '\n'); |
| 812 | if (mode === SessionMode.LAUNCH) { |
| 813 | this.args.runToEntryPoint = ''; // Don't try again. It will likely to fail |
| 814 | } |
| 815 | this.startComplete(mode); // Call this again to return actual stack trace |
| 816 | resolve(); |
| 817 | }); |
| 818 | } else { |
| 819 | this.runPostStartSessionCommands(mode).then((didContinue) => { |
| 820 | if (!didContinue) { |
| 821 | this.startCompleteForReset(mode, true); |
| 822 | } |
| 823 | resolve(); |
| 824 | }, (e) => { |
| 825 | // Should never happen |
| 826 | console.log(e); |
| 827 | resolve(); |
| 828 | }); |
| 829 | } |
| 830 | }); |
| 831 | } |
| 832 | |
| 833 | private getGdbPath(response: DebugProtocol.LaunchResponse): string { |
| 834 | let gdbExePath = os.platform() !== 'win32' ? `${this.args.toolchainPrefix}-gdb` : `${this.args.toolchainPrefix}-gdb.exe`; |
no test coverage detected