Skip to content
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: inlined functions incorrectly elided from stack traces #42754

Closed
aclements opened this issue Nov 20, 2020 · 2 comments
Closed

runtime: inlined functions incorrectly elided from stack traces #42754

aclements opened this issue Nov 20, 2020 · 2 comments

Comments

@aclements
Copy link
Member

What version of Go are you using (go version)?

$ go version
go version go1.15 linux/amd64

It reproduces as far back as 1.12 (and probably further) and on tip.

What did you do?

If a function that should be displayed in tracebacks get inlined into a function that's elided from tracebacks, then neither of them appear. Here's a synthetic example: https://play.golang.org/p/fkGOZCT5h2W

As of CL 258938 (which is after 1.15), this happens in practice in cgo code. Exported Go functions (and functions they call) can now be inlined into the generated _cgoexp_HASH_FN function. The runtime elides _cgoexp_HASH_FN from tracebacks because it doesn't contain a ".". Because of this bug, that means it also elides anything that was inlined into it. (This is why I'm marking this as a release-blocker.)

What did you expect to see?

tracebackNotExcluded should appear in the traceback.

What did you see instead?

It does not.

This happens because gentraceback's inlined function trace printer passes the _func of the outermost function to showframe. It uses the name of that _func to make decisions about whether the frame should be shown, rather than the name of the inlined function about to be printed.

@aclements aclements added this to the Go1.16 milestone Nov 20, 2020
@gopherbot
Copy link

Change https://golang.org/cl/272131 mentions this issue: runtime: use inlined function name for traceback elision

@gopherbot
Copy link

Change https://golang.org/cl/272132 mentions this issue: runtime: simplify showframe arguments

@golang golang locked and limited conversation to collaborators Nov 24, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants