(str: string, usePid?: number)
| 10 | |
| 11 | export let GdbPid = -1; |
| 12 | export function ServerConsoleLog(str: string, usePid?: number) { |
| 13 | if (!str) { return; } |
| 14 | try { |
| 15 | const tmpDirName = os.tmpdir(); |
| 16 | const date = new Date(); |
| 17 | if (usePid) { |
| 18 | GdbPid = usePid; |
| 19 | } |
| 20 | str = `[${date.toISOString()}] ppid=${process.pid} pid=${GdbPid} ` + str; |
| 21 | // console.log(str); |
| 22 | if (true) { |
| 23 | if (!str.endsWith('\n')) { |
| 24 | str += '\n'; |
| 25 | } |
| 26 | fs.appendFileSync(path.join(tmpDirName, 'cortex-debug-server-exiting.log'), str); |
| 27 | } |
| 28 | } |
| 29 | catch (e) { |
| 30 | console.log(e ? e.toString() : 'unknown exception?'); |
| 31 | } |
| 32 | } |
| 33 | |
| 34 | let currentServers: GDBServer[] = []; |
| 35 | export class GDBServer extends EventEmitter { |
no test coverage detected