README.md 10.5 KB
Newer Older
1 2 3 4
# Commands

Command | Description
--------|------------
5
[args](#args) | Print function arguments.
6
[break](#break) | Sets a breakpoint.
7
[breakpoints](#breakpoints) | Print out info for active breakpoints.
8
[call](#call) | Resumes process, injecting a function call (EXPERIMENTAL!!!)
9 10
[check](#check) | Creates a checkpoint at the current position.
[checkpoints](#checkpoints) | Print out info for existing checkpoints.
11
[clear](#clear) | Deletes breakpoint.
12
[clear-checkpoint](#clear-checkpoint) | Deletes checkpoint.
13
[clearall](#clearall) | Deletes multiple breakpoints.
14
[condition](#condition) | Set breakpoint condition.
A
aarzilli 已提交
15
[config](#config) | Changes configuration parameters.
16
[continue](#continue) | Run until breakpoint or program termination.
17
[deferred](#deferred) | Executes command in the context of a deferred call.
18
[disassemble](#disassemble) | Disassembler.
19
[down](#down) | Move the current frame down.
B
Ben Cotterell 已提交
20
[edit](#edit) | Open where you are in $DELVE_EDITOR or $EDITOR
21
[exit](#exit) | Exit the debugger.
22
[frame](#frame) | Set the current frame, or execute command on a different frame.
23
[funcs](#funcs) | Print list of functions.
24
[goroutine](#goroutine) | Shows or changes current goroutine
25 26 27 28 29 30
[goroutines](#goroutines) | List program goroutines.
[help](#help) | Prints the help message.
[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.
31
[print](#print) | Evaluate an expression.
32
[regs](#regs) | Print contents of CPU registers.
33 34
[restart](#restart) | Restart process from a checkpoint or event.
[rewind](#rewind) | Run backwards until breakpoint or program termination.
35
[set](#set) | Changes the value of a variable.
36
[source](#source) | Executes a file containing a list of delve commands
37
[sources](#sources) | Print list of source files.
38 39 40
[stack](#stack) | Print stack trace.
[step](#step) | Single step through program.
[step-instruction](#step-instruction) | Single step a single cpu instruction.
A
aarzilli 已提交
41
[stepout](#stepout) | Step out of the current function.
42 43 44
[thread](#thread) | Switch to the specified thread.
[threads](#threads) | Print out info for every traced thread.
[trace](#trace) | Set tracepoint.
45
[types](#types) | Print list of types
46
[up](#up) | Move the current frame up.
47
[vars](#vars) | Print package variables.
A
aarzilli 已提交
48
[whatis](#whatis) | Prints type of an expression.
49

50 51
## args
Print function arguments.
52

53 54 55
	[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.
56 57 58 59 60 61 62 63 64 65 66 67 68


## break
Sets a breakpoint.

	break [name] <linespec>

See [Documentation/cli/locspec.md](//github.com/derekparker/delve/tree/master/Documentation/cli/locspec.md) for the syntax of linespec.

See also: "help on", "help cond" and "help clear"

Aliases: b

69 70
## breakpoints
Print out info for active breakpoints.
71

72
Aliases: bp
73

74 75 76
## call
Resumes process, injecting a function call (EXPERIMENTAL!!!)
	
77 78
	call [-unsafe] <function call expression>
	
79 80
Current limitations:
- only pointers to stack-allocated objects can be passed as argument.
A
aarzilli 已提交
81
- only some automatic type conversions are supported.
82 83 84 85 86 87 88 89 90 91 92
- 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.



93 94
## check
Creates a checkpoint at the current position.
95

96 97 98 99 100 101 102 103
	checkpoint [where]

Aliases: checkpoint

## checkpoints
Print out info for existing checkpoints.


104 105
## clear
Deletes breakpoint.
106

107
	clear <breakpoint name or id>
108 109


110 111
## clear-checkpoint
Deletes checkpoint.
112

113
	clear-checkpoint <id>
114 115 116

Aliases: clearcheck

117 118
## clearall
Deletes multiple breakpoints.
119

120
	clearall [<linespec>]
121

122
If called with the linespec argument it will delete all the breakpoints matching the linespec. If linespec is omitted all breakpoints are deleted.
123 124


125 126
## condition
Set breakpoint condition.
127

128
	condition <breakpoint name or id> <boolean expression>.
129

130
Specifies that the breakpoint or tracepoint should break only if the boolean expression is true.
131

132
Aliases: cond
133

A
aarzilli 已提交
134 135
## config
Changes configuration parameters.
136

A
aarzilli 已提交
137
	config -list
138

A
aarzilli 已提交
139 140 141 142 143 144 145
Show all configuration parameters.

	config -save

Saves the configuration file to disk, overwriting the current configuration file.

	config <parameter> <value>
146

A
aarzilli 已提交
147 148
Changes the value of a configuration parameter.

J
Josh Soref 已提交
149 150
	config substitute-path <from> <to>
	config substitute-path <from>
151

J
Josh Soref 已提交
152
Adds or removes a path substitution rule.
A
aarzilli 已提交
153 154 155

	config alias <command> <alias>
	config alias <alias>
156

A
aarzilli 已提交
157 158 159
Defines <alias> as an alias to <command> or removes an alias.


160 161
## continue
Run until breakpoint or program termination.
162

163
Aliases: c
164

165 166 167 168 169 170 171 172
## 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.


173 174
## disassemble
Disassembler.
175

176
	[goroutine <n>] [frame <m>] disassemble [-a <start> <end>] [-l <locspec>]
177

178
If no argument is specified the function being executed in the selected stack frame will be executed.
179

180 181
	-a <start> <end>	disassembles the specified address range
	-l <locspec>		disassembles the specified function
182

183
Aliases: disass
184

185 186 187
## down
Move the current frame down.

188 189
	down [<m>]
	down [<m>] <command>
190 191 192 193

Move the current frame down by <m>. The second form runs the command on the given frame.


B
Ben Cotterell 已提交
194 195 196
## edit
Open where you are in $DELVE_EDITOR or $EDITOR

197 198 199 200
	edit [locspec]
	
If locspec is omitted edit will open the current source file in the editor, otherwise it will open the specified location.

B
Ben Cotterell 已提交
201 202
Aliases: ed

203 204
## exit
Exit the debugger.
205 206 207 208
		
	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.
209

210
Aliases: quit q
211

212
## frame
213
Set the current frame, or execute command on a different frame.
214

215 216
	frame <m>
	frame <m> <command>
217 218 219

The first form sets frame used by subsequent commands such as "print" or "set".
The second form runs the command on the given frame.
220 221


222 223
## funcs
Print list of functions.
224

225
	funcs [<regex>]
226

227
If regex is specified only the functions matching it will be returned.
228 229 230 231 232 233 234 235 236 237 238 239 240 241


## 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.


242 243
## goroutines
List program goroutines.
244

245
	goroutines [-u (default: user location)|-r (runtime location)|-g (go statement location)|-s (start location)] [ -t (stack trace)]
246

247
Print out info for every goroutine. The flag controls what information is shown along with each goroutine:
248

249 250 251
	-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
252
	-s	displays location of the start function
253
	-t	displays stack trace of goroutine
254

255
If no flag is specified the default is -u.
256 257


258 259
## help
Prints the help message.
260

261
	help [command]
262

263
Type "help" followed by the name of a command for more information about it.
264

265
Aliases: h
266

267 268
## list
Show source code.
269

270
	[goroutine <n>] [frame <m>] list [<linespec>]
271

272
Show source around current point or provided linespec.
273

274
Aliases: ls l
275

276 277
## locals
Print local variables.
278

279
	[goroutine <n>] [frame <m>] locals [-v] [<regex>]
280

281 282
The name of variables that are shadowed in the current scope will be shown in parenthesis.

283
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.
284 285


286 287
## next
Step over to next source line.
288

289
Aliases: n
290

291 292
## on
Executes a command when a breakpoint is hit.
293

294
	on <breakpoint name or id> <command>.
295

296
Supported commands: print, stack and goroutine)
297 298


299 300
## print
Evaluate an expression.
301

302
	[goroutine <n>] [frame <m>] print <expression>
303

304
See [Documentation/cli/expr.md](//github.com/derekparker/delve/tree/master/Documentation/cli/expr.md) for a description of supported expressions.
305

306
Aliases: p
307

308 309
## regs
Print contents of CPU registers.
310

A
aarzilli 已提交
311
	regs [-a]
312

A
aarzilli 已提交
313 314
Argument -a shows more registers.

315

316
## restart
317
Restart process from a checkpoint or event.
318 319

  restart [event number or checkpoint id]
320

321
Aliases: r
322

323 324 325 326 327
## rewind
Run backwards until breakpoint or program termination.

Aliases: rw

328 329
## set
Changes the value of a variable.
330

331
	[goroutine <n>] [frame <m>] set <variable> = <value>
332

333
See [Documentation/cli/expr.md](//github.com/derekparker/delve/tree/master/Documentation/cli/expr.md) for a description of supported expressions. Only numerical variables and pointers can be changed.
334 335


336 337
## source
Executes a file containing a list of delve commands
338

339
	source <path>
340 341


342 343
## sources
Print list of source files.
344

345
	sources [<regex>]
346

347
If regex is specified only the source files matching it will be returned.
348 349 350 351 352


## stack
Print stack trace.

353
	[goroutine <n>] [frame <m>] stack [<depth>] [-full] [-offsets] [-defer]
354

355
	-full		every stackframe is decorated with the value of its local variables and arguments.
356 357
	-offsets	prints frame offset of each frame.
	-defer		prints deferred function call stack for each frame.
358 359 360 361


Aliases: bt

362 363
## step
Single step through program.
364

365
Aliases: s
366

367 368
## step-instruction
Single step a single cpu instruction.
369

370
Aliases: si
371

A
aarzilli 已提交
372 373 374 375
## stepout
Step out of the current function.


376 377
## thread
Switch to the specified thread.
378

379
	thread <id>
380

381
Aliases: tr
382

383 384
## threads
Print out info for every traced thread.
385

386 387 388 389 390

## trace
Set tracepoint.

	trace [name] <linespec>
391

392
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/derekparker/delve/tree/master/Documentation/cli/locspec.md) for the syntax of linespec.
393

394
See also: "help on", "help cond" and "help clear"
395

396
Aliases: t
397

398 399
## types
Print list of types
400

401
	types [<regex>]
402

403
If regex is specified only the types matching it will be returned.
404 405


406 407 408
## up
Move the current frame up.

409 410
	up [<m>]
	up [<m>] <command>
411 412 413 414

Move the current frame up by <m>. The second form runs the command on the given frame.


415 416 417 418
## vars
Print package variables.

	vars [-v] [<regex>]
419

420
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.
A
aarzilli 已提交
421 422


A
aarzilli 已提交
423 424
## whatis
Prints type of an expression.
425

C
chainhelen 已提交
426
	whatis <expression>
A
aarzilli 已提交
427 428