This patch to libgo fixes the runtime/pprof test to pass, and enables it. it cleans up the runtime interface for profiling a little bit. Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu. Committed to mainline and 4.7 branch.
Ian diff -r 55f2af449cde libgo/Makefile.am --- a/libgo/Makefile.am Sun Jul 22 20:56:08 2012 -0700 +++ b/libgo/Makefile.am Wed Jul 25 18:54:44 2012 -0700 @@ -1794,7 +1794,7 @@ # Check a package. CHECK = \ - GC="$(GOC) $(GOCFLAGS) -L `${PWD_COMMAND}` -L `${PWD_COMMAND}`/.libs"; \ + GC="$(GOC) $(GOCFLAGS) $($(subst /,_,$@)_GOCFLAGS) -L `${PWD_COMMAND}` -L `${PWD_COMMAND}`/.libs"; \ export GC; \ GOLIBS="$(MATH_LIBS) $(NET_LIBS)"; \ export GOLIBS; \ @@ -3012,6 +3012,9 @@ runtime/pprof/check: $(CHECK_DEPS) @$(CHECK) .PHONY: runtime/pprof/check +# At least for now, we need -static-libgo for this test, because +# otherwise we can't get the line numbers. +runtime_pprof_check_GOCFLAGS = -static-libgo @go_include@ sync/atomic.lo.dep sync/atomic.lo.dep: $(go_sync_atomic_files) @@ -3548,6 +3551,7 @@ os/user/check \ path/filepath/check \ regexp/syntax/check \ + runtime/pprof/check \ sync/atomic/check \ text/scanner/check \ text/tabwriter/check \ diff -r 55f2af449cde libgo/go/runtime/pprof/pprof_test.go --- a/libgo/go/runtime/pprof/pprof_test.go Sun Jul 22 20:56:08 2012 -0700 +++ b/libgo/go/runtime/pprof/pprof_test.go Wed Jul 25 18:54:44 2012 -0700 @@ -71,7 +71,8 @@ if f == nil { continue } - if strings.Contains(f.Name(), "ChecksumIEEE") { + if strings.Contains(f.Name(), "ChecksumIEEE") || + (strings.Contains(f.Name(), "update") && strings.Contains(f.Name(), "crc32")) { found = true } } diff -r 55f2af449cde libgo/runtime/go-signal.c --- a/libgo/runtime/go-signal.c Sun Jul 22 20:56:08 2012 -0700 +++ b/libgo/runtime/go-signal.c Wed Jul 25 18:54:44 2012 -0700 @@ -149,8 +149,7 @@ #ifdef SIGPROF if (sig == SIGPROF) { - /* FIXME. */ - runtime_sigprof (0, 0, nil, nil); + runtime_sigprof (); return; } #endif diff -r 55f2af449cde libgo/runtime/proc.c --- a/libgo/runtime/proc.c Sun Jul 22 20:56:08 2012 -0700 +++ b/libgo/runtime/proc.c Wed Jul 25 18:54:44 2012 -0700 @@ -1681,10 +1681,7 @@ // Called if we receive a SIGPROF signal. void -runtime_sigprof(uint8 *pc __attribute__ ((unused)), - uint8 *sp __attribute__ ((unused)), - uint8 *lr __attribute__ ((unused)), - G *gp __attribute__ ((unused))) +runtime_sigprof() { int32 n; diff -r 55f2af449cde libgo/runtime/runtime.h --- a/libgo/runtime/runtime.h Sun Jul 22 20:56:08 2012 -0700 +++ b/libgo/runtime/runtime.h Wed Jul 25 18:54:44 2012 -0700 @@ -451,7 +451,7 @@ int32 runtime_atoi(const byte*); uint32 runtime_fastrand1(void); -void runtime_sigprof(uint8 *pc, uint8 *sp, uint8 *lr, G *gp); +void runtime_sigprof(); void runtime_resetcpuprofiler(int32); void runtime_setcpuprofilerate(void(*)(uintptr*, int32), int32); void runtime_usleep(uint32);