Skip to content

add support for debugging child process enabled by delve backend #3712

Open
@Lslightly

Description

@Lslightly

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:

Describe the solution you'd like
A clear and concise description of what you want to happen.

  1. 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)
  2. Allow setting breakpoint whose location is not found yet but will be found in child process. There are some mistakes. See the comment
    • This 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 of yesno decision is pkg/terminal/command.go#L1868
  3. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions