]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: use profile data before advancing index
authorRhys Hiltner <rhys@justin.tv>
Wed, 4 May 2022 14:26:21 +0000 (07:26 -0700)
committerBryan Mills <bcmills@google.com>
Thu, 5 May 2022 14:26:30 +0000 (14:26 +0000)
Fixes #52704

Change-Id: Ia2104c62d7ea9d67469144948b2ceb5d9f1313b3
Reviewed-on: https://go-review.googlesource.com/c/go/+/404054
Run-TryBot: Rhys Hiltner <rhys@justin.tv>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
src/runtime/trace.go

index 19c966800c1d77f0e5d2595ece42f963517f1ffb..10436d80c2f54b27f6f7594af5ba68cde26149ca 100644 (file)
@@ -745,6 +745,7 @@ func traceReadCPU() {
                        }
                        goid := data[3]
                        stk := data[4:data[0]]
+                       empty := len(stk) == 1 && data[2] == 0 && data[3] == 0
                        data = data[data[0]:]
                        // No support here for reporting goroutine tags at the moment; if
                        // that information is to be part of the execution trace, we'd
@@ -752,7 +753,7 @@ func traceReadCPU() {
                        // change, instead of only seeing them when we get a CPU sample.
                        tags = tags[1:]
 
-                       if len(stk) == 1 && data[2] == 0 && data[3] == 0 {
+                       if empty {
                                // Looks like an overflow record from the profBuf. Not much to
                                // do here, we only want to report full records.
                                //