diff options
| author | Russ Cox <rsc@golang.org> | 2011-07-26 00:52:46 -0400 |
|---|---|---|
| committer | Russ Cox <rsc@golang.org> | 2011-07-26 00:52:46 -0400 |
| commit | 12a5774cde429d8db8c499cbb818c76ec28a28c5 (patch) | |
| tree | 5b12b1224282cc42279b155f1810456d3e90b84e /src/pkg/runtime/amd64 | |
| parent | cce10dacc6489078837521d34ef317ca17b77d97 (diff) | |
| download | go-12a5774cde429d8db8c499cbb818c76ec28a28c5.tar.xz | |
gc, runtime: fix range+panic line number bugs
Fixes #1856.
R=ken2
CC=golang-dev
https://golang.org/cl/4810054
Diffstat (limited to 'src/pkg/runtime/amd64')
| -rw-r--r-- | src/pkg/runtime/amd64/traceback.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/pkg/runtime/amd64/traceback.c b/src/pkg/runtime/amd64/traceback.c index d422cb6922..3e85d36bd7 100644 --- a/src/pkg/runtime/amd64/traceback.c +++ b/src/pkg/runtime/amd64/traceback.c @@ -10,6 +10,7 @@ void runtime·deferproc(void); void runtime·newproc(void); void runtime·newstack(void); void runtime·morestack(void); +void runtime·sigpanic(void); // This code is also used for the 386 tracebacks. // Use uintptr for an appropriate word-sized integer. @@ -27,11 +28,13 @@ runtime·gentraceback(byte *pc0, byte *sp, byte *lr0, G *g, int32 skip, uintptr byte *fp; Stktop *stk; Func *f; + bool waspanic; USED(lr0); pc = (uintptr)pc0; lr = 0; fp = nil; + waspanic = false; // If the PC is goexit, the goroutine hasn't started yet. if(pc0 == g->sched.pc && sp == g->sched.sp && pc0 == (byte*)runtime·goexit) { @@ -127,7 +130,7 @@ runtime·gentraceback(byte *pc0, byte *sp, byte *lr0, G *g, int32 skip, uintptr if(pc > f->entry) runtime·printf("+%p", (uintptr)(pc - f->entry)); tracepc = pc; // back up to CALL instruction for funcline. - if(n > 0 && pc > f->entry) + if(n > 0 && pc > f->entry && !waspanic) tracepc--; runtime·printf(" %S:%d\n", f->src, runtime·funcline(f, tracepc)); runtime·printf("\t%S(", f->name); @@ -144,6 +147,8 @@ runtime·gentraceback(byte *pc0, byte *sp, byte *lr0, G *g, int32 skip, uintptr n++; } + waspanic = f->entry == (uintptr)runtime·sigpanic; + if(f->entry == (uintptr)runtime·deferproc || f->entry == (uintptr)runtime·newproc) fp += 2*sizeof(uintptr); |
