runtime: fix sigprof frame counting
authorIan Lance Taylor <ian@gcc.gnu.org>
Tue, 29 Jan 2019 15:31:10 +0000 (15:31 +0000)
committerIan Lance Taylor <ian@gcc.gnu.org>
Tue, 29 Jan 2019 15:31:10 +0000 (15:31 +0000)
    If sigtramp and sigtrampgo are both on stack, n -= framesToDiscard
    is executed twice, which should actually run only once.

    Reviewed-on: https://go-review.googlesource.com/c/159238

From-SVN: r268366

gcc/go/gofrontend/MERGE
libgo/go/runtime/proc.go

index 0eff5eba6a82972b6808204aeb1b8ddf6aa648c2..10e20cebfcd8991ab21a0494d27255b8aac9ff36 100644 (file)
@@ -1,4 +1,4 @@
-c2cac0ba0a92e74d5675c3c9f4e53d2567dbc903
+5af8ee0693944c280b1f529450dbfd4ec1ee451d
 
 The first line of this file holds the git revision number of the last
 merge done from the gofrontend repository.
index 05dd53d886fa770e8350cc803b498697fc8e7688..b4fa88fe5d869c0bec5300fa9b6e62503f4c4fbc 100644 (file)
@@ -3542,14 +3542,13 @@ func sigprof(pc uintptr, gp *g, mp *m) {
                for i := 0; i < n; i++ {
                        if stklocs[i].function == "runtime.sigtrampgo" && i+2 < n {
                                framesToDiscard = i + 2
-                               n -= framesToDiscard
                        }
                        if stklocs[i].function == "runtime.sigtramp" && i+2 < n {
                                framesToDiscard = i + 2
-                               n -= framesToDiscard
                                break
                        }
                }
+               n -= framesToDiscard
                for i := 0; i < n; i++ {
                        stk[i] = stklocs[i+framesToDiscard].pc
                }