diff options
| author | Daniel Martà <mvdan@mvdan.cc> | 2018-04-06 22:38:48 +0100 |
|---|---|---|
| committer | Brad Fitzpatrick <bradfitz@golang.org> | 2018-04-06 23:03:41 +0000 |
| commit | 31db81d329ddeacc4ba18671783cca5f1ddb4b9d (patch) | |
| tree | b767e593fda986a2cd5bdeb6e88cb438a19e69ed /src/cmd/vendor/github.com/google/pprof/internal/binutils/addr2liner.go | |
| parent | 4acb305d8bf421ccd8963faa140ce57094ce36ae (diff) | |
| download | go-31db81d329ddeacc4ba18671783cca5f1ddb4b9d.tar.xz | |
cmd/vendor/.../pprof: update to 0f7d9ba1
In particular, to pull a few fixes that were causing some tests to be
flaky on our build dashboard.
Fixes #24405.
Fixes #24508.
Fixes #24611.
Change-Id: I713156ad11c924e4a4b603144d10395523d526ed
Reviewed-on: https://go-review.googlesource.com/105275
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/binutils/addr2liner.go')
| -rw-r--r-- | src/cmd/vendor/github.com/google/pprof/internal/binutils/addr2liner.go | 25 |
1 files changed, 16 insertions, 9 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 } } |
