aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/signal_windows.go
diff options
context:
space:
mode:
authorAlex Brainman <alex.brainman@gmail.com>2018-12-04 12:05:11 +1100
committerAlex Brainman <alex.brainman@gmail.com>2018-12-05 02:56:47 +0000
commit9be01c2eab928f9899c67eb7bcdb164728f85a2c (patch)
treef481e1523c6b01b099b08754593c424ebf543675 /src/runtime/signal_windows.go
parenta7af474359179062a82429da927407d2d5395acc (diff)
downloadgo-9be01c2eab928f9899c67eb7bcdb164728f85a2c.tar.gz
go-9be01c2eab928f9899c67eb7bcdb164728f85a2c.zip
runtime: correct isAbortPC check in isgoexception
The expression passed into isAbortPC call was written specifically for windows/amd64 and windows/386 runtime.abort implementation. Adjust the code, so it also works for windows/arm. Fixes #29050 Change-Id: I3dc8ddd08031f34115396429eff512827264826f Reviewed-on: https://go-review.googlesource.com/c/152357 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'src/runtime/signal_windows.go')
-rw-r--r--src/runtime/signal_windows.go21
1 files changed, 18 insertions, 3 deletions
diff --git a/src/runtime/signal_windows.go b/src/runtime/signal_windows.go
index e6a75a160f..3fc1ec5886 100644
--- a/src/runtime/signal_windows.go
+++ b/src/runtime/signal_windows.go
@@ -38,6 +38,23 @@ func initExceptionHandler() {
}
}
+// isAbort returns true, if context r describes exception raised
+// by calling runtime.abort function.
+//
+//go:nosplit
+func isAbort(r *context) bool {
+ switch GOARCH {
+ case "386", "amd64":
+ // In the case of an abort, the exception IP is one byte after
+ // the INT3 (this differs from UNIX OSes).
+ return isAbortPC(r.ip() - 1)
+ case "arm":
+ return isAbortPC(r.ip())
+ default:
+ return false
+ }
+}
+
// isgoexception reports whether this exception should be translated
// into a Go panic.
//
@@ -53,9 +70,7 @@ func isgoexception(info *exceptionrecord, r *context) bool {
return false
}
- // In the case of an abort, the exception IP is one byte after
- // the INT3 (this differs from UNIX OSes).
- if isAbortPC(r.ip() - 1) {
+ if isAbort(r) {
// Never turn abort into a panic.
return false
}