-
Notifications
You must be signed in to change notification settings - Fork 619
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
pprof: symbolize mishandles the names of methods of parameterized Go types #705
Comments
I think that detection of Dot will need to handle There is another wrinkle here too, in that the actual symbol names look something like I took a look at the demangled symbols in a large C++ binary, and every instance of square brackets fell into one of two categories:
Neither of these patterns would appear in Go symbols, so we could match on either of these in |
Here are some other cases where square brackets will appear in demangled C++ names. I don't know whether they matter.
|
For the curious: `bar(int (*) [5])` is a pointer to an array of length 5: typedef int IntArray[5]; int bar(IntArray* arr); For google#705.
Go symbols with type parameters are reported in Go pprof profiles as something like `main.Set[...]`. Today, multilinePrintableName mishandles this by replacing each with a newline, resulting in a very strange looking node. Instead, replace ... with a unicode ellipsis so that it isn't replaced with a newline just below. Note that the full symbol name (which is reported by tools like perf) is something like `[go.shape.string_0,go.shape.int_1]`. This case is still not handled very well, but we likely want to strip this out anyways in ShortenFunctionName or demangling as future work. Fixes google#705.
Oof, wow. I, uh, love C++. #717 handles only the two cases I described. The others will not be detected as C++, so function parameters and type parameters would not be removed when simplifying names (https://github.com/golang/go/blob/master/src/cmd/vendor/github.com/google/pprof/internal/symbolizer/symbolizer.go#L231). I am also unsure how important these are either. This code is also only relevant if the profile contains symbol names that are already demangled, and it is unclear to me how common that is. I can also support a few more of these, but some like |
Go symbols with type parameters are reported in Go pprof profiles as something like `main.Set[...]`. Today, multilinePrintableName mishandles this by replacing each with a newline, resulting in a very strange looking node. Instead, replace ... with a unicode ellipsis so that it isn't replaced with a newline just below. Note that the full symbol name (which is reported by tools like perf) is something like `[go.shape.string_0,go.shape.int_1]`. This case is still not handled very well, but we likely want to strip this out anyways in ShortenFunctionName or demangling as future work. Fixes google#705.
* internal/symbolizer: add unit tests for Demangle For the curious: `bar(int (*) [5])` is a pointer to an array of length 5: typedef int IntArray[5]; int bar(IntArray* arr); For #705. * internal/symbolizer: avoid matching generic Go symbols as C++ For #705. * internal/graph: keep Go type parameter ellipsis in dot Go symbols with type parameters are reported in Go pprof profiles as something like `main.Set[...]`. Today, multilinePrintableName mishandles this by replacing each with a newline, resulting in a very strange looking node. Instead, replace ... with a unicode ellipsis so that it isn't replaced with a newline just below. Note that the full symbol name (which is reported by tools like perf) is something like `[go.shape.string_0,go.shape.int_1]`. This case is still not handled very well, but we likely want to strip this out anyways in ShortenFunctionName or demangling as future work. Fixes #705.
Using the version of pprof vendored in Go, the names of parameterized functions are mishandled so that a function named
pkg.(*T[...]).f
is rendered in SVG view aspkg \n \n f
. The reason for the mishandling is that the C++ heuristic in Symbolize spuriously matches the square brackets, causing the parenthesized type name portion(*T[...])
to be removed.This appears to be an effective workaround, but perhaps one can do better:
Before:

With workaround:
@ianlancetaylor
The text was updated successfully, but these errors were encountered: