Skip to content

Commit

Permalink
Removed Adapter Output
Browse files Browse the repository at this point in the history
  • Loading branch information
haneefdm committed Jan 20, 2022
1 parent 226ff9e commit 15b669a
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 69 deletions.
7 changes: 5 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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***<br>
*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
Expand All @@ -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

Expand Down
56 changes: 30 additions & 26 deletions src/backend/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}

Expand Down
12 changes: 0 additions & 12 deletions src/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
23 changes: 0 additions & 23 deletions src/frontend/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ interface SVDInfo {
}

export class CortexDebugExtension {
private adapterOutputChannel: vscode.OutputChannel = null;
private clearAdapterOutputChannel = false;
private rttTerminals: RTTTerminal[] = [];

private gdbServerConsole: GDBServerConsole = null;
Expand Down Expand Up @@ -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`);
Expand All @@ -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;
Expand Down Expand Up @@ -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) {
Expand Down
7 changes: 1 addition & 6 deletions src/gdb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit 15b669a

Please sign in to comment.