]> Cypherpunks repositories - gostls13.git/commit
runtime: record current PC for SIGPROF on non-Go thread
authorIan Lance Taylor <iant@golang.org>
Tue, 4 Oct 2016 14:11:55 +0000 (07:11 -0700)
committerIan Lance Taylor <iant@golang.org>
Tue, 11 Oct 2016 12:56:15 +0000 (12:56 +0000)
commitd03e8b226cd11692ca9505a815af559ce7989700
tree610aad4dc7c8b726d1f8de864ab994e63baa8339
parentc24cc40075d77b96bbf1f217dcdcff651229e89b
runtime: record current PC for SIGPROF on non-Go thread

If we get a SIGPROF on a non-Go thread, and the program has not called
runtime.SetCgoTraceback so we have no way to collect a stack trace, then
record a profile that is just the PC where the signal occurred. That
will at least point the user to the right area.

Retrieving the PC from the sigctxt in a signal handler on a non-G thread
required marking a number of trivial sigctxt methods as nosplit, and,
for extra safety, nowritebarrierrec.

The test shows that the existing test CgoPprofThread test does not test
the stack trace, just the profile signal. Leaving that for later.

Change-Id: I8f8f3ff09ac099fc9d9df94b5a9d210ffc20c4ab
Reviewed-on: https://go-review.googlesource.com/30252
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
38 files changed:
src/runtime/crash_cgo_test.go
src/runtime/defs_plan9_386.go
src/runtime/defs_plan9_amd64.go
src/runtime/defs_plan9_arm.go
src/runtime/proc.go
src/runtime/signal_386.go
src/runtime/signal_amd64x.go
src/runtime/signal_arm.go
src/runtime/signal_arm64.go
src/runtime/signal_darwin_386.go
src/runtime/signal_darwin_amd64.go
src/runtime/signal_darwin_arm.go
src/runtime/signal_darwin_arm64.go
src/runtime/signal_dragonfly_amd64.go
src/runtime/signal_freebsd_386.go
src/runtime/signal_freebsd_amd64.go
src/runtime/signal_freebsd_arm.go
src/runtime/signal_linux_386.go
src/runtime/signal_linux_amd64.go
src/runtime/signal_linux_arm.go
src/runtime/signal_linux_arm64.go
src/runtime/signal_linux_mips64x.go
src/runtime/signal_linux_ppc64x.go
src/runtime/signal_linux_s390x.go
src/runtime/signal_mips64x.go
src/runtime/signal_nacl_386.go
src/runtime/signal_nacl_amd64p32.go
src/runtime/signal_nacl_arm.go
src/runtime/signal_netbsd_386.go
src/runtime/signal_netbsd_amd64.go
src/runtime/signal_netbsd_arm.go
src/runtime/signal_openbsd_386.go
src/runtime/signal_openbsd_amd64.go
src/runtime/signal_openbsd_arm.go
src/runtime/signal_ppc64x.go
src/runtime/signal_solaris_amd64.go
src/runtime/signal_unix.go
src/runtime/testdata/testprogcgo/threadpprof.go