cmd/trace: fix off-by-one bug

Change-Id: I45e212dc8038895aa6076f98a450803d52ba3fa6
GitHub-Last-Rev: c7fb35127b
GitHub-Pull-Request: golang/go#78924
Reviewed-on: https://go-review.googlesource.com/c/go/+/770120
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Sean Liao <sean@liao.dev>
Reviewed-by: Florian Lehner <lehner.florian86@gmail.com>
Auto-Submit: Sean Liao <sean@liao.dev>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
This commit is contained in:
Weixie Cui 2026-04-23 23:22:29 +00:00 committed by Gopher Robot
parent 9a32e8ce07
commit 33cf6926ec

View file

@ -305,12 +305,12 @@ func (m *stackMap) profile() []traceviewer.ProfileRecord {
var i int
for frame := range stack.Frames() {
rec.Stack = append(rec.Stack, frame)
i++
// Cut this off at pprofMaxStack because that's as far
// as our deduplication goes.
if i >= pprofMaxStack {
break
}
i++
}
prof = append(prof, rec)
}