-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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
runtime/pprof: better generic type information in pprof stack traces #68196
Comments
Similar Issues (Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.) |
Good bot :). Based on the discussion in this issue, I understand that it might not be possible to do what's being suggested here. If that's the case I'd still suggest to leave the issue open for a bit to see how many Go users care about this problem. |
Taking this out of the proposal process. |
In particular, what I'd like to add is that if the definition of the generic type in question is constrained on an interface, the debug information could at least contain that interface name. (In my particular case that I reported to @felixge this was true.) Also I'm curious when there are different implementations of the interface, and the structure is like this:
Will the compiler ever generate different implementations of the various methods on |
Just brainstorming, but I think theoretically traceback could, upon encountering a type-parameterized function, look for the dictionary argument (assuming it is still live) and extracting the real type parameters. This would make traceback more expensive, but I think the dictionary does always contain the real types. I think we'd also want to use both the |
cc @golang/runtime |
Proposal Details
tl;dr: Can we show something more descriptive than
go.shape.*uint8
for generic methods invoked on a struct pointer Maybego.shape.uintptr
or the element type?While profiling is primarily seen as a performance tool, we often see it used for understanding the control flow of Go applications at runtime. In particular, profiling can be very useful to reveal which concrete types are being invoked behind an interface or a generic function call.
In one particular case @g-talbot recently tried to figure out the concrete type parameter for a generic function call, and to our surprise we saw the type being called
go.shape.*uint8
which was confusing since it doesn't correspond to any of the types satisfying the type constraints of the generic functions. We would have expected to see something more like*SomeStruct
instead.After a bit of digging, my colleague @nsrip-dd discovered that this output is probably intentional (source), but we're wondering if it could be made more user-friendly. Either by clarifying that the type is an unknown pointer type (
go.shape.uintptr
) or by showing the actual type.Below is a minimal example that shows how to end up with a
go.shape.*uint8
inside of a CPU profile:We understand that the current displayed type probably makes a lot of sense from the compiler's perspective, but seeing a
uint8
type as a placeholder for a pointer type on a 64 bit system was confusing to us.The text was updated successfully, but these errors were encountered: