MCPcopy Create free account
hub / github.com/Marus/cortex-debug / startServer

Method startServer

src/frontend/server_console.ts:209–228  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

207 // from the gdb-server (like OpenOCD) is sent here and sent to the terminal
208 // and any usr input in the terminal is sent back (like semi-hosting)
209 public startServer(): Promise<void> {
210 return new Promise((resolve, reject) => {
211 getAnyFreePort(55878).then((p) => {
212 this.toBackendPort = p;
213 const newServer = net.createServer(this.onBackendConnect.bind(this));
214 newServer.listen(this.toBackendPort, '127.0.0.1', () => {
215 this.toBackendServer = newServer;
216 GDBServerConsole.BackendPort = this.toBackendPort;
217 resolve();
218 });
219 newServer.on(('error'), (e) => {
220 console.error(e);
221 reject(e);
222 });
223 newServer.on('close', () => {
224 this.toBackendServer = null;
225 });
226 });
227 });
228 }
229
230 // The gdb-server running in the backend (debug adapter)
231 protected onBackendConnect(socket: net.Socket) {

Callers 1

startServerConsoleMethod · 0.45

Calls 1

getAnyFreePortFunction · 0.90

Tested by

no test coverage detected