Documentation: document runtime.curg and runtime.frameoff (#2835)

This commit is contained in:
Alessandro Arzilli 2021-12-22 18:38:39 +01:00 committed by GitHub
parent b81f618fb3
commit 07bcf0cb13
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 29 additions and 7 deletions

@ -182,6 +182,8 @@ Set breakpoint condition.
Specifies that the breakpoint, tracepoint or watchpoint should break only if the boolean expression is true.
See Documentation/cli/expr.md for a description of supported expressions.
With the -hitcount option a condition on the breakpoint hit count can be set, the following operators are supported
condition -hitcount bp > n
@ -194,6 +196,11 @@ With the -hitcount option a condition on the breakpoint hit count can be set, th
The '% n' form means we should stop at the breakpoint when the hitcount is a multiple of n.
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
Aliases: cond
## config
@ -489,7 +496,7 @@ Evaluate an expression.
[goroutine <n>] [frame <m>] print [%format] <expression>
See [Documentation/cli/expr.md](//github.com/go-delve/delve/tree/master/Documentation/cli/expr.md) for a description of supported expressions.
See Documentation/cli/expr.md for a description of supported expressions.
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.
@ -504,7 +511,7 @@ Print contents of CPU registers.
regs [-a]
Argument -a shows more registers. Individual registers can also be displayed by 'print' and 'display'. See [Documentation/cli/expr.md.](//github.com/go-delve/delve/tree/master/Documentation/cli/expr.md.)
Argument -a shows more registers. Individual registers can also be displayed by 'print' and 'display'. See Documentation/cli/expr.md.
## restart
@ -547,7 +554,7 @@ Changes the value of a variable.
[goroutine <n>] [frame <m>] set <variable> = <value>
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.
See Documentation/cli/expr.md for a description of supported expressions. Only numerical variables and pointers can be changed.
## source

@ -14,6 +14,13 @@ Delve can evaluate a subset of go expression language, specifically the followin
- Calls to builtin functions: `cap`, `len`, `complex`, `imag` and `real`
- Type assertion on interface variables (i.e. `somevar.(concretetype)`)
# Special Variables
Delve defines two special variables:
* `runtime.curg` evaluates to the 'g' struct for the current goroutine, in particular `runtime.curg.goid` is the goroutine id of the current goroutine.
* `runtime.frameoff` is the offset of the frame's base address from the bottom of the stack.
# Nesting limit
When delve evaluates a memory address it will automatically return the value of nested struct members, array and slice items and dereference pointers.
@ -129,3 +136,4 @@ Because many architectures have SIMD registers that can be used by the applicati
* `REGNAME.floatN` returns the register REGNAME as an array fo floatN elements.
In all cases N must be a power of 2.

@ -300,7 +300,7 @@ Specifying -a prints all physical breakpoint, including internal breakpoints.`},
[goroutine <n>] [frame <m>] print [%format] <expression>
See $GOPATH/src/github.com/go-delve/delve/Documentation/cli/expr.md for a description of supported expressions.
See Documentation/cli/expr.md for a description of supported expressions.
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.`},
{aliases: []string{"whatis"}, group: dataCmds, cmdFn: whatisCommand, helpMsg: `Prints type of an expression.
@ -310,7 +310,7 @@ The optional format argument is a format specifier, like the ones used by the fm
[goroutine <n>] [frame <m>] set <variable> = <value>
See $GOPATH/src/github.com/go-delve/delve/Documentation/cli/expr.md for a description of supported expressions. Only numerical variables and pointers can be changed.`},
See Documentation/cli/expr.md for a description of supported expressions. Only numerical variables and pointers can be changed.`},
{aliases: []string{"sources"}, cmdFn: sources, helpMsg: `Print list of source files.
sources [<regex>]
@ -347,7 +347,7 @@ If regex is specified only package variables with a name matching it will be ret
regs [-a]
Argument -a shows more registers. Individual registers can also be displayed by 'print' and 'display'. See $GOPATH/src/github.com/go-delve/delve/Documentation/cli/expr.md.`},
Argument -a shows more registers. Individual registers can also be displayed by 'print' and 'display'. See Documentation/cli/expr.md.`},
{aliases: []string{"exit", "quit", "q"}, cmdFn: exitCommand, helpMsg: `Exit the debugger.
exit [-c]
@ -454,6 +454,8 @@ The command 'on x -edit' can be used to edit the list of commands executed when
Specifies that the breakpoint, tracepoint or watchpoint should break only if the boolean expression is true.
See Documentation/cli/expr.md for a description of supported expressions.
With the -hitcount option a condition on the breakpoint hit count can be set, the following operators are supported
condition -hitcount bp > n
@ -464,7 +466,12 @@ With the -hitcount option a condition on the breakpoint hit count can be set, th
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.`},
The '% n' form means we should stop at the breakpoint when the hitcount is a multiple of n.
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
`},
{aliases: []string{"config"}, cmdFn: configureCmd, helpMsg: `Changes configuration parameters.
config -list