Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
bradfitz opened this issue Mar 13, 2013 · 4 comments
Closed

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

bradfitz opened this issue Mar 13, 2013 · 4 comments
Milestone

Comments

@bradfitz
Copy link
Contributor

"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.
@remyoudompheng
Copy link
Contributor

Comment 1:

I don't think I have observed any regression. My addr2line is:
GNU addr2line (GNU Binutils) 2.23.1
on Archlinux and I never had problems. What happens if you echo/pipe the hex addresses
into "addr2line -f -C -e go1.test" ?

@rsc
Copy link
Contributor

rsc commented Mar 13, 2013

Comment 2:

A change went in to pprof this morning to make it use go tool addr2line always, but I am
concerned that this is indicative of a deeper problem. I don't understand why
addr2line's help message got printed to the console when you ran pprof, and I don't
understand why the system addr2line doesn't work with Go binaries anymore. Both of those
need to be investigated and fixed before Go 1.1.

@gopherbot
Copy link

Comment 3 by jeff.allen:

I found that it was pprof line 4653 that was choosing Go's addr2line over the system
addr2line.
https://code.google.com/p/go/source/browse/misc/pprof#4653
But then it was trying to use Go's addr2line with the system options and causing the
help message. The fix I proposed this morning was to never try to use system options,
since pprof is always finding addr2line instead.

@rsc
Copy link
Contributor

rsc commented Mar 22, 2013

Comment 4:

Re #3, thank you very much for tracking that down. That's pretty subtle. I agree with
the fix now.

Status changed to WorkingAsIntended.

@rsc rsc added this to the Go1.1 milestone Apr 14, 2015
@rsc rsc removed the go1.1 label Apr 14, 2015
@golang golang locked and limited conversation to collaborators Jun 24, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants