-
Notifications
You must be signed in to change notification settings - Fork 18k
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: <autogenerated> elimination breaks some uses of runtime.CallersFrames
#22231
Comments
I suspect this could interact badly with embedded methods too. For example, the program in https://play.golang.org/p/xeyW_fDeo9 dereferences a nil pointer in an autogenerated method (see #18617), which might result in a panic trace showing no frames. |
(And the workaround of using |
That's a good example. Amusingly, when run on tip we get a larger stack trace because the first attempt doesn't get any frames, so we retry with runtime frames enabled. But that's clearly not ideal. :) |
I have some issue latest version. 1.9.2 => called from # 1 devel => called from # 0 ▶ tree 1 directory, 2 files main.go
runtimetest/init.go
brew install go
brew install --HEAD go
|
@s4l1h, what's the issue? |
@aclements
https://github.com/akmyazilim/assetmanager/blob/master/example/modules/t1/init.go#L17 |
Right. I'm still unclear on what you were expecting. Using |
Change https://golang.org/cl/76770 mentions this issue: |
What version of Go are you using (
go version
)?go version devel +67388e9866 Thu Oct 12 01:03:14 2017 +0000 linux/amd64
Does this issue reproduce with the latest release?
No. This was introduced on master after Go 1.9 by CL 45412, which fixed #16723.
What did you do?
https://play.golang.org/p/3rfhN6rO-_
What did you expect to see?
Prior to CL 45412, this would print the function information for the autogenerated wrapper
I.M
.What did you see instead?
On master,
Next
returns no frames because the stack consists solely of an autogenerated wrapper, which we now hide from stack traces.We started hiding autogenerated wrappers because, in any real stack trace, the preceding entry would be the actual method that the user thought they were calling. In this case, this logic fails because the stack is synthetic and consists solely of the wrapper.
Perhaps we shouldn't hide wrappers if they're the first entry in the stack trace.
There is a simple workaround. Code like this should be using
runtime.FuncForPC
anyway. But we shouldn't needlessly break things.The text was updated successfully, but these errors were encountered: