Commit f05cd4cd authored by Ian Lance Taylor's avatar Ian Lance Taylor

runtime: simplify conditions testing g.paniconfault

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: default avatarBrad Fitzpatrick <bradfitz@golang.org>
parent 343bec53
...@@ -211,13 +211,21 @@ func sigpanic() { ...@@ -211,13 +211,21 @@ func sigpanic() {
switch g.sig { switch g.sig {
case _SIGBUS: 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() panicmem()
} }
print("unexpected fault address ", hex(g.sigcode1), "\n") print("unexpected fault address ", hex(g.sigcode1), "\n")
throw("fault") throw("fault")
case _SIGSEGV: 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() panicmem()
} }
print("unexpected fault address ", hex(g.sigcode1), "\n") print("unexpected fault address ", hex(g.sigcode1), "\n")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment