Repository navigation
Replies: 2 comments 2 replies
|
Debugging subprocesses in Debugpy is handled by monkey patching the code that starts subprocesses. You can see it here: I was thinking there might need to be more patching for groups, but looking at it now, I'm not sure why it wouldn't just work. Attach AFAIK does the monkey patching too as long as you have So I'm not sure why it doesn't already work. |
|
Short answer: as Rich Chiodo (@rchiodo) said, this isn't possible with debugpy today — you have to attach to each already-running process individually. I dug into the code to confirm why, and it's architectural rather than a missing option. Subprocess debugging in debugpy works entirely by monkey-patching process creation inside the debugged process, not by discovering processes from the outside:
So the unified session only exists because each child is born already patched and phones home to the same adapter. A child that was already running before you attached was never patched, and debugpy has no code that enumerates an existing process group — there's no Likewise, What this feature would need is new code on the adapter/CLI side: enumerate the group (e.g.
|
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
I know I can debug all subprocesses by modifying the main process startup code to import debugpy. However, is there a way to attach to and debug an entire process group after both the main process and subprocesses have already started?
Currently, my approach is to attach to each process individually:
However, this creates separate, isolated debug sessions for each process. Is there any way to achieve the same unified debugging experience as when debugpy is imported at the main process startup (with subProcess=True)? Ideally, I'd like to:
Attach to an already-running process group
Have all subprocesses automatically included in a single coordinated debugging session
Avoid having to manually attach to each subprocess with separate ports
Is this possible with debugpy's current architecture, or would this require creating a custom wrapper/tool?
All reactions