diff options
| author | Alberto Donizetti <alb.donizetti@gmail.com> | 2017-06-20 17:40:21 +0200 |
|---|---|---|
| committer | Brad Fitzpatrick <bradfitz@golang.org> | 2017-06-20 18:31:06 +0000 |
| commit | 3d13b5e00c9bc065d83e27d787a64adc683cea02 (patch) | |
| tree | 60f71d89af63a6ee45cc73e79336c271511c5883 /src/cmd/vendor/github.com/google/pprof/internal/elfexec/elfexec.go | |
| parent | dc8b4e65a7a68e102484020efbf80cecd2d515bd (diff) | |
| download | go-3d13b5e00c9bc065d83e27d787a64adc683cea02.tar.xz | |
cmd/vendor/github.com/google/pprof: refresh from upstream
Updating to commit fffc5831a499a958516664a34cb7ba2b9e228793
from github.com/google/pprof
Fixes #19380
Change-Id: I7a0c64101f42b494c4a469c41628374272eccf95
Reviewed-on: https://go-review.googlesource.com/46155
Run-TryBot: Alberto Donizetti <alb.donizetti@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Diffstat (limited to 'src/cmd/vendor/github.com/google/pprof/internal/elfexec/elfexec.go')
| -rw-r--r-- | src/cmd/vendor/github.com/google/pprof/internal/elfexec/elfexec.go | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/src/cmd/vendor/github.com/google/pprof/internal/elfexec/elfexec.go b/src/cmd/vendor/github.com/google/pprof/internal/elfexec/elfexec.go index c46272e8fc..9b238c5b87 100644 --- a/src/cmd/vendor/github.com/google/pprof/internal/elfexec/elfexec.go +++ b/src/cmd/vendor/github.com/google/pprof/internal/elfexec/elfexec.go @@ -131,7 +131,7 @@ func GetBuildID(binary io.ReaderAt) ([]byte, error) { if buildID == nil { buildID = note.Desc } else { - return nil, fmt.Errorf("multiple build ids found, don't know which to use!") + return nil, fmt.Errorf("multiple build ids found, don't know which to use") } } } @@ -240,17 +240,22 @@ func GetBase(fh *elf.FileHeader, loadSegment *elf.ProgHeader, stextOffset *uint6 } return start, nil case elf.ET_DYN: - if offset != 0 { - if loadSegment == nil || loadSegment.Vaddr == 0 { - return start - offset, nil - } - return 0, fmt.Errorf("Don't know how to handle mapping. Offset=%x, vaddr=%x", - offset, loadSegment.Vaddr) - } + // The process mapping information, start = start of virtual address range, + // and offset = offset in the executable file of the start address, tells us + // that a runtime virtual address x maps to a file offset + // fx = x - start + offset. if loadSegment == nil { - return start, nil + return start - offset, nil } - return start - loadSegment.Vaddr, nil + // The program header, if not nil, indicates the offset in the file where + // the executable segment is located (loadSegment.Off), and the base virtual + // address where the first byte of the segment is loaded + // (loadSegment.Vaddr). A file offset fx maps to a virtual (symbol) address + // sx = fx - loadSegment.Off + loadSegment.Vaddr. + // + // Thus, a runtime virtual address x maps to a symbol address + // sx = x - start + offset - loadSegment.Off + loadSegment.Vaddr. + return start - offset + loadSegment.Off - loadSegment.Vaddr, nil } return 0, fmt.Errorf("Don't know how to handle FileHeader.Type %v", fh.Type) } |
