aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/vendor/github.com/google/pprof/internal/elfexec
diff options
context:
space:
mode:
authorDaniel Martí <mvdan@mvdan.cc>2018-02-12 16:34:48 +0000
committerDaniel Martí <mvdan@mvdan.cc>2018-02-15 16:25:43 +0000
commite7cbbbe9bb878b6ca4ce04fde645df1c8f1845bd (patch)
treef84255198234eb4870c48228cdb4828de1f4f8c5 /src/cmd/vendor/github.com/google/pprof/internal/elfexec
parentafb9fc1de922a4ead9d2d787613255a7ba3490f7 (diff)
downloadgo-e7cbbbe9bb878b6ca4ce04fde645df1c8f1845bd.tar.xz
cmd/vendor/github.com/google/pprof: refresh from upstream
Updating to commit 0e0e5b7254e076a62326ab7305ba49e8515f0c91 from github.com/google/pprof Recent modifications to the vendored pprof, such as skipping TestWebInterface to avoid starting a web browser, have all been fixed upstream. Change-Id: I72e11108c438e1573bf2f9216e76d157378e8d45 Reviewed-on: https://go-review.googlesource.com/93375 Run-TryBot: Daniel Martí <mvdan@mvdan.cc> 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')
-rw-r--r--src/cmd/vendor/github.com/google/pprof/internal/elfexec/elfexec.go16
1 files changed, 16 insertions, 0 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 9b238c5b87..7e42c88d14 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
@@ -259,3 +259,19 @@ func GetBase(fh *elf.FileHeader, loadSegment *elf.ProgHeader, stextOffset *uint6
}
return 0, fmt.Errorf("Don't know how to handle FileHeader.Type %v", fh.Type)
}
+
+// FindTextProgHeader finds the program segment header containing the .text
+// section or nil if the segment cannot be found.
+func FindTextProgHeader(f *elf.File) *elf.ProgHeader {
+ for _, s := range f.Sections {
+ if s.Name == ".text" {
+ // Find the LOAD segment containing the .text section.
+ for _, p := range f.Progs {
+ if p.Type == elf.PT_LOAD && p.Flags&elf.PF_X != 0 && s.Addr >= p.Vaddr && s.Addr < p.Vaddr+p.Memsz {
+ return &p.ProgHeader
+ }
+ }
+ }
+ }
+ return nil
+}