Skip to content

Commit 0d33a99

Browse files
rhyshprattmic
authored andcommitted
runtime/pprof: fix pcDeck's frame indexing
When building the inlining deck, correctly identify which is the last frame in the deck. Otherwise, when some forms of inlining cause a PC to expand to multiple frames, the length of the deck's two slices will diverge. Fixes #51567 Change-Id: I24e7ba32cb16b167f4307178b3f03c29e5362c4b Reviewed-on: https://go-review.googlesource.com/c/go/+/391134 Reviewed-by: Michael Pratt <[email protected]> Trust: Than McIntosh <[email protected]>
1 parent 7160e32 commit 0d33a99

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/runtime/pprof/proto.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,7 @@ func (d *pcDeck) reset() {
530530
// since the stack trace is already fully expanded) and the symbolizeResult
531531
// to the deck. If it fails the caller needs to flush the deck and retry.
532532
func (d *pcDeck) tryAdd(pc uintptr, frames []runtime.Frame, symbolizeResult symbolizeFlag) (success bool) {
533-
if existing := len(d.pcs); existing > 0 {
533+
if existing := len(d.frames); existing > 0 {
534534
// 'd.frames' are all expanded from one 'pc' and represent all
535535
// inlined functions so we check only the last one.
536536
newFrame := frames[0]

0 commit comments

Comments
 (0)