From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19044 invoked by alias); 28 Aug 2011 14:41:46 -0000 Received: (qmail 19036 invoked by uid 22791); 28 Aug 2011 14:41:45 -0000 X-SWARE-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (38.113.113.100) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 28 Aug 2011 14:41:31 +0000 Received: (qmail 8394 invoked from network); 28 Aug 2011 14:41:29 -0000 Received: from unknown (HELO ?192.168.0.100?) (yao@127.0.0.2) by mail.codesourcery.com with ESMTPA; 28 Aug 2011 14:41:29 -0000 Message-ID: <4E5A537E.30808@codesourcery.com> Date: Sun, 28 Aug 2011 14:41:00 -0000 From: Yao Qi User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.20) Gecko/20110805 Lightning/1.0b2 Thunderbird/3.1.12 MIME-Version: 1.0 To: gdb-patches@sourceware.org Subject: [ping] combine bfd_lookup_symbol in solib-*.c References: <4E4D318E.704@codesourcery.com> In-Reply-To: <4E4D318E.704@codesourcery.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2011-08/txt/msg00548.txt.bz2 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 (齐尧)