cmd/dap: server - always headless, target - always foregrounded (#2589)
Co-authored-by: Polina Sokolova <polinasok@users.noreply.github.com>
This commit is contained in:
parent
584191a75c
commit
5459034a98
@ -41,7 +41,7 @@ Pass flags to the program you are debugging using `--`, for example:
|
|||||||
* [dlv attach](dlv_attach.md) - Attach to running process and begin debugging.
|
* [dlv attach](dlv_attach.md) - Attach to running process and begin debugging.
|
||||||
* [dlv connect](dlv_connect.md) - Connect to a headless debug server.
|
* [dlv connect](dlv_connect.md) - Connect to a headless debug server.
|
||||||
* [dlv core](dlv_core.md) - Examine a core dump.
|
* [dlv core](dlv_core.md) - Examine a core dump.
|
||||||
* [dlv dap](dlv_dap.md) - [EXPERIMENTAL] Starts a TCP server communicating via Debug Adaptor Protocol (DAP).
|
* [dlv dap](dlv_dap.md) - [EXPERIMENTAL] Starts a headless TCP server communicating via Debug Adaptor Protocol (DAP).
|
||||||
* [dlv debug](dlv_debug.md) - Compile and begin debugging main package in current directory, or the package specified.
|
* [dlv debug](dlv_debug.md) - Compile and begin debugging main package in current directory, or the package specified.
|
||||||
* [dlv exec](dlv_exec.md) - Execute a precompiled binary, and begin a debug session.
|
* [dlv exec](dlv_exec.md) - Execute a precompiled binary, and begin a debug session.
|
||||||
* [dlv replay](dlv_replay.md) - Replays a rr trace.
|
* [dlv replay](dlv_replay.md) - Replays a rr trace.
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
## dlv dap
|
## dlv dap
|
||||||
|
|
||||||
[EXPERIMENTAL] Starts a TCP server communicating via Debug Adaptor Protocol (DAP).
|
[EXPERIMENTAL] Starts a headless TCP server communicating via Debug Adaptor Protocol (DAP).
|
||||||
|
|
||||||
### Synopsis
|
### Synopsis
|
||||||
|
|
||||||
|
|
||||||
[EXPERIMENTAL] Starts a TCP server communicating via Debug Adaptor Protocol (DAP).
|
[EXPERIMENTAL] Starts a headless TCP server communicating via Debug Adaptor Protocol (DAP).
|
||||||
|
|
||||||
The server is headless and requires a DAP client like vscode to connect and request a binary
|
The server is always headless and requires a DAP client like vscode to connect and request a binary
|
||||||
to be launched or process to be attached to. The following modes are supported:
|
to be launched or process to be attached to. The following modes are supported:
|
||||||
- launch + exec (executes precompiled binary, like 'dlv exec')
|
- launch + exec (executes precompiled binary, like 'dlv exec')
|
||||||
- launch + debug (builds and launches, like 'dlv debug')
|
- launch + debug (builds and launches, like 'dlv debug')
|
||||||
|
@ -174,10 +174,10 @@ option to let the process continue or kill it.
|
|||||||
// 'dap' subcommand.
|
// 'dap' subcommand.
|
||||||
dapCommand := &cobra.Command{
|
dapCommand := &cobra.Command{
|
||||||
Use: "dap",
|
Use: "dap",
|
||||||
Short: "[EXPERIMENTAL] Starts a TCP server communicating via Debug Adaptor Protocol (DAP).",
|
Short: "[EXPERIMENTAL] Starts a headless TCP server communicating via Debug Adaptor Protocol (DAP).",
|
||||||
Long: `[EXPERIMENTAL] Starts a TCP server communicating via Debug Adaptor Protocol (DAP).
|
Long: `[EXPERIMENTAL] Starts a headless TCP server communicating via Debug Adaptor Protocol (DAP).
|
||||||
|
|
||||||
The server is headless and requires a DAP client like vscode to connect and request a binary
|
The server is always headless and requires a DAP client like vscode to connect and request a binary
|
||||||
to be launched or process to be attached to. The following modes are supported:
|
to be launched or process to be attached to. The following modes are supported:
|
||||||
- launch + exec (executes precompiled binary, like 'dlv exec')
|
- launch + exec (executes precompiled binary, like 'dlv exec')
|
||||||
- launch + debug (builds and launches, like 'dlv debug')
|
- launch + debug (builds and launches, like 'dlv debug')
|
||||||
@ -188,6 +188,7 @@ While --continue is not supported, stopOnEntry launch/attach attribute can be us
|
|||||||
execution is resumed at the start of the debug session.`,
|
execution is resumed at the start of the debug session.`,
|
||||||
Run: dapCmd,
|
Run: dapCmd,
|
||||||
}
|
}
|
||||||
|
// TODO(polina): support --tty when dlv dap allows to launch a program from command-line
|
||||||
rootCommand.AddCommand(dapCommand)
|
rootCommand.AddCommand(dapCommand)
|
||||||
|
|
||||||
// 'debug' subcommand.
|
// 'debug' subcommand.
|
||||||
@ -409,7 +410,7 @@ func dapCmd(cmd *cobra.Command, args []string) {
|
|||||||
}
|
}
|
||||||
defer logflags.Close()
|
defer logflags.Close()
|
||||||
|
|
||||||
if headless {
|
if cmd.Flag("headless").Changed {
|
||||||
fmt.Fprintf(os.Stderr, "Warning: dap mode is always headless\n")
|
fmt.Fprintf(os.Stderr, "Warning: dap mode is always headless\n")
|
||||||
}
|
}
|
||||||
if acceptMulti {
|
if acceptMulti {
|
||||||
@ -446,10 +447,9 @@ func dapCmd(cmd *cobra.Command, args []string) {
|
|||||||
DisconnectChan: disconnectChan,
|
DisconnectChan: disconnectChan,
|
||||||
Debugger: debugger.Config{
|
Debugger: debugger.Config{
|
||||||
Backend: backend,
|
Backend: backend,
|
||||||
Foreground: headless && tty == "",
|
Foreground: true, // server always runs without terminal client
|
||||||
DebugInfoDirectories: conf.DebugInfoDirectories,
|
DebugInfoDirectories: conf.DebugInfoDirectories,
|
||||||
CheckGoVersion: checkGoVersion,
|
CheckGoVersion: checkGoVersion,
|
||||||
TTY: tty,
|
|
||||||
},
|
},
|
||||||
CheckLocalConnUser: checkLocalConnUser,
|
CheckLocalConnUser: checkLocalConnUser,
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user