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

runtime/pprof: addr2line does not translate address on mac intel 64bits #6197

Closed
gopherbot opened this issue Aug 20, 2013 · 9 comments
Closed
Labels
FrozenDueToAge Suggested Issues that may be good for new contributors looking for work to do.
Milestone

Comments

@gopherbot
Copy link

by arnaud.ysmal:

The current version of addr2line complains about a wrong cpu subtype:
addr2line: crackhdr: bad MACH cpu subtype - not amd64

What steps will reproduce the problem?

1. Run a program with profiling activated
2. Run pprof
3. Request information like top10

Before the pprof prompt, addr2line displays the error message above.
The function names are replaced by their address in the top10


Which operating system are you using?

Mac OS 10.8.4 - amd64

Which version are you using?  (run 'go version')

go version devel +4fa24b4ac2f9 Tue Aug 20 08:21:58 2013 -0700 darwin/amd64

The CPU_SUBTYPE_LIB64 which can be found in /usr/include/mach/machine.h is not used for
checking the cpu subtype.

Proposed correction:
- add MACH_CPU_SUBTYPE_X86_64 in the file libmach/macho.h
- use it in the check in libmach/executable.c line 1079.

Attachments:

  1. fix_addr2line_mach64.patch (816 bytes)
@robpike
Copy link
Contributor

robpike commented Aug 20, 2013

Comment 1:

Labels changed: added priority-soon, go1.2, removed priority-triage, go1.2maybe.

Status changed to Accepted.

@gopherbot
Copy link
Author

Comment 2 by arnaud.ysmal:

How to reproduce easily:
$ cat test.go 
package main
func main(){}
$ go build -o test.ext -ldflags "-linkmode=external" test.go
$ go tool addr2line test.ext <<< $(nm test.ext | grep main.main | cut -d' ' -f1)
addr2line: crackhdr: bad MACH cpu subtype - not amd64
$ go build -o test.int -ldflags "-linkmode=internal" test.go
$ go tool addr2line test.int <<< $(nm test.int | grep main.main | cut -d' ' -f1)
main.main
/Users/stacktic/test.go:3
The previous patch attached to this issue breaks the compatibility with the internal
linker.
Please find enclosed a corrected patch.

Attachments:

  1. fix_addr2line_mach64_v2.patch (858 bytes)

@davecheney
Copy link
Contributor

Comment 3:

@arnaud, would you like to propose a fix for this issue ? The guidelines for
contribution are described here, golang.org/doc/contribute.html

Labels changed: added suggested.

@gopherbot
Copy link
Author

Comment 4 by arnaud.ysmal:

I have created the CL 13248046.

@rsc
Copy link
Contributor

rsc commented Sep 9, 2013

Comment 5:

Status changed to Started.

@bradfitz
Copy link
Contributor

Comment 6:

This issue was closed by revision 8edf764.

Status changed to Fixed.

@rsc
Copy link
Contributor

rsc commented Oct 18, 2013

Comment 7:

Issue #6481 has been merged into this issue.

@lukescott
Copy link

Comment 8:

Is this really fixed? issue #6481 uses a tip from Sep 25. The last revision was from Sep
10.

@rsc
Copy link
Contributor

rsc commented Oct 23, 2013

Comment 9:

Issue #6481 has been merged into this issue.

@gopherbot gopherbot added fixed Suggested Issues that may be good for new contributors looking for work to do. labels Oct 23, 2013
@rsc rsc added this to the Go1.2 milestone Apr 14, 2015
@rsc rsc removed the go1.2 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.
Labels
FrozenDueToAge Suggested Issues that may be good for new contributors looking for work to do.
Projects
None yet
Development

No branches or pull requests

6 participants