]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: use GOTRACEBACK to decide whether to show runtime frames
authorRuss Cox <rsc@golang.org>
Mon, 6 Feb 2012 16:24:14 +0000 (11:24 -0500)
committerRuss Cox <rsc@golang.org>
Mon, 6 Feb 2012 16:24:14 +0000 (11:24 -0500)
Right now, GOTRACEBACK=0 means do not show any stack traces.
Unset means the default behavior (declutter by hiding runtime routines).

This CL makes GOTRACEBACK=2 mean include the runtime routines.
It avoids having to recompile the runtime when you want to see
the runtime in the tracebacks.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5633050

src/pkg/runtime/symtab.c

index 0346a420b5499789d8fc59e40476f7f5126a6a05..df4c9ad76cfabadab24ca5c985abf2d209fdb696 100644 (file)
@@ -507,6 +507,9 @@ contains(String s, int8 *p)
 bool
 runtime·showframe(Func *f)
 {
-       // return 1;  // for debugging - show all frames
-       return contains(f->name, ".") && !hasprefix(f->name, "runtime.");
+       static int32 traceback = -1;
+       
+       if(traceback < 0)
+               traceback = runtime·gotraceback();
+       return traceback > 1 || contains(f->name, ".") && !hasprefix(f->name, "runtime.");
 }