summaryrefslogtreecommitdiff
path: root/src/pkg/runtime/traceback_x86.c
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2014-02-28 17:13:59 -0500
committerRuss Cox <rsc@golang.org>2014-02-28 17:13:59 -0500
commit9786b64364246375276a6f1ed85e9f77dcead4a2 (patch)
tree282deda15038a8b0598bd7645f086cd70c530398 /src/pkg/runtime/traceback_x86.c
parent6dc75d34f149ee58c1c77fc1d45d7a9ff3d1ddd4 (diff)
downloadgo-9786b64364246375276a6f1ed85e9f77dcead4a2.tar.gz
[release-branch.go1.2] runtime: fix crash in runtime.GoroutineProfile
This CL is not exactly a copy of the original quoted below. This CL omits the changes made to mgc0.c in the original. Those changes do not apply cleanly to the Go 1.2 tree, and they were cosmetic, simplifying code that was already doing the right thing. To double-check that omitting the mgc0.c change has not invalidated the fix, I have verified by hand that the test program in issue 6946 fails without this CL and passes with this CL. ??? CL 41640043 / e4c381446b48 runtime: fix crash in runtime.GoroutineProfile This is a possible Go 1.2.1 candidate. Fixes issue 6946. R=iant, r CC=golang-dev https://codereview.appspot.com/41640043 ??? LGTM=adg R=adg CC=golang-codereviews, golang-dev, iant, r https://codereview.appspot.com/68820045
Diffstat (limited to 'src/pkg/runtime/traceback_x86.c')
-rw-r--r--src/pkg/runtime/traceback_x86.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/pkg/runtime/traceback_x86.c b/src/pkg/runtime/traceback_x86.c
index d658e8f11..8e3063f43 100644
--- a/src/pkg/runtime/traceback_x86.c
+++ b/src/pkg/runtime/traceback_x86.c
@@ -30,6 +30,16 @@ runtime·gentraceback(uintptr pc0, uintptr sp0, uintptr lr0, G *gp, int32 skip,
String file;
USED(lr0);
+
+ if(pc0 == ~(uintptr)0 && sp0 == ~(uintptr)0) { // Signal to fetch saved values from gp.
+ if(gp->syscallstack != (uintptr)nil) {
+ pc0 = gp->syscallpc;
+ sp0 = gp->syscallsp;
+ } else {
+ pc0 = gp->sched.pc;
+ sp0 = gp->sched.sp;
+ }
+ }
nprint = 0;
runtime·memclr((byte*)&frame, sizeof frame);