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

Can dlv trace print the value of the arguments passed to a function? #3586

Open
aojea opened this issue Nov 27, 2023 · 4 comments
Open

Can dlv trace print the value of the arguments passed to a function? #3586

aojea opened this issue Nov 27, 2023 · 4 comments

Comments

@aojea
Copy link

aojea commented Nov 27, 2023

  1. What version of Delve are you using (dlv version)?
Delve Debugger
Version: 1.21.2
Build: $Id: 98f8ab2662d926245917ade2f2bb38277315c7fc $
  1. What version of Go are you using? (go version)?

1.21.3

  1. What operating system and processor architecture are you using?

Linux x86

  1. What did you do?
dlv trace . k8s.io --timestamp=true 
  1. What did you expect to see?

The values of the parameters passed to the function

  1. What did you see instead?
2023-11-27T14:56:54.338358579-08:00 > goroutine(1): main.(*repoSync).SetupDefaultGitConfigs((*main.repoSync)(0xc000099040), context.Context(*context.timerCtx) 0xb
eef000000000108)
2023-11-27T14:56:54.340307306-08:00 > goroutine(1): main.(*repoSync).Run((*main.repoSync)(0xc000099040), context.Context(*context.timerCtx) 0xbeef000000000108, "", []string len: 4, cap: 4, [...])
2023-11-27T14:56:54.3420434-08:00 > goroutine(1): [k8s.io/git-sync/pkg/cmd.Runner.WithCallDepth(k8s.io/git-sync/pkg/cmd.Runner](http://k8s.io/git-sync/pkg/cmd.Runner.WithCallDepth%28k8s.io/git-sync/pkg/cmd.Runner) {log: [k8s.io/git-sync/pkg/cmd.logintf(*k8s.io/git-sync/pkg/logging.Logger)](http://k8s.io/git-sync/pkg/cmd.logintf%28*k8s.io/git-sync/pkg/logging.Logger%29) ...}, 1)
@thockin
Copy link
Contributor

thockin commented Nov 27, 2023

In particular, that []string is pretty important:)

@aarzilli
Copy link
Member

The trace subcommand can't do that, however the trace cli command creates a tracepoint that can be manipulated using the on command to print extra variables.

@thockin
Copy link
Contributor

thockin commented Nov 29, 2023

Should the trace command have some way to do this? Without the arguments, tracing function calls is a lot less helpful.

I am not sure exactly how one would express this, but... something?

@aarzilli
Copy link
Member

Without the arguments, tracing function calls is a lot less helpful.

It does print arguments, but to a limited extent.

I am not sure exactly how one would express this, but... something?

Neither am I.

I don't think just changing the variable depth would be useful, because it applies to everything and it would probably be too noisy and make the trace unreadable. If you make the configuration more fine grained eventually you will get something like the cli command trace (but that already exists).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants