]> Cypherpunks repositories - gostls13.git/commitdiff
[release-branch.go1.3] runtime: fix GOTRACEBACK reading on Windows, Plan 9
authorRuss Cox <rsc@golang.org>
Tue, 30 Sep 2014 02:50:34 +0000 (22:50 -0400)
committerRuss Cox <rsc@golang.org>
Tue, 30 Sep 2014 02:50:34 +0000 (22:50 -0400)
Only Unix was resetting the traceback_cache variable
after initializing the environment. Reset it on all systems
by resetting in parsedebugvars.

Fixes #8813.

LGTM=adg, alex.brainman
R=golang-codereviews, adg, alex.brainman
CC=golang-codereviews, iant, r
https://golang.org/cl/152760043

src/pkg/runtime/runtime.c

index 3a4f7199ede5a950a3483e105db9d79fd9a5e30b..3b322e0def43f2690d2e28bea81a2dc08866b5e7 100644 (file)
@@ -138,8 +138,6 @@ runtime·goenvs_unix(void)
        syscall·envs.array = (byte*)s;
        syscall·envs.len = n;
        syscall·envs.cap = n;
-
-       traceback_cache = ~(uint32)0;
 }
 
 int32
@@ -343,6 +341,16 @@ runtime·parsedebugvars(void)
 {
        byte *p;
        intgo i, n;
+       bool tmp;
+       
+       // gotraceback caches the GOTRACEBACK setting in traceback_cache.
+       // gotraceback can be called before the environment is available.
+       // traceback_cache must be reset after the environment is made
+       // available, in order for the environment variable to take effect.
+       // The code is fixed differently in Go 1.4.
+       // This is a limited fix for Go 1.3.3.
+       traceback_cache = ~(uint32)0;
+       runtime·gotraceback(&tmp);
 
        p = runtime·getenv("GODEBUG");
        if(p == nil)