aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/vendor/github.com/google/pprof/internal/binutils/addr2liner.go
diff options
context:
space:
mode:
authorHyang-Ah Hana Kim <hyangah@gmail.com>2018-03-23 15:00:34 +0000
committerHyang-Ah Hana Kim <hyangah@gmail.com>2018-03-23 15:09:04 +0000
commit58734039bdddbdfd3c7cd4f9fc232a75f5cef32a (patch)
treed460c5fe378acf8139ea9f7179ffe94156e88e7c /src/cmd/vendor/github.com/google/pprof/internal/binutils/addr2liner.go
parentc6e69ec7f930191022f1369761a680eecc2e89f1 (diff)
downloadgo-58734039bdddbdfd3c7cd4f9fc232a75f5cef32a.tar.xz
Revert "cmd/vendor/.../pprof: refresh from upstream@a74ae6f"
This reverts commit c6e69ec7f930191022f1369761a680eecc2e89f1. 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>
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.go25
1 files changed, 9 insertions, 16 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 c0661bf4aa..71e471b5d6 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,11 +41,9 @@ type addr2Liner struct {
rw lineReaderWriter
base uint64
- // 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 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 *addr2LinerNM
}
@@ -217,22 +215,17 @@ func (d *addr2Liner) addrInfo(addr uint64) ([]plugin.Frame, error) {
return nil, err
}
- // 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.
+ // Get better name from nm if possible.
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
- // 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).
+ // 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.
nmName := nm[len(nm)-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
}
}