aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/signal_windows.go
diff options
context:
space:
mode:
authorAustin Clements <austin@google.com>2018-07-06 09:50:05 -0400
committerAustin Clements <austin@google.com>2018-07-07 14:44:07 +0000
commit7001ac53946bb05c88a0e7d7c3c64dfb1cca1fca (patch)
tree56fd0945d8bae4bf95aa8dd93e3140058a06996a /src/runtime/signal_windows.go
parentf5d4863130dff38f7126df6ed6f0303a4809aa04 (diff)
downloadgo-7001ac53946bb05c88a0e7d7c3c64dfb1cca1fca.tar.gz
go-7001ac53946bb05c88a0e7d7c3c64dfb1cca1fca.zip
runtime: fix abort handling on Windows
On Windows, the IP recorded in the breakpoint exception caused by runtime.abort is actually one byte after the INT3, unlike on UNIX OSes. Account for this in isgoexception. It turns out TestAbort was "passing" on Windows anyway because abort still caused a fatal panic, just not the one we were expecting. This CL tightens this test to check that the runtime specifically reports a breakpoint exception. Fixing this is related to #21382, since we use runtime.abort in reporting g0 stack overflows, and it's important that we detect this and not try to handle it. Change-Id: I66120944d138eb80f839346b157a3759c1019e34 Reviewed-on: https://go-review.googlesource.com/122515 Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Diffstat (limited to 'src/runtime/signal_windows.go')
-rw-r--r--src/runtime/signal_windows.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/runtime/signal_windows.go b/src/runtime/signal_windows.go
index 500b02880d..fe5ff87cd6 100644
--- a/src/runtime/signal_windows.go
+++ b/src/runtime/signal_windows.go
@@ -46,7 +46,9 @@ func isgoexception(info *exceptionrecord, r *context) bool {
return false
}
- if isAbortPC(r.ip()) {
+ // 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) {
// Never turn abort into a panic.
return false
}