Skip to content

Commit 38ab959

Browse files
committed
Updated code to current version
1 parent 2ffca88 commit 38ab959

File tree

4 files changed

+39
-43
lines changed

4 files changed

+39
-43
lines changed

arduino-debugger-extension/src/browser/arduino-debug-frontend-application-contribution.ts

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
1-
import { injectable } from "inversify";
1+
import { injectable, inject } from 'inversify';
2+
import { MenuModelRegistry } from '@theia/core';
3+
import { KeybindingRegistry } from '@theia/core/lib/browser';
4+
import { TabBarToolbarRegistry } from '@theia/core/lib/browser/shell/tab-bar-toolbar';
25
import { DebugFrontendApplicationContribution } from '@theia/debug/lib/browser/debug-frontend-application-contribution';
36
import { DebugSessionOptions } from "@theia/debug/lib/browser/debug-session-options";
7+
import { EditorMode } from "arduino-ide-extension/lib/browser/editor-mode";
48

59
@injectable()
610
export class ArduinoDebugFrontendApplicationContribution extends DebugFrontendApplicationContribution {
711

12+
@inject(EditorMode)
13+
protected readonly editorMode: EditorMode;
14+
815
async start(noDebug?: boolean, debugSessionOptions?: DebugSessionOptions): Promise<void> {
916
let current = debugSessionOptions ? debugSessionOptions : this.configurations.current;
1017
// If no configurations are currently present, create the `launch.json` and prompt users to select the config.
@@ -27,4 +34,25 @@ export class ArduinoDebugFrontendApplicationContribution extends DebugFrontendAp
2734
}
2835
}
2936

30-
}
37+
initializeLayout(): Promise<void> {
38+
if (this.editorMode.proMode)
39+
return super.initializeLayout();
40+
return Promise.resolve();
41+
}
42+
43+
registerMenus(menus: MenuModelRegistry): void {
44+
if (this.editorMode.proMode)
45+
super.registerMenus(menus);
46+
}
47+
48+
registerKeybindings(keybindings: KeybindingRegistry): void {
49+
if (this.editorMode.proMode)
50+
super.registerKeybindings(keybindings);
51+
}
52+
53+
registerToolbarItems(toolbar: TabBarToolbarRegistry): void {
54+
if (this.editorMode.proMode)
55+
super.registerToolbarItems(toolbar);
56+
}
57+
58+
}
Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,14 @@
11
import { ContainerModule } from 'inversify';
22
import { VariableContribution } from '@theia/variable-resolver/lib/browser';
33
import { ArduinoVariableResolver } from './arduino-variable-resolver';
4-
import { ArduinoAdvancedMode } from 'arduino-ide-extension/lib/browser/arduino-frontend-contribution';
54
import { DebugFrontendApplicationContribution } from '@theia/debug/lib/browser/debug-frontend-application-contribution';
6-
import { SilentDebugFrontendApplicationContribution } from './silent-debug-frontend-application-contribution';
75
import { DebugConfigurationManager } from '@theia/debug/lib/browser/debug-configuration-manager';
86
import { ArduinoDebugConfigurationManager } from './arduino-debug-configuration-manager';
97
import { ArduinoDebugFrontendApplicationContribution } from './arduino-debug-frontend-application-contribution';
108

119
export default new ContainerModule((bind, unbind, isBound, rebind) => {
1210
bind(ArduinoVariableResolver).toSelf().inSingletonScope();
1311
bind(VariableContribution).toService(ArduinoVariableResolver);
14-
15-
if (!ArduinoAdvancedMode.TOGGLED) {
16-
unbind(DebugFrontendApplicationContribution);
17-
bind(DebugFrontendApplicationContribution).to(SilentDebugFrontendApplicationContribution);
18-
} else {
19-
unbind(DebugConfigurationManager);
20-
bind(DebugConfigurationManager).to(ArduinoDebugConfigurationManager).inSingletonScope();
21-
unbind(DebugFrontendApplicationContribution);
22-
bind(DebugFrontendApplicationContribution).to(ArduinoDebugFrontendApplicationContribution);
23-
}
12+
rebind(DebugConfigurationManager).to(ArduinoDebugConfigurationManager).inSingletonScope();
13+
rebind(DebugFrontendApplicationContribution).to(ArduinoDebugFrontendApplicationContribution);
2414
});

arduino-debugger-extension/src/browser/silent-debug-frontend-application-contribution.ts

Lines changed: 0 additions & 25 deletions
This file was deleted.

arduino-debugger-extension/src/node/debug-adapter/cmsis-debug-session.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ import { CmsisBackend } from './cmsis-backend';
3232
// import { PyocdServer } from './pyocd-server';
3333
import { PortScanner } from './port-scanner';
3434
import { SymbolTable } from './symbols';
35-
import * as varMgr from 'cdt-gdb-adapter/dist/varManager';
35+
import { VarManager } from 'cdt-gdb-adapter/dist/varManager';
3636
import * as mi from './mi';
3737
import { OpenocdServer } from './openocd-server';
3838

@@ -54,13 +54,16 @@ export class CmsisDebugSession extends GDBDebugSession {
5454
protected portScanner = new PortScanner();
5555
protected symbolTable!: SymbolTable;
5656
protected globalHandle!: number;
57+
protected varMgr: VarManager;
5758

5859
constructor() {
5960
super();
6061
}
6162

6263
protected createBackend(): GDBBackend {
63-
return new CmsisBackend();
64+
const gdb = new CmsisBackend();
65+
this.varMgr = new VarManager(gdb);
66+
return gdb;
6467
}
6568

6669
protected async launchRequest(response: DebugProtocol.LaunchResponse, args: CmsisRequestArguments): Promise<void> {
@@ -334,7 +337,7 @@ export class CmsisDebugSession extends GDBDebugSession {
334337
}
335338

336339
private async getVariables(frame: FrameReference, name: string, expression: string, depth: number): Promise<DebugProtocol.Variable> {
337-
let global = varMgr.getVar(frame.frameId, frame.threadId, depth, name);
340+
let global = this.varMgr.getVar(frame.frameId, frame.threadId, depth, name);
338341

339342
if (global) {
340343
// Update value if it is already loaded
@@ -351,7 +354,7 @@ export class CmsisDebugSession extends GDBDebugSession {
351354
expression,
352355
});
353356

354-
global = varMgr.addVar(frame.frameId, frame.threadId, depth, name, true, false, varCreateResponse);
357+
global = this.varMgr.addVar(frame.frameId, frame.threadId, depth, name, true, false, varCreateResponse);
355358
}
356359

357360
return {

0 commit comments

Comments
 (0)