aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/google/pprof/profile/encode.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/google/pprof/profile/encode.go')
-rw-r--r--vendor/github.com/google/pprof/profile/encode.go11
1 files changed, 10 insertions, 1 deletions
diff --git a/vendor/github.com/google/pprof/profile/encode.go b/vendor/github.com/google/pprof/profile/encode.go
index 1e84c72d4..96aa271e5 100644
--- a/vendor/github.com/google/pprof/profile/encode.go
+++ b/vendor/github.com/google/pprof/profile/encode.go
@@ -17,6 +17,7 @@ package profile
import (
"errors"
"sort"
+ "strings"
)
func (p *Profile) decoder() []decoder {
@@ -252,6 +253,14 @@ func (p *Profile) postDecode() error {
} else {
mappings[m.ID] = m
}
+
+ // If this a main linux kernel mapping with a relocation symbol suffix
+ // ("[kernel.kallsyms]_text"), extract said suffix.
+ // It is fairly hacky to handle at this level, but the alternatives appear even worse.
+ if strings.HasPrefix(m.File, "[kernel.kallsyms]") {
+ m.KernelRelocationSymbol = strings.ReplaceAll(m.File, "[kernel.kallsyms]", "")
+ }
+
}
functions := make(map[uint64]*Function, len(p.Function))
@@ -308,7 +317,7 @@ func (p *Profile) postDecode() error {
if l.strX != 0 {
value, err = getString(p.stringTable, &l.strX, err)
labels[key] = append(labels[key], value)
- } else if l.numX != 0 {
+ } else if l.numX != 0 || l.unitX != 0 {
numValues := numLabels[key]
units := numUnits[key]
if l.unitX != 0 {