diff options
author | Russ Cox <rsc@golang.org> | 2011-02-23 14:47:22 -0500 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2011-02-23 14:47:22 -0500 |
commit | 4b376ef328c69a803bcb801b122b4bfc270a403d (patch) | |
tree | 0353e5da0bf254a5f8d09c0ad256cbd8d2dd8944 | |
parent | 63c24081a09a363735797097bf238a7c78d15fd7 (diff) | |
download | go-4b376ef328c69a803bcb801b122b4bfc270a403d.tar.gz go-4b376ef328c69a803bcb801b122b4bfc270a403d.zip |
runtime: traceback through active lessstack
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
-rw-r--r-- | src/pkg/runtime/amd64/traceback.c | 12 | ||||
-rw-r--r-- | src/pkg/runtime/arm/traceback.c | 11 |
2 files changed, 23 insertions, 0 deletions
diff --git a/src/pkg/runtime/amd64/traceback.c b/src/pkg/runtime/amd64/traceback.c index d3aae0db95..035dc560c5 100644 --- a/src/pkg/runtime/amd64/traceback.c +++ b/src/pkg/runtime/amd64/traceback.c @@ -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; diff --git a/src/pkg/runtime/arm/traceback.c b/src/pkg/runtime/arm/traceback.c index 28d39dcdf6..ce0c287f3c 100644 --- a/src/pkg/runtime/arm/traceback.c +++ b/src/pkg/runtime/arm/traceback.c @@ -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; |