From befecf6b595220f31d70815bee4067a0e260516d Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Sat, 11 Sep 2010 00:26:56 -0400 Subject: [PATCH] runtime: fix crash trace on amd64 g is not in r15 anymore. now it's in a per-thread memory segment, which is valid even inside a signal handler, so we can just refer to g directly. Fixes #1082. R=r CC=golang-dev https://golang.org/cl/2149045 --- src/pkg/runtime/darwin/amd64/signal.c | 4 ++-- src/pkg/runtime/freebsd/amd64/signal.c | 4 ++-- src/pkg/runtime/linux/amd64/signal.c | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/pkg/runtime/darwin/amd64/signal.c b/src/pkg/runtime/darwin/amd64/signal.c index 648ef207ca6..5dc811cfa7f 100644 --- a/src/pkg/runtime/darwin/amd64/signal.c +++ b/src/pkg/runtime/darwin/amd64/signal.c @@ -112,8 +112,8 @@ sighandler(int32 sig, Siginfo *info, void *context) printf("\n"); if(gotraceback()){ - traceback((void*)r->rip, (void*)r->rsp, 0, (void*)r->r15); - tracebackothers((void*)r->r15); + traceback((void*)r->rip, (void*)r->rsp, 0, g); + tracebackothers(g); dumpregs(r); } diff --git a/src/pkg/runtime/freebsd/amd64/signal.c b/src/pkg/runtime/freebsd/amd64/signal.c index 57bfcfb55eb..09053ac7868 100644 --- a/src/pkg/runtime/freebsd/amd64/signal.c +++ b/src/pkg/runtime/freebsd/amd64/signal.c @@ -106,8 +106,8 @@ sighandler(int32 sig, Siginfo* info, void* context) printf("\n"); if(gotraceback()){ - traceback((void*)r->mc_rip, (void*)r->mc_rsp, 0, (void*)r->mc_r15); - tracebackothers((void*)r->mc_r15); + traceback((void*)r->mc_rip, (void*)r->mc_rsp, 0, g); + tracebackothers(g); dumpregs(r); } diff --git a/src/pkg/runtime/linux/amd64/signal.c b/src/pkg/runtime/linux/amd64/signal.c index 63c3a2e6ea5..e46a0944c57 100644 --- a/src/pkg/runtime/linux/amd64/signal.c +++ b/src/pkg/runtime/linux/amd64/signal.c @@ -105,8 +105,8 @@ sighandler(int32 sig, Siginfo* info, void* context) printf("\n"); if(gotraceback()){ - traceback((void*)r->rip, (void*)r->rsp, 0, (void*)r->r15); - tracebackothers((void*)r->r15); + traceback((void*)r->rip, (void*)r->rsp, 0, g); + tracebackothers(g); dumpregs(r); }