Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/commands: fix to read debug info file from correct directory in trace command #3405

Merged
merged 1 commit into from
Jun 6, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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