You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The symbol names currently produced by the compiler for generic function instantiations can not be parsed by debug/gosym (or any simple parser for that matter).
Parsing symbol names is further complicated by generic method instantiations:
type S[T any] struct {
x T
}
func (s *S[T]) testfunction() {
fmt.Println(s.x)
}
Will produce the symbol main.(*S[.shape.int]).testfunction, so just looking for the first . instead of the last one doesn't work either.
Referencing issue #37762 here since its making an effort to fix a bug in this area.
The text was updated successfully, but these errors were encountered:
cherrymui
changed the title
cmd/compile,debug/gosym: compiler produces symbols that gosym can not parse
cmd/compile,debug/gosym: generics: compiler produces symbols that gosym can not parse
Aug 30, 2021
@griesemer and I talked. Once some types2 change are complete that will give a better unique name for various types (in a week or two), we will discuss gosym compatibility and other issues related to naming instantiations of generic functions/methods, and come to a more formal decision on the format of names of function instantiations.
In this case, as you describe, the '.' that we are using when specifying the type args of a function instantiation is clearly confusing the current gosym code.
The symbol names currently produced by the compiler for generic function instantiations can not be parsed by debug/gosym (or any simple parser for that matter).
For example:
Produces the symbol
main.testfunction[.shape.int]
for which gosym will return:instead of:
Parsing symbol names is further complicated by generic method instantiations:
Will produce the symbol
main.(*S[.shape.int]).testfunction
, so just looking for the first.
instead of the last one doesn't work either.Referencing issue #37762 here since its making an effort to fix a bug in this area.
The text was updated successfully, but these errors were encountered: