Commit 3835e01d authored by Rob Pike's avatar Rob Pike

print tracebacks for all goroutines, not just the crashing one

R=ken
OCL=13518
CL=13518
parent ea056902
......@@ -74,6 +74,21 @@ sys·newproc(int32 siz, byte* fn, byte* arg0)
//prints("\n");
}
void
tracebackothers(G *me)
{
G *g;
for(g = allg; g != nil; g = g->alllink) {
if(g == me)
continue;
prints("\ngoroutine ");
sys·printint(g->goid);
prints(":\n");
traceback(g->sched.PC, g->sched.SP+8, g); // gogo adjusts SP by 8 (not portable!)
}
}
G*
select(void)
{
......
......@@ -149,6 +149,7 @@ sighandler(int32 sig, siginfo *info, void *context)
prints("\n\n");
traceback((void *)ss->__rip, (void *)ss->__rsp, (void*)ss->__r15);
tracebackothers((void*)ss->__r15);
print_thread_state(ss);
sys·exit(2);
......
......@@ -153,7 +153,8 @@ sighandler(int32 sig, siginfo* info, void** context)
prints("\n\n");
traceback((void *)sc->rip, (void *)sc->rsp, (void *)sc->r15);
print_sigcontext(sc);
tracebackothers((void*)sc->__r15);
print_sigcontext(sc);
sys·breakpoint();
sys·exit(2);
......
......@@ -19,6 +19,7 @@ sys·panicl(int32 lno)
prints("\n");
sp = (uint8*)&lno;
traceback(sys·getcallerpc(&lno), sp, g);
tracebackothers(g);
sys·breakpoint();
sys·exit(2);
}
......
......@@ -106,7 +106,7 @@ struct G
byte* stackbase; // must not move
byte* stack0; // first stack segment
Gobuf sched;
G* alllink; // on allq
G* alllink; // on allg
void* param; // passed parameter on wakeup
int16 status;
int32 goid;
......@@ -189,6 +189,7 @@ void* mal(uint32);
uint32 cmpstring(string, string);
void initsig(void);
void traceback(uint8 *pc, uint8 *sp, G* gp);
void tracebackothers(G*);
int32 open(byte*, int32, ...);
int32 read(int32, void*, int32);
int32 write(int32, void*, int32);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment