This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFC] extending bfd_print_private_bfd_data


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.



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]