aboutsummaryrefslogtreecommitdiff
path: root/libgo/runtime/proc.c
diff options
context:
space:
mode:
Diffstat (limited to 'libgo/runtime/proc.c')
-rw-r--r--libgo/runtime/proc.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/libgo/runtime/proc.c b/libgo/runtime/proc.c
index 99b2cb1..4004df4 100644
--- a/libgo/runtime/proc.c
+++ b/libgo/runtime/proc.c
@@ -442,6 +442,11 @@ void getTraceback(G*, G*) __asm__(GOSYM_PREFIX "runtime.getTraceback");
// goroutine stored in the traceback field, which is me.
void getTraceback(G* me, G* gp)
{
+ M* holdm;
+
+ holdm = gp->m;
+ gp->m = me->m;
+
#ifdef USING_SPLIT_STACK
__splitstack_getcontext((void*)(&me->stackcontext[0]));
#endif
@@ -450,6 +455,8 @@ void getTraceback(G* me, G* gp)
if (gp->traceback != 0) {
runtime_gogo(gp);
}
+
+ gp->m = holdm;
}
// Do a stack trace of gp, and then restore the context to
@@ -459,17 +466,11 @@ void
gtraceback(G* gp)
{
Traceback* traceback;
- M* holdm;
traceback = (Traceback*)gp->traceback;
gp->traceback = 0;
- holdm = gp->m;
- if(holdm != nil && holdm != g->m)
- runtime_throw("gtraceback: m is not nil");
- gp->m = traceback->gp->m;
traceback->c = runtime_callers(1, traceback->locbuf,
sizeof traceback->locbuf / sizeof traceback->locbuf[0], false);
- gp->m = holdm;
runtime_gogo(traceback->gp);
}