]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: fix handling of GOTRACEBACK
authorDavid du Colombier <0intro@gmail.com>
Thu, 18 Sep 2014 21:25:11 +0000 (23:25 +0200)
committerDavid du Colombier <0intro@gmail.com>
Thu, 18 Sep 2014 21:25:11 +0000 (23:25 +0200)
Since CL 130990043, the GOTRACEBACK variable is
only used when the GODEBUG variable is set.
This change restores the original behavior.

LGTM=rsc
R=golang-codereviews, aram, gobot, r, rsc
CC=golang-codereviews
https://golang.org/cl/132520043

src/runtime/runtime.c

index ae754dc5cd2ad6134fc8d422cddbc8b25b99423a..aa8dd8f7a008217172e81bcfcf7343ac23f48721 100644 (file)
@@ -287,18 +287,18 @@ runtime·parsedebugvars(void)
        intgo i, n;
 
        p = runtime·getenv("GODEBUG");
-       if(p == nil)
-               return;
-       for(;;) {
-               for(i=0; i<nelem(dbgvar); i++) {
-                       n = runtime·findnull((byte*)dbgvar[i].name);
-                       if(runtime·mcmp(p, (byte*)dbgvar[i].name, n) == 0 && p[n] == '=')
-                               *dbgvar[i].value = runtime·atoi(p+n+1);
+       if(p != nil){
+               for(;;) {
+                       for(i=0; i<nelem(dbgvar); i++) {
+                               n = runtime·findnull((byte*)dbgvar[i].name);
+                               if(runtime·mcmp(p, (byte*)dbgvar[i].name, n) == 0 && p[n] == '=')
+                                       *dbgvar[i].value = runtime·atoi(p+n+1);
+                       }
+                       p = runtime·strstr(p, (byte*)",");
+                       if(p == nil)
+                               break;
+                       p++;
                }
-               p = runtime·strstr(p, (byte*)",");
-               if(p == nil)
-                       break;
-               p++;
        }
 
        p = runtime·getenv("GOTRACEBACK");