maxround = sizeof(uintptr),
};
+// Keep a cached value to make gotraceback fast,
+// since we call it on every call to gentraceback.
+// The cached value is a uint32 in which the low bit
+// is the "crash" setting and the top 31 bits are the
+// gotraceback value.
+static uint32 traceback_cache = ~(uint32)0;
+
// The GOTRACEBACK environment variable controls the
// behavior of a Go program that is crashing and exiting.
// GOTRACEBACK=0 suppress all tracebacks
int32
runtime·gotraceback(bool *crash)
{
- // Keep a cached value to make gotraceback fast,
- // since we call it on every call to gentraceback.
- // The cached value is a uint32 in which the low bit
- // is the "crash" setting and the top 31 bits are the
- // gotraceback value.
- static uint32 cache = ~(uint32)0;
byte *p;
uint32 x;
*crash = false;
if(m->traceback != 0)
return m->traceback;
- x = runtime·atomicload(&cache);
+ x = runtime·atomicload(&traceback_cache);
if(x == ~(uint32)0) {
p = runtime·getenv("GOTRACEBACK");
if(p == nil)
x = (2<<1) | 1;
else
x = runtime·atoi(p)<<1;
- runtime·atomicstore(&cache, x);
+ runtime·atomicstore(&traceback_cache, x);
}
if(crash != nil)
*crash = x&1;
syscall·envs.array = (byte*)s;
syscall·envs.len = n;
syscall·envs.cap = n;
+
+ traceback_cache = ~(uint32)0;
}
int32