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
2020-03-09 15:11:32 +00:00
## Running the program
Command | Description
--------|------------
[call ](#call ) | Resumes process, injecting a function call (EXPERIMENTAL!!!)
[continue ](#continue ) | Run until breakpoint or program termination.
[next ](#next ) | Step over to next source line.
2020-06-05 18:03:09 +00:00
[rebuild ](#rebuild ) | Rebuild the target executable and restarts it. It does not work if the executable was not built by delve.
2020-03-24 16:09:28 +00:00
[restart ](#restart ) | Restart process.
proc,terminal: Implement reverse step, next and stepout (#1785)
* proc: move defer breakpoint code into a function
Moves the code that sets a breakpoint on the first deferred function,
used by both next and StepOut, to its function.
* proc: implement reverse step/next/stepout
When the direction of execution is reversed (on a recording) Step, Next and
StepOut will behave similarly to their forward version. However there are
some subtle interactions between their behavior, prologue skipping, deferred
calls and normal calls. Specifically:
- when stepping backwards we need to set a breakpoint on the first
instruction after each CALL instruction, once this breakpoint is reached we
need to execute a single StepInstruction operation to reverse step into the
CALL.
- to insure that the prologue is skipped reverse next needs to check if it
is on the first instruction after the prologue, and if it is behave like
reverse stepout.
- there is no reason to set breakpoints on deferred calls when reverse
nexting or reverse stepping out, they will never be hit.
- reverse step out should generally place its breakpoint on the CALL
instruction that created the current stack frame (which will be the CALL
instruction immediately preceding the instruction at the return address).
- reverse step out needs to treat panic calls and deferreturn calls
specially.
* service,terminal: implement reverse step, next, stepout
2020-03-11 22:40:41 +00:00
[rev ](#rev ) | Reverses the execution of the target program for the command specified.
2020-03-09 15:11:32 +00:00
[rewind ](#rewind ) | Run backwards until breakpoint or program termination.
[step ](#step ) | Single step through program.
[step-instruction ](#step-instruction ) | Single step a single cpu instruction.
[stepout ](#stepout ) | Step out of the current function.
## Manipulating breakpoints
2016-04-29 18:58:19 +00:00
Command | Description
--------|------------
[break ](#break ) | Sets a breakpoint.
2016-05-29 18:59:46 +00:00
[breakpoints ](#breakpoints ) | Print out info for active breakpoints.
2016-04-29 18:58:19 +00:00
[clear ](#clear ) | Deletes breakpoint.
[clearall ](#clearall ) | Deletes multiple breakpoints.
2016-05-29 18:59:46 +00:00
[condition ](#condition ) | Set breakpoint condition.
2020-03-09 15:11:32 +00:00
[on ](#on ) | Executes a command when a breakpoint is hit.
2021-03-19 18:02:23 +00:00
[toggle ](#toggle ) | Toggles on or off a breakpoint.
2020-03-09 15:11:32 +00:00
[trace ](#trace ) | Set tracepoint.
2021-05-20 17:04:02 +00:00
[watch ](#watch ) | Set watchpoint.
2020-03-09 15:11:32 +00:00
## Viewing program variables and memory
Command | Description
--------|------------
[args ](#args ) | Print function arguments.
2020-03-19 18:58:40 +00:00
[display ](#display ) | Print value of an expression every time the program stops.
2021-07-28 11:12:51 +00:00
[examinemem ](#examinemem ) | Examine raw memory at the given address.
2020-03-09 15:11:32 +00:00
[locals ](#locals ) | Print local variables.
[print ](#print ) | Evaluate an expression.
[regs ](#regs ) | Print contents of CPU registers.
[set ](#set ) | Changes the value of a variable.
[vars ](#vars ) | Print package variables.
[whatis ](#whatis ) | Prints type of an expression.
## Listing and switching between threads and goroutines
Command | Description
--------|------------
[goroutine ](#goroutine ) | Shows or changes current goroutine
[goroutines ](#goroutines ) | List program goroutines.
[thread ](#thread ) | Switch to the specified thread.
[threads ](#threads ) | Print out info for every traced thread.
## Viewing the call stack and selecting frames
Command | Description
--------|------------
2018-07-10 10:15:11 +00:00
[deferred ](#deferred ) | Executes command in the context of a deferred call.
2018-04-18 06:46:55 +00:00
[down ](#down ) | Move the current frame down.
2020-03-09 15:11:32 +00:00
[frame ](#frame ) | Set the current frame, or execute command on a different frame.
[stack ](#stack ) | Print stack trace.
[up ](#up ) | Move the current frame up.
## Other commands
Command | Description
--------|------------
[check ](#check ) | Creates a checkpoint at the current position.
[checkpoints ](#checkpoints ) | Print out info for existing checkpoints.
[clear-checkpoint ](#clear-checkpoint ) | Deletes checkpoint.
[config ](#config ) | Changes configuration parameters.
[disassemble ](#disassemble ) | Disassembler.
2021-01-29 21:39:33 +00:00
[dump ](#dump ) | Creates a core dump from the current process state
2018-07-27 10:16:41 +00:00
[edit ](#edit ) | Open where you are in $DELVE_EDITOR or $EDITOR
2016-05-29 18:59:46 +00:00
[exit ](#exit ) | Exit the debugger.
[funcs ](#funcs ) | Print list of functions.
[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.
[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.
[types ](#types ) | Print list of types
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.
2022-01-06 16:56:21 +00:00
break [name] [linespec]
2016-04-29 18:58:19 +00:00
2022-01-06 16:56:21 +00:00
See [Documentation/cli/locspec.md ](//github.com/go-delve/delve/tree/master/Documentation/cli/locspec.md ) for the syntax of linespec. If linespec is omitted a breakpoint will be set on the current line.
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.
2021-08-09 17:41:25 +00:00
breakpoints [-a]
Specifying -a prints all physical breakpoint, including internal 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 > .
2021-06-02 20:47:32 +00:00
condition -hitcount < breakpoint name or id > < operator > < argument >
2018-04-18 06:46:55 +00:00
2021-06-02 20:47:32 +00:00
Specifies that the breakpoint, tracepoint or watchpoint should break only if the boolean expression is true.
2021-12-22 17:38:39 +00:00
See Documentation/cli/expr.md for a description of supported expressions.
2021-06-02 20:47:32 +00:00
With the -hitcount option a condition on the breakpoint hit count can be set, the following operators are supported
condition -hitcount bp > n
condition -hitcount bp >= n
condition -hitcount bp < n
condition -hitcount bp < = n
condition -hitcount bp == n
condition -hitcount bp != n
condition -hitcount bp % n
The '% n' form means we should stop at the breakpoint when the hitcount is a multiple of n.
2016-04-29 18:58:19 +00:00
2021-12-22 17:38:39 +00:00
Examples:
cond 2 i == 10 breakpoint 2 will stop when variable i equals 10
cond name runtime.curg.goid == 5 breakpoint 'name' will stop only on goroutine 5
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
2021-03-11 21:27:29 +00:00
continue [< linespec > ]
Optional linespec argument allows you to continue until a specific location is reached. The program will halt if a breakpoint is hit before reaching the specified location.
For example:
continue main.main
continue encoding/json.Marshal
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
2020-03-19 18:58:40 +00:00
## display
Print value of an expression every time the program stops.
2021-03-25 16:45:30 +00:00
display -a [%format] < expression >
2020-03-19 18:58:40 +00:00
display -d < number >
The '-a' option adds an expression to the list of expression printed every time the program stops. The '-d' option removes the specified expression from the list.
If display is called without arguments it will print the value of all expression in the list.
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.
2021-01-29 21:39:33 +00:00
## dump
Creates a core dump from the current process state
dump < output file >
The core dump is always written in ELF, even on systems (windows, macOS) where this is not customary. For environments other than linux/amd64 threads and registers are dumped in a format that only Delve can read back.
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
2021-07-28 11:12:51 +00:00
Examine raw memory at the given address.
2020-02-13 17:29:21 +00:00
Examine memory:
2020-09-11 06:21:11 +00:00
examinemem [-fmt < format > ] [-count|-len < count > ] [-size < size > ] < address >
2021-04-26 17:36:24 +00:00
examinemem [-fmt < format > ] [-count|-len < count > ] [-size < size > ] -x < expression >
2020-02-13 17:29:21 +00:00
2020-09-11 06:21:11 +00:00
Format represents the data format and the value is one of this list (default hex): bin(binary), oct(octal), dec(decimal), hex(hexadecimal), addr(address).
2020-02-13 17:29:21 +00:00
Length is the number of bytes (default 1) and must be less than or equal to 1000.
2020-09-11 06:21:11 +00:00
Address is the memory location of the target to examine. Please note '-len' is deprecated by '-count and -size'.
2021-04-26 17:36:24 +00:00
Expression can be an integer expression or pointer value of the memory location to examine.
2020-02-27 06:53:09 +00:00
For example:
2020-09-11 06:21:11 +00:00
x -fmt hex -count 20 -size 1 0xc00008af38
2021-04-26 17:36:24 +00:00
x -fmt hex -count 20 -size 1 -x 0xc00008af38 + 8
x -fmt hex -count 20 -size 1 -x & myVar
x -fmt hex -count 20 -size 1 -x myPtrVar
2020-02-13 17:29:21 +00:00
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
2021-07-01 18:25:33 +00:00
goroutines [-u|-r|-g|-s] [-t [depth]] [-l] [-with loc expr] [-without loc expr] [-group argument]
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
2021-07-01 18:25:33 +00:00
-u displays location of topmost stackframe in user code (default)
2016-05-29 18:59:46 +00:00
-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
2021-07-01 18:25:33 +00:00
-t displays goroutine's stacktrace (an optional depth value can be specified, default: 10)
2020-02-24 17:47:54 +00:00
-l displays goroutine's labels
2018-04-18 06:46:55 +00:00
2021-07-01 18:25:33 +00:00
If no flag is specified the default is -u, i.e. the first frame within the first 30 frames that is not executing a runtime private function.
FILTERING
If -with or -without are specified only goroutines that match the given condition are returned.
To only display goroutines where the specified location contains (or does not contain, for -without and -wo) expr as a substring, use:
goroutines -with (userloc|curloc|goloc|startloc) expr
goroutines -w (userloc|curloc|goloc|startloc) expr
goroutines -without (userloc|curloc|goloc|startloc) expr
goroutines -wo (userloc|curloc|goloc|startloc) expr
To only display goroutines that have (or do not have) the specified label key and value, use:
goroutines -with label key=value
goroutines -without label key=value
To only display goroutines that have (or do not have) the specified label key, use:
goroutines -with label key
goroutines -without label key
To only display goroutines that are running (or are not running) on a OS thread, use:
goroutines -with running
goroutines -without running
To only display user (or runtime) goroutines, use:
goroutines -with user
goroutines -without user
GROUPING
goroutines -group (userloc|curloc|goloc|startloc|running|user)
Groups goroutines by the given location, running status or user classification, up to 5 goroutines per group will be displayed as well as the total number of goroutines in the group.
goroutines -group label key
Groups goroutines by the value of the label with the specified key.
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
2020-05-04 16:27:55 +00:00
For example:
frame 1 list 69
list testvariables.go:10000
list main.main:30
list 40
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
2021-03-11 21:27:29 +00:00
next [count]
2019-07-30 01:04:26 +00:00
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
2021-07-22 17:16:42 +00:00
on < breakpoint name or id > < command >
on < breakpoint name or id > -edit
Supported commands: print, stack, goroutine, trace and cond.
To convert a breakpoint into a tracepoint use:
on < breakpoint name or id > trace
The command 'on < bp > cond < cond-arguments > ' is equivalent to 'cond < bp > < cond-arguments > '.
2018-04-18 06:46:55 +00:00
2021-07-22 17:16:42 +00:00
The command 'on x -edit' can be used to edit the list of commands executed when the breakpoint is hit.
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
2021-03-25 16:45:30 +00:00
[goroutine < n > ] [frame < m > ] print [%format] < expression >
2016-04-29 18:58:19 +00:00
2021-12-22 17:38:39 +00:00
See Documentation/cli/expr.md for a description of supported expressions.
2016-04-29 18:58:19 +00:00
2021-03-25 16:45:30 +00:00
The optional format argument is a format specifier, like the ones used by the fmt package. For example "print %x v" will print v as an hexadecimal number.
2016-05-29 18:59:46 +00:00
Aliases: p
2016-04-29 18:58:19 +00:00
2020-06-05 18:03:09 +00:00
## rebuild
Rebuild the target executable and restarts it. It does not work if the executable was not built by delve.
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
2021-12-22 17:38:39 +00:00
Argument -a shows more registers. Individual registers can also be displayed by 'print' and 'display'. See Documentation/cli/expr.md.
2016-11-15 16:16:33 +00:00
2016-04-29 18:58:19 +00:00
2016-05-29 18:59:46 +00:00
## restart
2020-03-24 16:09:28 +00:00
Restart process.
For recorded targets the command takes the following forms:
2021-03-12 16:49:15 +00:00
restart resets to the start of the recording
2020-08-21 14:14:02 +00:00
restart [checkpoint] resets the recording to the given checkpoint
restart -r [newargv...] [redirects...] re-records the target process
2020-03-24 16:09:28 +00:00
For live targets the command takes the following forms:
2020-08-21 14:14:02 +00:00
restart [newargv...] [redirects...] restarts the process
2020-03-24 16:09:28 +00:00
If newargv is omitted the process is restarted (or re-recorded) with the same argument vector.
If -noargs is specified instead, the argument vector is cleared.
2018-04-18 06:46:55 +00:00
2020-08-21 14:14:02 +00:00
A list of file redirections can be specified after the new argument list to override the redirections defined using the '--redirect' command line option. A syntax similar to Unix shells is used:
< input.txt redirects the standard input of the target process from input . txt
>output.txt redirects the standard output of the target process to output.txt
2>error.txt redirects the standard error of the target process to error.txt
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
2021-12-22 17:38:39 +00:00
See 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
2021-03-19 18:02:23 +00:00
## toggle
Toggles on or off a breakpoint.
toggle < breakpoint name or id >
2016-05-29 18:59:46 +00:00
## trace
Set tracepoint.
2022-01-06 16:56:21 +00:00
trace [name] [linespec]
2018-04-18 06:46:55 +00:00
2022-01-06 16:56:21 +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. If linespec is omitted a tracepoint will be set on the current line.
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
2021-05-20 17:04:02 +00:00
## watch
Set watchpoint.
watch [-r|-w|-rw] < expr >
-r stops when the memory location is read
-w stops when the memory location is written
-rw stops when the memory location is read or written
The memory location is specified with the same expression language used by 'print', for example:
watch v
will watch the address of variable 'v'.
2021-10-04 21:45:05 +00:00
Note that writes that do not change the value of the watched memory address might not be reported.
2021-05-20 17:04:02 +00:00
See also: "help print".
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