aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/runtime.c
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2008-09-22 13:47:53 -0700
committerRuss Cox <rsc@golang.org>2008-09-22 13:47:53 -0700
commitfb40f88c409da18ee69a7450e1b8f9528f3538ee (patch)
tree16f93a9986c6fac7718d41bba86a8f804655457d /src/runtime/runtime.c
parenta27e61e2fe3e32fa629c2e07b4e9c70ba8c3d13a (diff)
downloadgo-fb40f88c409da18ee69a7450e1b8f9528f3538ee.tar.xz
test cleanup
- do not print tracebacks if $GOTRACEBACK=0 - set GOTRACEBACK=0 during tests - filter out pc numbers in errors R=r DELTA=70 (22 added, 30 deleted, 18 changed) OCL=15618 CL=15642
Diffstat (limited to 'src/runtime/runtime.c')
-rw-r--r--src/runtime/runtime.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/runtime/runtime.c b/src/runtime/runtime.c
index 2cbebda219..5fde296700 100644
--- a/src/runtime/runtime.c
+++ b/src/runtime/runtime.c
@@ -6,6 +6,17 @@
int32 panicking = 0;
+int32
+gotraceback(void)
+{
+ byte *p;
+
+ p = getenv("GOTRACEBACK");
+ if(p == nil || p[0] == '\0')
+ return 1; // default is on
+ return atoi(p);
+}
+
void
sys·panicl(int32 lno)
{
@@ -17,8 +28,10 @@ sys·panicl(int32 lno)
sys·printpc(&lno);
prints("\n");
sp = (uint8*)&lno;
- traceback(sys·getcallerpc(&lno), sp, g);
- tracebackothers(g);
+ if(gotraceback()){
+ traceback(sys·getcallerpc(&lno), sp, g);
+ tracebackothers(g);
+ }
panicking = 1;
sys·breakpoint(); // so we can grab it in a debugger
sys·exit(2);