• Hana (Hyang-Ah) Kim's avatar
    runtime/pprof: add a fake mapping when /proc/self/maps is unavailable · ba022644
    Hana (Hyang-Ah) Kim authored
    Profile's Mapping field is currently populated by reading /proc/self/maps.
    On systems where /proc/self/maps is not available, the profile generated
    by Go's runtime will not have any Mapping entry. Pprof command then adds
    a fake entry and links all Location entries in the profile with the fake
    entry to be used during symbolization.
    https://github.com/google/pprof/blob/a8644067d5a3c9a6386e7c88fa4a3d9d37877ca3/internal/driver/fetch.go#L437
    
    The fake entry is not enough to suppress the error or warning messages
    pprof command produces. We need to tell pprof that Location entries are
    symbolized already by Go runtime and pprof does not have to attempt to
    perform further symbolization.
    
    In #25743, we made Go runtime mark Mapping entries with HasFunctions=true
    when all Location entries from the Mapping entries are successfully
    symbolized. This change makes the Go runtime add a fake mapping entry,
    otherwise the pprof command tool would add, and set the HasFunctions=true
    following the same logic taken when the real mapping information is
    available.
    
    Updates #19790.
    Fixes #26255. Tested pprof doesn't report the error message any more
    for pure Go program.
    
    Change-Id: Ib12b62e15073f5d6c80967e44b3e8709277c11bd
    Reviewed-on: https://go-review.googlesource.com/123779
    Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
    ba022644
Name
Last commit
Last update
..
internal/profile Loading commit data...
testdata Loading commit data...
elf.go Loading commit data...
label.go Loading commit data...
label_test.go Loading commit data...
map.go Loading commit data...
mprof_test.go Loading commit data...
pprof.go Loading commit data...
pprof_test.go Loading commit data...
proto.go Loading commit data...
proto_test.go Loading commit data...
protobuf.go Loading commit data...
protomem.go Loading commit data...
protomem_test.go Loading commit data...
runtime.go Loading commit data...
runtime_test.go Loading commit data...