Skip to content

Commit

Permalink
cmd/commands: Fix to read debug info file from the correct directory …
Browse files Browse the repository at this point in the history
…when using trace command with -e option. (#3405)
  • Loading branch information
nozzy123nozzy authored Jun 6, 2023
1 parent 7603e46 commit 8b9c3a9
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions cmd/dlv/cmds/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,8 @@ to know what functions your process is executing.
The output of the trace sub command is printed to stderr, so if you would like to
only see the output of the trace operations you can redirect stdout.`,
Run: traceCmd,
Run: func(cmd *cobra.Command, args []string) {
os.Exit(traceCmd(cmd, args, conf)) },
}
traceCommand.Flags().IntVarP(&traceAttachPid, "pid", "p", 0, "Pid to attach to.")
traceCommand.Flags().StringVarP(&traceExecFile, "exec", "e", "", "Binary file to exec and trace.")
Expand Down Expand Up @@ -574,7 +575,7 @@ func debugCmd(cmd *cobra.Command, args []string) {
os.Exit(status)
}

func traceCmd(cmd *cobra.Command, args []string) {
func traceCmd(cmd *cobra.Command, args []string, conf *config.Config) int {
status := func() int {
err := logflags.Setup(log, logOutput, logDest)
defer logflags.Close()
Expand Down Expand Up @@ -648,6 +649,7 @@ func traceCmd(cmd *cobra.Command, args []string) {
WorkingDir: workingDir,
Backend: backend,
CheckGoVersion: checkGoVersion,
DebugInfoDirectories: conf.DebugInfoDirectories,
},
})
if err := server.Run(); err != nil {
Expand Down Expand Up @@ -769,7 +771,7 @@ func traceCmd(cmd *cobra.Command, args []string) {
}
return 0
}()
os.Exit(status)
return status
}

func isBreakpointExistsErr(err error) bool {
Expand Down

0 comments on commit 8b9c3a9

Please sign in to comment.