8000 [Feature Request]: Optional device reset during debug session · Issue #359 · eclipse-cdt-cloud/cdt-gdb-adapter · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

[Feature Request]: Optional device reset during debug session #359

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
jreineckearm opened this issue Apr 25, 2025 · 1 comment
Open

[Feature Request]: Optional device reset during debug session #359

jreineckearm open ABC6 ed this issue Apr 25, 2025 · 1 comment
Assignees

Comments

@jreineckearm
Copy link

Problem

It is common for embedded debugger IDEs to have a reset button.
Such reset buttons often have configurable and/or device specific reset strategies. Normally, the device ends up at a reset vector, an application entry point, or at a main function after the reset operation completed.

Comparable built-in functionality in VS Code is the Restart Button. However, its default behavior is different from the above: it tears down and restarts all involved processes (including GDB and a GDB server for remote target debug) and reconnects to the target. Whereas the above reset functionality only resets the target/program execution.

The advantage of an "in-session" reset is that it's often easier to preserve error symptoms and register states. While a traditional VS Code restart may re-initialize parts of the system or download the application again. Also, depending on the debugger backend, this approach often has higher performance and isn't perceived as disruptive by end users as a full restart is.

It is important to keep the behavior of such a reset configurable. It often is very specific to an SoC's reset architecture.

Proposal

One option to deal with this is to provide a custom implementation of the restart request of the MSFT DAP protocol. But there are valid use cases for having a restart button with the standard VS Code behavior. And making the behavior configurable is tricky because debug adapter capabilities are announced with the initialize request. Which is before seeing the debug launch configuration coming in. Also, such resets can be very use case specific which IMO is an argument for having this in the launch configurations.

The probably better approach is to

  • Add reset device functionality in addition to the default restart functionality.
  • Add a launch configuration setting resetDeviceCommands (name is negotiable). This is an array of GDB commands to execute when a reset device operation is requested. It's form is very similar to the existing initCommands setting.
  • resetDeviceCommands are executed as is. This can be for example a GDB server specific monitor command for reset.
  • A GDB server needs to ensure that appropriate asynchronous GDB notifications are sent. Like *running when a reset starts and *stopped when a reset completed AND the device is caught after reset. This gives the VS Code GUI a chance to refresh.
  • A new button gets contributed by cdt-gdb-vscode to the debug toolbar. This button is only visible if a launch configuration provides the resetDeviceCommands setting.
  • All of this is probably less relevant for local GDB debug sessions. Hence, can be limited to the gdbtarget debugger type.

Note that we have started some prototyping around this to verify feasibility of the approach. We'd be more than happy to continue this work and open PRs here and at cdt-gdb-vscode (CC: @thorstendb-ARM).

@jreineckearm
Copy link
Author

Assigning to myself while @thorstendb-ARM from my team is working on this. Can't assign to him directly at the moment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant
0