From 3b26d728489965102b5494197849e5d12cae0640 Mon Sep 17 00:00:00 2001 From: Haneef Mohammed Date: Thu, 30 Sep 2021 08:16:45 -0700 Subject: [PATCH] 0.4.7-pre3 --- CHANGELOG.md | 2 ++ package.json | 2 +- src/frontend/swo/decoders/console.ts | 31 +++++++++++----------------- 3 files changed, 15 insertions(+), 20 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a5a4c004..3d14f12b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,8 @@ ChangeLog #V0.4.7 * Fixed a regression for STLink gdbserver. It was in fact accidentally working in prior releases. The real bug is now fixed * We may have **finally** found a way to exit OpenOCD without having to kill it and OpenOCD not hanging around after the session ends. This is of course dependent on OpenOCD behaving as documented. Thanks to #482 and @bohdan-tymkiv for a solution +* Timestamps for RTT and SWO have been standardized to be of the form `[ISO-Date-Time, +NNNNNNms]` where the first part is the date/time of day and the NNNNNNms is the number of milliseconds elapsed since the debug session began. +* `timestamp` is now an option for SWO console decoders. Default is `false`. A timestamp is output only when a newline is received or a timeout of 5 seconds #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. diff --git a/package.json b/package.json index 12cefc51..58a38598 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "version": "0.4.7-pre2", + "version": "0.4.7-pre3", "activationEvents": [ "onDebugResolve:cortex-debug" ], diff --git a/src/frontend/swo/decoders/console.ts b/src/frontend/swo/decoders/console.ts index efc1c43d..9da8d5ad 100644 --- a/src/frontend/swo/decoders/console.ts +++ b/src/frontend/swo/decoders/console.ts @@ -76,12 +76,14 @@ export class SWOConsoleProcessor implements SWORTTDecoder { } private pushOutput(str: string) { - if (this.useTerminal) { - if (this.ptyTerm) { - this.ptyTerm.write(str); + if (str) { + if (this.useTerminal) { + if (this.ptyTerm) { + this.ptyTerm.write(str); + } + } else { + this.output.append(str); } - } else { - this.output.append(str); } } @@ -98,21 +100,13 @@ export class SWOConsoleProcessor implements SWORTTDecoder { const letters = packet.data.toString(this.encoding); - if (this.useTerminal) { - if (this.ptyTerm) { - this.ptyTerm.writeWithHeader(letters, this.createDateHeaderUs()); - } - return; - } - - // Following stuff will be deprecated soon for (const letter of letters) { if (this.timeout) { clearTimeout(this.timeout); this.timeout = null; } if (letter === '\n') { this.pushOutput('\n'); this.position = 0; - return; + continue; } if (this.position === 0) { @@ -122,11 +116,10 @@ export class SWOConsoleProcessor implements SWORTTDecoder { this.pushOutput(letter); this.position += 1; - if (this.position >= 80) { - this.pushOutput('\n'); - this.position = 0; - } - else { + if (this.timestamp && (this.position > 0)) { + if (this.timeout) { + clearTimeout(this.timeout) + } this.timeout = setTimeout(() => { this.pushOutput('\n'); this.position = 0;