aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/vendor/github.com
diff options
context:
space:
mode:
authorHana (Hyang-Ah) Kim <hyangah@gmail.com>2018-03-20 16:56:20 -0400
committerHyang-Ah Hana Kim <hyangah@gmail.com>2018-03-23 14:36:29 +0000
commitc6e69ec7f930191022f1369761a680eecc2e89f1 (patch)
treeeb57044879d427d13d3ff49dcbd41a01304a7d75 /src/cmd/vendor/github.com
parent50921bfa2e154f2e9346ebefba073c15c8afc453 (diff)
downloadgo-c6e69ec7f930191022f1369761a680eecc2e89f1.tar.xz
cmd/vendor/.../pprof: refresh from upstream@a74ae6f
Merges updates listed in https://github.com/google/pprof/compare/0e0e5b725...a74ae6f Update #24443 cmd/vendor/vendor.json was updated manually. Change-Id: I15d5fe82ac18263d4d54f5773cee0e197e93dd59 Reviewed-on: https://go-review.googlesource.com/101736 Reviewed-by: Alberto Donizetti <alb.donizetti@gmail.com>
Diffstat (limited to 'src/cmd/vendor/github.com')
-rw-r--r--src/cmd/vendor/github.com/google/pprof/internal/binutils/addr2liner.go25
-rw-r--r--src/cmd/vendor/github.com/google/pprof/internal/binutils/binutils.go11
-rw-r--r--src/cmd/vendor/github.com/google/pprof/internal/binutils/binutils_test.go4
-rwxr-xr-xsrc/cmd/vendor/github.com/google/pprof/internal/binutils/testdata/build_mac.sh31
-rwxr-xr-xsrc/cmd/vendor/github.com/google/pprof/internal/binutils/testdata/exe_mac_64bin0 -> 8648 bytes
-rw-r--r--src/cmd/vendor/github.com/google/pprof/internal/binutils/testdata/exe_mac_64.dSYM/Contents/Info.plist20
-rw-r--r--src/cmd/vendor/github.com/google/pprof/internal/binutils/testdata/exe_mac_64.dSYM/Contents/Resources/DWARF/exe_mac_64bin0 -> 8840 bytes
-rwxr-xr-xsrc/cmd/vendor/github.com/google/pprof/internal/binutils/testdata/lib_mac_64bin0 -> 4496 bytes
-rw-r--r--src/cmd/vendor/github.com/google/pprof/internal/binutils/testdata/lib_mac_64.dSYM/Contents/Info.plist20
-rw-r--r--src/cmd/vendor/github.com/google/pprof/internal/binutils/testdata/lib_mac_64.dSYM/Contents/Resources/DWARF/lib_mac_64bin0 -> 8934 bytes
-rw-r--r--src/cmd/vendor/github.com/google/pprof/internal/driver/driver.go2
-rw-r--r--src/cmd/vendor/github.com/google/pprof/internal/driver/fetch.go3
-rw-r--r--src/cmd/vendor/github.com/google/pprof/internal/driver/interactive.go9
-rw-r--r--src/cmd/vendor/github.com/google/pprof/internal/elfexec/elfexec.go2
-rw-r--r--src/cmd/vendor/github.com/google/pprof/third_party/svgpan/svgpan.go2
15 files changed, 108 insertions, 21 deletions
diff --git a/src/cmd/vendor/github.com/google/pprof/internal/binutils/addr2liner.go b/src/cmd/vendor/github.com/google/pprof/internal/binutils/addr2liner.go
index 71e471b5d6..c0661bf4aa 100644
--- a/src/cmd/vendor/github.com/google/pprof/internal/binutils/addr2liner.go
+++ b/src/cmd/vendor/github.com/google/pprof/internal/binutils/addr2liner.go
@@ -41,9 +41,11 @@ type addr2Liner struct {
rw lineReaderWriter
base uint64
- // nm holds an NM based addr2Liner which can provide
- // better full names compared to addr2line, which often drops
- // namespaces etc. from the names it returns.
+ // nm holds an addr2Liner using nm tool. Certain versions of addr2line
+ // produce incomplete names due to
+ // https://sourceware.org/bugzilla/show_bug.cgi?id=17541. As a workaround,
+ // the names from nm are used when they look more complete. See addrInfo()
+ // code below for the exact heuristic.
nm *addr2LinerNM
}
@@ -215,17 +217,22 @@ func (d *addr2Liner) addrInfo(addr uint64) ([]plugin.Frame, error) {
return nil, err
}
- // Get better name from nm if possible.
+ // Certain versions of addr2line produce incomplete names due to
+ // https://sourceware.org/bugzilla/show_bug.cgi?id=17541. Attempt to replace
+ // the name with a better one from nm.
if len(stack) > 0 && d.nm != nil {
nm, err := d.nm.addrInfo(addr)
if err == nil && len(nm) > 0 {
- // Last entry in frame list should match since
- // it is non-inlined. As a simple heuristic,
- // we only switch to the nm-based name if it
- // is longer.
+ // Last entry in frame list should match since it is non-inlined. As a
+ // simple heuristic, we only switch to the nm-based name if it is longer
+ // by 2 or more characters. We consider nm names that are longer by 1
+ // character insignificant to avoid replacing foo with _foo on MacOS (for
+ // unknown reasons read2line produces the former and nm produces the
+ // latter on MacOS even though both tools are asked to produce mangled
+ // names).
nmName := nm[len(nm)-1].Func
a2lName := stack[len(stack)-1].Func
- if len(nmName) > len(a2lName) {
+ if len(nmName) > len(a2lName)+1 {
stack[len(stack)-1].Func = nmName
}
}
diff --git a/src/cmd/vendor/github.com/google/pprof/internal/binutils/binutils.go b/src/cmd/vendor/github.com/google/pprof/internal/binutils/binutils.go
index 390f952feb..94edd0711a 100644
--- a/src/cmd/vendor/github.com/google/pprof/internal/binutils/binutils.go
+++ b/src/cmd/vendor/github.com/google/pprof/internal/binutils/binutils.go
@@ -111,6 +111,11 @@ func initTools(b *binrep, config string) {
defaultPath := paths[""]
b.llvmSymbolizer, b.llvmSymbolizerFound = findExe("llvm-symbolizer", append(paths["llvm-symbolizer"], defaultPath...))
b.addr2line, b.addr2lineFound = findExe("addr2line", append(paths["addr2line"], defaultPath...))
+ if !b.addr2lineFound {
+ // On MacOS, brew installs addr2line under gaddr2line name, so search for
+ // that if the tool is not found by its default name.
+ b.addr2line, b.addr2lineFound = findExe("gaddr2line", append(paths["addr2line"], defaultPath...))
+ }
b.nm, b.nmFound = findExe("nm", append(paths["nm"], defaultPath...))
b.objdump, b.objdumpFound = findExe("objdump", append(paths["objdump"], defaultPath...))
}
@@ -306,9 +311,9 @@ func (f *fileNM) SourceLine(addr uint64) ([]plugin.Frame, error) {
}
// fileAddr2Line implements the binutils.ObjFile interface, using
-// 'addr2line' to map addresses to symbols (with file/line number
-// information). It can be slow for large binaries with debug
-// information.
+// llvm-symbolizer, if that's available, or addr2line to map addresses to
+// symbols (with file/line number information). It can be slow for large
+// binaries with debug information.
type fileAddr2Line struct {
once sync.Once
file
diff --git a/src/cmd/vendor/github.com/google/pprof/internal/binutils/binutils_test.go b/src/cmd/vendor/github.com/google/pprof/internal/binutils/binutils_test.go
index 0317cf5126..9f11719694 100644
--- a/src/cmd/vendor/github.com/google/pprof/internal/binutils/binutils_test.go
+++ b/src/cmd/vendor/github.com/google/pprof/internal/binutils/binutils_test.go
@@ -265,8 +265,6 @@ func TestObjFile(t *testing.T) {
func TestMachoFiles(t *testing.T) {
skipUnlessDarwinAmd64(t)
- t.Skip("Disabled because of issues with addr2line (see https://github.com/google/pprof/pull/313#issuecomment-364073010)")
-
// Load `file`, pretending it was mapped at `start`. Then get the symbol
// table. Check that it contains the symbol `sym` and that the address
// `addr` gives the `expected` stack trace.
@@ -291,7 +289,7 @@ func TestMachoFiles(t *testing.T) {
{"lib normal mapping", "lib_mac_64", 0, math.MaxUint64, 0,
0xfa0, "_bar",
[]plugin.Frame{
- {Func: "bar", File: "/tmp/lib.c", Line: 6},
+ {Func: "bar", File: "/tmp/lib.c", Line: 5},
}},
} {
t.Run(tc.desc, func(t *testing.T) {
diff --git a/src/cmd/vendor/github.com/google/pprof/internal/binutils/testdata/build_mac.sh b/src/cmd/vendor/github.com/google/pprof/internal/binutils/testdata/build_mac.sh
new file mode 100755
index 0000000000..5ec98f39b5
--- /dev/null
+++ b/src/cmd/vendor/github.com/google/pprof/internal/binutils/testdata/build_mac.sh
@@ -0,0 +1,31 @@
+#!/bin/bash -x
+
+# This is a script that generates the test MacOS executables in this directory.
+# It should be needed very rarely to run this script. It is mostly provided
+# as a future reference on how the original binary set was created.
+
+set -o errexit
+
+cat <<EOF >/tmp/hello.cc
+#include <stdio.h>
+
+int main() {
+ printf("Hello, world!\n");
+ return 0;
+}
+EOF
+
+cat <<EOF >/tmp/lib.c
+int foo() {
+ return 1;
+}
+
+int bar() {
+ return 2;
+}
+EOF
+
+cd $(dirname $0)
+rm -rf exe_mac_64* lib_mac_64*
+clang -g -o exe_mac_64 /tmp/hello.c
+clang -g -o lib_mac_64 -dynamiclib /tmp/lib.c
diff --git a/src/cmd/vendor/github.com/google/pprof/internal/binutils/testdata/exe_mac_64 b/src/cmd/vendor/github.com/google/pprof/internal/binutils/testdata/exe_mac_64
new file mode 100755
index 0000000000..dba1ae1581
--- /dev/null
+++ b/src/cmd/vendor/github.com/google/pprof/internal/binutils/testdata/exe_mac_64
Binary files differ
diff --git a/src/cmd/vendor/github.com/google/pprof/internal/binutils/testdata/exe_mac_64.dSYM/Contents/Info.plist b/src/cmd/vendor/github.com/google/pprof/internal/binutils/testdata/exe_mac_64.dSYM/Contents/Info.plist
new file mode 100644
index 0000000000..b6f8ea3fb7
--- /dev/null
+++ b/src/cmd/vendor/github.com/google/pprof/internal/binutils/testdata/exe_mac_64.dSYM/Contents/Info.plist
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+ <dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>English</string>
+ <key>CFBundleIdentifier</key>
+ <string>com.apple.xcode.dsym.exe_mac_64</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundlePackageType</key>
+ <string>dSYM</string>
+ <key>CFBundleSignature</key>
+ <string>????</string>
+ <key>CFBundleShortVersionString</key>
+ <string>1.0</string>
+ <key>CFBundleVersion</key>
+ <string>1</string>
+ </dict>
+</plist>
diff --git a/src/cmd/vendor/github.com/google/pprof/internal/binutils/testdata/exe_mac_64.dSYM/Contents/Resources/DWARF/exe_mac_64 b/src/cmd/vendor/github.com/google/pprof/internal/binutils/testdata/exe_mac_64.dSYM/Contents/Resources/DWARF/exe_mac_64
new file mode 100644
index 0000000000..2cb0e3bf31
--- /dev/null
+++ b/src/cmd/vendor/github.com/google/pprof/internal/binutils/testdata/exe_mac_64.dSYM/Contents/Resources/DWARF/exe_mac_64
Binary files differ
diff --git a/src/cmd/vendor/github.com/google/pprof/internal/binutils/testdata/lib_mac_64 b/src/cmd/vendor/github.com/google/pprof/internal/binutils/testdata/lib_mac_64
new file mode 100755
index 0000000000..933a3f6931
--- /dev/null
+++ b/src/cmd/vendor/github.com/google/pprof/internal/binutils/testdata/lib_mac_64
Binary files differ
diff --git a/src/cmd/vendor/github.com/google/pprof/internal/binutils/testdata/lib_mac_64.dSYM/Contents/Info.plist b/src/cmd/vendor/github.com/google/pprof/internal/binutils/testdata/lib_mac_64.dSYM/Contents/Info.plist
new file mode 100644
index 0000000000..ad5e020468
--- /dev/null
+++ b/src/cmd/vendor/github.com/google/pprof/internal/binutils/testdata/lib_mac_64.dSYM/Contents/Info.plist
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+ <dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>English</string>
+ <key>CFBundleIdentifier</key>
+ <string>com.apple.xcode.dsym.lib_mac_64</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundlePackageType</key>
+ <string>dSYM</string>
+ <key>CFBundleSignature</key>
+ <string>????</string>
+ <key>CFBundleShortVersionString</key>
+ <string>1.0</string>
+ <key>CFBundleVersion</key>
+ <string>1</string>
+ </dict>
+</plist>
diff --git a/src/cmd/vendor/github.com/google/pprof/internal/binutils/testdata/lib_mac_64.dSYM/Contents/Resources/DWARF/lib_mac_64 b/src/cmd/vendor/github.com/google/pprof/internal/binutils/testdata/lib_mac_64.dSYM/Contents/Resources/DWARF/lib_mac_64
new file mode 100644
index 0000000000..e466c1342e
--- /dev/null
+++ b/src/cmd/vendor/github.com/google/pprof/internal/binutils/testdata/lib_mac_64.dSYM/Contents/Resources/DWARF/lib_mac_64
Binary files differ
diff --git a/src/cmd/vendor/github.com/google/pprof/internal/driver/driver.go b/src/cmd/vendor/github.com/google/pprof/internal/driver/driver.go
index c2b1cd082b..f4248fd8c7 100644
--- a/src/cmd/vendor/github.com/google/pprof/internal/driver/driver.go
+++ b/src/cmd/vendor/github.com/google/pprof/internal/driver/driver.go
@@ -138,7 +138,7 @@ func generateReport(p *profile.Profile, cmd []string, vars variables, o *plugin.
// Output to specified file.
o.UI.PrintErr("Generating report in ", output)
- out, err := os.Create(output)
+ out, err := o.Writer.Open(output)
if err != nil {
return err
}
diff --git a/src/cmd/vendor/github.com/google/pprof/internal/driver/fetch.go b/src/cmd/vendor/github.com/google/pprof/internal/driver/fetch.go
index 2b1d90dafd..ec2745f363 100644
--- a/src/cmd/vendor/github.com/google/pprof/internal/driver/fetch.go
+++ b/src/cmd/vendor/github.com/google/pprof/internal/driver/fetch.go
@@ -534,7 +534,8 @@ func convertPerfData(perfPath string, ui plugin.UI) (*os.File, error) {
return nil, err
}
deferDeleteTempFile(profile.Name())
- cmd := exec.Command("perf_to_profile", perfPath, profile.Name())
+ cmd := exec.Command("perf_to_profile", "-i", perfPath, "-o", profile.Name(), "-f")
+ cmd.Stdout, cmd.Stderr = os.Stdout, os.Stderr
if err := cmd.Run(); err != nil {
profile.Close()
return nil, fmt.Errorf("failed to convert perf.data file. Try github.com/google/perf_data_converter: %v", err)
diff --git a/src/cmd/vendor/github.com/google/pprof/internal/driver/interactive.go b/src/cmd/vendor/github.com/google/pprof/internal/driver/interactive.go
index b893697b62..bebfbbec1e 100644
--- a/src/cmd/vendor/github.com/google/pprof/internal/driver/interactive.go
+++ b/src/cmd/vendor/github.com/google/pprof/internal/driver/interactive.go
@@ -149,9 +149,14 @@ func greetings(p *profile.Profile, ui plugin.UI) {
numLabelUnits := identifyNumLabelUnits(p, ui)
ropt, err := reportOptions(p, numLabelUnits, pprofVariables)
if err == nil {
- ui.Print(strings.Join(report.ProfileLabels(report.New(p, ropt)), "\n"))
+ rpt := report.New(p, ropt)
+ ui.Print(strings.Join(report.ProfileLabels(rpt), "\n"))
+ if rpt.Total() == 0 && len(p.SampleType) > 1 {
+ ui.Print(`No samples were found with the default sample value type.`)
+ ui.Print(`Try "sample_index" command to analyze different sample values.`, "\n")
+ }
}
- ui.Print("Entering interactive mode (type \"help\" for commands, \"o\" for options)")
+ ui.Print(`Entering interactive mode (type "help" for commands, "o" for options)`)
}
// shortcuts represents composite commands that expand into a sequence
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 7e42c88d14..297bb24b1c 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
@@ -218,7 +218,7 @@ func GetBase(fh *elf.FileHeader, loadSegment *elf.ProgHeader, stextOffset *uint6
// So the base should be:
if stextOffset != nil && (start%pageSize) == (*stextOffset%pageSize) {
// perf uses the address of _stext as start. Some tools may
- // adjust for this before calling GetBase, in which case the the page
+ // adjust for this before calling GetBase, in which case the page
// alignment should be different from that of stextOffset.
return start - *stextOffset, nil
}
diff --git a/src/cmd/vendor/github.com/google/pprof/third_party/svgpan/svgpan.go b/src/cmd/vendor/github.com/google/pprof/third_party/svgpan/svgpan.go
index e7639a388e..6ca08adedb 100644
--- a/src/cmd/vendor/github.com/google/pprof/third_party/svgpan/svgpan.go
+++ b/src/cmd/vendor/github.com/google/pprof/third_party/svgpan/svgpan.go
@@ -12,7 +12,7 @@ const JSSource = `
* ======================
*
* Given an unique existing element with id "viewport" (or when missing, the
- * first g-element), including the the library into any SVG adds the following
+ * first g-element), including the library into any SVG adds the following
* capabilities:
*
* - Mouse panning