Skip to content

Commit

Permalink
V0.4.6
Browse files Browse the repository at this point in the history
  • Loading branch information
haneefdm committed Sep 28, 2021
1 parent 149698a commit 0f59e64
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 14 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
ChangeLog

#V0.4.6
* 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.

#V0.4.5
* 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:
* `Stop` will leave the program in a halted state
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "0.4.5",
"version": "0.4.6",
"activationEvents": [
"onDebugResolve:cortex-debug"
],
Expand Down
33 changes: 20 additions & 13 deletions src/backend/server.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,25 @@
import * as ChildProcess from 'child_process';
import * as os from 'os';
import * as net from 'net';
import * as fs from 'fs';
import { EventEmitter } from 'events';
import { setTimeout } from 'timers';
import { TcpPortScanner } from '../tcpportscanner';

const tmpDirName = os.platform() === 'win32' ? process.env.TEMP || process.env.TMP || '.' : '/tmp';
export function ServerConsoleLog(str: string) {
console.log(str);
try {
if (false) {
if (!str.endsWith('\n')) {
str += '\n';
}
fs.appendFileSync(`${tmpDirName}/cortex-debug-server-exiting-${process.pid}`, str);
}
}
catch (e) {
console.log(e.toString());
}
}
export class GDBServer extends EventEmitter {
private process: ChildProcess.ChildProcess;
private outBuffer: string = '';
Expand Down Expand Up @@ -67,25 +82,17 @@ export class GDBServer extends EventEmitter {
public exit(): void {
if (this.process) {
try {
// Some of gdb-servers want to recieve an Control-C equivalent first, so try that for
// a bit more graceful exit
console.log('GDBServer: requesting an exit with SIGINT');
this.process.kill('SIGINT');
setTimeout(() => {
if (this.process != null) { // Still not dead?
console.log('GDBServer: forcing an exit with kill()');
this.process.kill();
}
}, 100);
ServerConsoleLog('GDBServer: forcing an exit with kill()');
this.process.kill();
}
catch (e) {
console.log(`Tring to force and exit failed ${e}`);
ServerConsoleLog(`Tring to force and exit failed ${e}`);
}
}
}

private onExit(code, signal) {
console.log(`GDBServer: exited ${code} ${signal}`);
ServerConsoleLog(`GDBServer: exited ${code} ${signal}`);
this.process = null;
if (this.exitTimeout) {
clearTimeout(this.exitTimeout);
Expand Down

0 comments on commit 0f59e64

Please sign in to comment.