summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2014-09-29 22:50:34 -0400
committerRuss Cox <rsc@golang.org>2014-09-29 22:50:34 -0400
commitc40928fa96aac2a762cf9ee08ab453f13d30a5a1 (patch)
tree2ccf7e5fc8bf704cfd861c1200f7d4830bd0828b
parent51c7c3269af143c16a8ad57f213044c31df9dd97 (diff)
downloadgo-c40928fa96aac2a762cf9ee08ab453f13d30a5a1.tar.gz
[release-branch.go1.3] runtime: fix GOTRACEBACK reading on Windows, Plan 9
Only Unix was resetting the traceback_cache variable after initializing the environment. Reset it on all systems by resetting in parsedebugvars. Fixes issue 8813. LGTM=adg, alex.brainman R=golang-codereviews, adg, alex.brainman CC=golang-codereviews, iant, r https://codereview.appspot.com/152760043
-rw-r--r--src/pkg/runtime/runtime.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/pkg/runtime/runtime.c b/src/pkg/runtime/runtime.c
index 3a4f7199e..3b322e0de 100644
--- a/src/pkg/runtime/runtime.c
+++ b/src/pkg/runtime/runtime.c
@@ -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)