]> Cypherpunks repositories - gostls13.git/commit
runtime/pprof: handle empty stack traces in Profile.Add
authorJosh Bleecher Snyder <josharian@gmail.com>
Sat, 11 Feb 2017 22:44:16 +0000 (14:44 -0800)
committerJosh Bleecher Snyder <josharian@gmail.com>
Mon, 27 Feb 2017 17:11:07 +0000 (17:11 +0000)
commitc7894924c7702c88e2b9836323bd4f40cd0257e7
tree99cb6b373fcf2782338d0cf41ce551f4d070f98b
parenteae657e9ee2897ffac8c8918738b0a4bab5864d6
runtime/pprof: handle empty stack traces in Profile.Add

If the caller passes a large number to Profile.Add,
the list of pcs is empty, which results in junk
(a nil pc) being recorded. Check for that explicitly,
and replace such stack traces with a lostProfileEvent.

Fixes #18836.

Change-Id: I99c96aa67dd5525cd239ea96452e6e8fcb25ce02
Reviewed-on: https://go-review.googlesource.com/36891
Reviewed-by: Russ Cox <rsc@golang.org>
src/runtime/pprof/pprof.go
src/runtime/pprof/pprof_test.go