From: Michael Pratt Date: Tue, 20 Jun 2023 18:22:35 +0000 (-0400) Subject: runtime: print fault addr in fatalsignal X-Git-Tag: go1.22rc1~779 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=c4af8abae11841d20dfa495a62acc96e5f701f4a;p=gostls13.git runtime: print fault addr in fatalsignal Fixes #60894. Change-Id: I2e97c9ed527395303548bebe68ca7764e43132d1 Reviewed-on: https://go-review.googlesource.com/c/go/+/504635 Reviewed-by: Cherry Mui Reviewed-by: Michael Knyszek LUCI-TryBot-Result: Go LUCI --- diff --git a/src/runtime/signal_unix.go b/src/runtime/signal_unix.go index 9a3f18bc14..1423923e06 100644 --- a/src/runtime/signal_unix.go +++ b/src/runtime/signal_unix.go @@ -788,7 +788,11 @@ func fatalsignal(sig uint32, c *sigctxt, gp *g, mp *m) *g { exit(2) } - print("PC=", hex(c.sigpc()), " m=", mp.id, " sigcode=", c.sigcode(), "\n") + print("PC=", hex(c.sigpc()), " m=", mp.id, " sigcode=", c.sigcode()) + if sig == _SIGSEGV || sig == _SIGBUS { + print(" addr=", hex(c.fault())) + } + print("\n") if mp.incgo && gp == mp.g0 && mp.curg != nil { print("signal arrived during cgo execution\n") // Switch to curg so that we get a traceback of the Go code