From patchwork Mon Oct 20 21:45:00 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kratochvil X-Patchwork-Id: 3295 Received: (qmail 18728 invoked by alias); 20 Oct 2014 21:45:07 -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 18709 invoked by uid 89); 20 Oct 2014 21:45:06 -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, KAM_STOCKGEN, RP_MATCHES_RCVD, SPF_HELO_PASS, SPF_PASS 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; Mon, 20 Oct 2014 21:45:05 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s9KLj4m5002963 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Mon, 20 Oct 2014 17:45:04 -0400 Received: from host2.jankratochvil.net (ovpn-116-79.ams2.redhat.com [10.36.116.79]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s9KLj1od021823 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=NO) for ; Mon, 20 Oct 2014 17:45:03 -0400 Date: Mon, 20 Oct 2014 23:45:00 +0200 From: Jan Kratochvil To: gdb-patches@sourceware.org Subject: [patch 2/2] Accelerate lookup_symbol_aux_objfile 8x Message-ID: <20141020214500.GC22011@host2.jankratochvil.net> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) X-IsSubscribed: yes Hi, lookup_symbol_aux_objfile() processing is very ineffective. For each primary symtab it searches it and also all its secondary symtabs. But that means that secondary symtabs included in many primary symtabs get needlessly searched many times during one lookup_symbol_aux_objfile() run. lookup_symbol_aux_objfile does not care in which primary/secondary symtab the symbol is found. Jan gdb/ 2014-10-20 Jan Kratochvil * symtab.c (lookup_symbol_aux_objfile): Use ALL_OBJFILE_SYMTABS, inline lookup_block_symbol. diff --git a/gdb/symtab.c b/gdb/symtab.c index c530d50..bc800ef 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -1657,15 +1657,25 @@ lookup_symbol_aux_objfile (struct objfile *objfile, int block_index, const struct block *block; struct symtab *s; - ALL_OBJFILE_PRIMARY_SYMTABS (objfile, s) + gdb_assert (block_index == GLOBAL_BLOCK || block_index == STATIC_BLOCK); + + ALL_OBJFILE_SYMTABS (objfile, s) { + struct dict_iterator dict_iter; + bv = BLOCKVECTOR (s); block = BLOCKVECTOR_BLOCK (bv, block_index); - sym = lookup_block_symbol (block, name, domain); - if (sym) + + for (sym = dict_iter_name_first (block->dict, name, &dict_iter); + sym != NULL; + sym = dict_iter_name_next (name, &dict_iter)) { - block_found = block; - return fixup_symbol_section (sym, objfile); + if (symbol_matches_domain (SYMBOL_LANGUAGE (sym), + SYMBOL_DOMAIN (sym), domain)) + { + block_found = block; + return fixup_symbol_section (sym, objfile); + } } }