From 1bc996d8d8fd733a107a225283b370d0b456cc56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Sp=C3=B6nemann?= Date: Mon, 24 Feb 2020 15:26:35 +0100 Subject: [PATCH] Updated to CLI version 0.9.0-rc2 --- .../debug-adapter/arduino-debug-session.ts | 2 +- .../debug-adapter/arduino-variable-handler.ts | 44 +++++++++---------- arduino-ide-extension/scripts/download-cli.js | 2 +- 3 files changed, 24 insertions(+), 24 deletions(-) diff --git a/arduino-debugger-extension/src/node/debug-adapter/arduino-debug-session.ts b/arduino-debugger-extension/src/node/debug-adapter/arduino-debug-session.ts index ef69bf67..1b2f6683 100644 --- a/arduino-debugger-extension/src/node/debug-adapter/arduino-debug-session.ts +++ b/arduino-debugger-extension/src/node/debug-adapter/arduino-debug-session.ts @@ -91,7 +91,7 @@ export class ArduinoDebugSession extends GDBDebugSession { // new Scope('Pins', this.variableHandles.create(pins), false), new Scope('Local', this.variableHandles.create(frame), false), new Scope('Global', GLOBAL_HANDLE_ID, false), - new Scope('Static', STATIC_HANDLES_START + parseInt(args.frameId as any, 10), false) + // new Scope('Static', STATIC_HANDLES_START + parseInt(args.frameId as any, 10), false) ], }; diff --git a/arduino-debugger-extension/src/node/debug-adapter/arduino-variable-handler.ts b/arduino-debugger-extension/src/node/debug-adapter/arduino-variable-handler.ts index c3705f95..db3c7590 100644 --- a/arduino-debugger-extension/src/node/debug-adapter/arduino-variable-handler.ts +++ b/arduino-debugger-extension/src/node/debug-adapter/arduino-variable-handler.ts @@ -44,6 +44,28 @@ export class ArduinoVariableHandler { return variables; } + /** TODO */ + async getStaticVariables(frameHandle: number): Promise { + throw new Error('Static variables are not supported yet.'); + const frame = this.frameHandles.get(frameHandle); + const result = await this.gdb.sendStackInfoFrame(this.gdb, frame.threadId, frame.frameId); + const file = path.normalize(result.frame.file || ''); + const symbolInfo: any[] = [] // this.symbolTable.getStaticVariables(file); + const variables: DebugProtocol.Variable[] = []; + + // Fetch stack depth to obtain frameId/threadId/depth tuple + const stackDepth = await mi.sendStackInfoDepth(this.gdb, { maxDepth: 100 }); + const depth = parseInt(stackDepth.depth, 10); + + for (const symbol of symbolInfo) { + const name = `${file}_static_var_${symbol.name}`; + const variable = await this.getVariables(frame, name, symbol.name, depth); + variables.push(variable); + } + + return variables; + } + private async getVariables(frame: FrameReference, name: string, expression: string, depth: number): Promise { let global = this.varMgr.getVar(frame.frameId, frame.threadId, depth, name); @@ -79,28 +101,6 @@ export class ArduinoVariableHandler { }; } - /** TODO */ - async getStaticVariables(frameHandle: number): Promise { - throw new Error('Static variables are not supported yet.'); - const frame = this.frameHandles.get(frameHandle); - const result = await this.gdb.sendStackInfoFrame(this.gdb, frame.threadId, frame.frameId); - const file = path.normalize(result.frame.file || ''); - const symbolInfo: any[] = [] // this.symbolTable.getStaticVariables(file); - const variables: DebugProtocol.Variable[] = []; - - // Fetch stack depth to obtain frameId/threadId/depth tuple - const stackDepth = await mi.sendStackInfoDepth(this.gdb, { maxDepth: 100 }); - const depth = parseInt(stackDepth.depth, 10); - - for (const symbol of symbolInfo) { - const name = `${file}_static_var_${symbol.name}`; - const variable = await this.getVariables(frame, name, symbol.name, depth); - variables.push(variable); - } - - return variables; - } - async handlePinStatusRequest(): Promise { const variables: DebugProtocol.Variable[] = []; variables.push({ diff --git a/arduino-ide-extension/scripts/download-cli.js b/arduino-ide-extension/scripts/download-cli.js index 79ac7cfa..7009a077 100755 --- a/arduino-ide-extension/scripts/download-cli.js +++ b/arduino-ide-extension/scripts/download-cli.js @@ -10,7 +10,7 @@ (() => { - const DEFAULT_VERSION = '0.7.1'; // require('moment')().format('YYYYMMDD'); + const DEFAULT_VERSION = '0.9.0-rc2'; // require('moment')().format('YYYYMMDD'); const path = require('path'); const shell = require('shelljs');