| 6 | import * as ChildProcess from 'child_process'; |
| 7 | |
| 8 | export class ExternalServerController extends EventEmitter implements GDBServerController { |
| 9 | public readonly name: string = 'External'; |
| 10 | public readonly portsNeeded: string[] = []; |
| 11 | private swoPath: string; |
| 12 | |
| 13 | private args: ConfigurationArguments; |
| 14 | private ports: { [name: string]: number }; |
| 15 | |
| 16 | constructor() { |
| 17 | super(); |
| 18 | this.swoPath = tmp.tmpNameSync(); |
| 19 | } |
| 20 | |
| 21 | public setPorts(ports: { [name: string]: number }): void { |
| 22 | this.ports = ports; |
| 23 | } |
| 24 | |
| 25 | public setArguments(args: ConfigurationArguments): void { |
| 26 | this.args = args; |
| 27 | if (this.args.swoConfig.enabled) { |
| 28 | if (os.platform() === 'win32') { |
| 29 | this.swoPath = this.swoPath.replace(/\\/g, '/'); |
| 30 | } |
| 31 | } |
| 32 | } |
| 33 | |
| 34 | public customRequest(command: string, response: DebugProtocol.Response, args: any): boolean { |
| 35 | return false; |
| 36 | } |
| 37 | |
| 38 | public initCommands(): string[] { |
| 39 | const target = this.args.gdbTarget; |
| 40 | return [ |
| 41 | `target-select extended-remote ${target}` |
| 42 | ]; |
| 43 | } |
| 44 | |
| 45 | public launchCommands(): string[] { |
| 46 | const commands = [ |
| 47 | ...genDownloadCommands(this.args, ['interpreter-exec console "monitor reset halt"']), |
| 48 | 'interpreter-exec console "monitor reset halt"' |
| 49 | ]; |
| 50 | |
| 51 | return commands; |
| 52 | } |
| 53 | |
| 54 | public attachCommands(): string[] { |
| 55 | const commands = [ |
| 56 | 'interpreter-exec console "monitor halt"' |
| 57 | ]; |
| 58 | |
| 59 | return commands; |
| 60 | } |
| 61 | |
| 62 | public swoAndRTTCommands(): string[] { |
| 63 | return []; |
| 64 | } |
| 65 |
nothing calls this directly
no outgoing calls
no test coverage detected