Bug 16373 - new option -o for objdump
Summary: new option -o for objdump
Status: NEW
Alias: None
Product: binutils
Classification: Unclassified
Component: binutils (show other bugs)
Version: unspecified
: P2 enhancement
Target Milestone: ---
Assignee: Not yet assigned to anyone
Depends on:
Reported: 2013-12-27 09:37 UTC by Liviu Ionescu
Modified: 2016-10-21 18:00 UTC (History)
1 user (show)

See Also:
Last reconfirmed:


Note You need to log in before you can comment on or make changes to this bug.
Description Liviu Ionescu 2013-12-27 09:37:20 UTC
I'm trying to integrate objdump as a command in a secondary target in Eclipse CDT, and the current CDT environment is quite simple, and does not allow to redirect the stdout to a file.

Could you add '-o filename' to objdump to write the result to a file, instead of stdout? 

I know that this implies a lot of small changes, and I'm ready to contribute this patch if you agree to merge it to the main branch.


Comment 1 Andreas Schwab 2013-12-27 11:04:32 UTC
Just create a script that wraps around objdump and handles the redirection.
Comment 2 Liviu Ionescu 2013-12-27 11:19:48 UTC
come on, using scripts in this case is a kludge, not to mention that invoking them is not portable between Windows and Unix.

my Eclipse plug-in adds three more steps to the usual build process, after link I do one step to create the binary hex file (via objcopy), one more step to create the listing (via objdump), and one final step to report sized (via size).

all program names and parameters are fully configurable via the Eclipse GUI.

as long as I execute them from a make, everything is ok, make takes care of the redirection and 'objdump >file' works as expected.

but Eclipse also has an internal builder, that processes the dependencies internally and issues the commands directly. This one has no redirect capabilities, since all other GNU tools are able to generate the output into a file, only objdump is different (in a not so friendly way).
Comment 3 Andreas Schwab 2013-12-27 13:21:52 UTC
How is adding the -o option not a kludge?
Comment 4 Liviu Ionescu 2013-12-27 13:46:14 UTC
if -o (as an option to redirect the output) is an appropriate solution for the GNU compiler/linker and for countless other programs (most GNU programs in fact), I fail to see why objdump is so special that may not use the same widely accepted solution.

according to the dictionary, 'dump' means 'copy (stored data) to a different location, especially so as to protect against loss', not necessarily on stdout, as you try to imply.

of course you are free to call it whatever you want, but by denying this additional functionality you are just limiting the tool usability.
Comment 5 Robert Baruch 2016-10-21 18:00:04 UTC
In case anyone else runs into this. In Eclipse, when configuring an external tool, you can go to the Common tab, go down to the Standard Input and Output section, make sure Allocate Console is not checked, check Output file, and enter a filename.

Now when you run the tool, all output will be sent to that file.