mirror of
https://github.com/go-delve/delve.git
synced 2025-11-02 21:40:22 +08:00
committed by
Derek Parker
parent
1f1535802e
commit
a843f7944e
@ -98,7 +98,9 @@ func New() *cobra.Command {
|
||||
RootCommand.PersistentFlags().StringVar(&Backend, "backend", "default", `Backend selection:
|
||||
default Uses lldb on macOS, native everywhere else.
|
||||
native Native backend.
|
||||
lldb Uses lldb-server or debugserver.`)
|
||||
lldb Uses lldb-server or debugserver.
|
||||
rr Uses mozilla rr (https://github.com/mozilla/rr).
|
||||
`)
|
||||
|
||||
// 'attach' subcommand.
|
||||
attachCommand := &cobra.Command{
|
||||
@ -240,6 +242,29 @@ core dump was taken.`,
|
||||
}
|
||||
RootCommand.AddCommand(versionCommand)
|
||||
|
||||
if path, _ := exec.LookPath("rr"); path != "" {
|
||||
replayCommand := &cobra.Command{
|
||||
Use: "replay [trace directory]",
|
||||
Short: "Replays a rr trace.",
|
||||
Long: `Replays a rr trace.
|
||||
|
||||
The replay command will open a trace generated by mozilla rr. Mozilla rr must be installed:
|
||||
https://github.com/mozilla/rr
|
||||
`,
|
||||
PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
|
||||
if len(args) == 0 {
|
||||
return errors.New("you must provide a path to a binary")
|
||||
}
|
||||
return nil
|
||||
},
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
Backend = "rr"
|
||||
os.Exit(execute(0, []string{}, conf, args[0], executingOther))
|
||||
},
|
||||
}
|
||||
RootCommand.AddCommand(replayCommand)
|
||||
}
|
||||
|
||||
return RootCommand
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user