objdump -d --line-numbers performance question
Nick Clifton
nickc@redhat.com
Tue Mar 1 11:11:00 GMT 2005
Hi Emile,
> Looking at elf_find_function() it jumps out that it's doing a linear
> search through the entire set of symbols every time it's called. But
> show_line() has access to find_symbol_for_address which does a binary
> search on a sorted set of symbols.
>
> So. The attached patch uses find_symbol_for_address() in show_line(),
> and then passes down a fake asymbol** list consisting of just the found
> symbol and a null end marker. So far it always produces identical
> 'objdump -d --line-numbers' output for me as the stock objdump, but my
> run time on one representative file has gone from ~2 hours to ~4
> minutes.
>
> Does this look right? If not, can anyone give me some pointers on the
> right way to try to optimize things?
Actually this looks like a very good idea. I only have two improvements
to suggest:
1. Be paranoid. If the call to bfd_find_nearest_line() fails to find
the desired information with the abbreviated symbol table then it should
be re-called with the full symbol table.
2. Use the latest sources. The 2.15 release is not going to have any
new features added to it, so it is best to produce a patch against the
latest sources in the binutils CVS repository.
To that end, please could you try out the attached patch which is meant
to address both of these points. If you can confirm that it does still
work (and reduce the search times) then I will commit it to the sources.
Cheers
Nick
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: objdump.c.patch
URL: <https://sourceware.org/pipermail/binutils/attachments/20050301/bbbe67d9/attachment.ksh>
More information about the Binutils
mailing list