mirror of
https://github.com/go-delve/delve.git
synced 2025-11-01 20:20:40 +08:00
* logflags,proc: flag to log stacktrace execution Add a log flag to write logs about what the stacktracer does. * proc: read context from sigtrampgo, fixes TestCgoStacktrace2 on 1.21 Changes stacktrace code to read the signal context from the arguments of sigtrampgo. Also changes the automatic fatalthrow breakpoint for go 1.21. In combination these two changes fix TestCgoStacktrace2 on Go 1.21 on various platforms.
Using Delve
You can invoke Delve in multiple ways, depending on your usage needs. Delve makes every attempt to be user-friendly, ensuring the user has to do the least amount of work possible to begin debugging their program.
The available commands can be grouped into the following categories:
- Specify target and start debugging with the default terminal interface:
- Trace target program execution
- Start a headless backend server only and connect with an external frontend client:
- dlv --headless <command> <target> <args>
- starts a server, enters a debug session for the specified target and waits to accept a client connection over JSON-RPC or DAP
<command>can be any ofdebug,test,exec,attach,coreorreplay- if
--headlessflag is not specified the default terminal client will be automatically started instead - compatible with dlv connect, VS Code Go, GoLand
- dlv dap
- starts a DAP-only server and waits for a DAP client connection to specify the target and arguments
- compatible with VS Code Go
- NOT compatible with dlv connect, GoLand
- dlv connect <addr>
- starts a terminal interface client and connects it to a running headless server over JSON-RPC
- dlv --headless <command> <target> <args>
- Help information
The above list may be incomplete. Refer to the auto-generated complete usage document to further explore all available commands.
Environment variables
Delve also reads the following environment variables:
$DELVE_EDITORis used by theeditcommand (if it isn't set the$EDITORvariable is used instead)$DELVE_PAGERis used by commands that emit large output (if it isn't set the$PAGERvariable is used instead, if neither is setmoreis used)$TERMis used to decide whether or not ANSI escape codes should be used for colorized output$DELVE_DEBUGSERVER_PATHis used to locate the debugserver executable on macOS