Skip to content

Commit 0f59e64

Browse files
committed
V0.4.6
1 parent 149698a commit 0f59e64

File tree

3 files changed

+24
-14
lines changed

3 files changed

+24
-14
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
ChangeLog
22

3+
#V0.4.6
4+
* Bugfix: Issue #493 In the previous release, we were trying to end OpenOCD using a SIGINT first and then SIGTERM. The way VSCode works, this did not work in production releases. Reverting back to the previous method of just using SIGTERM. Unfortunately. Still looking for a better method to end OpenOCD.
5+
36
#V0.4.5
47
* Support for resume/suspend after Launch/Attach. With new UI features added to VSCode, the Stop button (after `Launch`) can now also be used for a Disconnect using keyboard shortcuts. The reverse is true when using an `Attach` type session. But this requires co-operation from the gdb-server to comply. Certain versions of OpenOCD do comply, JLink always seems to resume (see issue $481). Provided the gdb-server cooperates, the expected behavior now when you end a debug session is:
58
* `Stop` will leave the program in a halted state

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "0.4.5",
2+
"version": "0.4.6",
33
"activationEvents": [
44
"onDebugResolve:cortex-debug"
55
],

src/backend/server.ts

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,25 @@
11
import * as ChildProcess from 'child_process';
22
import * as os from 'os';
33
import * as net from 'net';
4+
import * as fs from 'fs';
45
import { EventEmitter } from 'events';
56
import { setTimeout } from 'timers';
6-
import { TcpPortScanner } from '../tcpportscanner';
77

8+
const tmpDirName = os.platform() === 'win32' ? process.env.TEMP || process.env.TMP || '.' : '/tmp';
9+
export function ServerConsoleLog(str: string) {
10+
console.log(str);
11+
try {
12+
if (false) {
13+
if (!str.endsWith('\n')) {
14+
str += '\n';
15+
}
16+
fs.appendFileSync(`${tmpDirName}/cortex-debug-server-exiting-${process.pid}`, str);
17+
}
18+
}
19+
catch (e) {
20+
console.log(e.toString());
21+
}
22+
}
823
export class GDBServer extends EventEmitter {
924
private process: ChildProcess.ChildProcess;
1025
private outBuffer: string = '';
@@ -67,25 +82,17 @@ export class GDBServer extends EventEmitter {
6782
public exit(): void {
6883
if (this.process) {
6984
try {
70-
// Some of gdb-servers want to recieve an Control-C equivalent first, so try that for
71-
// a bit more graceful exit
72-
console.log('GDBServer: requesting an exit with SIGINT');
73-
this.process.kill('SIGINT');
74-
setTimeout(() => {
75-
if (this.process != null) { // Still not dead?
76-
console.log('GDBServer: forcing an exit with kill()');
77-
this.process.kill();
78-
}
79-
}, 100);
85+
ServerConsoleLog('GDBServer: forcing an exit with kill()');
86+
this.process.kill();
8087
}
8188
catch (e) {
82-
console.log(`Tring to force and exit failed ${e}`);
89+
ServerConsoleLog(`Tring to force and exit failed ${e}`);
8390
}
8491
}
8592
}
8693

8794
private onExit(code, signal) {
88-
console.log(`GDBServer: exited ${code} ${signal}`);
95+
ServerConsoleLog(`GDBServer: exited ${code} ${signal}`);
8996
this.process = null;
9097
if (this.exitTimeout) {
9198
clearTimeout(this.exitTimeout);

0 commit comments

Comments
 (0)