aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/stack.go
diff options
context:
space:
mode:
authorAustin Clements <austin@google.com>2017-12-14 15:32:12 -0500
committerAustin Clements <austin@google.com>2017-12-15 17:21:07 +0000
commit44213336f06755115e6b9a5407af7a2312c0d896 (patch)
tree073f3a6446f4d7e9db4a3648d6f7d90661de12c7 /src/runtime/stack.go
parentbfb8f2a765d6097c82b30ae2c19c99fa1082add3 (diff)
downloadgo-44213336f06755115e6b9a5407af7a2312c0d896.tar.xz
runtime: symbolize morestack caller in throwsplit panic
This attempts to symbolize the PC of morestack's caller when there's a stack split at a bad time. The stack trace starts at the *caller* of the function that attempted to grow the stack, so this is useful if it isn't obvious what's being called at that point, such as in #21431. Change-Id: I5dee305d87c8069611de2d14e7a3083d76264f8f Reviewed-on: https://go-review.googlesource.com/84115 Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'src/runtime/stack.go')
-rw-r--r--src/runtime/stack.go9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/runtime/stack.go b/src/runtime/stack.go
index eb0716c18d..6149838b6d 100644
--- a/src/runtime/stack.go
+++ b/src/runtime/stack.go
@@ -938,7 +938,14 @@ func newstack() {
morebuf := thisg.m.morebuf
gp.syscallsp = morebuf.sp
gp.syscallpc = morebuf.pc
- print("runtime: newstack sp=", hex(gp.sched.sp), " stack=[", hex(gp.stack.lo), ", ", hex(gp.stack.hi), "]\n",
+ pcname, pcoff := "(unknown)", uintptr(0)
+ f := findfunc(gp.sched.pc)
+ if f.valid() {
+ pcname = funcname(f)
+ pcoff = gp.sched.pc - f.entry
+ }
+ print("runtime: newstack at ", pcname, "+", hex(pcoff),
+ " sp=", hex(gp.sched.sp), " stack=[", hex(gp.stack.lo), ", ", hex(gp.stack.hi), "]\n",
"\tmorebuf={pc:", hex(morebuf.pc), " sp:", hex(morebuf.sp), " lr:", hex(morebuf.lr), "}\n",
"\tsched={pc:", hex(gp.sched.pc), " sp:", hex(gp.sched.sp), " lr:", hex(gp.sched.lr), " ctxt:", gp.sched.ctxt, "}\n")