aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/pprof
diff options
context:
space:
mode:
authorRhys Hiltner <rhys@justin.tv>2022-03-09 07:56:04 -0800
committerMichael Pratt <mpratt@google.com>2022-03-09 17:07:49 +0000
commit0d33a9967540fe06f5ce7b14790e9be8da576936 (patch)
tree33cb6450cde27b08650a806c1ab8dc32f00920c7 /src/runtime/pprof
parent7160e3252991d9462ee3a155b5504c564a6cffe5 (diff)
downloadgo-0d33a9967540fe06f5ce7b14790e9be8da576936.tar.xz
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 <mpratt@google.com> Trust: Than McIntosh <thanm@google.com>
Diffstat (limited to 'src/runtime/pprof')
-rw-r--r--src/runtime/pprof/proto.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/runtime/pprof/proto.go b/src/runtime/pprof/proto.go
index 215bd0bf96..68dac42d20 100644
--- a/src/runtime/pprof/proto.go
+++ b/src/runtime/pprof/proto.go
@@ -530,7 +530,7 @@ func (d *pcDeck) reset() {
// since the stack trace is already fully expanded) and the symbolizeResult
// to the deck. If it fails the caller needs to flush the deck and retry.
func (d *pcDeck) tryAdd(pc uintptr, frames []runtime.Frame, symbolizeResult symbolizeFlag) (success bool) {
- if existing := len(d.pcs); existing > 0 {
+ if existing := len(d.frames); existing > 0 {
// 'd.frames' are all expanded from one 'pc' and represent all
// inlined functions so we check only the last one.
newFrame := frames[0]