Delve
Introduction
Delve is used for Go program debugging thanks to its simplicity and complete features.
Installation Mode
1 | go get -u github.com/go-delve/delve/cmd/dlv |
Usage
- Initialize the module to generate a go.mod file.
go mod init Module name
- Debug the application.
dlv debug File name
This command is used to access the debugging mode.
- dlv debugging command
(dlv) command *args
dlv is displayed when accessing the dlv debugging page. command indicates the debugging command to be executed (some commands are abbreviated). *args indicates the parameters required by some debugging commands.
Common parameters are as follows:
Parameter
Description
h
Views the usage.
b
Sets a breakpoint.
c
Runs till the breakpoint or the program stops.
disass
Performs disassembling.
n
Goes to the next line.
r
Restarts the process.
bt
Displays the stack trace information.
s
Executes the program in step-by-step mode.
p
Calculates an expression.
ls
Displays the source code.
q
Exits the debugger.
Parent topic: Analysis Tools