From patchwork Wed Dec 3 17:07:14 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kratochvil X-Patchwork-Id: 4059 Received: (qmail 11266 invoked by alias); 3 Dec 2014 17:07:21 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 11181 invoked by uid 89); 3 Dec 2014 17:07:20 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.9 required=5.0 tests=AWL, BAYES_00, SPF_HELO_PASS, SPF_PASS, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Wed, 03 Dec 2014 17:07:19 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id sB3H7HPj013161 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Wed, 3 Dec 2014 12:07:18 -0500 Received: from host2.jankratochvil.net (ovpn-116-31.ams2.redhat.com [10.36.116.31]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id sB3H7E9R002196 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=NO) for ; Wed, 3 Dec 2014 12:07:17 -0500 Date: Wed, 3 Dec 2014 18:07:14 +0100 From: Jan Kratochvil To: gdb-patches@sourceware.org Subject: [patch +noconst 2/2] Unify lookup_symbol_in_objfile_symtabs Message-ID: <20141203170714.GE25020@host2.jankratochvil.net> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) X-IsSubscribed: yes 2014-12-03 Jan Kratochvil * symtab.c (lookup_symbol_in_objfile_symtabs): New declaration. (lookup_global_symbol_from_objfile): Call it. diff --git a/gdb/symtab.c b/gdb/symtab.c index 6d50ebe..213bd4e 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -79,6 +79,11 @@ struct symbol *lookup_local_symbol (const char *name, const domain_enum domain, enum language language); +static struct symbol * + lookup_symbol_in_objfile_symtabs (struct objfile *objfile, + int block_index, const char *name, + const domain_enum domain); + static struct symbol *lookup_symbol_via_quick_fns (struct objfile *objfile, int block_index, @@ -1546,24 +1551,12 @@ lookup_global_symbol_from_objfile (struct objfile *main_objfile, objfile; objfile = objfile_separate_debug_iterate (main_objfile, objfile)) { - struct compunit_symtab *cust; struct symbol *sym; - - /* Go through symtabs. */ - ALL_OBJFILE_COMPUNITS (objfile, cust) - { - const struct blockvector *bv; - const struct block *block; - - bv = COMPUNIT_BLOCKVECTOR (cust); - block = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK); - sym = block_lookup_symbol (block, name, domain); - if (sym) - { - block_found = block; - return fixup_symbol_section (sym, objfile); - } - } + + sym = lookup_symbol_in_objfile_symtabs (objfile, GLOBAL_BLOCK, name, + domain); + if (sym != NULL) + return sym; sym = lookup_symbol_via_quick_fns (objfile, GLOBAL_BLOCK, name, domain); if (sym)