]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: traceback through active lessstack
authorRuss Cox <rsc@golang.org>
Wed, 23 Feb 2011 19:47:22 +0000 (14:47 -0500)
committerRuss Cox <rsc@golang.org>
Wed, 23 Feb 2011 19:47:22 +0000 (14:47 -0500)
With this change, a panic trace due to a signal arriving while
running on the scheduler stack during a lessstack
(a stack unsplit) will trace through the lessstack to show
the state of the goroutine that was unsplitting its stack.

R=r
CC=golang-dev
https://golang.org/cl/4206042

src/pkg/runtime/amd64/traceback.c
src/pkg/runtime/arm/traceback.c

index d3aae0db954973677265f71059ced34df8e12ad4..035dc560c5a8d088fd3fdf6193f59b0f325c917c 100644 (file)
@@ -164,6 +164,18 @@ gentraceback(byte *pc0, byte *sp, G *g, int32 skip, uintptr *pcbuf, int32 max)
                        continue;
                }
 
+               if(pcbuf == nil && f->entry == (uintptr)runtime·lessstack && g == m->g0) {
+                       // Lessstack is running on scheduler stack.  Switch to original goroutine.
+                       runtime·printf("----- lessstack called from goroutine %d -----\n", m->curg->goid);
+                       g = m->curg;
+                       stk = (Stktop*)g->stackbase;
+                       sp = stk->gobuf.sp;
+                       pc = (uintptr)stk->gobuf.pc;
+                       fp = nil;
+                       lr = 0;
+                       continue;
+               }
+
                // Unwind to next frame.
                pc = lr;
                lr = 0;
index 28d39dcdf62636d3c409b682005a6ad667d4e9c1..ce0c287f3cb2520ed148db798f2b862adaebdb13 100644 (file)
@@ -149,6 +149,17 @@ gentraceback(byte *pc0, byte *sp, byte *lr0, G *g, int32 skip, uintptr *pcbuf, i
                        continue;
                }
                
+               if(pcbuf == nil && f->entry == (uintptr)runtime·lessstack && g == m->g0) {
+                       runtime·printf("----- lessstack called from goroutine %d -----\n", m->curg->goid);
+                       g = m->curg;
+                       stk = (Stktop*)g->stackbase;
+                       sp = stk->gobuf.sp;
+                       pc = (uintptr)stk->gobuf.pc;
+                       fp = nil;
+                       lr = 0;
+                       continue;
+               }       
+               
                // Unwind to next frame.
                pc = lr;
                lr = 0;