]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: use runtime·callers when racefuncenter's pc is on the heap.
authorRémy Oudompheng <oudomphe@phare.normalesup.org>
Wed, 7 Nov 2012 20:35:21 +0000 (21:35 +0100)
committerRémy Oudompheng <oudomphe@phare.normalesup.org>
Wed, 7 Nov 2012 20:35:21 +0000 (21:35 +0100)
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6821069

src/pkg/runtime/race.c

index 49c7d4eb2cac0278af8d0f0a6f3a9da74848b7cc..a89986ad404be84c7495acdce9d367ee3cb48d0e 100644 (file)
@@ -89,7 +89,10 @@ runtime·racefuncenter(uintptr pc)
 {
        // If the caller PC is lessstack, use slower runtime·callers
        // to walk across the stack split to find the real caller.
-       if(pc == (uintptr)runtime·lessstack)
+       // Same thing if the PC is on the heap, which should be a
+       // closure trampoline.
+       if(pc == (uintptr)runtime·lessstack ||
+               (pc >= (uintptr)runtime·mheap.arena_start && pc < (uintptr)runtime·mheap.arena_used))
                runtime·callers(2, &pc, 1);
 
        m->racecall = true;