aboutsummaryrefslogtreecommitdiff
path: root/src/pkg/runtime
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2013-09-15 12:05:24 -0400
committerRuss Cox <rsc@golang.org>2013-09-15 12:05:24 -0400
commit6d68fc8eeaf32375eda7208b62cedf6ee5d241d0 (patch)
treec4a98688e747994a46fdaf3942152cd352a7206f /src/pkg/runtime
parentaa53b37fa6aeb4ea378b5fc833f0aea5d6f9711e (diff)
downloadgo-6d68fc8eeaf32375eda7208b62cedf6ee5d241d0.tar.xz
runtime: fix CPU profiling on Windows
The test 'gp == m->curg' is not valid on Windows, because the goroutine being profiled is not from the current m. TBR=golang-dev CC=golang-dev https://golang.org/cl/13718043
Diffstat (limited to 'src/pkg/runtime')
-rw-r--r--src/pkg/runtime/proc.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/pkg/runtime/proc.c b/src/pkg/runtime/proc.c
index 215bcd8cd9..07515c54f9 100644
--- a/src/pkg/runtime/proc.c
+++ b/src/pkg/runtime/proc.c
@@ -2115,7 +2115,13 @@ runtime·sigprof(uint8 *pc, uint8 *sp, uint8 *lr, G *gp)
// To recap, there are no constraints on the assembly being used for the
// transition. We simply require that g and SP match and that the PC is not
// in runtime.gogo.
- if(gp == nil || gp != m->curg || (uintptr)sp < gp->stackguard - StackGuard || gp->stackbase < (uintptr)sp ||
+ //
+ // On Windows, one m is sending reports about all the g's, so gp == m->curg
+ // is not a useful comparison. The profilem function in os_windows.c has
+ // already checked that gp is a user g.
+ if(gp == nil ||
+ (!Windows && gp != m->curg) ||
+ (uintptr)sp < gp->stackguard - StackGuard || gp->stackbase < (uintptr)sp ||
((uint8*)runtime·gogo <= pc && pc < (uint8*)runtime·gogo + RuntimeGogoBytes))
traceback = false;