]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: fix windows/arm CONTEXT_CONTROL
authorRuss Cox <rsc@golang.org>
Wed, 27 Jan 2021 16:02:33 +0000 (11:02 -0500)
committerRuss Cox <rsc@golang.org>
Fri, 19 Feb 2021 00:03:36 +0000 (00:03 +0000)
The constant was wrong, and the “right” constant doesn't work either.
But with the actually-right constant (and possibly earlier fixes in this
stack as well), profiling now works.

Change-Id: If8caff1da556826db40961fb9bcfe2b1f31ea9f9
Reviewed-on: https://go-review.googlesource.com/c/go/+/288808
Trust: Russ Cox <rsc@golang.org>
Trust: Jason A. Donenfeld <Jason@zx2c4.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Jason A. Donenfeld <Jason@zx2c4.com>
src/runtime/defs_windows_arm.go
src/runtime/pprof/pprof_test.go

index 4021f77ba8cf74b0b2d5663105e22ad48ae584ea..370470e35d94fb9846b659d9fd093b79dbd1e071 100644 (file)
@@ -4,7 +4,13 @@
 
 package runtime
 
-const _CONTEXT_CONTROL = 0x10001
+// NOTE(rsc): _CONTEXT_CONTROL is actually 0x200001 and should include PC, SP, and LR.
+// However, empirically, LR doesn't come along on Windows 10
+// unless you also set _CONTEXT_INTEGER (0x200002).
+// Without LR, we skip over the next-to-bottom function in profiles
+// when the bottom function is frameless.
+// So we set both here, to make a working _CONTEXT_CONTROL.
+const _CONTEXT_CONTROL = 0x200003
 
 type neon128 struct {
        low  uint64
index 37f12de0d91d3cb532f4788be2973ffea3176677..f7c1349bc68ab19c738eb4377cf14f070f168639 100644 (file)
@@ -285,10 +285,6 @@ func testCPUProfile(t *testing.T, matches matchFunc, need []string, avoid []stri
                if runtime.GOARCH == "arm" || runtime.GOARCH == "arm64" {
                        broken = true
                }
-       case "windows":
-               if runtime.GOARCH == "arm" {
-                       broken = true // See https://golang.org/issues/42862
-               }
        }
 
        maxDuration := 5 * time.Second