diff options
author | Keith Randall <khr@golang.org> | 2020-03-20 12:25:57 -0700 |
---|---|---|
committer | Keith Randall <khr@golang.org> | 2020-03-20 20:01:06 +0000 |
commit | 5bc75a3097a3671055f0f9c503850edbe830601d (patch) | |
tree | 852c5457532d73737a5a8d0462f36de61b16bfdf /src/runtime/pprof | |
parent | c5058652fd724cb1ed8ea91a4e76b202d6910482 (diff) | |
download | go-5bc75a3097a3671055f0f9c503850edbe830601d.tar.gz go-5bc75a3097a3671055f0f9c503850edbe830601d.zip |
runtime: handle empty stack in expandFinalInlineFrame
Fixes #37967
Change-Id: I6fc22bdd65f0263d5672731b73d09249201ab0aa
Reviewed-on: https://go-review.googlesource.com/c/go/+/224458
Reviewed-by: Michael Pratt <mpratt@google.com>
Diffstat (limited to 'src/runtime/pprof')
-rw-r--r-- | src/runtime/pprof/proto_test.go | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/runtime/pprof/proto_test.go b/src/runtime/pprof/proto_test.go index f3456ffede..37e68b9c53 100644 --- a/src/runtime/pprof/proto_test.go +++ b/src/runtime/pprof/proto_test.go @@ -422,3 +422,16 @@ func TestFakeMapping(t *testing.T) { } } } + +// Make sure the profiler can handle an empty stack trace. +// See issue 37967. +func TestEmptyStack(t *testing.T) { + b := []uint64{ + 3, 0, 500, // hz = 500 + 3, 0, 10, // 10 samples with an empty stack trace + } + _, err := translateCPUProfile(b) + if err != nil { + t.Fatalf("translating profile: %v", err) + } +} |