From fb40f88c409da18ee69a7450e1b8f9528f3538ee Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Mon, 22 Sep 2008 13:47:53 -0700 Subject: 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 --- src/runtime/runtime.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'src/runtime/runtime.c') 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); -- cgit v1.3