[RFC] extending bfd_print_private_bfd_data
Tristan Gingold
gingold@adacore.com
Wed Nov 4 14:26:00 GMT 2009
Hi,
some formats (pe, coff, mach-o) may dump a lot of information with
'objdump -p'. This is somewhat boring
if you need only to dump a specific part of that (for example only the
characteristics of a PE file).
ELF users don't have this issue because they can use readelf.
I'd like to enhance this feature.
From a user point of view:
Add a new switch to objdump: -P xx, where xx is a word or a list of
words separated by a comma.
The definition of the words are back-end specific.
'objdump -p' will be equivalent to 'objdump -P all'.
'objdump --help' will display the list of words and their meanings.
From a bfd point a view:
Add new parameter 'const char *what' to bfd_print_private_bfd_data, to
describe what has to be displayed.
WHAT should only be a word (ie the handling of a list of words is done
by objdump).
If the word is not recognized by print_private_bfd_data, then FALSE
must be returned.
In order to simplify the transition, NULL will be used to print
everything. Therefore the minimal code to
be added to all bfd back-end is something like:
if (what != NULL)
return FALSE;
Finally, back-ends that recognize non-NULL WHAT must also recognize
"help". In this case the documentation
for all words is displayed.
If this feature and this design is accepted, I will make a patch to
transition all back-ends.
Comments are welcome,
Tristan.
More information about the Binutils
mailing list