Skip to content

cmd/pprof: system addr2line isn't compatible #5039

@bradfitz

Description

@bradfitz
"go tool pprof" seems to have regressed somehow.

bradfitz@bradfitzlap:~/go/test/bench/go1$ go test -c
....
bradfitz@bradfitzlap:~/go/test/bench/go1$ go tool pprof go1.test cpu.prof 
usage: addr2line binary
reads addresses from standard input and writes two lines for each:
    function name
    file:line
Welcome to pprof!  For help, type 'help'.
(pprof) top
Total: 187 samples
       9   4.8%   4.8%        9   4.8% 000000000052ce95
       6   3.2%   8.0%        6   3.2% 00000000004219eb
       5   2.7%  10.7%        5   2.7% 0000000000410b31
       3   1.6%  12.3%        3   1.6% 00000000004118a8
       2   1.1%  13.4%        2   1.1% 0000000000410211
       2   1.1%  14.4%        2   1.1% 00000000004119b9
       2   1.1%  15.5%        2   1.1% 000000000041e697
       2   1.1%  16.6%        2   1.1% 00000000004219e0
       2   1.1%  17.6%        2   1.1% 00000000004219e5
       2   1.1%  18.7%        2   1.1% 0000000000421c49
(pprof) 


$ which addr2line
/usr/bin/addr2line

$ addr2line --version
GNU addr2line (GNU Binutils for Ubuntu) 2.22

$ go tool addr2line 
usage: addr2line binary
reads addresses from standard input and writes two lines for each:
    function name
    file:line

If I modify misc/pprof:

diff -r f3ca7d5b1b0b misc/pprof
--- a/misc/pprof        Tue Mar 12 17:12:56 2013 -0700
+++ b/misc/pprof        Tue Mar 12 18:11:24 2013 -0700
@@ -4417,11 +4417,11 @@
     $cmd = "$addr2line --demangle -f -C -e $image";
   }
 
-  if (system("$addr2line --help >/dev/null 2>&1") != 0) {
+  #if (system("$addr2line --help >/dev/null 2>&1") != 0) {
     # addr2line must not exist.  Fall back to go tool addr2line.
     $addr2line = "go tool addr2line";
     $cmd = "$addr2line $image";
-  }
+ # }
 
   # If "addr2line" isn't installed on the system at all, just use
   # nm to get what info we can (function names, but not line numbers).

... then it works.

It seems we can't use the system addr2line anymore?

I don't know what the right fix is here but happy to send a CL if I'm told.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions