dlv/main: Add exec subcommand to debug existing binary

Added subcommand which takes a path to an existing binary, starts it,
and begins a debug session.
This commit is contained in:
Derek Parker 2015-08-19 18:01:47 -05:00
parent 32b499fa47
commit 71845350a0

@ -95,6 +95,16 @@ starts and attaches to it, and enables you to immediately begin debugging your p
}
rootCommand.AddCommand(debugCommand)
// 'exec' subcommand.
execCommand := &cobra.Command{
Use: "exec [./path/to/binary]",
Short: "Runs precompiled binary, attaches and begins debug session.",
Run: func(cmd *cobra.Command, args []string) {
os.Exit(execute(0, args))
},
}
rootCommand.AddCommand(execCommand)
// 'trace' subcommand.
var traceAttachPid int
traceCommand := &cobra.Command{