mirror of
https://github.com/golang/go.git
synced 2024-09-21 10:28:27 +00:00
runtime: print goid when throwing in gentraceback
This makes it easier to figure out where the crash is occurring. Change-Id: Ie1f78a360367090dcd61c61b2a55c34f3e2ff2eb Reviewed-on: https://go-review.googlesource.com/c/go/+/390034 Trust: David Chase <drchase@google.com> Reviewed-by: David Chase <drchase@google.com> Trust: Michael Pratt <mpratt@google.com> Run-TryBot: Michael Pratt <mpratt@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com>
This commit is contained in:
parent
63bd6f68e6
commit
cc9d3f548a
@ -665,7 +665,7 @@ retry:
|
||||
func TestBadTraceback(t *testing.T) {
|
||||
output := runTestProg(t, "testprog", "BadTraceback")
|
||||
for _, want := range []string{
|
||||
"runtime: unexpected return pc",
|
||||
"unexpected return pc",
|
||||
"called from 0xbad",
|
||||
"00000bad", // Smashed LR in hex dump
|
||||
"<main.badLR", // Symbolization in hex dump (badLR1 or badLR2)
|
||||
|
@ -113,7 +113,7 @@ func gentraceback(pc0, sp0, lr0 uintptr, gp *g, skip int, pcbuf *uintptr, max in
|
||||
f := findfunc(frame.pc)
|
||||
if !f.valid() {
|
||||
if callback != nil || printing {
|
||||
print("runtime: unknown pc ", hex(frame.pc), "\n")
|
||||
print("runtime: g ", gp.goid, ": unknown pc ", hex(frame.pc), "\n")
|
||||
tracebackHexdump(gp.stack, &frame, 0)
|
||||
}
|
||||
if callback != nil {
|
||||
@ -247,7 +247,7 @@ func gentraceback(pc0, sp0, lr0 uintptr, gp *g, skip int, pcbuf *uintptr, max in
|
||||
doPrint = false
|
||||
}
|
||||
if callback != nil || doPrint {
|
||||
print("runtime: unexpected return pc for ", funcname(f), " called from ", hex(frame.lr), "\n")
|
||||
print("runtime: g ", gp.goid, ": unexpected return pc for ", funcname(f), " called from ", hex(frame.lr), "\n")
|
||||
tracebackHexdump(gp.stack, &frame, lrPtr)
|
||||
}
|
||||
if callback != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user