src/pkg/runtime/mprof.goc | 4 ++-- src/pkg/runtime/proc.c | 4 ++-- src/pkg/runtime/traceback_arm.c | 12 ++++++++++++ src/pkg/runtime/traceback_x86.c | 10 ++++++++++ diff --git a/src/pkg/runtime/mprof.goc b/src/pkg/runtime/mprof.goc index 5b92cec95c72856053f84bf785cf8875db084dae..4ae74f0c288377de607d5d63ad3f01b5125ec786 100644 --- a/src/pkg/runtime/mprof.goc +++ b/src/pkg/runtime/mprof.goc @@ -477,7 +477,7 @@ saveg(uintptr pc, uintptr sp, G *gp, TRecord *r) { int32 n; - n = runtime·gentraceback((uintptr)pc, (uintptr)sp, 0, gp, 0, r->stk, nelem(r->stk), nil, nil, false); + n = runtime·gentraceback(pc, sp, 0, gp, 0, r->stk, nelem(r->stk), nil, nil, false); if(n < nelem(r->stk)) r->stk[n] = 0; } @@ -505,7 +505,7 @@ saveg(pc, sp, g, r++); for(gp = runtime·allg; gp != nil; gp = gp->alllink) { if(gp == g || gp->status == Gdead) continue; - saveg(gp->sched.pc, gp->sched.sp, gp, r++); + saveg(~(uintptr)0, ~(uintptr)0, gp, r++); } } diff --git a/src/pkg/runtime/proc.c b/src/pkg/runtime/proc.c index de26c72d3d7553243dd79c7e6ffcef95fb5ef8a4..ed3e1e73eebdd1ba7a5556cce834b74b56632647 100644 --- a/src/pkg/runtime/proc.c +++ b/src/pkg/runtime/proc.c @@ -276,7 +276,7 @@ // Show the current goroutine first, if we haven't already. if((gp = m->curg) != nil && gp != me) { runtime·printf("\n"); runtime·goroutineheader(gp); - runtime·traceback(gp->sched.pc, gp->sched.sp, gp->sched.lr, gp); + runtime·traceback(~(uintptr)0, ~(uintptr)0, 0, gp); } for(gp = runtime·allg; gp != nil; gp = gp->alllink) { @@ -290,7 +290,7 @@ if(gp->status == Grunning) { runtime·printf("\tgoroutine running on other thread; stack unavailable\n"); runtime·printcreatedby(gp); } else - runtime·traceback(gp->sched.pc, gp->sched.sp, gp->sched.lr, gp); + runtime·traceback(~(uintptr)0, ~(uintptr)0, 0, gp); } } diff --git a/src/pkg/runtime/traceback_arm.c b/src/pkg/runtime/traceback_arm.c index 341aa20588010d7a3a0574dce69732a431084e7b..8a3685e76c508ee3d0ffa251bfdba5a88aaf3eee 100644 --- a/src/pkg/runtime/traceback_arm.c +++ b/src/pkg/runtime/traceback_arm.c @@ -20,6 +20,18 @@ Stkframe frame; Stktop *stk; String file; + 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; + lr0 = 0; + } else { + pc0 = gp->sched.pc; + sp0 = gp->sched.sp; + lr0 = gp->sched.lr; + } + } + nprint = 0; runtime·memclr((byte*)&frame, sizeof frame); frame.pc = pc0; diff --git a/src/pkg/runtime/traceback_x86.c b/src/pkg/runtime/traceback_x86.c index d658e8f11a94d32184833e38179d9ea5be4795a2..8e3063f43a64a89fe23f064d95059ef89795b4a3 100644 --- a/src/pkg/runtime/traceback_x86.c +++ b/src/pkg/runtime/traceback_x86.c @@ -30,6 +30,16 @@ Stktop *stk; 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);