summaryrefslogtreecommitdiff
path: root/src/pkg/runtime/linux/arm/signal.c
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2010-04-13 22:31:47 -0700
committerRuss Cox <rsc@golang.org>2010-04-13 22:31:47 -0700
commit5b3825261301b55243a9529d83b68500f87c00c0 (patch)
tree132e81d75cc022447dcc0e94209b1d889a90738f /src/pkg/runtime/linux/arm/signal.c
parent403065e079898cb5e87298b50c27e41cfe7a269c (diff)
downloadgolang-5b3825261301b55243a9529d83b68500f87c00c0.tar.gz
runtime: better trace for fault due to nil pointer call
R=r CC=golang-dev http://codereview.appspot.com/854048
Diffstat (limited to 'src/pkg/runtime/linux/arm/signal.c')
-rw-r--r--src/pkg/runtime/linux/arm/signal.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/pkg/runtime/linux/arm/signal.c b/src/pkg/runtime/linux/arm/signal.c
index 6cc4ac9be..4d315cc80 100644
--- a/src/pkg/runtime/linux/arm/signal.c
+++ b/src/pkg/runtime/linux/arm/signal.c
@@ -70,7 +70,11 @@ sighandler(int32 sig, Siginfo *info, void *context)
// If this is a leaf function, we do smash LR,
// but we're not going back there anyway.
- r->arm_lr = r->arm_pc;
+ // Don't bother smashing if r->arm_pc is 0,
+ // which is probably a call to a nil func: the
+ // old link register is more useful in the stack trace.
+ if(r->arm_pc != 0)
+ r->arm_lr = r->arm_pc;
r->arm_pc = (uintptr)sigpanic;
return;
}