From 1926fa5f84b87a7a6cb9f153337424baf367937a Mon Sep 17 00:00:00 2001 From: Rhys Hiltner Date: Wed, 4 May 2022 07:26:21 -0700 Subject: [PATCH] runtime: use profile data before advancing index Fixes #52704 Change-Id: Ia2104c62d7ea9d67469144948b2ceb5d9f1313b3 Reviewed-on: https://go-review.googlesource.com/c/go/+/404054 Run-TryBot: Rhys Hiltner TryBot-Result: Gopher Robot Reviewed-by: Michael Knyszek Reviewed-by: Bryan Mills --- src/runtime/trace.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/runtime/trace.go b/src/runtime/trace.go index 19c966800c..10436d80c2 100644 --- a/src/runtime/trace.go +++ b/src/runtime/trace.go @@ -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. // -- 2.48.1