Skip to content

Commit ab63026

Browse files
committed
JLink RTT with no decoders support
1 parent 74cdeb1 commit ab63026

File tree

3 files changed

+15
-8
lines changed

3 files changed

+15
-8
lines changed

src/backend/mi2/mi2.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,6 @@ export class MI2 extends EventEmitter implements IBackend {
259259
this.log('stderr', 'stop');
260260
}
261261
if (!this.exited) {
262-
const proc = this.process;
263262
const to = setTimeout(() => { this.tryKill(); }, 500);
264263
this.process.on('exit', (code) => { clearTimeout(to); });
265264
// Disconnect first. Not doing so and exiting will cause an unwanted detach if the

src/backend/server.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,17 +67,19 @@ export class GDBServer extends EventEmitter {
6767
public exit(): void {
6868
if (this.process) {
6969
try {
70-
console.log('GDBServer: forcing an exit with SIGNINT');
71-
// A log of gdb-servers want to recieve an Control-C equivalent first, so try that for
70+
console.log('GDBServer: requesting an exit with SIGNINT');
71+
// Some of gdb-servers want to recieve an Control-C equivalent first, so try that for
7272
// a bit more graceful exit
73+
this.process.once('SIGINT', () => {
74+
console.log('Server got SIGINT');
75+
})
7376
this.process.kill('SIGINT');
7477
setTimeout(() => {
75-
if (process != null) { // Still not dead?
76-
console.log('GDBServer: forcing an exit with SIGTERM');
78+
if (this.process != null) { // Still not dead?
79+
console.log('GDBServer: forcing an exit with kill()');
7780
this.process.kill();
7881
}
79-
this.process = null;
80-
} , 1000);
82+
}, 100);
8183
}
8284
catch (e) {
8385
console.log(`Tring to force and exit failed ${e}`);

src/jlink.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,13 @@ export class JLinkServerController extends EventEmitter implements GDBServerCont
165165
// If we are getting here, we will need some serious re-factoring
166166
throw new Error('Asynchronous timing error. Could not allocate all the ports needed in time.');
167167
}
168-
cmdargs.push('-rtttelnetport', this.rttHelper.rttLocalPortMap[0] || this.defaultRttPort.toString());
168+
const keys = Object.keys(this.rttHelper.rttLocalPortMap);
169+
let tcpPort = this.defaultRttPort.toString();
170+
if (keys && (keys.length > 0)) {
171+
// We only support one port because JLink gdb-server only supports one port
172+
tcpPort = this.rttHelper.rttLocalPortMap[keys[0]];
173+
}
174+
cmdargs.push('-rtttelnetport', tcpPort);
169175
}
170176

171177
if (this.args.serialNumber) {

0 commit comments

Comments
 (0)