-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
print pointer value of pointer expressions #3451
Comments
Something like this was already done in #3448 (weird that we'd have two requests for the same feature a week apart).
I don't understand what this means. It should indeed work for arbitrary expressions or interfaces. |
When I tried debugging an unrecovered panic I faced the follow problem after going up the stack several layers:
This is what I meant with "does not work in all contexts". I'm not sure if this is a bug or intented behavior but something that means the work around does not work in all cases. |
|
Thanks. This seems to work. Is this documented somewhere? Anyway, I still think this would not be needed if delve would just print the pointer value by default. |
https://github.com/go-delve/delve/blob/master/Documentation/cli/expr.md#interfaces
The next version of delve will print it with just |
Just to be clear. This issue is primarily about expressions of pointer type not interfaces. Do I understand your last comment correctly that you are rejecting this feature request? I think it is the wrong default to not print the pointer value of an expression pointer type (not interface). I think this is inconsistent with how e.g. fmt.Printf with I don't think that adding the pointer value to the output makes the output to busy because for scalar types the output is already only a single line and it would stay a single line. I think printing the pointer value and the pointed-to value be default is correct and users don't want to have the pointer value they can dereference the expression to only get the pointed to value. |
Looking at the other issue it seems this was already implemented. Thanks and sorry for the noise. |
What version of Delve are you using (
dlv version
)?What version of Go are you using? (
go version
)?go version built from HEAD
What operating system and processor architecture are you using?
linux/amd64
What did you do?
Compile https://go.dev/play/p/Sth1ADkMLj5
What did you expect to see?
I would like to see the actual pointer value of a pointer based expression in addition the the pointed-to value as I suggested in the What did you expect to see?. I don't mind the concrete formatting but printing the concrete pointer value would be a great addition.
For pure variables you can work around this by using something like
p %x uintptr(var)
but this does not work for arbitrary expression or interfaces.The text was updated successfully, but these errors were encountered: