From: Russ Cox Date: Fri, 2 Aug 2013 17:51:28 +0000 (-0400) Subject: runtime: in newstack, double-check calling goroutine X-Git-Tag: go1.2rc2~819 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=ebc5513be607165c4d676283d76b3284f103dbd8;p=gostls13.git runtime: in newstack, double-check calling goroutine Checking this condition helped me find the arm problem last night. R=golang-dev, bradfitz CC=golang-dev https://golang.org/cl/12267043 --- diff --git a/src/pkg/runtime/stack.c b/src/pkg/runtime/stack.c index b959eb316d..71c4c4caee 100644 --- a/src/pkg/runtime/stack.c +++ b/src/pkg/runtime/stack.c @@ -201,6 +201,13 @@ runtime·newstack(void) bool reflectcall; uintptr free; + if(m->morebuf.g != m->curg) { + runtime·printf("runtime: newstack called from g=%p\n" + "\tm=%p m->curg=%p m->g0=%p m->gsignal=%p\n", + m->morebuf.g, m, m->curg, m->g0, m->gsignal); + runtime·throw("runtime: wrong goroutine in newstack"); + } + // gp->status is usually Grunning, but it could be Gsyscall if a stack split // happens during a function call inside entersyscall. gp = m->curg;