runtime: support for cgo pprof is currently heavily Linux-dependent #24545
Labels
FrozenDueToAge
WaitingForInfo
Issue is not actionable because of missing required information, which needs to be provided.
Milestone
What version of Go are you using (
go version
)?go version go1.10 freebsd/amd64
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?freebsd/amd64
As suggested in CL 93875 "After this CL is in it would be worth seeing whether testCgoPprof in runtime/crash_test.go can be enabled for FreeBSD.", I have been looking into what it would take to enable the test. What I'm finding is that all of the cgo pprof tests fail and when I look at the pprof output, it's missing the header that details the executable and libraries, which causes the profile to be incomplete/incorrect.
Following the code, readMapping in runtime/pprof/proto.go is using /proc/self/maps which is Linux-specific. I'm looking for thoughts on how this might be extended to other platforms. It's not obvious that there's any portable equivalent here.
On FreeBSD there are at least two options. Code to parse /proc/curproc/map would be very easy to write based on the existing code, but the downside is that procfs isn't mounted by default on FreeBSD. The libprocstat code would work everywhere, but is sysctl-based and would require a fair bit more work, at least to convert it to Go code rather than relying on an external library.
On OSX, it's completely different again. There are Mach calls to get the info. Sample code can be found at e.g. http://www.newosxbook.com/src.jl?tree=listings&file=12-1-vmmap.c
Anyway, I'm curious if anybody has any ideas or opinions about this.
The text was updated successfully, but these errors were encountered: