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:
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)
|
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.
|
// 'trace' subcommand.
|
||||||
var traceAttachPid int
|
var traceAttachPid int
|
||||||
traceCommand := &cobra.Command{
|
traceCommand := &cobra.Command{
|
||||||
|
Loading…
Reference in New Issue
Block a user