This libgo patch by Cherry Zhang fixes sigprof frame counting.  If
sigtramp and sigtrampgo are both on stack, n -= framesToDiscard is
executed twice, which should actually run only once.  Bootstrapped and
ran Go testsuite on x86_64-pc-linux-gnu.  Committed to mainline.

Ian
Index: gcc/go/gofrontend/MERGE
===================================================================
--- gcc/go/gofrontend/MERGE     (revision 268358)
+++ gcc/go/gofrontend/MERGE     (working copy)
@@ -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: libgo/go/runtime/proc.go
===================================================================
--- libgo/go/runtime/proc.go    (revision 268158)
+++ libgo/go/runtime/proc.go    (working copy)
@@ -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
                }

Reply via email to