Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Change Log

## Unreleased
- Implements:
- [Optional device reset during debug session](https://github.com/eclipse-cdt-cloud/cdt-gdb-adapter/issues/359)

## 2.0.3
- Fixes [#144](https://github.com/eclipse-cdt-cloud/cdt-gdb-vscode/issues/144): Error with the openGdbConsole option

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ Launch and attach configuration settings that can be used with the `gdbtarget` d
| `preRunCommands` | x | x | `string[]` | List of GDB commands sent after loading image on target before resuming target. |
| `imageAndSymbols` | x | x | `object` | Additional settings for loading images to the target and symbols into the debugger. See section "`imageAndSymbols` object" for details.
| `target` | x | x | `object` | Additional settings to configure the remote GDB target. See section "`target` object" for details. |
| `customResetCommands` | x | x | `string[]` | List of GDB commands to perform a RESET of the connected target, for example through `monitor ...` commands of the connected GDB server. |

#### `imageAndSymbols` Object

Expand Down
1 change: 1 addition & 0 deletions images/CustomReset_Dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions images/CustomReset_Light.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
29 changes: 29 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,14 @@
"light": "images/SuspendAll_Light.png",
"dark": "images/SuspendAll_Dark.png"
}
},
{
"command": "cdt.debug.customReset",
"title": "Custom Reset",
"icon": {
"light": "images/CustomReset_Light.svg",
"dark": "images/CustomReset_Dark.svg"
}
}
],
"breakpoints": [
Expand Down Expand Up @@ -300,6 +308,14 @@
},
"default": []
},
"customResetCommands": {
"type": "array",
"description": "List of debugger commands required to execute a reset through connected debugger.",
"items": {
"type": "string"
},
"default": []
},
"preRunCommands": {
"type": "array",
"description": "List of GDB commands sent after loading image on target before resuming target.",
Expand Down Expand Up @@ -541,6 +557,14 @@
},
"default": []
},
"customResetCommands": {
"type": "array",
"description": "List of debugger commands required to execute a reset through connected debugger.",
"items": {
"type": "string"
},
"default": []
},
"preRunCommands": {
"type": "array",
"description": "List of GDB commands sent after loading image on target before resuming target.",
Expand Down Expand Up @@ -725,6 +749,11 @@
"command": "cdt.debug.suspendAllSession",
"group": "navigation",
"when": "debugType == amalgamator"
},
{
"command": "cdt.debug.customReset",
"group": "custom",
"when": "cdt.debug.hasCustomReset && (debugType == amalgamator || debugType == gdbtarget)"
}
]
}
Expand Down
55 changes: 55 additions & 0 deletions src/CustomReset.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/*********************************************************************
* Copyright (c) 2025 Arm Ltd. and others
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*********************************************************************/
import { ExtensionContext } from 'vscode';
import * as vscode from 'vscode';

export class CustomReset {
constructor(context: ExtensionContext) {
this.registerCommands(context);
this.registerCallbacks();
}

private readonly registerCallbacks = () => {
vscode.debug.onDidStartDebugSession((session) => {
const hasCustomReset =
Array.isArray(session.configuration?.customResetCommands) &&
session.configuration.customResetCommands.length > 0;
vscode.commands.executeCommand(
'setContext',
'cdt.debug.hasCustomReset',
hasCustomReset
);
});

vscode.debug.onDidTerminateDebugSession(() => {
vscode.commands.executeCommand(
'setContext',
'cdt.debug.hasCustomReset',
false
);
});
};

private readonly registerCommands = (context: ExtensionContext) => {
context.subscriptions.push(
vscode.commands.registerCommand(
'cdt.debug.customReset',
async () => {
const session = vscode.debug.activeDebugSession;
if (session) {
await session.customRequest(
'cdt-gdb-adapter/customReset'
);
}
}
)
);
};
}
3 changes: 3 additions & 0 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,14 @@ import { ResumeAllSession } from './ResumeAllSession';
export { ResumeAllSession } from './ResumeAllSession';
import { SuspendAllSession } from './SuspendAllSession';
export { SuspendAllSession } from './SuspendAllSession';
import { CustomReset } from './CustomReset';
export { CustomReset } from './CustomReset';

export function activate(context: ExtensionContext) {
new MemoryServer(context);
new ResumeAllSession(context);
new SuspendAllSession(context);
new CustomReset(context);

context.subscriptions.push(
commands.registerCommand('cdt.debug.askProgramPath', (_config) => {
Expand Down
Loading