mirror of
https://github.com/golang/go
synced 2024-11-12 10:30:23 -07:00
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
This commit is contained in:
parent
aa53b37fa6
commit
6d68fc8eea
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user