2009-06-10 12:53:07 -06:00
|
|
|
// Copyright 2009 The Go Authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style
|
|
|
|
// license that can be found in the LICENSE file.
|
|
|
|
|
|
|
|
#include "runtime.h"
|
2011-12-16 13:33:58 -07:00
|
|
|
#include "arch_GOARCH.h"
|
runtime: more detailed panic traces, line number work
Follow morestack, so that crashes during a stack split
give complete traces. Also mark stack segment boundaries
as an aid to debugging.
Correct various line number bugs with yet another attempt
at interpreting the pc/ln table. This one has a chance at
being correct, because I based it on reading src/cmd/ld/lib.c
instead of on reading the documentation.
Fixes #1138.
Fixes #1430.
Fixes #1461.
throw: runtime: split stack overflow
runtime.throw+0x3e /home/rsc/g/go2/src/pkg/runtime/runtime.c:78
runtime.throw(0x81880af, 0xf75c8b18)
runtime.newstack+0xad /home/rsc/g/go2/src/pkg/runtime/proc.c:728
runtime.newstack()
runtime.morestack+0x4f /home/rsc/g/go2/src/pkg/runtime/386/asm.s:184
runtime.morestack()
----- morestack called from stack: -----
runtime.new+0x1a /home/rsc/g/go2/src/pkg/runtime/malloc.c:288
runtime.new(0x1, 0x0, 0x0)
gongo.makeBoard+0x33 /tmp/Gongo/gongo_robot_test.go:344
gongo.makeBoard(0x809d238, 0x1, 0xf76092c8, 0x1)
----- stack segment boundary -----
gongo.checkEasyScore+0xcc /tmp/Gongo/gongo_robot_test.go:287
gongo.checkEasyScore(0xf764b710, 0x0, 0x809d238, 0x1)
gongo.TestEasyScore+0x8c /tmp/Gongo/gongo_robot_test.go:255
gongo.TestEasyScore(0xf764b710, 0x818a990)
testing.tRunner+0x2f /home/rsc/g/go2/src/pkg/testing/testing.go:132
testing.tRunner(0xf764b710, 0xf763b5dc, 0x0)
runtime.goexit /home/rsc/g/go2/src/pkg/runtime/proc.c:149
runtime.goexit()
R=ken2, r
CC=golang-dev
https://golang.org/cl/4000053
2011-02-02 14:44:20 -07:00
|
|
|
#include "malloc.h"
|
|
|
|
|
|
|
|
void runtime·deferproc(void);
|
|
|
|
void runtime·newproc(void);
|
|
|
|
void runtime·newstack(void);
|
|
|
|
void runtime·morestack(void);
|
2011-07-25 22:52:46 -06:00
|
|
|
void runtime·sigpanic(void);
|
2011-02-18 11:30:29 -07:00
|
|
|
void _div(void);
|
|
|
|
void _mod(void);
|
|
|
|
void _divu(void);
|
|
|
|
void _modu(void);
|
2009-06-10 12:53:07 -06:00
|
|
|
|
2011-03-25 10:30:49 -06:00
|
|
|
int32
|
2011-03-23 09:43:37 -06:00
|
|
|
runtime·gentraceback(byte *pc0, byte *sp, byte *lr0, G *g, int32 skip, uintptr *pcbuf, int32 max)
|
2010-04-05 13:51:09 -06:00
|
|
|
{
|
|
|
|
int32 i, n, iter;
|
runtime: more detailed panic traces, line number work
Follow morestack, so that crashes during a stack split
give complete traces. Also mark stack segment boundaries
as an aid to debugging.
Correct various line number bugs with yet another attempt
at interpreting the pc/ln table. This one has a chance at
being correct, because I based it on reading src/cmd/ld/lib.c
instead of on reading the documentation.
Fixes #1138.
Fixes #1430.
Fixes #1461.
throw: runtime: split stack overflow
runtime.throw+0x3e /home/rsc/g/go2/src/pkg/runtime/runtime.c:78
runtime.throw(0x81880af, 0xf75c8b18)
runtime.newstack+0xad /home/rsc/g/go2/src/pkg/runtime/proc.c:728
runtime.newstack()
runtime.morestack+0x4f /home/rsc/g/go2/src/pkg/runtime/386/asm.s:184
runtime.morestack()
----- morestack called from stack: -----
runtime.new+0x1a /home/rsc/g/go2/src/pkg/runtime/malloc.c:288
runtime.new(0x1, 0x0, 0x0)
gongo.makeBoard+0x33 /tmp/Gongo/gongo_robot_test.go:344
gongo.makeBoard(0x809d238, 0x1, 0xf76092c8, 0x1)
----- stack segment boundary -----
gongo.checkEasyScore+0xcc /tmp/Gongo/gongo_robot_test.go:287
gongo.checkEasyScore(0xf764b710, 0x0, 0x809d238, 0x1)
gongo.TestEasyScore+0x8c /tmp/Gongo/gongo_robot_test.go:255
gongo.TestEasyScore(0xf764b710, 0x818a990)
testing.tRunner+0x2f /home/rsc/g/go2/src/pkg/testing/testing.go:132
testing.tRunner(0xf764b710, 0xf763b5dc, 0x0)
runtime.goexit /home/rsc/g/go2/src/pkg/runtime/proc.c:149
runtime.goexit()
R=ken2, r
CC=golang-dev
https://golang.org/cl/4000053
2011-02-02 14:44:20 -07:00
|
|
|
uintptr pc, lr, tracepc, x;
|
|
|
|
byte *fp, *p;
|
2011-07-25 22:52:46 -06:00
|
|
|
bool waspanic;
|
2010-04-05 13:51:09 -06:00
|
|
|
Stktop *stk;
|
|
|
|
Func *f;
|
|
|
|
|
|
|
|
pc = (uintptr)pc0;
|
|
|
|
lr = (uintptr)lr0;
|
runtime: more detailed panic traces, line number work
Follow morestack, so that crashes during a stack split
give complete traces. Also mark stack segment boundaries
as an aid to debugging.
Correct various line number bugs with yet another attempt
at interpreting the pc/ln table. This one has a chance at
being correct, because I based it on reading src/cmd/ld/lib.c
instead of on reading the documentation.
Fixes #1138.
Fixes #1430.
Fixes #1461.
throw: runtime: split stack overflow
runtime.throw+0x3e /home/rsc/g/go2/src/pkg/runtime/runtime.c:78
runtime.throw(0x81880af, 0xf75c8b18)
runtime.newstack+0xad /home/rsc/g/go2/src/pkg/runtime/proc.c:728
runtime.newstack()
runtime.morestack+0x4f /home/rsc/g/go2/src/pkg/runtime/386/asm.s:184
runtime.morestack()
----- morestack called from stack: -----
runtime.new+0x1a /home/rsc/g/go2/src/pkg/runtime/malloc.c:288
runtime.new(0x1, 0x0, 0x0)
gongo.makeBoard+0x33 /tmp/Gongo/gongo_robot_test.go:344
gongo.makeBoard(0x809d238, 0x1, 0xf76092c8, 0x1)
----- stack segment boundary -----
gongo.checkEasyScore+0xcc /tmp/Gongo/gongo_robot_test.go:287
gongo.checkEasyScore(0xf764b710, 0x0, 0x809d238, 0x1)
gongo.TestEasyScore+0x8c /tmp/Gongo/gongo_robot_test.go:255
gongo.TestEasyScore(0xf764b710, 0x818a990)
testing.tRunner+0x2f /home/rsc/g/go2/src/pkg/testing/testing.go:132
testing.tRunner(0xf764b710, 0xf763b5dc, 0x0)
runtime.goexit /home/rsc/g/go2/src/pkg/runtime/proc.c:149
runtime.goexit()
R=ken2, r
CC=golang-dev
https://golang.org/cl/4000053
2011-02-02 14:44:20 -07:00
|
|
|
fp = nil;
|
2011-07-25 22:52:46 -06:00
|
|
|
waspanic = false;
|
runtime: more detailed panic traces, line number work
Follow morestack, so that crashes during a stack split
give complete traces. Also mark stack segment boundaries
as an aid to debugging.
Correct various line number bugs with yet another attempt
at interpreting the pc/ln table. This one has a chance at
being correct, because I based it on reading src/cmd/ld/lib.c
instead of on reading the documentation.
Fixes #1138.
Fixes #1430.
Fixes #1461.
throw: runtime: split stack overflow
runtime.throw+0x3e /home/rsc/g/go2/src/pkg/runtime/runtime.c:78
runtime.throw(0x81880af, 0xf75c8b18)
runtime.newstack+0xad /home/rsc/g/go2/src/pkg/runtime/proc.c:728
runtime.newstack()
runtime.morestack+0x4f /home/rsc/g/go2/src/pkg/runtime/386/asm.s:184
runtime.morestack()
----- morestack called from stack: -----
runtime.new+0x1a /home/rsc/g/go2/src/pkg/runtime/malloc.c:288
runtime.new(0x1, 0x0, 0x0)
gongo.makeBoard+0x33 /tmp/Gongo/gongo_robot_test.go:344
gongo.makeBoard(0x809d238, 0x1, 0xf76092c8, 0x1)
----- stack segment boundary -----
gongo.checkEasyScore+0xcc /tmp/Gongo/gongo_robot_test.go:287
gongo.checkEasyScore(0xf764b710, 0x0, 0x809d238, 0x1)
gongo.TestEasyScore+0x8c /tmp/Gongo/gongo_robot_test.go:255
gongo.TestEasyScore(0xf764b710, 0x818a990)
testing.tRunner+0x2f /home/rsc/g/go2/src/pkg/testing/testing.go:132
testing.tRunner(0xf764b710, 0xf763b5dc, 0x0)
runtime.goexit /home/rsc/g/go2/src/pkg/runtime/proc.c:149
runtime.goexit()
R=ken2, r
CC=golang-dev
https://golang.org/cl/4000053
2011-02-02 14:44:20 -07:00
|
|
|
|
|
|
|
// If the PC is goexit, the goroutine hasn't started yet.
|
runtime: ,s/[a-zA-Z0-9_]+/runtime·&/g, almost
Prefix all external symbols in runtime by runtime·,
to avoid conflicts with possible symbols of the same
name in linked-in C libraries. The obvious conflicts
are printf, malloc, and free, but hide everything to
avoid future pain.
The symbols left alone are:
** known to cgo **
_cgo_free
_cgo_malloc
libcgo_thread_start
initcgo
ncgocall
** known to linker **
_rt0_$GOARCH
_rt0_$GOARCH_$GOOS
text
etext
data
end
pclntab
epclntab
symtab
esymtab
** known to C compiler **
_divv
_modv
_div64by32
etc (arch specific)
Tested on darwin/386, darwin/amd64, linux/386, linux/amd64.
Built (but not tested) for freebsd/386, freebsd/amd64, linux/arm, windows/386.
R=r, PeterGo
CC=golang-dev
https://golang.org/cl/2899041
2010-11-04 12:00:19 -06:00
|
|
|
if(pc == (uintptr)runtime·goexit) {
|
2010-05-21 15:40:21 -06:00
|
|
|
pc = (uintptr)g->entry;
|
runtime: ,s/[a-zA-Z0-9_]+/runtime·&/g, almost
Prefix all external symbols in runtime by runtime·,
to avoid conflicts with possible symbols of the same
name in linked-in C libraries. The obvious conflicts
are printf, malloc, and free, but hide everything to
avoid future pain.
The symbols left alone are:
** known to cgo **
_cgo_free
_cgo_malloc
libcgo_thread_start
initcgo
ncgocall
** known to linker **
_rt0_$GOARCH
_rt0_$GOARCH_$GOOS
text
etext
data
end
pclntab
epclntab
symtab
esymtab
** known to C compiler **
_divv
_modv
_div64by32
etc (arch specific)
Tested on darwin/386, darwin/amd64, linux/386, linux/amd64.
Built (but not tested) for freebsd/386, freebsd/amd64, linux/arm, windows/386.
R=r, PeterGo
CC=golang-dev
https://golang.org/cl/2899041
2010-11-04 12:00:19 -06:00
|
|
|
lr = (uintptr)runtime·goexit;
|
2010-05-21 15:40:21 -06:00
|
|
|
}
|
2010-04-05 13:51:09 -06:00
|
|
|
|
|
|
|
// If the PC is zero, it's likely a nil function call.
|
|
|
|
// Start in the caller's frame.
|
|
|
|
if(pc == 0) {
|
|
|
|
pc = lr;
|
|
|
|
lr = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
n = 0;
|
|
|
|
stk = (Stktop*)g->stackbase;
|
runtime: more detailed panic traces, line number work
Follow morestack, so that crashes during a stack split
give complete traces. Also mark stack segment boundaries
as an aid to debugging.
Correct various line number bugs with yet another attempt
at interpreting the pc/ln table. This one has a chance at
being correct, because I based it on reading src/cmd/ld/lib.c
instead of on reading the documentation.
Fixes #1138.
Fixes #1430.
Fixes #1461.
throw: runtime: split stack overflow
runtime.throw+0x3e /home/rsc/g/go2/src/pkg/runtime/runtime.c:78
runtime.throw(0x81880af, 0xf75c8b18)
runtime.newstack+0xad /home/rsc/g/go2/src/pkg/runtime/proc.c:728
runtime.newstack()
runtime.morestack+0x4f /home/rsc/g/go2/src/pkg/runtime/386/asm.s:184
runtime.morestack()
----- morestack called from stack: -----
runtime.new+0x1a /home/rsc/g/go2/src/pkg/runtime/malloc.c:288
runtime.new(0x1, 0x0, 0x0)
gongo.makeBoard+0x33 /tmp/Gongo/gongo_robot_test.go:344
gongo.makeBoard(0x809d238, 0x1, 0xf76092c8, 0x1)
----- stack segment boundary -----
gongo.checkEasyScore+0xcc /tmp/Gongo/gongo_robot_test.go:287
gongo.checkEasyScore(0xf764b710, 0x0, 0x809d238, 0x1)
gongo.TestEasyScore+0x8c /tmp/Gongo/gongo_robot_test.go:255
gongo.TestEasyScore(0xf764b710, 0x818a990)
testing.tRunner+0x2f /home/rsc/g/go2/src/pkg/testing/testing.go:132
testing.tRunner(0xf764b710, 0xf763b5dc, 0x0)
runtime.goexit /home/rsc/g/go2/src/pkg/runtime/proc.c:149
runtime.goexit()
R=ken2, r
CC=golang-dev
https://golang.org/cl/4000053
2011-02-02 14:44:20 -07:00
|
|
|
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.
|
|
|
|
// fp is the frame pointer (caller's stack pointer) at that program counter, or nil if unknown.
|
|
|
|
// stk is the stack containing sp.
|
|
|
|
// The caller's program counter is lr, unless lr is zero, in which case it is *(uintptr*)sp.
|
|
|
|
|
runtime: ,s/[a-zA-Z0-9_]+/runtime·&/g, almost
Prefix all external symbols in runtime by runtime·,
to avoid conflicts with possible symbols of the same
name in linked-in C libraries. The obvious conflicts
are printf, malloc, and free, but hide everything to
avoid future pain.
The symbols left alone are:
** known to cgo **
_cgo_free
_cgo_malloc
libcgo_thread_start
initcgo
ncgocall
** known to linker **
_rt0_$GOARCH
_rt0_$GOARCH_$GOOS
text
etext
data
end
pclntab
epclntab
symtab
esymtab
** known to C compiler **
_divv
_modv
_div64by32
etc (arch specific)
Tested on darwin/386, darwin/amd64, linux/386, linux/amd64.
Built (but not tested) for freebsd/386, freebsd/amd64, linux/arm, windows/386.
R=r, PeterGo
CC=golang-dev
https://golang.org/cl/2899041
2010-11-04 12:00:19 -06:00
|
|
|
if(pc == (uintptr)runtime·lessstack) {
|
2010-04-05 13:51:09 -06:00
|
|
|
// Hit top of stack segment. Unwind to next segment.
|
|
|
|
pc = (uintptr)stk->gobuf.pc;
|
2012-05-30 11:07:52 -06:00
|
|
|
sp = (byte*)stk->gobuf.sp;
|
runtime: more detailed panic traces, line number work
Follow morestack, so that crashes during a stack split
give complete traces. Also mark stack segment boundaries
as an aid to debugging.
Correct various line number bugs with yet another attempt
at interpreting the pc/ln table. This one has a chance at
being correct, because I based it on reading src/cmd/ld/lib.c
instead of on reading the documentation.
Fixes #1138.
Fixes #1430.
Fixes #1461.
throw: runtime: split stack overflow
runtime.throw+0x3e /home/rsc/g/go2/src/pkg/runtime/runtime.c:78
runtime.throw(0x81880af, 0xf75c8b18)
runtime.newstack+0xad /home/rsc/g/go2/src/pkg/runtime/proc.c:728
runtime.newstack()
runtime.morestack+0x4f /home/rsc/g/go2/src/pkg/runtime/386/asm.s:184
runtime.morestack()
----- morestack called from stack: -----
runtime.new+0x1a /home/rsc/g/go2/src/pkg/runtime/malloc.c:288
runtime.new(0x1, 0x0, 0x0)
gongo.makeBoard+0x33 /tmp/Gongo/gongo_robot_test.go:344
gongo.makeBoard(0x809d238, 0x1, 0xf76092c8, 0x1)
----- stack segment boundary -----
gongo.checkEasyScore+0xcc /tmp/Gongo/gongo_robot_test.go:287
gongo.checkEasyScore(0xf764b710, 0x0, 0x809d238, 0x1)
gongo.TestEasyScore+0x8c /tmp/Gongo/gongo_robot_test.go:255
gongo.TestEasyScore(0xf764b710, 0x818a990)
testing.tRunner+0x2f /home/rsc/g/go2/src/pkg/testing/testing.go:132
testing.tRunner(0xf764b710, 0xf763b5dc, 0x0)
runtime.goexit /home/rsc/g/go2/src/pkg/runtime/proc.c:149
runtime.goexit()
R=ken2, r
CC=golang-dev
https://golang.org/cl/4000053
2011-02-02 14:44:20 -07:00
|
|
|
lr = 0;
|
|
|
|
fp = nil;
|
|
|
|
if(pcbuf == nil)
|
|
|
|
runtime·printf("----- stack segment boundary -----\n");
|
2010-04-05 13:51:09 -06:00
|
|
|
stk = (Stktop*)stk->stackbase;
|
|
|
|
continue;
|
|
|
|
}
|
runtime: more detailed panic traces, line number work
Follow morestack, so that crashes during a stack split
give complete traces. Also mark stack segment boundaries
as an aid to debugging.
Correct various line number bugs with yet another attempt
at interpreting the pc/ln table. This one has a chance at
being correct, because I based it on reading src/cmd/ld/lib.c
instead of on reading the documentation.
Fixes #1138.
Fixes #1430.
Fixes #1461.
throw: runtime: split stack overflow
runtime.throw+0x3e /home/rsc/g/go2/src/pkg/runtime/runtime.c:78
runtime.throw(0x81880af, 0xf75c8b18)
runtime.newstack+0xad /home/rsc/g/go2/src/pkg/runtime/proc.c:728
runtime.newstack()
runtime.morestack+0x4f /home/rsc/g/go2/src/pkg/runtime/386/asm.s:184
runtime.morestack()
----- morestack called from stack: -----
runtime.new+0x1a /home/rsc/g/go2/src/pkg/runtime/malloc.c:288
runtime.new(0x1, 0x0, 0x0)
gongo.makeBoard+0x33 /tmp/Gongo/gongo_robot_test.go:344
gongo.makeBoard(0x809d238, 0x1, 0xf76092c8, 0x1)
----- stack segment boundary -----
gongo.checkEasyScore+0xcc /tmp/Gongo/gongo_robot_test.go:287
gongo.checkEasyScore(0xf764b710, 0x0, 0x809d238, 0x1)
gongo.TestEasyScore+0x8c /tmp/Gongo/gongo_robot_test.go:255
gongo.TestEasyScore(0xf764b710, 0x818a990)
testing.tRunner+0x2f /home/rsc/g/go2/src/pkg/testing/testing.go:132
testing.tRunner(0xf764b710, 0xf763b5dc, 0x0)
runtime.goexit /home/rsc/g/go2/src/pkg/runtime/proc.c:149
runtime.goexit()
R=ken2, r
CC=golang-dev
https://golang.org/cl/4000053
2011-02-02 14:44:20 -07:00
|
|
|
|
|
|
|
if(pc <= 0x1000 || (f = runtime·findfunc(pc)) == nil) {
|
|
|
|
// Dangerous, but worthwhile: see if this is a closure by
|
|
|
|
// decoding the instruction stream.
|
|
|
|
//
|
|
|
|
// We check p < p+4 to avoid wrapping and faulting if
|
|
|
|
// we have lost track of where we are.
|
|
|
|
p = (byte*)pc;
|
|
|
|
if((pc&3) == 0 && p < p+4 &&
|
|
|
|
runtime·mheap.arena_start < p &&
|
|
|
|
p+4 < runtime·mheap.arena_used) {
|
|
|
|
x = *(uintptr*)p;
|
|
|
|
if((x&0xfffff000) == 0xe49df000) {
|
|
|
|
// End of closure:
|
|
|
|
// MOVW.P frame(R13), R15
|
|
|
|
pc = *(uintptr*)sp;
|
|
|
|
lr = 0;
|
|
|
|
sp += x & 0xfff;
|
|
|
|
fp = nil;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if((x&0xfffff000) == 0xe52de000 && lr == (uintptr)runtime·goexit) {
|
|
|
|
// Beginning of closure.
|
|
|
|
// Closure at top of stack, not yet started.
|
|
|
|
p += 5*4;
|
|
|
|
if((x&0xfff) != 4) {
|
|
|
|
// argument copying
|
|
|
|
p += 7*4;
|
|
|
|
}
|
|
|
|
if((byte*)pc < p && p < p+4 && p+4 < runtime·mheap.arena_used) {
|
|
|
|
pc = *(uintptr*)p;
|
|
|
|
fp = nil;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2010-04-05 13:51:09 -06:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
runtime: more detailed panic traces, line number work
Follow morestack, so that crashes during a stack split
give complete traces. Also mark stack segment boundaries
as an aid to debugging.
Correct various line number bugs with yet another attempt
at interpreting the pc/ln table. This one has a chance at
being correct, because I based it on reading src/cmd/ld/lib.c
instead of on reading the documentation.
Fixes #1138.
Fixes #1430.
Fixes #1461.
throw: runtime: split stack overflow
runtime.throw+0x3e /home/rsc/g/go2/src/pkg/runtime/runtime.c:78
runtime.throw(0x81880af, 0xf75c8b18)
runtime.newstack+0xad /home/rsc/g/go2/src/pkg/runtime/proc.c:728
runtime.newstack()
runtime.morestack+0x4f /home/rsc/g/go2/src/pkg/runtime/386/asm.s:184
runtime.morestack()
----- morestack called from stack: -----
runtime.new+0x1a /home/rsc/g/go2/src/pkg/runtime/malloc.c:288
runtime.new(0x1, 0x0, 0x0)
gongo.makeBoard+0x33 /tmp/Gongo/gongo_robot_test.go:344
gongo.makeBoard(0x809d238, 0x1, 0xf76092c8, 0x1)
----- stack segment boundary -----
gongo.checkEasyScore+0xcc /tmp/Gongo/gongo_robot_test.go:287
gongo.checkEasyScore(0xf764b710, 0x0, 0x809d238, 0x1)
gongo.TestEasyScore+0x8c /tmp/Gongo/gongo_robot_test.go:255
gongo.TestEasyScore(0xf764b710, 0x818a990)
testing.tRunner+0x2f /home/rsc/g/go2/src/pkg/testing/testing.go:132
testing.tRunner(0xf764b710, 0xf763b5dc, 0x0)
runtime.goexit /home/rsc/g/go2/src/pkg/runtime/proc.c:149
runtime.goexit()
R=ken2, r
CC=golang-dev
https://golang.org/cl/4000053
2011-02-02 14:44:20 -07:00
|
|
|
// Found an actual function.
|
|
|
|
if(lr == 0)
|
|
|
|
lr = *(uintptr*)sp;
|
|
|
|
if(fp == nil) {
|
|
|
|
fp = sp;
|
|
|
|
if(pc > f->entry && f->frame >= 0)
|
|
|
|
fp += f->frame;
|
|
|
|
}
|
|
|
|
|
2010-04-05 13:51:09 -06:00
|
|
|
if(skip > 0)
|
|
|
|
skip--;
|
|
|
|
else if(pcbuf != nil)
|
|
|
|
pcbuf[n++] = pc;
|
|
|
|
else {
|
2011-08-29 08:55:21 -06:00
|
|
|
if(runtime·showframe(f)) {
|
2011-08-22 21:26:39 -06:00
|
|
|
// Print during crash.
|
|
|
|
// main(0x1, 0x2, 0x3)
|
|
|
|
// /home/rsc/go/src/runtime/x.go:23 +0xf
|
|
|
|
tracepc = pc; // back up to CALL instruction for funcline.
|
|
|
|
if(n > 0 && pc > f->entry && !waspanic)
|
|
|
|
tracepc -= sizeof(uintptr);
|
|
|
|
runtime·printf("%S(", f->name);
|
|
|
|
for(i = 0; i < f->args; i++) {
|
|
|
|
if(i != 0)
|
|
|
|
runtime·prints(", ");
|
|
|
|
runtime·printhex(((uintptr*)fp)[1+i]);
|
|
|
|
if(i >= 4) {
|
|
|
|
runtime·prints(", ...");
|
|
|
|
break;
|
|
|
|
}
|
2010-04-05 13:51:09 -06:00
|
|
|
}
|
2011-08-22 21:26:39 -06:00
|
|
|
runtime·prints(")\n");
|
|
|
|
runtime·printf("\t%S:%d", f->src, runtime·funcline(f, tracepc));
|
|
|
|
if(pc > f->entry)
|
|
|
|
runtime·printf(" +%p", (uintptr)(pc - f->entry));
|
|
|
|
runtime·printf("\n");
|
2010-04-05 13:51:09 -06:00
|
|
|
}
|
|
|
|
n++;
|
|
|
|
}
|
2011-07-25 22:52:46 -06:00
|
|
|
|
|
|
|
waspanic = f->entry == (uintptr)runtime·sigpanic;
|
runtime: more detailed panic traces, line number work
Follow morestack, so that crashes during a stack split
give complete traces. Also mark stack segment boundaries
as an aid to debugging.
Correct various line number bugs with yet another attempt
at interpreting the pc/ln table. This one has a chance at
being correct, because I based it on reading src/cmd/ld/lib.c
instead of on reading the documentation.
Fixes #1138.
Fixes #1430.
Fixes #1461.
throw: runtime: split stack overflow
runtime.throw+0x3e /home/rsc/g/go2/src/pkg/runtime/runtime.c:78
runtime.throw(0x81880af, 0xf75c8b18)
runtime.newstack+0xad /home/rsc/g/go2/src/pkg/runtime/proc.c:728
runtime.newstack()
runtime.morestack+0x4f /home/rsc/g/go2/src/pkg/runtime/386/asm.s:184
runtime.morestack()
----- morestack called from stack: -----
runtime.new+0x1a /home/rsc/g/go2/src/pkg/runtime/malloc.c:288
runtime.new(0x1, 0x0, 0x0)
gongo.makeBoard+0x33 /tmp/Gongo/gongo_robot_test.go:344
gongo.makeBoard(0x809d238, 0x1, 0xf76092c8, 0x1)
----- stack segment boundary -----
gongo.checkEasyScore+0xcc /tmp/Gongo/gongo_robot_test.go:287
gongo.checkEasyScore(0xf764b710, 0x0, 0x809d238, 0x1)
gongo.TestEasyScore+0x8c /tmp/Gongo/gongo_robot_test.go:255
gongo.TestEasyScore(0xf764b710, 0x818a990)
testing.tRunner+0x2f /home/rsc/g/go2/src/pkg/testing/testing.go:132
testing.tRunner(0xf764b710, 0xf763b5dc, 0x0)
runtime.goexit /home/rsc/g/go2/src/pkg/runtime/proc.c:149
runtime.goexit()
R=ken2, r
CC=golang-dev
https://golang.org/cl/4000053
2011-02-02 14:44:20 -07:00
|
|
|
|
|
|
|
if(pcbuf == nil && f->entry == (uintptr)runtime·newstack && g == m->g0) {
|
|
|
|
runtime·printf("----- newstack called from goroutine %d -----\n", m->curg->goid);
|
|
|
|
pc = (uintptr)m->morepc;
|
|
|
|
sp = (byte*)m->moreargp - sizeof(void*);
|
|
|
|
lr = (uintptr)m->morebuf.pc;
|
2012-05-30 11:07:52 -06:00
|
|
|
fp = (byte*)m->morebuf.sp;
|
runtime: more detailed panic traces, line number work
Follow morestack, so that crashes during a stack split
give complete traces. Also mark stack segment boundaries
as an aid to debugging.
Correct various line number bugs with yet another attempt
at interpreting the pc/ln table. This one has a chance at
being correct, because I based it on reading src/cmd/ld/lib.c
instead of on reading the documentation.
Fixes #1138.
Fixes #1430.
Fixes #1461.
throw: runtime: split stack overflow
runtime.throw+0x3e /home/rsc/g/go2/src/pkg/runtime/runtime.c:78
runtime.throw(0x81880af, 0xf75c8b18)
runtime.newstack+0xad /home/rsc/g/go2/src/pkg/runtime/proc.c:728
runtime.newstack()
runtime.morestack+0x4f /home/rsc/g/go2/src/pkg/runtime/386/asm.s:184
runtime.morestack()
----- morestack called from stack: -----
runtime.new+0x1a /home/rsc/g/go2/src/pkg/runtime/malloc.c:288
runtime.new(0x1, 0x0, 0x0)
gongo.makeBoard+0x33 /tmp/Gongo/gongo_robot_test.go:344
gongo.makeBoard(0x809d238, 0x1, 0xf76092c8, 0x1)
----- stack segment boundary -----
gongo.checkEasyScore+0xcc /tmp/Gongo/gongo_robot_test.go:287
gongo.checkEasyScore(0xf764b710, 0x0, 0x809d238, 0x1)
gongo.TestEasyScore+0x8c /tmp/Gongo/gongo_robot_test.go:255
gongo.TestEasyScore(0xf764b710, 0x818a990)
testing.tRunner+0x2f /home/rsc/g/go2/src/pkg/testing/testing.go:132
testing.tRunner(0xf764b710, 0xf763b5dc, 0x0)
runtime.goexit /home/rsc/g/go2/src/pkg/runtime/proc.c:149
runtime.goexit()
R=ken2, r
CC=golang-dev
https://golang.org/cl/4000053
2011-02-02 14:44:20 -07:00
|
|
|
g = m->curg;
|
|
|
|
stk = (Stktop*)g->stackbase;
|
|
|
|
continue;
|
|
|
|
}
|
2010-04-05 13:51:09 -06:00
|
|
|
|
2011-02-23 12:47:22 -07:00
|
|
|
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;
|
2012-05-30 11:07:52 -06:00
|
|
|
sp = (byte*)stk->gobuf.sp;
|
2011-02-23 12:47:22 -07:00
|
|
|
pc = (uintptr)stk->gobuf.pc;
|
|
|
|
fp = nil;
|
|
|
|
lr = 0;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
runtime: more detailed panic traces, line number work
Follow morestack, so that crashes during a stack split
give complete traces. Also mark stack segment boundaries
as an aid to debugging.
Correct various line number bugs with yet another attempt
at interpreting the pc/ln table. This one has a chance at
being correct, because I based it on reading src/cmd/ld/lib.c
instead of on reading the documentation.
Fixes #1138.
Fixes #1430.
Fixes #1461.
throw: runtime: split stack overflow
runtime.throw+0x3e /home/rsc/g/go2/src/pkg/runtime/runtime.c:78
runtime.throw(0x81880af, 0xf75c8b18)
runtime.newstack+0xad /home/rsc/g/go2/src/pkg/runtime/proc.c:728
runtime.newstack()
runtime.morestack+0x4f /home/rsc/g/go2/src/pkg/runtime/386/asm.s:184
runtime.morestack()
----- morestack called from stack: -----
runtime.new+0x1a /home/rsc/g/go2/src/pkg/runtime/malloc.c:288
runtime.new(0x1, 0x0, 0x0)
gongo.makeBoard+0x33 /tmp/Gongo/gongo_robot_test.go:344
gongo.makeBoard(0x809d238, 0x1, 0xf76092c8, 0x1)
----- stack segment boundary -----
gongo.checkEasyScore+0xcc /tmp/Gongo/gongo_robot_test.go:287
gongo.checkEasyScore(0xf764b710, 0x0, 0x809d238, 0x1)
gongo.TestEasyScore+0x8c /tmp/Gongo/gongo_robot_test.go:255
gongo.TestEasyScore(0xf764b710, 0x818a990)
testing.tRunner+0x2f /home/rsc/g/go2/src/pkg/testing/testing.go:132
testing.tRunner(0xf764b710, 0xf763b5dc, 0x0)
runtime.goexit /home/rsc/g/go2/src/pkg/runtime/proc.c:149
runtime.goexit()
R=ken2, r
CC=golang-dev
https://golang.org/cl/4000053
2011-02-02 14:44:20 -07:00
|
|
|
// Unwind to next frame.
|
2010-04-05 13:51:09 -06:00
|
|
|
pc = lr;
|
|
|
|
lr = 0;
|
runtime: more detailed panic traces, line number work
Follow morestack, so that crashes during a stack split
give complete traces. Also mark stack segment boundaries
as an aid to debugging.
Correct various line number bugs with yet another attempt
at interpreting the pc/ln table. This one has a chance at
being correct, because I based it on reading src/cmd/ld/lib.c
instead of on reading the documentation.
Fixes #1138.
Fixes #1430.
Fixes #1461.
throw: runtime: split stack overflow
runtime.throw+0x3e /home/rsc/g/go2/src/pkg/runtime/runtime.c:78
runtime.throw(0x81880af, 0xf75c8b18)
runtime.newstack+0xad /home/rsc/g/go2/src/pkg/runtime/proc.c:728
runtime.newstack()
runtime.morestack+0x4f /home/rsc/g/go2/src/pkg/runtime/386/asm.s:184
runtime.morestack()
----- morestack called from stack: -----
runtime.new+0x1a /home/rsc/g/go2/src/pkg/runtime/malloc.c:288
runtime.new(0x1, 0x0, 0x0)
gongo.makeBoard+0x33 /tmp/Gongo/gongo_robot_test.go:344
gongo.makeBoard(0x809d238, 0x1, 0xf76092c8, 0x1)
----- stack segment boundary -----
gongo.checkEasyScore+0xcc /tmp/Gongo/gongo_robot_test.go:287
gongo.checkEasyScore(0xf764b710, 0x0, 0x809d238, 0x1)
gongo.TestEasyScore+0x8c /tmp/Gongo/gongo_robot_test.go:255
gongo.TestEasyScore(0xf764b710, 0x818a990)
testing.tRunner+0x2f /home/rsc/g/go2/src/pkg/testing/testing.go:132
testing.tRunner(0xf764b710, 0xf763b5dc, 0x0)
runtime.goexit /home/rsc/g/go2/src/pkg/runtime/proc.c:149
runtime.goexit()
R=ken2, r
CC=golang-dev
https://golang.org/cl/4000053
2011-02-02 14:44:20 -07:00
|
|
|
sp = fp;
|
|
|
|
fp = nil;
|
2011-02-18 11:30:29 -07:00
|
|
|
|
|
|
|
// If this was div or divu or mod or modu, the caller had
|
|
|
|
// an extra 8 bytes on its stack. Adjust sp.
|
|
|
|
if(f->entry == (uintptr)_div || f->entry == (uintptr)_divu || f->entry == (uintptr)_mod || f->entry == (uintptr)_modu)
|
|
|
|
sp += 8;
|
|
|
|
|
|
|
|
// If this was deferproc or newproc, the caller had an extra 12.
|
|
|
|
if(f->entry == (uintptr)runtime·deferproc || f->entry == (uintptr)runtime·newproc)
|
|
|
|
sp += 12;
|
2010-04-05 13:51:09 -06:00
|
|
|
}
|
2011-03-02 11:42:02 -07:00
|
|
|
|
2011-08-22 21:26:39 -06:00
|
|
|
if(pcbuf == nil && (pc = g->gopc) != 0 && (f = runtime·findfunc(pc)) != nil && g->goid != 1) {
|
|
|
|
runtime·printf("created by %S\n", f->name);
|
2011-03-02 11:42:02 -07:00
|
|
|
tracepc = pc; // back up to CALL instruction for funcline.
|
|
|
|
if(n > 0 && pc > f->entry)
|
|
|
|
tracepc -= sizeof(uintptr);
|
2011-08-22 21:26:39 -06:00
|
|
|
runtime·printf("\t%S:%d", f->src, runtime·funcline(f, tracepc));
|
|
|
|
if(pc > f->entry)
|
|
|
|
runtime·printf(" +%p", (uintptr)(pc - f->entry));
|
|
|
|
runtime·printf("\n");
|
2011-03-02 11:42:02 -07:00
|
|
|
}
|
|
|
|
|
2010-04-05 13:51:09 -06:00
|
|
|
return n;
|
|
|
|
}
|
2009-06-10 12:53:07 -06:00
|
|
|
|
|
|
|
void
|
runtime: ,s/[a-zA-Z0-9_]+/runtime·&/g, almost
Prefix all external symbols in runtime by runtime·,
to avoid conflicts with possible symbols of the same
name in linked-in C libraries. The obvious conflicts
are printf, malloc, and free, but hide everything to
avoid future pain.
The symbols left alone are:
** known to cgo **
_cgo_free
_cgo_malloc
libcgo_thread_start
initcgo
ncgocall
** known to linker **
_rt0_$GOARCH
_rt0_$GOARCH_$GOOS
text
etext
data
end
pclntab
epclntab
symtab
esymtab
** known to C compiler **
_divv
_modv
_div64by32
etc (arch specific)
Tested on darwin/386, darwin/amd64, linux/386, linux/amd64.
Built (but not tested) for freebsd/386, freebsd/amd64, linux/arm, windows/386.
R=r, PeterGo
CC=golang-dev
https://golang.org/cl/2899041
2010-11-04 12:00:19 -06:00
|
|
|
runtime·traceback(byte *pc0, byte *sp, byte *lr, G *g)
|
2009-06-10 12:53:07 -06:00
|
|
|
{
|
2011-03-23 09:43:37 -06:00
|
|
|
runtime·gentraceback(pc0, sp, lr, g, 0, nil, 100);
|
2009-06-10 12:53:07 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
// func caller(n int) (pc uintptr, file string, line int, ok bool)
|
2010-03-23 18:01:17 -06:00
|
|
|
int32
|
runtime: ,s/[a-zA-Z0-9_]+/runtime·&/g, almost
Prefix all external symbols in runtime by runtime·,
to avoid conflicts with possible symbols of the same
name in linked-in C libraries. The obvious conflicts
are printf, malloc, and free, but hide everything to
avoid future pain.
The symbols left alone are:
** known to cgo **
_cgo_free
_cgo_malloc
libcgo_thread_start
initcgo
ncgocall
** known to linker **
_rt0_$GOARCH
_rt0_$GOARCH_$GOOS
text
etext
data
end
pclntab
epclntab
symtab
esymtab
** known to C compiler **
_divv
_modv
_div64by32
etc (arch specific)
Tested on darwin/386, darwin/amd64, linux/386, linux/amd64.
Built (but not tested) for freebsd/386, freebsd/amd64, linux/arm, windows/386.
R=r, PeterGo
CC=golang-dev
https://golang.org/cl/2899041
2010-11-04 12:00:19 -06:00
|
|
|
runtime·callers(int32 skip, uintptr *pcbuf, int32 m)
|
2009-06-10 12:53:07 -06:00
|
|
|
{
|
2010-04-05 13:51:09 -06:00
|
|
|
byte *pc, *sp;
|
|
|
|
|
runtime: ,s/[a-zA-Z0-9_]+/runtime·&/g, almost
Prefix all external symbols in runtime by runtime·,
to avoid conflicts with possible symbols of the same
name in linked-in C libraries. The obvious conflicts
are printf, malloc, and free, but hide everything to
avoid future pain.
The symbols left alone are:
** known to cgo **
_cgo_free
_cgo_malloc
libcgo_thread_start
initcgo
ncgocall
** known to linker **
_rt0_$GOARCH
_rt0_$GOARCH_$GOOS
text
etext
data
end
pclntab
epclntab
symtab
esymtab
** known to C compiler **
_divv
_modv
_div64by32
etc (arch specific)
Tested on darwin/386, darwin/amd64, linux/386, linux/amd64.
Built (but not tested) for freebsd/386, freebsd/amd64, linux/arm, windows/386.
R=r, PeterGo
CC=golang-dev
https://golang.org/cl/2899041
2010-11-04 12:00:19 -06:00
|
|
|
sp = runtime·getcallersp(&skip);
|
|
|
|
pc = runtime·getcallerpc(&skip);
|
2010-04-05 13:51:09 -06:00
|
|
|
|
2011-03-23 09:43:37 -06:00
|
|
|
return runtime·gentraceback(pc, sp, 0, g, skip, pcbuf, m);
|
2009-06-10 12:53:07 -06:00
|
|
|
}
|