mirror of https://github.com/golang/go.git
Revert "cmd/vendor/.../pprof: refresh from upstream@a74ae6f"
This reverts commit c6e69ec7f9.
Reason for revert: Broke builders. #24508
Change-Id: I66abff0dd14ec6e1f8d8d982ccfb0438633b639d
Reviewed-on: https://go-review.googlesource.com/102316
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
This commit is contained in:
parent
c6e69ec7f9
commit
58734039bd
|
|
@ -41,11 +41,9 @@ type addr2Liner struct {
|
||||||
rw lineReaderWriter
|
rw lineReaderWriter
|
||||||
base uint64
|
base uint64
|
||||||
|
|
||||||
// nm holds an addr2Liner using nm tool. Certain versions of addr2line
|
// nm holds an NM based addr2Liner which can provide
|
||||||
// produce incomplete names due to
|
// better full names compared to addr2line, which often drops
|
||||||
// https://sourceware.org/bugzilla/show_bug.cgi?id=17541. As a workaround,
|
// namespaces etc. from the names it returns.
|
||||||
// the names from nm are used when they look more complete. See addrInfo()
|
|
||||||
// code below for the exact heuristic.
|
|
||||||
nm *addr2LinerNM
|
nm *addr2LinerNM
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -217,22 +215,17 @@ func (d *addr2Liner) addrInfo(addr uint64) ([]plugin.Frame, error) {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Certain versions of addr2line produce incomplete names due to
|
// Get better name from nm if possible.
|
||||||
// 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 {
|
if len(stack) > 0 && d.nm != nil {
|
||||||
nm, err := d.nm.addrInfo(addr)
|
nm, err := d.nm.addrInfo(addr)
|
||||||
if err == nil && len(nm) > 0 {
|
if err == nil && len(nm) > 0 {
|
||||||
// Last entry in frame list should match since it is non-inlined. As a
|
// Last entry in frame list should match since
|
||||||
// simple heuristic, we only switch to the nm-based name if it is longer
|
// it is non-inlined. As a simple heuristic,
|
||||||
// by 2 or more characters. We consider nm names that are longer by 1
|
// we only switch to the nm-based name if it
|
||||||
// character insignificant to avoid replacing foo with _foo on MacOS (for
|
// is longer.
|
||||||
// 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
|
nmName := nm[len(nm)-1].Func
|
||||||
a2lName := stack[len(stack)-1].Func
|
a2lName := stack[len(stack)-1].Func
|
||||||
if len(nmName) > len(a2lName)+1 {
|
if len(nmName) > len(a2lName) {
|
||||||
stack[len(stack)-1].Func = nmName
|
stack[len(stack)-1].Func = nmName
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -111,11 +111,6 @@ func initTools(b *binrep, config string) {
|
||||||
defaultPath := paths[""]
|
defaultPath := paths[""]
|
||||||
b.llvmSymbolizer, b.llvmSymbolizerFound = findExe("llvm-symbolizer", append(paths["llvm-symbolizer"], defaultPath...))
|
b.llvmSymbolizer, b.llvmSymbolizerFound = findExe("llvm-symbolizer", append(paths["llvm-symbolizer"], defaultPath...))
|
||||||
b.addr2line, b.addr2lineFound = findExe("addr2line", append(paths["addr2line"], 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.nm, b.nmFound = findExe("nm", append(paths["nm"], defaultPath...))
|
||||||
b.objdump, b.objdumpFound = findExe("objdump", append(paths["objdump"], defaultPath...))
|
b.objdump, b.objdumpFound = findExe("objdump", append(paths["objdump"], defaultPath...))
|
||||||
}
|
}
|
||||||
|
|
@ -311,9 +306,9 @@ func (f *fileNM) SourceLine(addr uint64) ([]plugin.Frame, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// fileAddr2Line implements the binutils.ObjFile interface, using
|
// fileAddr2Line implements the binutils.ObjFile interface, using
|
||||||
// llvm-symbolizer, if that's available, or addr2line to map addresses to
|
// 'addr2line' to map addresses to symbols (with file/line number
|
||||||
// symbols (with file/line number information). It can be slow for large
|
// information). It can be slow for large binaries with debug
|
||||||
// binaries with debug information.
|
// information.
|
||||||
type fileAddr2Line struct {
|
type fileAddr2Line struct {
|
||||||
once sync.Once
|
once sync.Once
|
||||||
file
|
file
|
||||||
|
|
|
||||||
|
|
@ -265,6 +265,8 @@ func TestObjFile(t *testing.T) {
|
||||||
func TestMachoFiles(t *testing.T) {
|
func TestMachoFiles(t *testing.T) {
|
||||||
skipUnlessDarwinAmd64(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
|
// Load `file`, pretending it was mapped at `start`. Then get the symbol
|
||||||
// table. Check that it contains the symbol `sym` and that the address
|
// table. Check that it contains the symbol `sym` and that the address
|
||||||
// `addr` gives the `expected` stack trace.
|
// `addr` gives the `expected` stack trace.
|
||||||
|
|
@ -289,7 +291,7 @@ func TestMachoFiles(t *testing.T) {
|
||||||
{"lib normal mapping", "lib_mac_64", 0, math.MaxUint64, 0,
|
{"lib normal mapping", "lib_mac_64", 0, math.MaxUint64, 0,
|
||||||
0xfa0, "_bar",
|
0xfa0, "_bar",
|
||||||
[]plugin.Frame{
|
[]plugin.Frame{
|
||||||
{Func: "bar", File: "/tmp/lib.c", Line: 5},
|
{Func: "bar", File: "/tmp/lib.c", Line: 6},
|
||||||
}},
|
}},
|
||||||
} {
|
} {
|
||||||
t.Run(tc.desc, func(t *testing.T) {
|
t.Run(tc.desc, func(t *testing.T) {
|
||||||
|
|
|
||||||
31
src/cmd/vendor/github.com/google/pprof/internal/binutils/testdata/build_mac.sh
generated
vendored
31
src/cmd/vendor/github.com/google/pprof/internal/binutils/testdata/build_mac.sh
generated
vendored
|
|
@ -1,31 +0,0 @@
|
||||||
#!/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
|
|
||||||
Binary file not shown.
|
|
@ -1,20 +0,0 @@
|
||||||
<?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>
|
|
||||||
Binary file not shown.
Binary file not shown.
|
|
@ -1,20 +0,0 @@
|
||||||
<?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>
|
|
||||||
Binary file not shown.
|
|
@ -138,7 +138,7 @@ func generateReport(p *profile.Profile, cmd []string, vars variables, o *plugin.
|
||||||
|
|
||||||
// Output to specified file.
|
// Output to specified file.
|
||||||
o.UI.PrintErr("Generating report in ", output)
|
o.UI.PrintErr("Generating report in ", output)
|
||||||
out, err := o.Writer.Open(output)
|
out, err := os.Create(output)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -534,8 +534,7 @@ func convertPerfData(perfPath string, ui plugin.UI) (*os.File, error) {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
deferDeleteTempFile(profile.Name())
|
deferDeleteTempFile(profile.Name())
|
||||||
cmd := exec.Command("perf_to_profile", "-i", perfPath, "-o", profile.Name(), "-f")
|
cmd := exec.Command("perf_to_profile", perfPath, profile.Name())
|
||||||
cmd.Stdout, cmd.Stderr = os.Stdout, os.Stderr
|
|
||||||
if err := cmd.Run(); err != nil {
|
if err := cmd.Run(); err != nil {
|
||||||
profile.Close()
|
profile.Close()
|
||||||
return nil, fmt.Errorf("failed to convert perf.data file. Try github.com/google/perf_data_converter: %v", err)
|
return nil, fmt.Errorf("failed to convert perf.data file. Try github.com/google/perf_data_converter: %v", err)
|
||||||
|
|
|
||||||
|
|
@ -149,14 +149,9 @@ func greetings(p *profile.Profile, ui plugin.UI) {
|
||||||
numLabelUnits := identifyNumLabelUnits(p, ui)
|
numLabelUnits := identifyNumLabelUnits(p, ui)
|
||||||
ropt, err := reportOptions(p, numLabelUnits, pprofVariables)
|
ropt, err := reportOptions(p, numLabelUnits, pprofVariables)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
rpt := report.New(p, ropt)
|
ui.Print(strings.Join(report.ProfileLabels(report.New(p, ropt)), "\n"))
|
||||||
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
|
// shortcuts represents composite commands that expand into a sequence
|
||||||
|
|
|
||||||
|
|
@ -218,7 +218,7 @@ func GetBase(fh *elf.FileHeader, loadSegment *elf.ProgHeader, stextOffset *uint6
|
||||||
// So the base should be:
|
// So the base should be:
|
||||||
if stextOffset != nil && (start%pageSize) == (*stextOffset%pageSize) {
|
if stextOffset != nil && (start%pageSize) == (*stextOffset%pageSize) {
|
||||||
// perf uses the address of _stext as start. Some tools may
|
// perf uses the address of _stext as start. Some tools may
|
||||||
// adjust for this before calling GetBase, in which case the page
|
// adjust for this before calling GetBase, in which case the the page
|
||||||
// alignment should be different from that of stextOffset.
|
// alignment should be different from that of stextOffset.
|
||||||
return start - *stextOffset, nil
|
return start - *stextOffset, nil
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ const JSSource = `
|
||||||
* ======================
|
* ======================
|
||||||
*
|
*
|
||||||
* Given an unique existing element with id "viewport" (or when missing, the
|
* Given an unique existing element with id "viewport" (or when missing, the
|
||||||
* first g-element), including the library into any SVG adds the following
|
* first g-element), including the the library into any SVG adds the following
|
||||||
* capabilities:
|
* capabilities:
|
||||||
*
|
*
|
||||||
* - Mouse panning
|
* - Mouse panning
|
||||||
|
|
|
||||||
|
|
@ -9,8 +9,8 @@
|
||||||
{
|
{
|
||||||
"canonical": "github.com/google/pprof",
|
"canonical": "github.com/google/pprof",
|
||||||
"local": "github.com/google/pprof",
|
"local": "github.com/google/pprof",
|
||||||
"revision": "a74ae6fb3cd7047c79272e3ea0814b08154a2d3c",
|
"revision": "9e20b5b106e946f4cd1df94c1f6fe3f88456628d",
|
||||||
"revisionTime": "2018-03-20T17:03:05Z"
|
"revisionTime": "2017-11-08T17:47:23Z"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"canonical": "golang.org/x/arch/x86/x86asm",
|
"canonical": "golang.org/x/arch/x86/x86asm",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue