continue;
runtime·printf("\n");
runtime·goroutineheader(gp);
- if(gp->status == Grunning)
+ if(gp->status == Grunning) {
runtime·printf("\tgoroutine running on other thread; stack unavailable\n");
- else
+ runtime·printcreatedby(gp);
+ } else
runtime·traceback(gp->sched.pc, gp->sched.sp, gp->sched.lr, gp);
}
}
void runtime·chansend(ChanType*, Hchan*, byte*, bool*, void*);
void runtime·chanrecv(ChanType*, Hchan*, byte*, bool*, bool*);
bool runtime·showframe(Func*, G*);
+void runtime·printcreatedby(G*);
void runtime·ifaceE2I(InterfaceType*, Eface, Iface*);
return n;
}
-static void
-printcreatedby(G *gp)
+void
+runtime·printcreatedby(G *gp)
{
int32 line;
uintptr pc, tracepc;
Func *f;
String file;
- if((pc = gp->gopc) != 0 && (f = runtime·findfunc(pc)) != nil
- && runtime·showframe(f, gp) && gp->goid != 1) {
+ // Show what created goroutine, except main goroutine (goid 1).
+ if((pc = gp->gopc) != 0 && (f = runtime·findfunc(pc)) != nil &&
+ runtime·showframe(f, gp) && gp->goid != 1) {
runtime·printf("created by %s\n", runtime·funcname(f));
tracepc = pc; // back up to CALL instruction for funcline.
if(pc > f->entry)
- tracepc -= sizeof(uintptr);
+ tracepc -= PCQuantum;
line = runtime·funcline(f, tracepc, &file);
runtime·printf("\t%S:%d", file, line);
if(pc > f->entry)
// If that means we print nothing at all, repeat forcing all frames printed.
if(runtime·gentraceback(pc, sp, lr, gp, 0, nil, 100, nil, nil, false) == 0)
runtime·gentraceback(pc, sp, lr, gp, 0, nil, 100, nil, nil, true);
- printcreatedby(gp);
+ runtime·printcreatedby(gp);
}
// func caller(n int) (pc uintptr, file string, line int, ok bool)
return n;
}
-static void
-printcreatedby(G *gp)
+void
+runtime·printcreatedby(G *gp)
{
int32 line;
- String file;
uintptr pc, tracepc;
Func *f;
+ String file;
// Show what created goroutine, except main goroutine (goid 1).
- if((pc = gp->gopc) != 0 && (f = runtime·findfunc(pc)) != nil && gp->goid != 1) {
+ if((pc = gp->gopc) != 0 && (f = runtime·findfunc(pc)) != nil &&
+ runtime·showframe(f, gp) && gp->goid != 1) {
runtime·printf("created by %s\n", runtime·funcname(f));
tracepc = pc; // back up to CALL instruction for funcline.
if(pc > f->entry)
- tracepc--;
- line = runtime·funcline(f, tracepc, &file);
+ tracepc -= PCQuantum;
+ line = runtime·funcline(f, tracepc, &file);
runtime·printf("\t%S:%d", file, line);
if(pc > f->entry)
runtime·printf(" +%p", (uintptr)(pc - f->entry));
// If that means we print nothing at all, repeat forcing all frames printed.
if(runtime·gentraceback(pc, sp, 0, gp, 0, nil, 100, nil, nil, false) == 0)
runtime·gentraceback(pc, sp, 0, gp, 0, nil, 100, nil, nil, true);
- printcreatedby(gp);
+ runtime·printcreatedby(gp);
}
int32