-
Notifications
You must be signed in to change notification settings - Fork 30k
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
Display debugged sub-processes as a treeview #62972
Comments
Clarification: Today both VS Code and the Debug Adapter Protocol (DAP) knows nothing about child processes. All functionality supported in the scenarios from above works either automatically or through a small amount of glue code in the debugger extension. Making VS Code's debugger multi-process aware would be a big effort which not only affects VS Code but the DAP as well. Currently we do not see a big need for this and consequently it is not on our roadmap. So the only feature that I could imagine to offer for VS Code is some sort of "visual grouping mechanism". So when creating new debug sessions via the extension API (e.g. "startDebugging" call), we could support to pass in a parent debug session and VS Code would honour that by indenting the debug sessions to form a tree. As a workaround for now you could just prepend some non-breakable whitespace characters (\u00A0) to the generated debug configuration name. I tried this for the node.js Cluster and it looks like this: /cc @isidorn |
Coming back to this, we were blocked on another issue on our side but will soon be able to make progress. I don't think we need the DAP to be multi-process aware, if VS Code could be made aware of "Child Debug Sessions" on create as you proposed, what we'd be asking for in the UI would be to:
So in the typical case when you start debugging once, but the app spawns multiple child debug sessions, the user would have a single stop button that would stop all child sessions. Visual indenting in the call stack window as you've shown would be nice as well, but this is not essential as it would only be for the less common case when the user has intentionally started debugging two different parent debug sessions. |
@qubitron we are planning to implement the "visual grouping of child processes" approach in the next milestone. The only API change will add an additional Now I have a question regarding the UI that we will have to implement for this feature. Above you said:
I do not understand how that would work: |
@weinand I would have assumed that clicking on the child process in the call stack window would allow you to switch between active contexts and single step. Though I'm not exactly sure how to get VS Code into multi-proc debugging mode to test if this works. If it is problematic to hide the child processes from the debug toolbar, the important capability is to make make "stop" stop all of the processes. In our scenarios most people don't realize multiple processes are in play, they just start debugging and as an implementation detail the web server spawns sub-processes. |
@qubitron @DonJayamanne I'm not yet convinced that making the "Stop action stop all of the processes" is the right thing to do for VS Code. WE can continue the discussion in April. |
@weinand
|
@DonJayamanne no, the new API is not part of a config but an additional parameter of the startDebugging API: /**
* Start debugging by using either a named launch or named compound configuration,
* or by directly passing a [DebugConfiguration](#DebugConfiguration).
* The named configurations are looked up in '.vscode/launch.json' found in the given folder.
* Before debugging starts, all unsaved files are saved and the launch configurations are brought up-to-date.
* Folder specific variables used in the configuration (e.g. '${workspaceFolder}') are resolved against the given folder.
* @param folder The [workspace folder](#WorkspaceFolder) for looking up named configurations and resolving variables or `undefined` for a non-folder setup.
* @param nameOrConfiguration Either the name of a debug or compound configuration or a [DebugConfiguration](#DebugConfiguration) object.
* @param parent If specified the newly created debug session is registered as a "child" session of a "parent" debug session.
* @return A thenable that resolves when debugging could be successfully started.
*/
export function startDebugging(folder: WorkspaceFolder | undefined, nameOrConfiguration: string | DebugConfiguration, parentSession?: DebugSession): Thenable<boolean>; Just set your "vscode" engine version to 1.33 in the package.json and do a "npm install". |
@qubitron @DonJayamanne @isidorn Proposal resulting from today's discussion:
Compound launch configs are not affected by this. Whether this behavior is configurable at all, or as a user setting or as an additional option passed to "startDebugging" has to be decided. |
@isidorn could you please implement the proposal behind an experimental setting. |
@weinand yes. Let me look into this. |
I have pushed the experimental setting In both cases the individual sub-sessions can be terminated via context menu in the call stack viewer. Try it out and let me know what you think. After getting some feedback as @weinand already pointed out we should figure out if this should be configurable or not. If yes we should find a better name for the setting probably. |
Will try in tomorrows insider build. Thanks. |
Tried and works great. @qubitron /cc |
After using this setting for some time I propose to make this setting official:
@DonJayamanne @testforstephen @roblourens any objections? |
I like this feature because we meet similar issues before during reusing java debugger for other extensions. But one question here: if the sub debug session is hided in the debug toolbar, how to |
@testforstephen yes, the call stack is the preferred way to switch between sessions, processes, and threads. |
One important thing to note: this new behavior only affects hierarchical debug session (that use the new |
I have introduced the Try it out and let me know how it behaves. |
Thanks, we're happy with the changes, apologies for the delay in getting back. |
Adding verified label per @DonJayamanne comment |
Terms
spawn
in node).Debug toolbar should show run configurations in drop-down, not processes
Expected behavior
Current behavior
Detach
thenStop
).The text was updated successfully, but these errors were encountered: