From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28859 invoked by alias); 1 Sep 2010 21:32:54 -0000 Received: (qmail 28844 invoked by uid 22791); 1 Sep 2010 21:32:53 -0000 X-SWARE-Spam-Status: No, hits=-6.0 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,TW_BJ,TW_CP,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 01 Sep 2010 21:32:47 +0000 Received: from int-mx03.intmail.prod.int.phx2.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o81LWjin031525 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 1 Sep 2010 17:32:46 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx03.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o81LWjwo028567; Wed, 1 Sep 2010 17:32:45 -0400 Received: from opsy.redhat.com (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id o81LWi2q000952; Wed, 1 Sep 2010 17:32:45 -0400 Received: by opsy.redhat.com (Postfix, from userid 500) id 1D8EB379677; Wed, 1 Sep 2010 15:32:43 -0600 (MDT) From: Tom Tromey To: Keith Seitz Cc: gdb-patches@sourceware.org Subject: Re: [RFA] Change to pre-expand symtabs References: <4C4DD835.7060702@redhat.com> Date: Wed, 01 Sep 2010 21:44:00 -0000 In-Reply-To: <4C4DD835.7060702@redhat.com> (Keith Seitz's message of "Mon, 26 Jul 2010 11:47:17 -0700") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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: 2010-09/txt/msg00066.txt.bz2 Keith> This patch actually does two things, both related to PR symtab/11743 Keith> (for which I've previously submitted various ugly patches). First, it Keith> switches gdb to search for symtabs by using psymtab pre-expansion. [...] Tom> Would you mind letting me take over this one? I found a case where Tom> pre-expansion with an index expands way too many symbol tables. I'm afraid I am going to kick this one back to you. As we discussed on irc, it has problems if the searched-for name includes a paren that is not used to enclose the function arguments. I found one other little buglet: + char *tmp = alloca (strlen (name)); + memcpy (tmp, name, paren - name); + tmp[name - paren] = '\0'; That last line should read "paren - name". (Also it is more efficient not to use paren-name+1, not strlen, to size the temporary array.) I've appended a patch which is this patch, updated with that fix, and updated for the pre-expansion change I'm going to send soon. This modified patch causes a regression in type-opaque.exp, I didn't research why. Tom diff --git b/gdb/psymtab.c a/gdb/psymtab.c index 44ccb0f..54057b2 100644 --- b/gdb/psymtab.c +++ a/gdb/psymtab.c @@ -409,15 +409,6 @@ lookup_symbol_aux_psymtabs (struct objfile *objfile, int block_index, const char *name, const domain_enum domain) { - struct partial_symtab *ps; - const int psymtab_index = (block_index == GLOBAL_BLOCK ? 1 : 0); - - ALL_OBJFILE_PSYMTABS (objfile, ps) - { - if (!ps->readin && lookup_partial_symbol (ps, name, psymtab_index, domain)) - return PSYMTAB_TO_SYMTAB (ps); - } - return NULL; } @@ -432,6 +423,35 @@ expand_one_symtab_matching_psymtabs (struct objfile *objfile, void *), void *data) { + char *paren; + struct partial_symtab *pst; + const int psymtab_index = (kind == GLOBAL_BLOCK ? 1 : 0); + + /* If NAME contains overload information, strip it, since psymtabs only + contain the method name. */ + paren = strchr (name, '('); + if (paren != NULL) + { + char *tmp = alloca (paren - name + 1); + memcpy (tmp, name, paren - name); + tmp[paren - name] = '\0'; + name = tmp; + } + + ALL_OBJFILE_PSYMTABS (objfile, pst) + { + if (!pst->readin + && lookup_partial_symbol (pst, name, psymtab_index, domain) != NULL) + { + struct symtab *symtab = PSYMTAB_TO_SYMTAB (pst); + struct symbol *sym; + + sym = matcher (symtab, kind, name, domain, data); + if (sym) + return sym; + } + } + return NULL; }