()
| 1533 | return new Promise<void>((resolve) => { |
| 1534 | const mode: SessionMode = (args === 'reset') ? SessionMode.RESET : SessionMode.RESTART; |
| 1535 | const restartProcessing = () => { |
| 1536 | const commands = []; |
| 1537 | this.args.pvtRestartOrReset = true; |
| 1538 | this.disableSendStoppedEvents = false; |
| 1539 | this.continuing = false; |
| 1540 | |
| 1541 | if (mode === SessionMode.RESTART) { |
| 1542 | commands.push(...this.args.preRestartCommands.map(COMMAND_MAP)); |
| 1543 | const restartCommands = this.args.overrideRestartCommands ? |
| 1544 | this.args.overrideRestartCommands.map(COMMAND_MAP) : this.serverController.restartCommands(); |
| 1545 | commands.push(...restartCommands); |
| 1546 | commands.push(...this.args.postRestartCommands.map(COMMAND_MAP)); |
| 1547 | } else { |
| 1548 | commands.push(...this.args.preResetCommands.map(COMMAND_MAP)); |
| 1549 | const resetCommands = this.args.overrideResetCommands ? this.args.overrideResetCommands.map(COMMAND_MAP) : |
| 1550 | this.args.overrideRestartCommands ? this.args.overrideRestartCommands.map(COMMAND_MAP) : |
| 1551 | this.serverController.restartCommands(); |
| 1552 | commands.push(...resetCommands); |
| 1553 | commands.push(...this.args.postResetCommands.map(COMMAND_MAP)); |
| 1554 | } |
| 1555 | |
| 1556 | let finishCalled = false; |
| 1557 | const callFinish = () => { |
| 1558 | if (!finishCalled) { |
| 1559 | finishCalled = true; |
| 1560 | this.sendDummyStackTrace = false; |
| 1561 | this.finishStartSequence(mode); |
| 1562 | } |
| 1563 | }; |
| 1564 | |
| 1565 | // When we restart/reset, some startup sequences will produce a stopped event and some don't. In case such |
| 1566 | // an event is called, consume and return a dummy stacktrace (prevents unnecessary disassembly, multiple requests from VSCode, etc.) |
| 1567 | this.sendDummyStackTrace = true; // Return dummies until we finish the start sequence |
| 1568 | this.onInternalEvents.once('stack-trace-request', () => { |
| 1569 | callFinish(); |
| 1570 | }); |
| 1571 | |
| 1572 | this.miDebugger.restart(commands).then(async (done) => { |
| 1573 | if (this.args.chainedConfigurations && this.args.chainedConfigurations.enabled) { |
| 1574 | setTimeout(() => { // Maybe this delay should be handled in the front-end |
| 1575 | this.serverConsoleLog(`Begin ${mode} children`); |
| 1576 | this.sendEvent(new GenericCustomEvent(`session-${mode}`, args)); |
| 1577 | }, 250); |
| 1578 | } |
| 1579 | |
| 1580 | if (!finishCalled) { |
| 1581 | // gdb-server never produced any stopped events, so wait a bit to let things settle down |
| 1582 | // Sometimes gdb sends delayed responses for program status (running, stopped, etc.) changes |
| 1583 | await new Promise((resolve) => setTimeout(resolve, 100)); |
| 1584 | callFinish(); |
| 1585 | } |
| 1586 | resolve(); |
| 1587 | }, (msg) => { |
| 1588 | this.sendErrorResponse(response, 6, `Could not restart/reset: ${msg}`); |
| 1589 | resolve(); |
| 1590 | }); |
| 1591 | }; |
| 1592 |
nothing calls this directly
no test coverage detected