-
Notifications
You must be signed in to change notification settings - Fork 18k
cmd/objdump: add -file-offset option #27941
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
Comments
cc @randall77 for decision |
Could you describe how it would be useful? Darwin objdump (Apple LLVM version 9.0.0 (clang-900.0.38)) does not have this option. My linux objdump does, but it didn't make the cut for the binary's one-page help page. |
I wanted to extract the text for a given symbol, or set of symbols. Yes this is probably a niche use case, and there are other ways to do it (hence why its not made it into LLVM-based FWIW this gist shows a script to do it using the |
It seems to me that you really want to be using a programmatic interface (like the gist) and not parsing objdump output. It seems a lot simpler than shelling out to objdump, parsing the output, then opening the file and reading the ranges you want. objdump output is for humans. I don't want to add to it unless it's useful for humans. There are other interfaces that programs can use to access this information. |
I think the only problem with this is that the package you need to access Actually occurs to me that this feature may have been more useful in |
This works on public interfaces only (but ELF only):
It should be easy to grab the actual instruction bytes using the elf.Section.ReaderAt. |
Nice. Of course the benefit of the internal package is the abstraction layer over the object file format. Feel free to close the ticket, it's not something I feel strongly about. |
GNU binutils version of
objdump
offers a[-F|--file-offsets]
flagExample output on a Go binary:
This was useful for something I've been working on, and I think it would be fairly easy to add something like this to
go tool objdump
. Thoughts? If there's interest I could work on a CL.The text was updated successfully, but these errors were encountered: