• Hana Kim's avatar
    runtime/pprof: set HasFunctions of mapping entries · 7b2f55d8
    Hana Kim authored
    The pprof tool utilizes attributes of mapping entries
    such as HasFunctions to determine whether the profile
    includes necessary symbol information.
    If none of the attributes is set, pprof tool tries to
    read the corresponding binary to use for local symbolization.
    If the binary doesn't exist, it prints out error messages.
    
    Go runtime generated profiles without any of the attributes
    set so the pprof tool always printed out the error messages.
    The error messages became more obvious with the new
    terminal support that uses red color for error messages.
    
    Go runtime can symbolize all Go symbols and generate
    self-contained profile for pure Go program. Thus, there
    is no reason for the pprof tool to look for the copy of
    the binary. So, this CL sets one of the attributes
    (HasFunctions) true if all PCs in samples look fully
    symbolized.
    
    For non-pure Go program, however, it's possible that
    symbolization of non-Go PCs is incomplete. In this case,
    we need to leave the attributes all false so pprof can attempt
    to symbolize using the local copy of the binary if available.
    It's hard to determine whether a mapping includes non-Go
    code. Instead, this CL checks PCs from collected samples.
    If unsuccessful symbolization is observed, it skips setting
    the HasFunctions attribute.
    
    Fixes #25743
    
    Change-Id: I5108be45bbc37ab486d145fa03e7ce37d88fad50
    Reviewed-on: https://go-review.googlesource.com/118275
    Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
    7b2f55d8
proto.go 17 KB