
This flag allows users on UNIX systems to set the tty for the program being debugged by Delve. This is useful for debugging command line applications which need access to their own TTY, and also for controlling the output of the debugged programs so that IDEs may open a dedicated terminal to show the output for the process.
2.3 KiB
Frequently Asked Questions
I'm getting an error while compiling Delve / unsupported architectures and OSs
The most likely cause of this is that you are running an unsupported Operating System or architecture. Currently Delve supports Linux, Windows and macOS on the amd64 architecture (also known as Intel 86x64).
For example if you are getting the undefined: ArchInst
error message while compiling Delve, that means that Delve doesn't currently support your processor architecture.
There is no planned ETA for support of other architectures or operating systems. Bugs tracking requested support are:
How do I use Delve with Docker?
When running the container you should pass the --security-opt=seccomp:unconfined
option to Docker. You can start a headless instance of Delve inside the container like this:
dlv exec --headless --listen :4040 /path/to/executable
And then connect to it from outside the container:
dlv connect :4040
The program will not start executing until you connect to Delve and send the continue
command. If you want the program to start immediately you can do that by passing the --continue
and --accept-multiclient
options to Delve:
dlv exec --headless --continue --listen :4040 --accept-multiclient /path/to/executable
Note that the connection to Delve is unauthenticated and will allow arbitrary remote code execution: do not do this in production.
How can I use Delve to debug a CLI application?
There are three good ways to go about this
-
Run your CLI application in a separate terminal and then attach to it via
dlv attach
. -
Run Delve in headless mode via
dlv debug --headless
and then connect to it from another terminal. This will place the process in the foreground and allow it to access the terminal TTY. -
Assign the process its own TTY. This can be done on UNIX systems via the
--tty
flag for thedlv debug
anddlv exec
commands. For the best experience, you should create your own PTY and assign it as the TTY. This can be done via ptyme.