[ping] combine bfd_lookup_symbol in solib-*.c

Yao Qi
2011-08-28T14:41:46Z

On 08/18/2011 11:36 PM, Yao Qi wrote:
>>>> +static CORE_ADDR
>>>> +bfd_lookup_symbol (bfd *abfd, char *symname)
>> I now notice that we already have copies of this
>> function in solib-svr4.c, solib-frv.c and solib-pa64.c
>> could could be combined. Given the precedent, it's okay
>> to leave that for a follow up.
>>
>
> During the tic6x patches review, Pedro pointed out the duplication of
> bfd_lookup_symbol cross solib-svr4.c, solib-frv.c and solib-pa64.c.
> This patch is to remove the duplication.
>
> Four instances of bfd_lookup_symbol is not exactly the same, and can be
> grouped into three 1) solib-svr4.c 2) solib-frv.c and solib-dsbt.c, 3)
> solib-pa64. In this patch, I split original version into two functions
> bfd_lookup_symbol_from_symtab and bfd_lookup_symbol_from_dyn_symtab, and
> move them to solib.c, so that they can be reused easily. A helper
> function, as a parameter, is introduced to hide the difference on
> comparing symbol name and checking section flag.
>
> There is still minor duplications in this new patch, which is helper
> function (cmp_name) defined in each solib-{frv,pa64,dsbt}.c
> respectively. Since I don't want helper_function be visible out of
> file, so this duplication is acceptable to me.
>
> Regression tested x86_64-pc-linux-gnu. OK for mainline?
>

Ping. http://sourceware.org/ml/gdb-patches/2011-08/msg00356.html

--
Yao (é½å°§)