diff options
author | Russ Cox <rsc@golang.org> | 2013-03-05 15:36:40 -0500 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2013-03-05 15:36:40 -0500 |
commit | b82691ba49e3e9fd5982ce45410f717a737de1e0 (patch) | |
tree | d59e557bfdb375c5045f18c9d39b968daa9557ee /src/pkg/runtime/traceback_arm.c | |
parent | f9ab330e9c55b5dfa702bb006386dc2215b9456d (diff) | |
download | go-b82691ba49e3e9fd5982ce45410f717a737de1e0.tar.gz |
undo CL 7301062 / 9742f722b558
broke arm garbage collector
traceback_arm fails with a missing pc. It needs CL 7494043.
But that only makes the build break later, this time with
"invalid freelist". Roll back until it can be fixed correctly.
??? original CL description
runtime: restrict stack root scan to locals and arguments
R=rsc
CC=golang-dev
https://codereview.appspot.com/7301062
???
R=golang-dev, bradfitz
CC=golang-dev
https://codereview.appspot.com/7493044
Diffstat (limited to 'src/pkg/runtime/traceback_arm.c')
-rw-r--r-- | src/pkg/runtime/traceback_arm.c | 29 |
1 files changed, 10 insertions, 19 deletions
diff --git a/src/pkg/runtime/traceback_arm.c b/src/pkg/runtime/traceback_arm.c index 1b4176803..dd85cc02c 100644 --- a/src/pkg/runtime/traceback_arm.c +++ b/src/pkg/runtime/traceback_arm.c @@ -17,9 +17,9 @@ void _divu(void); void _modu(void); int32 -runtime·gentraceback(byte *pc0, byte *sp, byte *lr0, G *gp, int32 skip, uintptr *pcbuf, int32 max, void (*fn)(Func*, byte*, byte*, void*), void *arg) +runtime·gentraceback(byte *pc0, byte *sp, byte *lr0, G *gp, int32 skip, uintptr *pcbuf, int32 max) { - int32 i, n; + int32 i, n, iter; uintptr pc, lr, tracepc, x; byte *fp; bool waspanic; @@ -46,7 +46,7 @@ runtime·gentraceback(byte *pc0, byte *sp, byte *lr0, G *gp, int32 skip, uintptr n = 0; stk = (Stktop*)gp->stackbase; - while(n < max) { + for(iter = 0; iter < 100 && n < max; iter++) { // iter avoids looping forever // Typically: // pc is the PC of the running function. // sp is the stack pointer at that program counter. @@ -60,17 +60,14 @@ runtime·gentraceback(byte *pc0, byte *sp, byte *lr0, G *gp, int32 skip, uintptr sp = (byte*)stk->gobuf.sp; lr = 0; fp = nil; - if(pcbuf == nil && fn == nil && runtime·showframe(nil, gp == m->curg)) + if(pcbuf == nil && runtime·showframe(nil, gp == m->curg)) runtime·printf("----- stack segment boundary -----\n"); stk = (Stktop*)stk->stackbase; continue; } - if(pc <= 0x1000 || (f = runtime·findfunc(pc)) == nil) { - if(fn != nil) - runtime·throw("unknown pc"); + if(pc <= 0x1000 || (f = runtime·findfunc(pc)) == nil) break; - } // Found an actual function. if(lr == 0) @@ -85,8 +82,6 @@ runtime·gentraceback(byte *pc0, byte *sp, byte *lr0, G *gp, int32 skip, uintptr skip--; else if(pcbuf != nil) pcbuf[n++] = pc; - else if(fn != nil) - (*fn)(f, (byte*)pc, sp, arg); else { if(runtime·showframe(f, gp == m->curg)) { // Print during crash. @@ -118,7 +113,7 @@ runtime·gentraceback(byte *pc0, byte *sp, byte *lr0, G *gp, int32 skip, uintptr waspanic = f->entry == (uintptr)runtime·sigpanic; - if(pcbuf == nil && fn == nil && f->entry == (uintptr)runtime·newstack && gp == m->g0) { + if(pcbuf == nil && f->entry == (uintptr)runtime·newstack && gp == m->g0) { runtime·printf("----- newstack called from goroutine %D -----\n", m->curg->goid); pc = (uintptr)m->morepc; sp = (byte*)m->moreargp - sizeof(void*); @@ -129,7 +124,7 @@ runtime·gentraceback(byte *pc0, byte *sp, byte *lr0, G *gp, int32 skip, uintptr continue; } - if(pcbuf == nil && fn == nil && f->entry == (uintptr)runtime·lessstack && gp == m->g0) { + if(pcbuf == nil && f->entry == (uintptr)runtime·lessstack && gp == m->g0) { runtime·printf("----- lessstack called from goroutine %D -----\n", m->curg->goid); gp = m->curg; stk = (Stktop*)gp->stackbase; @@ -140,10 +135,6 @@ runtime·gentraceback(byte *pc0, byte *sp, byte *lr0, G *gp, int32 skip, uintptr continue; } - // Do not unwind past the bottom of the stack. - if(pc == (uintptr)runtime·goexit) - break; - // Unwind to next frame. pc = lr; lr = 0; @@ -171,7 +162,7 @@ runtime·gentraceback(byte *pc0, byte *sp, byte *lr0, G *gp, int32 skip, uintptr } } - if(pcbuf == nil && fn == nil && (pc = gp->gopc) != 0 && (f = runtime·findfunc(pc)) != nil + if(pcbuf == nil && (pc = gp->gopc) != 0 && (f = runtime·findfunc(pc)) != nil && runtime·showframe(f, gp == m->curg) && gp->goid != 1) { runtime·printf("created by %S\n", f->name); tracepc = pc; // back up to CALL instruction for funcline. @@ -195,7 +186,7 @@ runtime·traceback(byte *pc0, byte *sp, byte *lr, G *gp) sp = (byte*)gp->sched.sp; lr = nil; } - runtime·gentraceback(pc0, sp, lr, gp, 0, nil, 100, nil, nil); + runtime·gentraceback(pc0, sp, lr, gp, 0, nil, 100); } // func caller(n int) (pc uintptr, file string, line int, ok bool) @@ -207,5 +198,5 @@ runtime·callers(int32 skip, uintptr *pcbuf, int32 m) sp = runtime·getcallersp(&skip); pc = runtime·getcallerpc(&skip); - return runtime·gentraceback(pc, sp, 0, g, skip, pcbuf, m, nil, nil); + return runtime·gentraceback(pc, sp, 0, g, skip, pcbuf, m); } |