• Austin Clements's avatar
    cmd/pprof: fix EOF handling when getting function source · 38fef031
    Austin Clements authored
    getFunctionSource gathers five lines of "margin" around every
    requested sample line.  However, if this margin went past the
    end of the source file, getFunctionSource would encounter an
    io.EOF error and abort with this error, resulting in listings
    like
    
        (pprof) list main.main
        ROUTINE ======================== main.main in ...
        0      8.33s (flat, cum) 99.17% of Total
        Error: EOF
        (pprof)
    
    Modify the error handling in getFunctionSource so io.EOF is
    always considered non-fatal.  If it reaches EOF, it simply
    returns the lines it has.
    
    LGTM=bradfitz
    R=rsc, bradfitz
    CC=golang-codereviews
    https://golang.org/cl/172600043
    38fef031
Name
Last commit
Last update
api Loading commit data...
doc Loading commit data...
include Loading commit data...
lib Loading commit data...
misc Loading commit data...
src Loading commit data...
test Loading commit data...
.hgignore Loading commit data...
.hgtags Loading commit data...
AUTHORS Loading commit data...
CONTRIBUTORS Loading commit data...
LICENSE Loading commit data...
PATENTS Loading commit data...
README Loading commit data...
favicon.ico Loading commit data...
robots.txt Loading commit data...