From 73788e47e474ef139fdada60195d9d0d73b4257c Mon Sep 17 00:00:00 2001 From: JackN Date: Thu, 7 Apr 2022 13:45:56 -0400 Subject: [PATCH 1/2] Add SVD and prep for multi-core. --- package.json | 419 +++++++++++++++++++++++++---------------- src/debugProtocol.json | 23 +-- src/extension.ts | 91 +++++---- 3 files changed, 312 insertions(+), 221 deletions(-) diff --git a/package.json b/package.json index 9aeec1e..80ad693 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "probe-rs-debugger", "displayName": "Debugger for probe-rs", - "version": "0.3.6", + "version": "0.4.0", "publisher": "probe-rs", "description": "probe-rs Debug Adapter for VS Code.", "author": { @@ -13,7 +13,7 @@ "probe-rs embedded debug" ], "engines": { - "vscode": "^1.65.0" + "vscode": "^1.66.0" }, "icon": "images/probe-rs-debugger.png", "categories": [ @@ -45,26 +45,26 @@ }, "enabledApiProposals": [], "dependencies": { - "@vscode/debugadapter": "^1.54.0", + "@vscode/debugadapter": "^1.55.1", "await-notify": "1.0.1", "portfinder": "^1.0.28" }, "devDependencies": { "@types/glob": "^7.2.0", "@types/mocha": "^9.1.0", - "@types/node": "^17.0.21", - "@types/vscode": "^1.65.0", - "@typescript-eslint/eslint-plugin": "^5.13.0", - "@typescript-eslint/parser": "^5.13.0", - "@vscode/debugprotocol": "^1.54.0", - "eslint": "^8.10.0", + "@types/node": "^17.0.23", + "@types/vscode": "^1.66.0", + "@typescript-eslint/eslint-plugin": "^5.18.0", + "@typescript-eslint/parser": "^5.18.0", + "@vscode/debugprotocol": "^1.55.1", + "eslint": "^8.12.0", "glob": "^7.2.0", - "mocha": "^9.2.1", + "mocha": "^9.2.2", "portfinder": "^1.0.28", - "ts-loader": "^9.2.7", - "typescript": "^4.6.2", - "vsce": "^2.6.5", - "webpack": "^5.70.0", + "ts-loader": "^9.2.8", + "typescript": "^4.6.3", + "vsce": "^2.7.0", + "webpack": "^5.72.0", "webpack-cli": "^4.9.2" }, "main": "./dist/ext/extension.js", @@ -91,8 +91,8 @@ "configurationAttributes": { "launch": { "required": [ - "programBinary", - "chip" + "chip", + "coreConfigs" ], "properties": { "server": { @@ -100,28 +100,17 @@ "description": "Optionally onnect to an existing `probe-rs-debugger` session on IP and Port, e.g. '127.0.0.1:50000'", "default": "127.0.0.1:50000" }, - "programBinary": { - "type": "string", - "description": "The path (relative to `cwd` or absolute) to the binary for your target firmware", - "default": "./target/thumbv7em-none-eabihf/debug/${workspaceFolderBasename}" - }, - "cwd": { - "type": "string", - "description": "The working directory of the debugger, typically the RUST crate root", - "default": "${workspaceFolder}" - }, - "chip": { - "type": "string", - "description": "Please specify the appropriate chip from the list of supported chips reported by running `probe-rs-debugger list-chips`." - }, - "coreIndex": { - "type": "number", - "description": "The zero based index of the MCU core for this session", - "default": 0 - }, - "probe": { + "consoleLogLevel": { "type": "string", - "description": "Use this flag to select a specific probe in the list. Use '--probe VID:PID' or '--probe VID:PID:Serial' if you have more than one probe with the same VID:PID." + "description": "The level of log info printed to the console. This also sets the RUST_LOG environment variable wherever possible.", + "enum": [ + "Error", + "Warn", + "Info", + "Debug", + "Trace" + ], + "default": "Error" }, "runtimeExecutable": { "type": "string", @@ -139,91 +128,125 @@ "--dap" ] }, - "speed": { - "type": "number", - "description": "Specify the protocol speed in kHz." + "cwd": { + "type": "string", + "description": "The working directory of the debugger, typically the RUST crate root", + "default": "${workspaceFolder}" }, - "wireProtocol": { + "probe": { "type": "string", - "description": "The correct wire Protocol to use.", - "enum": [ - "Swd", - "Jtag" - ] + "description": "Use this flag to select a specific probe in the list. Use '--probe VID:PID' or '--probe VID:PID:Serial' if you have more than one probe with the same VID:PID." }, - "consoleLogLevel": { + "chip": { "type": "string", - "description": "The level of log info printed to the console. This also sets the RUST_LOG environment variable wherever possible.", - "enum": [ - "Error", - "Warn", - "Info", - "Debug", - "Trace" - ], - "default": "Error" + "description": "Please specify the appropriate chip from the list of supported chips reported by running `probe-rs-debugger list-chips`." }, "connectUnderReset": { "type": "boolean", "description": "This option will result in the target reset pin being held high during the attach operation.", "default": false }, - "flashingEnabled": { - "type": "boolean", - "description": "Flash the target before debugging.", - "default": true + "speed": { + "type": "number", + "description": "Specify the protocol speed in kHz." }, - "resetAfterFlashing": { - "type": "boolean", - "description": "Reset the target after flashing.", - "default": true + "wireProtocol": { + "type": "string", + "description": "The correct wire Protocol to use.", + "enum": [ + "Swd", + "Jtag" + ] }, - "haltAfterReset": { + "allowEraseAll": { "type": "boolean", - "description": "Halt the target after reset.", + "description": "Allow the session to erase all memory of the chip or reset it to factory default.", "default": true }, - "fullChipErase": { - "type": "boolean", - "description": "Do a full chip erase, versus page-by-page erase.", - "default": false - }, - "restoreUnwrittenBytes": { - "type": "boolean", - "description": "Restore erased bytes that will not be rewritten from ELF.", - "default": false - }, - "rttEnabled": { - "type": "boolean", - "description": "If true, the debugger will open an RTT Terminal tab for each of the active channels on the target.", - "default": false + "flashingConfig": { + "type": "object", + "description": "These flashing options are applied when flashing one or more core `program_binary` files to the target memory.", + "flashingEnabled": { + "type": "boolean", + "description": "Flash the target before debugging.", + "default": true + }, + "resetAfterFlashing": { + "type": "boolean", + "description": "Reset all cores on the target after flashing.", + "default": true + }, + "haltAfterReset": { + "type": "boolean", + "description": "Halt all cores on the target after reset.", + "default": true + }, + "fullChipErase": { + "type": "boolean", + "description": "Do a full chip erase, versus page-by-page erase.", + "default": false + }, + "restoreUnwrittenBytes": { + "type": "boolean", + "description": "Restore erased bytes that will not be rewritten from ELF.", + "default": false + } }, - "rttChannelFormats": { + "coreConfigs": { "type": "array", + "description": "Each MCU core will have a mandatory `coreIndex`, `programBinary`, and `chip` as well as several other optional properties.", "items": { - "channelNumber": { + "required": [ + "programBinary" + ], + "coreIndex": { "type": "number", - "description": "The channel number to which this data format applies. If any active channel numbers are omitted, we will assume the default will be `dataFormat=String', and 'showTimestamps=false'." + "description": "The zero based index of the MCU core for this session", + "default": 0 + }, + "programBinary": { + "type": "string", + "description": "The path (relative to `cwd` or absolute) to the binary for your target firmware", + "default": "./target/thumbv7em-none-eabihf/debug/${workspaceFolderBasename}" }, - "dataFormat": { + "svdFile": { "type": "string", - "description": "One of the supported data formats for RTT channels.", - "enum": [ - "String", - "BinaryLE", - "Defmt" - ], - "enumDescriptions": [ - "String (text) format.", - "Binary Little Endian format.", - "Deferred formatting (see: https://defmt.ferrous-systems.com)." - ], - "default": "String" + "description": "The path (relative to `cwd` or absolute) to the CMCIS-SVD file for your target core", + "default": "./CMSIS.SVD" }, - "showTimestamps": { + "rttEnabled": { "type": "boolean", - "default": false, - "description": "Enable the inclusion of timestamps in the RTT output for `dataFormat=String`." + "description": "If true, the debugger will open an RTT Terminal tab for each of the active channels on the target.", + "default": false + }, + "rttChannelFormats": { + "type": "array", + "items": { + "channelNumber": { + "type": "number", + "description": "The channel number to which this data format applies. If any active channel numbers are omitted, we will assume the default will be `dataFormat=String', and 'showTimestamps=false'." + }, + "dataFormat": { + "type": "string", + "description": "One of the supported data formats for RTT channels.", + "enum": [ + "String", + "BinaryLE", + "Defmt" + ], + "enumDescriptions": [ + "String (text) format.", + "Binary Little Endian format.", + "Deferred formatting (see: https://defmt.ferrous-systems.com)." + ], + "default": "String" + }, + "showTimestamps": { + "type": "boolean", + "default": false, + "description": "Enable the inclusion of timestamps in the RTT output for `dataFormat=String`." + } + } } } } @@ -232,7 +255,7 @@ "attach": { "required": [ "chip", - "programBinary" + "coreConfigs" ], "properties": { "server": { @@ -240,28 +263,17 @@ "description": "Optionally onnect to an existing `probe-rs-debugger` session on IP and Port, e.g. '127.0.0.1:50000'", "default": "127.0.0.1:50000" }, - "programBinary": { - "type": "string", - "description": "The path (relative to `cwd` or absolute) to the binary for your target firmware", - "default": "./target/thumbv7em-none-eabihf/debug/${workspaceFolderBasename}" - }, - "cwd": { - "type": "string", - "description": "The working directory of the debugger, typically the RUST crate root", - "default": "${workspaceFolder}" - }, - "chip": { - "type": "string", - "description": "Please specify the appropriate chip from the list of supported chips reported by running `probe-rs-debugger list-chips`." - }, - "coreIndex": { - "type": "number", - "description": "The zero based index of the MCU core for this session", - "default": 0 - }, - "probe": { + "consoleLogLevel": { "type": "string", - "description": "Use this flag to select a specific probe in the list. Use '--probe VID:PID' or '--probe VID:PID:Serial' if you have more than one probe with the same VID:PID." + "description": "The level of log info printed to the console. This also sets the RUST_LOG environment variable wherever possible.", + "enum": [ + "Error", + "Warn", + "Info", + "Debug", + "Trace" + ], + "default": "Error" }, "runtimeExecutable": { "type": "string", @@ -279,6 +291,24 @@ "--dap" ] }, + "cwd": { + "type": "string", + "description": "The working directory of the debugger, typically the RUST crate root", + "default": "${workspaceFolder}" + }, + "probe": { + "type": "string", + "description": "Use this flag to select a specific probe in the list. Use '--probe VID:PID' or '--probe VID:PID:Serial' if you have more than one probe with the same VID:PID." + }, + "chip": { + "type": "string", + "description": "Please specify the appropriate chip from the list of supported chips reported by running `probe-rs-debugger list-chips`." + }, + "connectUnderReset": { + "type": "boolean", + "description": "This option will result in the target reset pin being held high during the attach operation.", + "default": false + }, "speed": { "type": "number", "description": "Specify the protocol speed in kHz." @@ -291,49 +321,95 @@ "Jtag" ] }, - "consoleLogLevel": { - "type": "string", - "description": "The level of log info printed to the console. This also sets the RUST_LOG environment variable wherever possible.", - "enum": [ - "Error", - "Warn", - "Info", - "Debug", - "Trace" - ], - "default": "Error" - }, - "rttEnabled": { + "allowEraseAll": { "type": "boolean", - "description": "If true, the debugger will open an RTT Terminal tab for each of the active channels on the target.", - "default": false + "description": "Allow the session to erase all memory of the chip or reset it to factory default.", + "default": true }, - "rttChannelFormats": { + "flashingConfig": { + "type": "object", + "description": "These flashing options are applied when flashing one or more core `program_binary` files to the target memory.", + "flashingEnabled": { + "type": "boolean", + "description": "Flash the target before debugging.", + "default": true + }, + "resetAfterFlashing": { + "type": "boolean", + "description": "Reset all cores on the target after flashing.", + "default": true + }, + "haltAfterReset": { + "type": "boolean", + "description": "Halt all cores on the target after reset.", + "default": true + }, + "fullChipErase": { + "type": "boolean", + "description": "Do a full chip erase, versus page-by-page erase.", + "default": false + }, + "restoreUnwrittenBytes": { + "type": "boolean", + "description": "Restore erased bytes that will not be rewritten from ELF.", + "default": false + } + }, + "coreConfigs": { "type": "array", + "description": "Each MCU core will have a mandatory `coreIndex`, `programBinary`, and `chip` as well as several other optional properties.", "items": { - "channelNumber": { + "required": [ + "programBinary" + ], + "coreIndex": { "type": "number", - "description": "The channel number to which this data format applies. If any active channel numbers are omitted, we will assume the default will be `dataFormat=String', and 'showTimestamps=false'." + "description": "The zero based index of the MCU core for this session", + "default": 0 + }, + "programBinary": { + "type": "string", + "description": "The path (relative to `cwd` or absolute) to the binary for your target firmware", + "default": "./target/thumbv7em-none-eabihf/debug/${workspaceFolderBasename}" }, - "dataFormat": { + "svdFile": { "type": "string", - "description": "One of the supported data formats for RTT channels.", - "enum": [ - "String", - "BinaryLE", - "Defmt" - ], - "enumDescriptions": [ - "String (text) format.", - "Binary Little Endian format.", - "Deferred formatting (see: https://defmt.ferrous-systems.com)." - ], - "default": "String" + "description": "The path (relative to `cwd` or absolute) to the CMCIS-SVD file for your target core", + "default": "./CMSIS.SVD" }, - "showTimestamps": { + "rttEnabled": { "type": "boolean", - "default": false, - "description": "Enable the inclusion of timestamps in the RTT output for `dataFormat=String`." + "description": "If true, the debugger will open an RTT Terminal tab for each of the active channels on the target.", + "default": false + }, + "rttChannelFormats": { + "type": "array", + "items": { + "channelNumber": { + "type": "number", + "description": "The channel number to which this data format applies. If any active channel numbers are omitted, we will assume the default will be `dataFormat=String', and 'showTimestamps=false'." + }, + "dataFormat": { + "type": "string", + "description": "One of the supported data formats for RTT channels.", + "enum": [ + "String", + "BinaryLE", + "Defmt" + ], + "enumDescriptions": [ + "String (text) format.", + "Binary Little Endian format.", + "Deferred formatting (see: https://defmt.ferrous-systems.com)." + ], + "default": "String" + }, + "showTimestamps": { + "type": "boolean", + "default": false, + "description": "Enable the inclusion of timestamps in the RTT output for `dataFormat=String`." + } + } } } } @@ -345,13 +421,20 @@ "type": "probe-rs-debug", "request": "launch", "name": "probe-rs Test", - "programBinary": "./target/thumbv7em-none-eabihf/debug/${workspaceFolderBasename}", "cwd": "${workspaceFolder}", - "chip": "STM32H745ZITx", "connectUnderReset": true, - "flashingEnabled": true, - "resetAfterFlashing": true, - "haltAfterReset": true + "chip": "STM32H745ZITx", + "flashingConfig": { + "flashingEnabled": true, + "resetAfterFlashing": true, + "haltAfterReset": true + }, + "coreConfigs": [ + { + "coreIndex": 0, + "programBinary": "./target/thumbv7em-none-eabihf/debug/${workspaceFolderBasename}" + } + ] } ], "configurationSnippets": [ @@ -362,14 +445,24 @@ "type": "probe-rs-debug", "request": "launch", "name": "probe-rs Test", - "programBinary": "./target/thumbv7em-none-eabihf/$debug/{workspaceFolderBasename}", "cwd": "${workspaceFolder}", + "connectUnderReset": true, "chip": "STM32H745ZITx", - "connectUnderReset": true + "flashingConfig": { + "flashingEnabled": true, + "resetAfterFlashing": true, + "haltAfterReset": true + }, + "coreConfigs": [ + { + "coreIndex": 0, + "programBinary": "./target/thumbv7em-none-eabihf/debug/${workspaceFolderBasename}" + } + ] } } ] } ] } -} +} \ No newline at end of file diff --git a/src/debugProtocol.json b/src/debugProtocol.json index e331ac6..aa70609 100644 --- a/src/debugProtocol.json +++ b/src/debugProtocol.json @@ -1035,7 +1035,7 @@ "DisconnectRequest": { "allOf": [ { "$ref": "#/definitions/Request" }, { "type": "object", - "description": "The 'disconnect' request is sent from the client to the debug adapter in order to stop debugging.\nIt asks the debug adapter to disconnect from the debuggee and to terminate the debug adapter.\nIf the debuggee has been started with the 'launch' request, the 'disconnect' request terminates the debuggee.\nIf the 'attach' request was used to connect to the debuggee, 'disconnect' does not terminate the debuggee.\nThis behavior can be controlled with the 'terminateDebuggee' argument (if supported by the debug adapter).", + "description": "The 'disconnect' request asks the debug adapter to disconnect from the debuggee (thus ending the debug session) and then to shut down itself (the debug adapter).\nIn addition, the debug adapter must terminate the debuggee if it was started with the 'launch' request. If an 'attach' request was used to connect to the debuggee, then the debug adapter must not terminate the debuggee.\nThis implicit behavior of when to terminate the debuggee can be overridden with the optional argument 'terminateDebuggee' (which is only supported by a debug adapter if the corresponding capability 'supportTerminateDebuggee' is true).", "properties": { "command": { "type": "string", @@ -1076,7 +1076,7 @@ "TerminateRequest": { "allOf": [ { "$ref": "#/definitions/Request" }, { "type": "object", - "description": "The 'terminate' request is sent from the client to the debug adapter in order to give the debuggee a chance for terminating itself.\nClients should only call this request if the capability 'supportsTerminateRequest' is true.", + "description": "The 'terminate' request is sent from the client to the debug adapter in order to shut down the debuggee gracefully. Clients should only call this request if the capability 'supportsTerminateRequest' is true.\nTypically a debug adapter implements 'terminate' by sending a software signal which the debuggee intercepts in order to clean things up properly before terminating itself.\nPlease note that this request does not directly affect the state of the debug session: if the debuggee decides to veto the graceful shutdown for any reason by not terminating itself, then the debug session will just continue.\nClients can surface the 'terminate' request as an explicit command or they can integrate it into a two stage Stop command that first sends 'terminate' to request a graceful shutdown, and if that fails uses 'disconnect' for a forceful shutdown.", "properties": { "command": { "type": "string", @@ -1195,7 +1195,7 @@ "properties": { "source": { "$ref": "#/definitions/Source", - "description": "The source location of the breakpoints; either 'source.path' or 'source.reference' must be specified." + "description": "The source location of the breakpoints; either 'source.path' or 'source.sourceReference' must be specified." }, "breakpoints": { "type": "array", @@ -2417,18 +2417,19 @@ }, "context": { "type": "string", - "_enum": [ "watch", "repl", "hover", "clipboard" ], + "_enum": [ "variables", "watch", "repl", "hover", "clipboard" ], "enumDescriptions": [ - "evaluate is run in a watch.", - "evaluate is run from REPL console.", - "evaluate is run from a data hover.", - "evaluate is run to generate the value that will be stored in the clipboard.\nThe attribute is only honored by a debug adapter if the capability 'supportsClipboardContext' is true." + "evaluate is called from a variables view context.", + "evaluate is called from a watch view context.", + "evaluate is called from a REPL context.", + "evaluate is called to generate the debug hover contents.\nThis value should only be used if the capability 'supportsEvaluateForHovers' is true.", + "evaluate is called to generate clipboard contents.\nThis value should only be used if the capability 'supportsClipboardContext' is true." ], - "description": "The context in which the evaluate request is run." + "description": "The context in which the evaluate request is used." }, "format": { "$ref": "#/definitions/ValueFormat", - "description": "Specifies details on how to format the Evaluate result.\nThe attribute is only honored by a debug adapter if the capability 'supportsValueFormattingOptions' is true." + "description": "Specifies details on how to format the result.\nThe attribute is only honored by a debug adapter if the capability 'supportsValueFormattingOptions' is true." } }, "required": [ "expression" ] @@ -3940,7 +3941,7 @@ "ExceptionFilterOptions": { "type": "object", - "description": "An ExceptionFilterOptions is used to specify an exception filter together with a condition for the setExceptionsFilter request.", + "description": "An ExceptionFilterOptions is used to specify an exception filter together with a condition for the 'setExceptionBreakpoints' request.", "properties": { "filterId": { "type": "string", diff --git a/src/extension.ts b/src/extension.ts index fcd39c0..c78b6bb 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -101,56 +101,53 @@ class ProbeRSDebugAdapterServerDescriptorFactory implements vscode.DebugAdapterD // Make sure we have a terminal window per channel, for RTT Logging if (vscode.debug.activeDebugSession) { let session = vscode.debug.activeDebugSession; - if (session.configuration.hasOwnProperty('rttEnabled') && - session.configuration.rttEnabled) { - let channelWriteEmitter = new vscode.EventEmitter(); - let channelPty: vscode.Pseudoterminal = { - onDidWrite: channelWriteEmitter.event, - open: () => { - let windowIsOpen = true; - session.customRequest("rttWindowOpened", { channelNumber, windowIsOpen }).then((response) => { - logToConsole("DEBUG: probe-rs: RTT Window opened, and ready to receive RTT data on channel" + JSON.stringify(channelNumber, null, 2)); - }); - }, - close: () => { - let windowIsOpen = false; - session.customRequest("rttWindowOpened", { channelNumber, windowIsOpen }).then((response) => { - logToConsole("DEBUG: probe-rs: RTT Window closed, and can no longer receive RTT data on channel" + JSON.stringify(channelNumber, null, 2)); - }); - }, + let channelWriteEmitter = new vscode.EventEmitter(); + let channelPty: vscode.Pseudoterminal = { + onDidWrite: channelWriteEmitter.event, + open: () => { + let windowIsOpen = true; + session.customRequest("rttWindowOpened", { channelNumber, windowIsOpen }).then((response) => { + logToConsole("DEBUG: probe-rs: RTT Window opened, and ready to receive RTT data on channel" + JSON.stringify(channelNumber, null, 2)); + }); + }, + close: () => { + let windowIsOpen = false; + session.customRequest("rttWindowOpened", { channelNumber, windowIsOpen }).then((response) => { + logToConsole("DEBUG: probe-rs: RTT Window closed, and can no longer receive RTT data on channel" + JSON.stringify(channelNumber, null, 2)); + }); + }, + }; + let channelTerminalConfig: vscode.ExtensionTerminalOptions | undefined; + let channelTerminal: vscode.Terminal | undefined; + for (let reuseTerminal of vscode.window.terminals) { + if (reuseTerminal.name === channelName) { + channelTerminal = reuseTerminal; + channelTerminalConfig = channelTerminal.creationOptions as vscode.ExtensionTerminalOptions; + let windowIsOpen = true; + session.customRequest("rttWindowOpened", { channelNumber, windowIsOpen }).then((response) => { + logToConsole("DEBUG: probe-rs: RTT Window reused, and ready to receive RTT data on channel" + JSON.stringify(channelNumber, null, 2)); + }); + break; + } + } + if (channelTerminal === undefined) { + channelTerminalConfig = { + name: channelName, + pty: channelPty }; - let channelTerminalConfig: vscode.ExtensionTerminalOptions | undefined; - let channelTerminal: vscode.Terminal | undefined; - for (let reuseTerminal of vscode.window.terminals) { - if (reuseTerminal.name === channelName) { - channelTerminal = reuseTerminal; - channelTerminalConfig = channelTerminal.creationOptions as vscode.ExtensionTerminalOptions; - let windowIsOpen = true; - session.customRequest("rttWindowOpened", { channelNumber, windowIsOpen }).then((response) => { - logToConsole("DEBUG: probe-rs: RTT Window reused, and ready to receive RTT data on channel" + JSON.stringify(channelNumber, null, 2)); - }); + for (let index in this.rttTerminals) { + var [formerChannelNumber, , ,] = this.rttTerminals[index]; + if (formerChannelNumber === channelNumber) { + this.rttTerminals.splice(+index, 1); break; } } - if (channelTerminal === undefined) { - channelTerminalConfig = { - name: channelName, - pty: channelPty - }; - for (let index in this.rttTerminals) { - var [formerChannelNumber, , ,] = this.rttTerminals[index]; - if (formerChannelNumber === channelNumber) { - this.rttTerminals.splice(+index, 1); - break; - } - } - channelTerminal = vscode.window.createTerminal(channelTerminalConfig); - vscode.debug.activeDebugConsole.appendLine("probe-rs-debugger: Opened a new RTT Terminal window named: " + channelName); - this.rttTerminals.push([+channelNumber, dataFormat, channelTerminal, channelWriteEmitter]); - } - if (channelNumber === 0) { - channelTerminal.show(false); - } + channelTerminal = vscode.window.createTerminal(channelTerminalConfig); + vscode.debug.activeDebugConsole.appendLine("probe-rs-debugger: Opened a new RTT Terminal window named: " + channelName); + this.rttTerminals.push([+channelNumber, dataFormat, channelTerminal, channelWriteEmitter]); + } + if (channelNumber === 0) { + channelTerminal.show(false); } } } @@ -250,7 +247,7 @@ class ProbeRSDebugAdapterServerDescriptorFactory implements vscode.DebugAdapterD var options = { cwd: session.configuration.cwd, // eslint-disable-next-line @typescript-eslint/naming-convention - env: { ...process.env, 'RUST_LOG': probeRsLogLevel, 'DEFMT_LOG': probeRsLogLevel }, + env: { ...process.env, 'RUST_LOG': probeRsLogLevel.toLowerCase(), 'DEFMT_LOG': probeRsLogLevel.toLowerCase() }, windowsHide: true, }; From f9d0d4422877e4992dcd13a61b99a8d3dd218b81 Mon Sep 17 00:00:00 2001 From: JackN Date: Thu, 14 Apr 2022 13:22:11 -0400 Subject: [PATCH 2/2] Add option to omit location from Defmt formatting --- {src => dap}/debugProtocol.json | 0 package.json | 12 +++++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) rename {src => dap}/debugProtocol.json (100%) diff --git a/src/debugProtocol.json b/dap/debugProtocol.json similarity index 100% rename from src/debugProtocol.json rename to dap/debugProtocol.json diff --git a/package.json b/package.json index 80ad693..018ee9e 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,7 @@ "url": "https://github.com/probe-rs/vscode/issues" }, "scripts": { - "probe-rs: getDebugProtocolLatest": "curl -LJs https://microsoft.github.io/debug-adapter-protocol/debugAdapterProtocol.json -o src/debugProtocol.json", + "probe-rs: getDebugProtocolLatest": "curl -LJs https://microsoft.github.io/debug-adapter-protocol/debugAdapterProtocol.json -o dap/debugProtocol.json", "probe-rs:Update Dev Dependencies": "yarn upgrade --latest", "probe-rs:package": "vsce package", "vscode:prepublish": "yarn run package-ext && yarn run package-web", @@ -245,6 +245,11 @@ "type": "boolean", "default": false, "description": "Enable the inclusion of timestamps in the RTT output for `dataFormat=String`." + }, + "showLocation": { + "type": "boolean", + "default": true, + "description": "Enable the inclusion of Defmt location information in the RTT output for `dataFormat=Defmt`." } } } @@ -408,6 +413,11 @@ "type": "boolean", "default": false, "description": "Enable the inclusion of timestamps in the RTT output for `dataFormat=String`." + }, + "showLocation": { + "type": "boolean", + "default": true, + "description": "Enable the inclusion of Defmt location information in the RTT output for `dataFormat=Defmt`." } } }