Description
Problem demo:
The demo repository is Lslightly/delve-dbg-child-proc, where I can debug child process in delve. But I can't debug child process in vscode-go.
Although most go projects are organized as package and support of single process with multiple goroutines is enough, there are projects like golang/go where the cmd/go can invoke cmd/compile tool as the child process. The command arguments passed to cmd/compile tool is complicated. It will be convenient to debug cmd/compile through debugging go build -a .
command instead of debugging go tool compile ... ... ...
command. So demand of multiple process debugging feature exist.
Besides, this scenario(use case) is different from the client/server architecture which may run the process for a long time and you can connect to the delve server at any time(or make the child process sleep for some seconds).
Related issues and blogs:
- Attach and debug any child process fork'ed by the target process go-delve/delve#2551
- service/debugger: fix FindLocation with child processes go-delve/delve#3937
- Any support for `target follow-exec` to debug child process? #3704
- https://www.dolthub.com/blog/2023-05-25-debugging-multiple-golang-processes/
Describe the solution you'd like
A clear and concise description of what you want to happen.
- Enable
target follow-exec -on
by default or provide an option to enable child process debug. (--init
option of delve is disabled when combining with--headless
option) Allow setting breakpoint whose location is not found yet but will be found in child process.There are some mistakes. See the commentThis needs support in delve to answer yes when the breakpoint is not found to set a suspended breakpoint(in delve but not in vscode-go. vscode-go can always set the breakpoint on since there is no side effect).The source code location ofyesno
decision is pkg/terminal/command.go#L1868
- Reuse the Call Stack for debugging child process. (low priority. Since attach remote and substitutePath(I haven't succeeded in using this feature yet) can be used to debug child process in different vscode window.
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Additional context
Add any other context or screenshots about the feature request here.
I will upload a demo video later.