From: Russ Cox Date: Mon, 6 Feb 2012 16:24:14 +0000 (-0500) Subject: runtime: use GOTRACEBACK to decide whether to show runtime frames X-Git-Tag: weekly.2012-02-07~42 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=48bd13911de978effd30402253de523b8eb4bb11;p=gostls13.git runtime: use GOTRACEBACK to decide whether to show runtime frames 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 --- diff --git a/src/pkg/runtime/symtab.c b/src/pkg/runtime/symtab.c index 0346a420b5..df4c9ad76c 100644 --- a/src/pkg/runtime/symtab.c +++ b/src/pkg/runtime/symtab.c @@ -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."); }