]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: print fault addr in fatalsignal
authorMichael Pratt <mpratt@google.com>
Tue, 20 Jun 2023 18:22:35 +0000 (14:22 -0400)
committerMichael Pratt <mpratt@google.com>
Wed, 20 Sep 2023 16:03:20 +0000 (16:03 +0000)
Fixes #60894.

Change-Id: I2e97c9ed527395303548bebe68ca7764e43132d1
Reviewed-on: https://go-review.googlesource.com/c/go/+/504635
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

src/runtime/signal_unix.go

index 9a3f18bc14d770a429b943db8dcfc6389e8ecbf1..1423923e06ae2b4f5a566606133321a55e5d4223 100644 (file)
@@ -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