-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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: can't read from a pipe #41051
Labels
compiler/runtime
Issues related to the Go compiler and/or runtime.
NeedsFix
The path to resolution is known, but the work has not been done.
Milestone
Comments
prattmic
added
the
NeedsFix
The path to resolution is known, but the work has not been done.
label
Aug 26, 2020
ethe
added a commit
to ethe/go
that referenced
this issue
Sep 10, 2020
It is convenient if objdump supports read from a pipe. However, cmd/internal/objfile.Open is not easy to be modified, so I create a function cmd/internal/objfile.Dump2Open, it reads from a no seekable reader, dump all bytes to a temporary file, and open it. For golang#41051
ethe
added a commit
to ethe/go
that referenced
this issue
Sep 10, 2020
It is convenient if the objdump supports reading from a pipe. However, cmd/internal/objfile.Open is not easy to be modified, so I create a function cmd/internal/objfile.Dump2Open, it reads from a no seekable reader, dumps all bytes to a temporary file, and open it. For golang#41051
Change https://golang.org/cl/253897 mentions this issue: |
Change https://golang.org/cl/254337 mentions this issue: |
ethe
added a commit
to ethe/go
that referenced
this issue
Sep 11, 2020
It is convenient if the objdump supports reading from a pipe. I modified `cmd/internal/objfile.Open`, it would check file at first, dumps it to a temporary file if it is not seekable, and open tmp file. For golang#41051 Change-Id: I4bf47c1b9722aee03a54147a7aa8dd44529ada89
ethe
added a commit
to ethe/go
that referenced
this issue
Sep 11, 2020
It is convenient if the objdump supports reading from a pipe. I modified `cmd/internal/objfile.Open`, it would check file at first, dumps it to a temporary file if it is not seekable, and open tmp file. For golang#41051 Change-Id: I4bf47c1b9722aee03a54147a7aa8dd44529ada89
ethe
added a commit
to ethe/go
that referenced
this issue
Sep 15, 2020
It is convenient if the objdump supports reading from a pipe. I modified `cmd/internal/objfile.Open`, it would check file at first, dumps it to a temporary file if it is not seekable, and open tmp file. For golang#41051 Change-Id: I4bf47c1b9722aee03a54147a7aa8dd44529ada89
ethe
added a commit
to ethe/go
that referenced
this issue
Nov 4, 2020
It is convenient if the objdump supports reading from a pipe. I modified `cmd/internal/objfile.Open`, it would check file at first, dumps it to a temporary file if it is not seekable, and open tmp file. For golang#41051 Change-Id: I4bf47c1b9722aee03a54147a7aa8dd44529ada89
gopherbot
added
the
compiler/runtime
Issues related to the Go compiler and/or runtime.
label
Jul 13, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
compiler/runtime
Issues related to the Go compiler and/or runtime.
NeedsFix
The path to resolution is known, but the work has not been done.
cmd/internal/objfile.Open
requires that the passed file is seekable, which prevents using a pipe to pass in an object to analyze.e.g.,
$ cat ../bin/go | go tool objdump /dev/stdin objdump: open /dev/stdin: unrecognized object file
On the other hand, connecting the file directly does work:
$ go tool objdump /dev/stdin < ../bin/go ... normal output ...
In these minimal examples, it is trivial to switch to the second form, but more complex programs make need to manually buffer input to a file before passing to the tool. This is annoying, though not the end of the world.
This also affects other tools using this open (addr2line, nm, etc).
Without major changes to object parsing, probably the way to fix this is to just buffer the entire input into memory, which is of course not great. I'm not sure this is worth fixing immediately, though it could at least use a better error message.
cc @cherrymui
The text was updated successfully, but these errors were encountered: