From 15b669a70eaacfa69f3b0b8702a00706f3fab779 Mon Sep 17 00:00:00 2001 From: Haneef Mohammed Date: Thu, 20 Jan 2022 07:50:38 -0800 Subject: [PATCH] Removed Adapter Output --- CHANGELOG.md | 7 +++-- src/backend/server.ts | 56 +++++++++++++++++++++------------------ src/common.ts | 12 --------- src/frontend/extension.ts | 23 ---------------- src/gdb.ts | 7 +---- 5 files changed, 36 insertions(+), 69 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2404f438..72facc6e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,7 +14,8 @@ This is a rather large release. Contains many enhancements, new features and bug * SWO and RTT are now session aware * SVD files: You can have multiple SVD files (one for each session) but hopefully, you only need one as they are slow. But given that we also support multi-session, we do not restrict the number of SVD files. * One can see the relationship of the various items in the chained configurations in the `Call Stack` window. Children are nested (indented) a bit. -* **[Full Disassembly with inline source](https://github.com/Marus/cortex-debug/wiki/Disassembly-Debugging)**: Thanks to a Viewer from Microsoft and our backend+gdb, we now have full disassembly of your entire program (virtual and on demand so it is performant). [See details here](https://github.com/Marus/cortex-debug/wiki/Disassembly-Debugging). Thanks to @hongshui3000 for taking this for a ride and providing valuable feedback. *Note: The old style disassembly of functions without source will be **DEPRECATED*** +* **[Full Disassembly with inline source](https://github.com/Marus/cortex-debug/wiki/Disassembly-Debugging)**: Thanks to a Viewer from Microsoft and our backend+gdb, we now have full disassembly of your entire program (virtual and on demand so it is performant). [See details here](https://github.com/Marus/cortex-debug/wiki/Disassembly-Debugging). Thanks to @hongshui3000 for taking this for a ride and providing valuable feedback. *Note: The old style disassembly of functions without source will be **DEPRECATED***
+*Known issue*: Sometimes you may not see source code when the current instruction is near a bunch of other functions that do not have source. This happens for example if you are stopped in main, and your main is small, and it is surrounded by startup code that does not have source. Not sure why gdb is doing this * **Registers**: `Registers` are now available in the `Variables` panel. You can now change the values of registers. But more importantly, unlike the `Registers` panel, this will track your current thread/frame in the `Call Stack` window. This means that registers are now shown in the context of the current frame. What we had before in the `Registers` panel was information we had at the time a halt/breakpoint was hit and potentially incorrect when you refreshed -- this was because there was no API in VSCode for extensions to track the Call Stack window. **`The old Registers panel will be DEPRECATED`** * **Website changes**: Our github repo always had a [Wiki](https://github.com/Marus/cortex-debug/wiki) but it was pretty weak. Many thanks to @PhilippHaefele for a lot of edits he did over the last couple of months and also helping closing many issues that were already addressed. * **SWO configuration**: SWO was a hit and miss as multi-core devices appeared and device manufacturers were not using the default base addresses for the ARM debug hardware like TPIU, DWT, ITM, etc. We factored this out in a user settable gdb script as well a small TCL file for OpenOCD which needs additional configuration. See https://github.com/Marus/cortex-debug/wiki/SWO-Output#swo-configuration @@ -29,7 +30,9 @@ This is a rather large release. Contains many enhancements, new features and bug * Issue #538: Fixed bug SVD internal debug verification. Not supposed to be for production but got released and caused false errors. This in turn resulted in SVD load failure. * Issue #522: Qemu launch failed because it does not have a matching regular expression that indicated a start. It never does and code to handle that did not work. Fixed. * Issue #539: Using GDB to get some symbol information for locals and globals. Hopefully, gives better performance for large executables. Most information still comes from objdump though. - +# Others +* The `Adapter Output` window in the `OUTPUT` tab is no more. We have had a deprecation notice for months now and have been using the `gdb-server` tab in the `TERMINALS` tab. + # V1.1.10 * Bugfix: Unable to delete instruction breakpoint diff --git a/src/backend/server.ts b/src/backend/server.ts index af4acc51..e1b4f215 100644 --- a/src/backend/server.ts +++ b/src/backend/server.ts @@ -141,39 +141,43 @@ export class GDBServer extends EventEmitter { private onStdout(data) { this.sendToConsole(data); // Send it without any processing or buffering - if (typeof data === 'string') { this.outBuffer += data; } - else { this.outBuffer += data.toString('utf8'); } - - if (this.initResolve && this.initMatch && this.initMatch.test(this.outBuffer)) { - // console.log(`********* Got initmatch on stdout ${Date.now() - this.startTime}ms`); - this.initResolve(true); - this.initResolve = null; - this.initReject = null; - } + if (this.initResolve) { + if (typeof data === 'string') { this.outBuffer += data; } + else { this.outBuffer += data.toString('utf8'); } + + if (this.initResolve && this.initMatch && this.initMatch.test(this.outBuffer)) { + // console.log(`********* Got initmatch on stdout ${Date.now() - this.startTime}ms`); + this.initResolve(true); + this.initResolve = null; + this.initReject = null; + } - const end = this.outBuffer.lastIndexOf('\n'); - if (end !== -1) { - this.emit('output', this.outBuffer.substring(0, end)); - this.outBuffer = this.outBuffer.substring(end + 1); + const end = this.outBuffer.lastIndexOf('\n'); + if (end !== -1) { + // this.emit('output', this.outBuffer.substring(0, end)); + this.outBuffer = this.outBuffer.substring(end + 1); + } } } private onStderr(data) { this.sendToConsole(data); // Send it without any processing or buffering - if (typeof data === 'string') { this.errBuffer += data; } - else { this.errBuffer += data.toString('utf8'); } - - if (this.initResolve && this.initMatch && this.initMatch.test(this.errBuffer)) { - // console.log(`********* Got initmatch on stderr ${Date.now() - this.startTime}ms`); - this.initResolve(true); - this.initResolve = null; - this.initReject = null; - } + if (this.initResolve) { + if (typeof data === 'string') { this.errBuffer += data; } + else { this.errBuffer += data.toString('utf8'); } + + if (this.initResolve && this.initMatch && this.initMatch.test(this.errBuffer)) { + // console.log(`********* Got initmatch on stderr ${Date.now() - this.startTime}ms`); + this.initResolve(true); + this.initResolve = null; + this.initReject = null; + } - const end = this.errBuffer.lastIndexOf('\n'); - if (end !== -1) { - this.emit('output', this.errBuffer.substring(0, end)); - this.errBuffer = this.errBuffer.substring(end + 1); + const end = this.errBuffer.lastIndexOf('\n'); + if (end !== -1) { + // this.emit('output', this.errBuffer.substring(0, end)); + this.errBuffer = this.errBuffer.substring(end + 1); + } } } diff --git a/src/common.ts b/src/common.ts index 31bbf531..c5ba2fc3 100644 --- a/src/common.ts +++ b/src/common.ts @@ -38,18 +38,6 @@ export class GenericCustomEvent extends Event implements DebugProtocol.Event { } } -export class AdapterOutputEvent extends Event implements DebugProtocol.Event { - public body: { - type: string, - content: string - }; - public event: string; - - constructor(content: string, type: string) { - super('adapter-output', { content: content, type: type }); - } -} - export class StoppedEvent extends Event implements DebugProtocol.Event { public readonly body: { reason: string; diff --git a/src/frontend/extension.ts b/src/frontend/extension.ts index 4ce69bfb..0c8c1ff7 100644 --- a/src/frontend/extension.ts +++ b/src/frontend/extension.ts @@ -32,8 +32,6 @@ interface SVDInfo { } export class CortexDebugExtension { - private adapterOutputChannel: vscode.OutputChannel = null; - private clearAdapterOutputChannel = false; private rttTerminals: RTTTerminal[] = []; private gdbServerConsole: GDBServerConsole = null; @@ -605,8 +603,6 @@ export class CortexDebugExtension { } mySession.rttPortMap = {}; } - - this.clearAdapterOutputChannel = true; } catch (e) { vscode.window.showInformationMessage(`Debug session did not terminate cleanly ${e}\n${e ? e.stackstrace : ''}. Please report this problem`); @@ -632,9 +628,6 @@ export class CortexDebugExtension { case 'rtt-configure': this.receivedRTTConfigureEvent(e); break; - case 'adapter-output': - this.receivedAdapterOutput(e); - break; case 'record-event': this.receivedEvent(e); break; @@ -935,22 +928,6 @@ export class CortexDebugExtension { this.rttTerminals = this.rttTerminals.filter((t) => t.terminal !== terminal); } - private receivedAdapterOutput(e) { - let output = e.body.content; - if (!output.endsWith('\n')) { output += '\n'; } - if (!this.adapterOutputChannel) { - this.adapterOutputChannel = vscode.window.createOutputChannel('Adapter Output'); - this.adapterOutputChannel.appendLine('DEPRECATED: Please check the \'TERMINALS\' tab for \'gdb-server\' output. ' + - 'This \'Adapter Output\' will not appear in future releases'); - // this.adapterOutputChannel.show(); - } else if (this.clearAdapterOutputChannel) { - this.adapterOutputChannel.clear(); - } - this.clearAdapterOutputChannel = false; - - this.adapterOutputChannel.append(output); - } - private initializeSWO(session: vscode.DebugSession, args) { const mySession = CDebugSession.FindSession(session); if (!mySession.swoSource) { diff --git a/src/gdb.ts b/src/gdb.ts index b41f4407..430e9e2d 100755 --- a/src/gdb.ts +++ b/src/gdb.ts @@ -9,7 +9,7 @@ import { extractBits, hexFormat } from './frontend/utils'; import { Variable, VariableObject, MIError, OurDataBreakpoint, OurInstructionBreakpoint, OurSourceBreakpoint } from './backend/backend'; import { TelemetryEvent, ConfigurationArguments, StoppedEvent, GDBServerController, - AdapterOutputEvent, DisassemblyInstruction, createPortName, GenericCustomEvent, quoteShellCmdLine, toStringDecHexOctBin, ADAPTER_DEBUG_MODE + createPortName, GenericCustomEvent, quoteShellCmdLine, toStringDecHexOctBin, ADAPTER_DEBUG_MODE } from './common'; import { GDBServer, ServerConsoleLog } from './backend/server'; import { MINode } from './backend/mi_parse'; @@ -403,7 +403,6 @@ export class GDBDebugSession extends DebugSession { } } this.server = new GDBServer(this.args.cwd, executable, args, initMatch, gdbPort, consolePort); - this.server.on('output', this.handleAdapterOutput.bind(this)); this.server.on('quit', () => { if (this.started) { this.quitEvent(); @@ -1211,10 +1210,6 @@ export class GDBDebugSession extends DebugSession { } } - protected handleAdapterOutput(output) { - this.sendEvent(new AdapterOutputEvent(output, 'out')); - } - private serverControllerEvent(event: DebugProtocol.Event) { this.sendEvent(event); }