-
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
proposal: debug/gosym: expose function start line and inline tree #58474
Comments
What's the exact api that would be added for this? |
Adding a This would only work for binaries that are Go >=1.3 as far as I understand, which would be fine for my case, since I'm targeting >=1.20 binaries in my use case. |
CC @golang/runtime |
For PGO, profiles need to contain inlined frames as well. Thus, I imagine that you want to add access to the inline tree to debug/gosym as well? (This came up recently in another context that wants inlining information and we were considering a proposal to add it to debug/gosym, or perhaps an x/debug package). |
I was going to open a separate proposal for that, but yes! |
The start line in the pclntab is added last cycle (Go 1.20, specifically for PGO). So this would only work with Go 1.20+ binaries. For older binaries maybe fall back to 0? |
I think that would make sense. |
This field was introduced in go 1.20 therefore we need to safeguard it to only be read for pclntabs of that version or higher, as otherwise nonsensical bytes would be read. The fallback is now the default value of 0. Fixes golang#58474
Change https://go.dev/cl/473455 mentions this issue: |
@aclements, @mknyszek, and I are thinking of tying this in with #57447 (comment). i.e., instead of continuing to extend |
I’m ok with forking |
Change https://go.dev/cl/474541 mentions this issue: |
Change https://go.dev/cl/474543 mentions this issue: |
Change https://go.dev/cl/474542 mentions this issue: |
Just as a point of reference, Go 1.21 adds start line to DWARF (#57308), so this data is now available, just not from (We should still expose the gosym version. I'm just leaving this breadcrumb in case anyone is blocked on this.) |
x/vuln has a forked version of One pain point that came up there is that the references to funcdata (where the inline tree lines) in the pclntab section are stored as offsets from the One possible resolution here is to change (cc @zpavlinovic) |
Expose function start line through an API in the
debug/gosym
package.The
.gopclntab
section includes data for the starting line number of a function, however, thedebug/gosym
package does not export an API that allows reading this data. I propose adding it to the API surface.Use case: I happen to work on the Parca open-source continuous-profiling project and we quite frequently run into Go binaries, that don't include DWARF debuginfos (which we discourage but it's out of our control) but of course keep the
.gopclntab
, so we would like to be able to support those binaries as best as possible. The function starting line number in particular is important for the new PGO features, as noted in the documentation appendix.The text was updated successfully, but these errors were encountered: