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/objdump: is broken on windows #7937

Closed
alexbrainman opened this issue May 5, 2014 · 3 comments
Closed

cmd/objdump: is broken on windows #7937

alexbrainman opened this issue May 5, 2014 · 3 comments
Milestone

Comments

@alexbrainman
Copy link
Member

Similar to issue #7899.

Apply this diff (to compensate for issue #7936):

diff --git a/src/cmd/objdump/main.go b/src/cmd/objdump/main.go
--- a/src/cmd/objdump/main.go
+++ b/src/cmd/objdump/main.go
@@ -79,11 +79,11 @@
        log.Fatalf("reading %s: %v", flag.Arg(0), err)
    }
 
-   start, err := strconv.ParseUint(flag.Arg(1), 0, 64)
+   start, err := strconv.ParseUint(flag.Arg(1), 16, 64)
    if err != nil {
        log.Fatalf("invalid start PC: %v", err)
    }
-   end, err := strconv.ParseUint(flag.Arg(2), 0, 64)
+   end, err := strconv.ParseUint(flag.Arg(2), 16, 64)
    if err != nil {
        log.Fatalf("invalid end PC: %v", err)
    }

Then, this

# go install cmd/objdump && go build -o objdump.exe && start=$(go tool
nm objdump.exe | awk '/main.main/{print $1}') && end=$(echo $start | sed
's/.$/f/') && echo $start $end && go tool objdump objdump.exe $start $end
8048d90 8048d9f
/root/go/root/src/cmd/objdump/main.go:56
 8048d90: byte 0x65
 8048d91: byte 0x8b
 8048d92: byte 0xd
 8048d93: byte 0x0
 8048d94: byte 0x0
 8048d95: byte 0x0
 8048d96: byte 0x0
 8048d97: byte 0x8b
 8048d98: byte 0x89
 8048d99: byte 0xf8
 8048d9a: byte 0xff
 8048d9b: byte 0xff
 8048d9c: byte 0xff
 8048d9d: byte 0x8d
 8048d9e: byte 0x84

works, while that
 
# go install cmd/objdump && GOOS=windows go build -o objdump.exe &&
start=$(go tool nm objdump.exe | awk '/main.main/{print $1}') && end=$(echo
$start | sed 's/.$/f/') && echo $start $end && go tool objdump
objdump.exe $start $end
401190 40119f

does not.

hg id is b0443478e712+ tip

Alex
@gopherbot
Copy link

Comment 2:

CL https://golang.org/cl/95090044 mentions this issue.

@ianlancetaylor
Copy link
Contributor

Comment 3:

Labels changed: added repo-main, release-go1.3maybe.

Status changed to Accepted.

@alexbrainman
Copy link
Member Author

Comment 4:

Fixed by
cmd/objdump: works with windows pe executables now
Most code is copy from addr2line change 01dd67e5827f
Update issue #7406
Fixes issue #7937
LGTM=iant
R=golang-codereviews, iant, 0intro
CC=golang-codereviews
https://golang.org/cl/95090044

Status changed to Fixed.

@rsc rsc added this to the Go1.3 milestone Apr 14, 2015
@golang golang locked and limited conversation to collaborators Jun 25, 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