]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: simplify conditions testing g.paniconfault
authorIan Lance Taylor <iant@golang.org>
Sun, 25 Sep 2016 19:37:00 +0000 (12:37 -0700)
committerIan Lance Taylor <iant@golang.org>
Sun, 25 Sep 2016 20:29:50 +0000 (20:29 +0000)
Implement a comment by Ralph Corderoy on CL 29754.

Change-Id: I22bbede211ddcb8a057f16b4f47d335a156cc8d2
Reviewed-on: https://go-review.googlesource.com/29756
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/runtime/signal_unix.go

index 08e57ca0e5f171f028047ec26ae9e367a9235eb2..31751185727f5d07c89fde49dde52c5f96123b01 100644 (file)
@@ -211,13 +211,21 @@ func sigpanic() {
 
        switch g.sig {
        case _SIGBUS:
-               if g.sigcode0 == _BUS_ADRERR && g.sigcode1 < 0x1000 || g.paniconfault {
+               if g.sigcode0 == _BUS_ADRERR && g.sigcode1 < 0x1000 {
+                       panicmem()
+               }
+               // Support runtime/debug.SetPanicOnFault.
+               if g.paniconfault {
                        panicmem()
                }
                print("unexpected fault address ", hex(g.sigcode1), "\n")
                throw("fault")
        case _SIGSEGV:
-               if (g.sigcode0 == 0 || g.sigcode0 == _SEGV_MAPERR || g.sigcode0 == _SEGV_ACCERR) && g.sigcode1 < 0x1000 || g.paniconfault {
+               if (g.sigcode0 == 0 || g.sigcode0 == _SEGV_MAPERR || g.sigcode0 == _SEGV_ACCERR) && g.sigcode1 < 0x1000 {
+                       panicmem()
+               }
+               // Support runtime/debug.SetPanicOnFault.
+               if g.paniconfault {
                        panicmem()
                }
                print("unexpected fault address ", hex(g.sigcode1), "\n")