2020-02-12 16:59:37 +00:00
# Configuration and Command History
2019-12-30 09:08:29 +00:00
2020-02-12 16:59:37 +00:00
If `$XDG_CONFIG_HOME` is set, then configuration and command history files are located in `$XDG_CONFIG_HOME/dlv` . Otherwise, they are located in `$HOME/.config/dlv` on Linux and `$HOME/.dlv` on other systems.
2019-12-30 09:08:29 +00:00
2020-02-12 16:59:37 +00:00
The configuration file `config.yml` contains all the configurable options and their default values. The command history is stored in `.dbg_history` .
2019-12-30 09:08:29 +00:00
2016-04-29 18:58:19 +00:00
# Commands
Command | Description
--------|------------
2016-05-29 18:59:46 +00:00
[args ](#args ) | Print function arguments.
2016-04-29 18:58:19 +00:00
[break ](#break ) | Sets a breakpoint.
2016-05-29 18:59:46 +00:00
[breakpoints ](#breakpoints ) | Print out info for active breakpoints.
2018-05-04 17:31:45 +00:00
[call ](#call ) | Resumes process, injecting a function call (EXPERIMENTAL!!!)
2017-05-05 22:17:52 +00:00
[check ](#check ) | Creates a checkpoint at the current position.
[checkpoints ](#checkpoints ) | Print out info for existing checkpoints.
2016-04-29 18:58:19 +00:00
[clear ](#clear ) | Deletes breakpoint.
2017-05-05 22:17:52 +00:00
[clear-checkpoint ](#clear-checkpoint ) | Deletes checkpoint.
2016-04-29 18:58:19 +00:00
[clearall ](#clearall ) | Deletes multiple breakpoints.
2016-05-29 18:59:46 +00:00
[condition ](#condition ) | Set breakpoint condition.
2017-07-29 04:11:06 +00:00
[config ](#config ) | Changes configuration parameters.
2016-05-29 18:59:46 +00:00
[continue ](#continue ) | Run until breakpoint or program termination.
2018-07-10 10:15:11 +00:00
[deferred ](#deferred ) | Executes command in the context of a deferred call.
2016-05-29 18:59:46 +00:00
[disassemble ](#disassemble ) | Disassembler.
2018-04-18 06:46:55 +00:00
[down ](#down ) | Move the current frame down.
2018-07-27 10:16:41 +00:00
[edit ](#edit ) | Open where you are in $DELVE_EDITOR or $EDITOR
2020-02-13 17:29:21 +00:00
[examinemem ](#examinemem ) | Examine memory:
2016-05-29 18:59:46 +00:00
[exit ](#exit ) | Exit the debugger.
2018-04-18 06:46:55 +00:00
[frame ](#frame ) | Set the current frame, or execute command on a different frame.
2016-05-29 18:59:46 +00:00
[funcs ](#funcs ) | Print list of functions.
2016-04-29 18:58:19 +00:00
[goroutine ](#goroutine ) | Shows or changes current goroutine
2016-05-29 18:59:46 +00:00
[goroutines ](#goroutines ) | List program goroutines.
[help ](#help ) | Prints the help message.
2019-03-20 17:32:51 +00:00
[libraries ](#libraries ) | List loaded dynamic libraries
2016-05-29 18:59:46 +00:00
[list ](#list ) | Show source code.
[locals ](#locals ) | Print local variables.
[next ](#next ) | Step over to next source line.
[on ](#on ) | Executes a command when a breakpoint is hit.
2016-04-29 18:58:19 +00:00
[print ](#print ) | Evaluate an expression.
2016-05-29 18:59:46 +00:00
[regs ](#regs ) | Print contents of CPU registers.
2017-05-05 22:17:52 +00:00
[restart ](#restart ) | Restart process from a checkpoint or event.
2019-07-09 01:01:00 +00:00
[rev ](#rev ) | Reverses the execution of the target program for the command specified.
2017-05-05 22:17:52 +00:00
[rewind ](#rewind ) | Run backwards until breakpoint or program termination.
2016-04-29 18:58:19 +00:00
[set ](#set ) | Changes the value of a variable.
2016-05-29 18:59:46 +00:00
[source ](#source ) | Executes a file containing a list of delve commands
2016-04-29 18:58:19 +00:00
[sources ](#sources ) | Print list of source files.
2016-05-29 18:59:46 +00:00
[stack ](#stack ) | Print stack trace.
[step ](#step ) | Single step through program.
[step-instruction ](#step-instruction ) | Single step a single cpu instruction.
2016-11-15 16:16:33 +00:00
[stepout ](#stepout ) | Step out of the current function.
2016-05-29 18:59:46 +00:00
[thread ](#thread ) | Switch to the specified thread.
[threads ](#threads ) | Print out info for every traced thread.
[trace ](#trace ) | Set tracepoint.
2016-04-29 18:58:19 +00:00
[types ](#types ) | Print list of types
2018-04-18 06:46:55 +00:00
[up ](#up ) | Move the current frame up.
2016-04-29 18:58:19 +00:00
[vars ](#vars ) | Print package variables.
2017-08-09 13:55:39 +00:00
[whatis ](#whatis ) | Prints type of an expression.
2016-04-29 18:58:19 +00:00
2016-05-29 18:59:46 +00:00
## args
Print function arguments.
2016-04-29 18:58:19 +00:00
2016-05-29 18:59:46 +00:00
[goroutine < n > ] [frame < m > ] args [-v] [< regex > ]
If regex is specified only function arguments with a name matching it will be returned. If -v is specified more information about each function argument will be shown.
2016-04-29 18:58:19 +00:00
## break
Sets a breakpoint.
break [name] < linespec >
2019-01-04 18:39:25 +00:00
See [Documentation/cli/locspec.md ](//github.com/go-delve/delve/tree/master/Documentation/cli/locspec.md ) for the syntax of linespec.
2016-04-29 18:58:19 +00:00
See also: "help on", "help cond" and "help clear"
Aliases: b
2016-05-29 18:59:46 +00:00
## breakpoints
Print out info for active breakpoints.
2016-04-29 18:58:19 +00:00
2016-05-29 18:59:46 +00:00
Aliases: bp
2016-04-29 18:58:19 +00:00
2018-05-04 17:31:45 +00:00
## call
Resumes process, injecting a function call (EXPERIMENTAL!!!)
2018-08-18 08:53:21 +00:00
call [-unsafe] < function call expression >
2018-05-04 17:31:45 +00:00
Current limitations:
- only pointers to stack-allocated objects can be passed as argument.
2018-08-03 13:57:43 +00:00
- only some automatic type conversions are supported.
2018-05-04 17:31:45 +00:00
- functions can only be called on running goroutines that are not
executing the runtime.
- the current goroutine needs to have at least 256 bytes of free space on
the stack.
- functions can only be called when the goroutine is stopped at a safe
point.
- calling a function will resume execution of all goroutines.
- only supported on linux's native backend.
2017-05-05 22:17:52 +00:00
## check
Creates a checkpoint at the current position.
2018-04-18 06:46:55 +00:00
2018-10-16 07:55:08 +00:00
checkpoint [note]
The "note" is arbitrary text that can be used to identify the checkpoint, if it is not specified it defaults to the current filename:line position.
2017-05-05 22:17:52 +00:00
Aliases: checkpoint
## checkpoints
Print out info for existing checkpoints.
2016-05-29 18:59:46 +00:00
## clear
Deletes breakpoint.
2016-04-29 18:58:19 +00:00
2016-05-29 18:59:46 +00:00
clear < breakpoint name or id >
2016-04-29 18:58:19 +00:00
2017-05-05 22:17:52 +00:00
## clear-checkpoint
Deletes checkpoint.
2018-04-18 06:46:55 +00:00
2017-08-02 01:50:45 +00:00
clear-checkpoint < id >
2017-05-05 22:17:52 +00:00
Aliases: clearcheck
2016-05-29 18:59:46 +00:00
## clearall
Deletes multiple breakpoints.
2016-04-29 18:58:19 +00:00
2016-05-29 18:59:46 +00:00
clearall [< linespec > ]
2018-04-18 06:46:55 +00:00
2016-05-29 18:59:46 +00:00
If called with the linespec argument it will delete all the breakpoints matching the linespec. If linespec is omitted all breakpoints are deleted.
2016-04-29 18:58:19 +00:00
2016-05-29 18:59:46 +00:00
## condition
Set breakpoint condition.
2016-04-29 18:58:19 +00:00
2016-05-29 18:59:46 +00:00
condition < breakpoint name or id > < boolean expression > .
2018-04-18 06:46:55 +00:00
2016-05-29 18:59:46 +00:00
Specifies that the breakpoint or tracepoint should break only if the boolean expression is true.
2016-04-29 18:58:19 +00:00
2016-05-29 18:59:46 +00:00
Aliases: cond
2016-04-29 18:58:19 +00:00
2017-07-29 04:11:06 +00:00
## config
Changes configuration parameters.
2018-04-18 06:46:55 +00:00
2017-07-29 04:11:06 +00:00
config -list
2018-04-18 06:46:55 +00:00
2017-07-29 04:11:06 +00:00
Show all configuration parameters.
config -save
Saves the configuration file to disk, overwriting the current configuration file.
config < parameter > < value >
2018-04-18 06:46:55 +00:00
2017-07-29 04:11:06 +00:00
Changes the value of a configuration parameter.
2018-03-20 10:05:35 +00:00
config substitute-path < from > < to >
config substitute-path < from >
2018-04-18 06:46:55 +00:00
2018-03-20 10:05:35 +00:00
Adds or removes a path substitution rule.
2017-07-29 04:11:06 +00:00
config alias < command > < alias >
config alias < alias >
2018-04-18 06:46:55 +00:00
2017-07-29 04:11:06 +00:00
Defines < alias > as an alias to < command > or removes an alias.
2016-05-29 18:59:46 +00:00
## continue
Run until breakpoint or program termination.
2016-04-29 18:58:19 +00:00
2016-05-29 18:59:46 +00:00
Aliases: c
2016-04-29 18:58:19 +00:00
2018-07-10 10:15:11 +00:00
## deferred
Executes command in the context of a deferred call.
deferred < n > < command >
Executes the specified command (print, args, locals) in the context of the n-th deferred call in the current frame.
2016-05-29 18:59:46 +00:00
## disassemble
Disassembler.
2016-04-29 18:58:19 +00:00
2016-05-29 18:59:46 +00:00
[goroutine < n > ] [frame < m > ] disassemble [-a < start > < end > ] [-l < locspec > ]
2016-04-29 18:58:19 +00:00
2016-05-29 18:59:46 +00:00
If no argument is specified the function being executed in the selected stack frame will be executed.
2018-04-18 06:46:55 +00:00
2016-05-29 18:59:46 +00:00
-a < start > < end > disassembles the specified address range
-l < locspec > disassembles the specified function
2016-04-29 18:58:19 +00:00
2016-05-29 18:59:46 +00:00
Aliases: disass
2016-04-29 18:58:19 +00:00
2018-04-18 06:46:55 +00:00
## down
Move the current frame down.
2018-08-18 08:53:21 +00:00
down [< m > ]
down [< m > ] < command >
2018-04-18 06:46:55 +00:00
Move the current frame down by < m > . The second form runs the command on the given frame.
2018-07-27 10:16:41 +00:00
## edit
Open where you are in $DELVE_EDITOR or $EDITOR
2018-08-31 12:53:06 +00:00
edit [locspec]
If locspec is omitted edit will open the current source file in the editor, otherwise it will open the specified location.
2018-07-27 10:16:41 +00:00
Aliases: ed
2020-02-13 17:29:21 +00:00
## examinemem
Examine memory:
examinemem [-fmt < format > ] [-len < length > ] < address >
Format represents the data format and the value is one of this list (default hex): oct(octal), hex(hexadecimal), dec(decimal), bin(binary).
Length is the number of bytes (default 1) and must be less than or equal to 1000.
Address is the memory location of the target to examine.
For example: x -fmt hex -len 20 0xc00008af38
Aliases: x
2016-05-29 18:59:46 +00:00
## exit
Exit the debugger.
2018-06-21 11:07:37 +00:00
exit [-c]
When connected to a headless instance started with the --accept-multiclient, pass -c to resume the execution of the target process before disconnecting.
2016-04-29 18:58:19 +00:00
2016-05-29 18:59:46 +00:00
Aliases: quit q
2016-04-29 18:58:19 +00:00
2016-05-29 18:59:46 +00:00
## frame
2018-04-18 06:46:55 +00:00
Set the current frame, or execute command on a different frame.
2016-04-29 18:58:19 +00:00
2018-08-18 08:53:21 +00:00
frame < m >
frame < m > < command >
2018-04-18 06:46:55 +00:00
The first form sets frame used by subsequent commands such as "print" or "set".
The second form runs the command on the given frame.
2016-04-29 18:58:19 +00:00
2016-05-29 18:59:46 +00:00
## funcs
Print list of functions.
2016-04-29 18:58:19 +00:00
2016-05-29 18:59:46 +00:00
funcs [< regex > ]
2016-04-29 18:58:19 +00:00
2016-05-29 18:59:46 +00:00
If regex is specified only the functions matching it will be returned.
2016-04-29 18:58:19 +00:00
## goroutine
Shows or changes current goroutine
goroutine
goroutine < id >
goroutine < id > < command >
Called without arguments it will show information about the current goroutine.
Called with a single argument it will switch to the specified goroutine.
Called with more arguments it will execute a command on the specified goroutine.
2019-05-31 07:33:39 +00:00
Aliases: gr
2016-04-29 18:58:19 +00:00
2016-05-29 18:59:46 +00:00
## goroutines
List program goroutines.
2016-04-29 18:58:19 +00:00
2018-07-05 11:06:12 +00:00
goroutines [-u (default: user location)|-r (runtime location)|-g (go statement location)|-s (start location)] [ -t (stack trace)]
2016-04-29 18:58:19 +00:00
2016-05-29 18:59:46 +00:00
Print out info for every goroutine. The flag controls what information is shown along with each goroutine:
2016-04-29 18:58:19 +00:00
2016-05-29 18:59:46 +00:00
-u displays location of topmost stackframe in user code
-r displays location of topmost stackframe (including frames inside private runtime functions)
-g displays location of go instruction that created the goroutine
2018-07-05 11:06:12 +00:00
-s displays location of the start function
2018-05-22 18:02:43 +00:00
-t displays stack trace of goroutine
2018-04-18 06:46:55 +00:00
2016-05-29 18:59:46 +00:00
If no flag is specified the default is -u.
2016-04-29 18:58:19 +00:00
2019-05-31 07:33:39 +00:00
Aliases: grs
2016-04-29 18:58:19 +00:00
2016-05-29 18:59:46 +00:00
## help
Prints the help message.
2016-04-29 18:58:19 +00:00
2016-05-29 18:59:46 +00:00
help [command]
2018-04-18 06:46:55 +00:00
2016-05-29 18:59:46 +00:00
Type "help" followed by the name of a command for more information about it.
2016-04-29 18:58:19 +00:00
2016-05-29 18:59:46 +00:00
Aliases: h
2016-04-29 18:58:19 +00:00
2019-03-20 17:32:51 +00:00
## libraries
List loaded dynamic libraries
2016-05-29 18:59:46 +00:00
## list
Show source code.
2016-04-29 18:58:19 +00:00
2016-05-29 18:59:46 +00:00
[goroutine < n > ] [frame < m > ] list [< linespec > ]
2016-04-29 18:58:19 +00:00
2016-05-29 18:59:46 +00:00
Show source around current point or provided linespec.
2016-04-29 18:58:19 +00:00
2018-04-18 06:46:55 +00:00
Aliases: ls l
2016-04-29 18:58:19 +00:00
2016-05-29 18:59:46 +00:00
## locals
Print local variables.
2016-04-29 18:58:19 +00:00
2016-05-29 18:59:46 +00:00
[goroutine < n > ] [frame < m > ] locals [-v] [< regex > ]
2016-04-29 18:58:19 +00:00
2017-08-02 01:50:45 +00:00
The name of variables that are shadowed in the current scope will be shown in parenthesis.
2016-05-29 18:59:46 +00:00
If regex is specified only local variables with a name matching it will be returned. If -v is specified more information about each local variable will be shown.
2016-04-29 18:58:19 +00:00
2016-05-29 18:59:46 +00:00
## next
Step over to next source line.
2016-04-29 18:58:19 +00:00
2019-07-30 01:04:26 +00:00
next [count]
Optional [count] argument allows you to skip multiple lines.
2016-05-29 18:59:46 +00:00
Aliases: n
2016-04-29 18:58:19 +00:00
2016-05-29 18:59:46 +00:00
## on
Executes a command when a breakpoint is hit.
2016-04-29 18:58:19 +00:00
2016-05-29 18:59:46 +00:00
on < breakpoint name or id > < command > .
2018-04-18 06:46:55 +00:00
2016-05-29 18:59:46 +00:00
Supported commands: print, stack and goroutine)
2016-04-29 18:58:19 +00:00
2016-05-29 18:59:46 +00:00
## print
Evaluate an expression.
2016-04-29 18:58:19 +00:00
2016-05-29 18:59:46 +00:00
[goroutine < n > ] [frame < m > ] print < expression >
2016-04-29 18:58:19 +00:00
2019-01-04 18:39:25 +00:00
See [Documentation/cli/expr.md ](//github.com/go-delve/delve/tree/master/Documentation/cli/expr.md ) for a description of supported expressions.
2016-04-29 18:58:19 +00:00
2016-05-29 18:59:46 +00:00
Aliases: p
2016-04-29 18:58:19 +00:00
2016-05-29 18:59:46 +00:00
## regs
Print contents of CPU registers.
2016-04-29 18:58:19 +00:00
2016-11-15 16:16:33 +00:00
regs [-a]
2018-04-18 06:46:55 +00:00
2016-11-15 16:16:33 +00:00
Argument -a shows more registers.
2016-04-29 18:58:19 +00:00
2016-05-29 18:59:46 +00:00
## restart
2017-05-05 22:17:52 +00:00
Restart process from a checkpoint or event.
2018-04-18 06:46:55 +00:00
restart [event number or checkpoint id]
2016-04-29 18:58:19 +00:00
2016-05-29 18:59:46 +00:00
Aliases: r
2016-04-29 18:58:19 +00:00
2019-07-09 01:01:00 +00:00
## rev
Reverses the execution of the target program for the command specified.
Currently, only the rev step-instruction command is supported.
2017-05-05 22:17:52 +00:00
## rewind
Run backwards until breakpoint or program termination.
Aliases: rw
2016-05-29 18:59:46 +00:00
## set
Changes the value of a variable.
2016-04-29 18:58:19 +00:00
2016-05-29 18:59:46 +00:00
[goroutine < n > ] [frame < m > ] set < variable > = < value >
2016-04-29 18:58:19 +00:00
2019-01-04 18:39:25 +00:00
See [Documentation/cli/expr.md ](//github.com/go-delve/delve/tree/master/Documentation/cli/expr.md ) for a description of supported expressions. Only numerical variables and pointers can be changed.
2016-04-29 18:58:19 +00:00
2016-05-29 18:59:46 +00:00
## source
Executes a file containing a list of delve commands
2016-04-29 18:58:19 +00:00
2016-05-29 18:59:46 +00:00
source < path >
2019-07-02 17:55:27 +00:00
If path ends with the .star extension it will be interpreted as a starlark script. See [Documentation/cli/starlark.md ](//github.com/go-delve/delve/tree/master/Documentation/cli/starlark.md ) for the syntax.
If path is a single '-' character an interactive starlark interpreter will start instead. Type 'exit' to exit.
2016-04-29 18:58:19 +00:00
2016-05-29 18:59:46 +00:00
## sources
Print list of source files.
2016-04-29 18:58:19 +00:00
2016-05-29 18:59:46 +00:00
sources [< regex > ]
2016-04-29 18:58:19 +00:00
2016-05-29 18:59:46 +00:00
If regex is specified only the source files matching it will be returned.
2016-04-29 18:58:19 +00:00
## stack
Print stack trace.
2019-09-25 17:21:20 +00:00
[goroutine < n > ] [frame < m > ] stack [< depth > ] [-full] [-offsets] [-defer] [-a < n > ] [-adepth < depth > ] [-mode < mode > ]
2018-04-18 06:46:55 +00:00
2017-08-19 20:20:47 +00:00
-full every stackframe is decorated with the value of its local variables and arguments.
2018-07-10 10:15:11 +00:00
-offsets prints frame offset of each frame.
-defer prints deferred function call stack for each frame.
2019-03-16 13:50:18 +00:00
-a < n > prints stacktrace of n ancestors of the selected goroutine (target process must have tracebackancestors enabled)
-adepth < depth > configures depth of ancestor stacktrace
2019-09-25 17:21:20 +00:00
-mode < mode > specifies the stacktrace mode, possible values are:
normal - attempts to automatically switch between cgo frames and go frames
simple - disables automatic switch between cgo and go
fromg - starts from the registers stored in the runtime.g struct
2016-04-29 18:58:19 +00:00
Aliases: bt
2016-05-29 18:59:46 +00:00
## step
Single step through program.
2016-04-29 18:58:19 +00:00
2016-05-29 18:59:46 +00:00
Aliases: s
2016-04-29 18:58:19 +00:00
2016-05-29 18:59:46 +00:00
## step-instruction
Single step a single cpu instruction.
2016-04-29 18:58:19 +00:00
2016-05-29 18:59:46 +00:00
Aliases: si
2016-04-29 18:58:19 +00:00
2016-11-15 16:16:33 +00:00
## stepout
Step out of the current function.
2019-07-31 20:09:20 +00:00
Aliases: so
2016-11-15 16:16:33 +00:00
2016-05-29 18:59:46 +00:00
## thread
Switch to the specified thread.
2016-04-29 18:58:19 +00:00
2016-05-29 18:59:46 +00:00
thread < id >
2016-04-29 18:58:19 +00:00
2016-05-29 18:59:46 +00:00
Aliases: tr
2016-04-29 18:58:19 +00:00
2016-05-29 18:59:46 +00:00
## threads
Print out info for every traced thread.
2016-04-29 18:58:19 +00:00
2016-05-29 18:59:46 +00:00
## trace
Set tracepoint.
trace [name] < linespec >
2018-04-18 06:46:55 +00:00
2019-01-04 18:39:25 +00:00
A tracepoint is a breakpoint that does not stop the execution of the program, instead when the tracepoint is hit a notification is displayed. See [Documentation/cli/locspec.md ](//github.com/go-delve/delve/tree/master/Documentation/cli/locspec.md ) for the syntax of linespec.
2016-04-29 18:58:19 +00:00
2016-05-29 18:59:46 +00:00
See also: "help on", "help cond" and "help clear"
2016-04-29 18:58:19 +00:00
2016-05-29 18:59:46 +00:00
Aliases: t
2016-04-29 18:58:19 +00:00
2016-05-29 18:59:46 +00:00
## types
Print list of types
2016-04-29 18:58:19 +00:00
2016-05-29 18:59:46 +00:00
types [< regex > ]
2016-04-29 18:58:19 +00:00
2017-06-05 21:20:10 +00:00
If regex is specified only the types matching it will be returned.
2016-04-29 18:58:19 +00:00
2018-04-18 06:46:55 +00:00
## up
Move the current frame up.
2018-08-18 08:53:21 +00:00
up [< m > ]
up [< m > ] < command >
2018-04-18 06:46:55 +00:00
Move the current frame up by < m > . The second form runs the command on the given frame.
2016-05-29 18:59:46 +00:00
## vars
Print package variables.
vars [-v] [< regex > ]
2016-04-29 18:58:19 +00:00
2016-05-29 18:59:46 +00:00
If regex is specified only package variables with a name matching it will be returned. If -v is specified more information about each package variable will be shown.
2016-11-15 16:16:33 +00:00
2017-08-09 13:55:39 +00:00
## whatis
Prints type of an expression.
2018-04-18 06:46:55 +00:00
2018-09-21 03:05:13 +00:00
whatis < expression >
2017-08-09 13:55:39 +00:00