aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/signal_windows.go
diff options
context:
space:
mode:
authorJordan Rhee <jordanrh@microsoft.com>2018-11-21 14:04:29 -0800
committerAustin Clements <austin@google.com>2018-11-26 19:24:54 +0000
commit9ab2ffe8e92f9660cbde1a18921ae864c64f280b (patch)
tree9a2ea5369f179ed20deb01c77689abe12da692d4 /src/runtime/signal_windows.go
parent9fe9853ae5641eda4cfa58015bd0bcedb99c12cb (diff)
downloadgo-9ab2ffe8e92f9660cbde1a18921ae864c64f280b.tar.gz
go-9ab2ffe8e92f9660cbde1a18921ae864c64f280b.zip
runtime: windows/arm fix tracebacks printed from sigpanic
The exception handler modifies the stack and continuation context so it looks like the faulting code calls sigpanic() directly. The call was not set up correctly on ARM, because it did not handle the link register correctly. This change handles the link register correctly for ARM. Updates #28854 Change-Id: I7ccf838adfc05cd968a5edd7d19ebba6a2478360 Reviewed-on: https://go-review.googlesource.com/c/150957 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Austin Clements <austin@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'src/runtime/signal_windows.go')
-rw-r--r--src/runtime/signal_windows.go14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/runtime/signal_windows.go b/src/runtime/signal_windows.go
index e8a64da657..e6a75a160f 100644
--- a/src/runtime/signal_windows.go
+++ b/src/runtime/signal_windows.go
@@ -117,10 +117,18 @@ func exceptionhandler(info *exceptionrecord, r *context, gp *g) int32 {
if r.ip() != 0 {
sp := unsafe.Pointer(r.sp())
sp = add(sp, ^(unsafe.Sizeof(uintptr(0)) - 1)) // sp--
- *((*uintptr)(sp)) = r.ip()
- r.setsp(uintptr(sp))
+ r.set_sp(uintptr(sp))
+ switch GOARCH {
+ default:
+ panic("unsupported architecture")
+ case "386", "amd64":
+ *((*uintptr)(sp)) = r.ip()
+ case "arm":
+ *((*uintptr)(sp)) = r.lr()
+ r.set_lr(r.ip())
+ }
}
- r.setip(funcPC(sigpanic))
+ r.set_ip(funcPC(sigpanic))
return _EXCEPTION_CONTINUE_EXECUTION
}