dlv/cmds: Improve subcommand help output
This commit is contained in:
parent
58738c969e
commit
93d82ca8d2
@ -28,11 +28,11 @@ The goal of this tool is to provide a simple yet powerful interface for debuggin
|
|||||||
### SEE ALSO
|
### SEE ALSO
|
||||||
* [dlv attach](dlv_attach.md) - Attach to running process and begin debugging.
|
* [dlv attach](dlv_attach.md) - Attach to running process and begin debugging.
|
||||||
* [dlv connect](dlv_connect.md) - Connect to a headless debug server.
|
* [dlv connect](dlv_connect.md) - Connect to a headless debug server.
|
||||||
* [dlv debug](dlv_debug.md) - Compile and begin debugging program.
|
* [dlv debug](dlv_debug.md) - Compile and begin debugging main package in current directory, or the package specified
|
||||||
* [dlv exec](dlv_exec.md) - Runs precompiled binary, attaches and begins debug session.
|
* [dlv exec](dlv_exec.md) - Execute a precompiled binary, and begin a debug session.
|
||||||
* [dlv run](dlv_run.md) - Deprecated command. Use 'debug' instead.
|
* [dlv run](dlv_run.md) - Deprecated command. Use 'debug' instead.
|
||||||
* [dlv test](dlv_test.md) - Compile test binary and begin debugging program.
|
* [dlv test](dlv_test.md) - Compile test binary and begin debugging program.
|
||||||
* [dlv trace](dlv_trace.md) - Compile and begin tracing program.
|
* [dlv trace](dlv_trace.md) - Compile and begin tracing program.
|
||||||
* [dlv version](dlv_version.md) - Prints version.
|
* [dlv version](dlv_version.md) - Prints version.
|
||||||
|
|
||||||
###### Auto generated by spf13/cobra on 11-Apr-2016
|
###### Auto generated by spf13/cobra on 20-May-2016
|
||||||
|
|||||||
@ -5,7 +5,12 @@ Attach to running process and begin debugging.
|
|||||||
### Synopsis
|
### Synopsis
|
||||||
|
|
||||||
|
|
||||||
Attach to running process and begin debugging.
|
Attach to an already running process and begin debugging it.
|
||||||
|
|
||||||
|
This command will cause Delve to take control of an already running process, and
|
||||||
|
begin a new debug session. When exiting the debug session you will have the
|
||||||
|
option to let the process continue or kill it.
|
||||||
|
|
||||||
|
|
||||||
```
|
```
|
||||||
dlv attach pid
|
dlv attach pid
|
||||||
@ -26,4 +31,4 @@ dlv attach pid
|
|||||||
### SEE ALSO
|
### SEE ALSO
|
||||||
* [dlv](dlv.md) - Delve is a debugger for the Go programming language.
|
* [dlv](dlv.md) - Delve is a debugger for the Go programming language.
|
||||||
|
|
||||||
###### Auto generated by spf13/cobra on 11-Apr-2016
|
###### Auto generated by spf13/cobra on 20-May-2016
|
||||||
|
|||||||
@ -5,7 +5,7 @@ Connect to a headless debug server.
|
|||||||
### Synopsis
|
### Synopsis
|
||||||
|
|
||||||
|
|
||||||
Connect to a headless debug server.
|
Connect to a running headless debug server.
|
||||||
|
|
||||||
```
|
```
|
||||||
dlv connect addr
|
dlv connect addr
|
||||||
@ -26,4 +26,4 @@ dlv connect addr
|
|||||||
### SEE ALSO
|
### SEE ALSO
|
||||||
* [dlv](dlv.md) - Delve is a debugger for the Go programming language.
|
* [dlv](dlv.md) - Delve is a debugger for the Go programming language.
|
||||||
|
|
||||||
###### Auto generated by spf13/cobra on 11-Apr-2016
|
###### Auto generated by spf13/cobra on 20-May-2016
|
||||||
|
|||||||
@ -1,12 +1,16 @@
|
|||||||
## dlv debug
|
## dlv debug
|
||||||
|
|
||||||
Compile and begin debugging program.
|
Compile and begin debugging main package in current directory, or the package specified
|
||||||
|
|
||||||
### Synopsis
|
### Synopsis
|
||||||
|
|
||||||
|
|
||||||
Compiles your program with optimizations disabled,
|
Compiles your program with optimizations disabled, starts and attaches to it.
|
||||||
starts and attaches to it, and enables you to immediately begin debugging your program.
|
|
||||||
|
By default, with no arguments, Delve will compile the 'main' package in the
|
||||||
|
current directory, and begin to debug it. Alternatively you can specify a
|
||||||
|
package name and Delve will compile that package instead, and begin a new debug
|
||||||
|
session.
|
||||||
|
|
||||||
```
|
```
|
||||||
dlv debug [package]
|
dlv debug [package]
|
||||||
@ -27,4 +31,4 @@ dlv debug [package]
|
|||||||
### SEE ALSO
|
### SEE ALSO
|
||||||
* [dlv](dlv.md) - Delve is a debugger for the Go programming language.
|
* [dlv](dlv.md) - Delve is a debugger for the Go programming language.
|
||||||
|
|
||||||
###### Auto generated by spf13/cobra on 11-Apr-2016
|
###### Auto generated by spf13/cobra on 20-May-2016
|
||||||
|
|||||||
@ -1,11 +1,16 @@
|
|||||||
## dlv exec
|
## dlv exec
|
||||||
|
|
||||||
Runs precompiled binary, attaches and begins debug session.
|
Execute a precompiled binary, and begin a debug session.
|
||||||
|
|
||||||
### Synopsis
|
### Synopsis
|
||||||
|
|
||||||
|
|
||||||
Runs precompiled binary, attaches and begins debug session.
|
Execute a precompiled binary and begin a debug session.
|
||||||
|
|
||||||
|
This command will cause Delve to exec the binary and immediately attach to it to
|
||||||
|
begin a new debug session. Please note that if the binary was not compiled with
|
||||||
|
optimizations disabled, it may be difficult to properly debug it. Please
|
||||||
|
consider compiling debugging binaries with -gcflags="-N -l".
|
||||||
|
|
||||||
```
|
```
|
||||||
dlv exec [./path/to/binary]
|
dlv exec [./path/to/binary]
|
||||||
@ -26,4 +31,4 @@ dlv exec [./path/to/binary]
|
|||||||
### SEE ALSO
|
### SEE ALSO
|
||||||
* [dlv](dlv.md) - Delve is a debugger for the Go programming language.
|
* [dlv](dlv.md) - Delve is a debugger for the Go programming language.
|
||||||
|
|
||||||
###### Auto generated by spf13/cobra on 11-Apr-2016
|
###### Auto generated by spf13/cobra on 20-May-2016
|
||||||
|
|||||||
@ -26,4 +26,4 @@ dlv run
|
|||||||
### SEE ALSO
|
### SEE ALSO
|
||||||
* [dlv](dlv.md) - Delve is a debugger for the Go programming language.
|
* [dlv](dlv.md) - Delve is a debugger for the Go programming language.
|
||||||
|
|
||||||
###### Auto generated by spf13/cobra on 11-Apr-2016
|
###### Auto generated by spf13/cobra on 20-May-2016
|
||||||
|
|||||||
@ -5,7 +5,12 @@ Compile test binary and begin debugging program.
|
|||||||
### Synopsis
|
### Synopsis
|
||||||
|
|
||||||
|
|
||||||
Compiles a test binary with optimizations disabled, starts and attaches to it, and enable you to immediately begin debugging your program.
|
Compiles a test binary with optimizations disabled and begins a new debug session.
|
||||||
|
|
||||||
|
The test command allows you to begin a new debug session in the context of your
|
||||||
|
unit tests. By default Delve will debug the tests in the current directory.
|
||||||
|
Alternatively you can specify a package name, and Delve will debug the tests in
|
||||||
|
that package instead.
|
||||||
|
|
||||||
```
|
```
|
||||||
dlv test [package]
|
dlv test [package]
|
||||||
@ -26,4 +31,4 @@ dlv test [package]
|
|||||||
### SEE ALSO
|
### SEE ALSO
|
||||||
* [dlv](dlv.md) - Delve is a debugger for the Go programming language.
|
* [dlv](dlv.md) - Delve is a debugger for the Go programming language.
|
||||||
|
|
||||||
###### Auto generated by spf13/cobra on 11-Apr-2016
|
###### Auto generated by spf13/cobra on 20-May-2016
|
||||||
|
|||||||
@ -5,7 +5,12 @@ Compile and begin tracing program.
|
|||||||
### Synopsis
|
### Synopsis
|
||||||
|
|
||||||
|
|
||||||
Trace program execution. Will set a tracepoint on every function matching the provided regular expression and output information when tracepoint is hit.
|
Trace program execution.
|
||||||
|
|
||||||
|
The trace sub command will set a tracepoint on every function matching the
|
||||||
|
provided regular expression and output information when tracepoint is hit. This
|
||||||
|
is useful if you do not want to begin an entire debug session, but merely want
|
||||||
|
to know what functions your process is executing.
|
||||||
|
|
||||||
```
|
```
|
||||||
dlv trace [package] regexp
|
dlv trace [package] regexp
|
||||||
@ -33,4 +38,4 @@ dlv trace [package] regexp
|
|||||||
### SEE ALSO
|
### SEE ALSO
|
||||||
* [dlv](dlv.md) - Delve is a debugger for the Go programming language.
|
* [dlv](dlv.md) - Delve is a debugger for the Go programming language.
|
||||||
|
|
||||||
###### Auto generated by spf13/cobra on 11-Apr-2016
|
###### Auto generated by spf13/cobra on 20-May-2016
|
||||||
|
|||||||
@ -26,4 +26,4 @@ dlv version
|
|||||||
### SEE ALSO
|
### SEE ALSO
|
||||||
* [dlv](dlv.md) - Delve is a debugger for the Go programming language.
|
* [dlv](dlv.md) - Delve is a debugger for the Go programming language.
|
||||||
|
|
||||||
###### Auto generated by spf13/cobra on 11-Apr-2016
|
###### Auto generated by spf13/cobra on 20-May-2016
|
||||||
|
|||||||
@ -89,7 +89,12 @@ func New() *cobra.Command {
|
|||||||
attachCommand := &cobra.Command{
|
attachCommand := &cobra.Command{
|
||||||
Use: "attach pid",
|
Use: "attach pid",
|
||||||
Short: "Attach to running process and begin debugging.",
|
Short: "Attach to running process and begin debugging.",
|
||||||
Long: "Attach to running process and begin debugging.",
|
Long: `Attach to an already running process and begin debugging it.
|
||||||
|
|
||||||
|
This command will cause Delve to take control of an already running process, and
|
||||||
|
begin a new debug session. When exiting the debug session you will have the
|
||||||
|
option to let the process continue or kill it.
|
||||||
|
`,
|
||||||
PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
|
PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
|
||||||
if len(args) == 0 {
|
if len(args) == 0 {
|
||||||
return errors.New("you must provide a PID")
|
return errors.New("you must provide a PID")
|
||||||
@ -104,7 +109,7 @@ func New() *cobra.Command {
|
|||||||
connectCommand := &cobra.Command{
|
connectCommand := &cobra.Command{
|
||||||
Use: "connect addr",
|
Use: "connect addr",
|
||||||
Short: "Connect to a headless debug server.",
|
Short: "Connect to a headless debug server.",
|
||||||
Long: "Connect to a headless debug server.",
|
Long: "Connect to a running headless debug server.",
|
||||||
PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
|
PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
|
||||||
if len(args) == 0 {
|
if len(args) == 0 {
|
||||||
return errors.New("you must provide an address as the first argument")
|
return errors.New("you must provide an address as the first argument")
|
||||||
@ -118,9 +123,13 @@ func New() *cobra.Command {
|
|||||||
// 'debug' subcommand.
|
// 'debug' subcommand.
|
||||||
debugCommand := &cobra.Command{
|
debugCommand := &cobra.Command{
|
||||||
Use: "debug [package]",
|
Use: "debug [package]",
|
||||||
Short: "Compile and begin debugging program.",
|
Short: "Compile and begin debugging main package in current directory, or the package specified",
|
||||||
Long: `Compiles your program with optimizations disabled,
|
Long: `Compiles your program with optimizations disabled, starts and attaches to it.
|
||||||
starts and attaches to it, and enables you to immediately begin debugging your program.`,
|
|
||||||
|
By default, with no arguments, Delve will compile the 'main' package in the
|
||||||
|
current directory, and begin to debug it. Alternatively you can specify a
|
||||||
|
package name and Delve will compile that package instead, and begin a new debug
|
||||||
|
session.`,
|
||||||
Run: debugCmd,
|
Run: debugCmd,
|
||||||
}
|
}
|
||||||
RootCommand.AddCommand(debugCommand)
|
RootCommand.AddCommand(debugCommand)
|
||||||
@ -128,7 +137,13 @@ starts and attaches to it, and enables you to immediately begin debugging your p
|
|||||||
// 'exec' subcommand.
|
// 'exec' subcommand.
|
||||||
execCommand := &cobra.Command{
|
execCommand := &cobra.Command{
|
||||||
Use: "exec [./path/to/binary]",
|
Use: "exec [./path/to/binary]",
|
||||||
Short: "Runs precompiled binary, attaches and begins debug session.",
|
Short: "Execute a precompiled binary, and begin a debug session.",
|
||||||
|
Long: `Execute a precompiled binary and begin a debug session.
|
||||||
|
|
||||||
|
This command will cause Delve to exec the binary and immediately attach to it to
|
||||||
|
begin a new debug session. Please note that if the binary was not compiled with
|
||||||
|
optimizations disabled, it may be difficult to properly debug it. Please
|
||||||
|
consider compiling debugging binaries with -gcflags="-N -l".`,
|
||||||
PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
|
PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
|
||||||
if len(args) == 0 {
|
if len(args) == 0 {
|
||||||
return errors.New("you must provide a path to a binary")
|
return errors.New("you must provide a path to a binary")
|
||||||
@ -156,7 +171,12 @@ starts and attaches to it, and enables you to immediately begin debugging your p
|
|||||||
testCommand := &cobra.Command{
|
testCommand := &cobra.Command{
|
||||||
Use: "test [package]",
|
Use: "test [package]",
|
||||||
Short: "Compile test binary and begin debugging program.",
|
Short: "Compile test binary and begin debugging program.",
|
||||||
Long: `Compiles a test binary with optimizations disabled, starts and attaches to it, and enable you to immediately begin debugging your program.`,
|
Long: `Compiles a test binary with optimizations disabled and begins a new debug session.
|
||||||
|
|
||||||
|
The test command allows you to begin a new debug session in the context of your
|
||||||
|
unit tests. By default Delve will debug the tests in the current directory.
|
||||||
|
Alternatively you can specify a package name, and Delve will debug the tests in
|
||||||
|
that package instead.`,
|
||||||
Run: testCmd,
|
Run: testCmd,
|
||||||
}
|
}
|
||||||
RootCommand.AddCommand(testCommand)
|
RootCommand.AddCommand(testCommand)
|
||||||
@ -165,7 +185,12 @@ starts and attaches to it, and enables you to immediately begin debugging your p
|
|||||||
traceCommand := &cobra.Command{
|
traceCommand := &cobra.Command{
|
||||||
Use: "trace [package] regexp",
|
Use: "trace [package] regexp",
|
||||||
Short: "Compile and begin tracing program.",
|
Short: "Compile and begin tracing program.",
|
||||||
Long: "Trace program execution. Will set a tracepoint on every function matching the provided regular expression and output information when tracepoint is hit.",
|
Long: `Trace program execution.
|
||||||
|
|
||||||
|
The trace sub command will set a tracepoint on every function matching the
|
||||||
|
provided regular expression and output information when tracepoint is hit. This
|
||||||
|
is useful if you do not want to begin an entire debug session, but merely want
|
||||||
|
to know what functions your process is executing.`,
|
||||||
Run: traceCmd,
|
Run: traceCmd,
|
||||||
}
|
}
|
||||||
traceCommand.Flags().IntVarP(&traceAttachPid, "pid", "p", 0, "Pid to attach to.")
|
traceCommand.Flags().IntVarP(&traceAttachPid, "pid", "p", 0, "Pid to attach to.")
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user