From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26240 invoked by alias); 2 Sep 2010 19:35:17 -0000 Received: (qmail 26225 invoked by uid 22791); 2 Sep 2010 19:35:15 -0000 X-SWARE-Spam-Status: No, hits=-5.5 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,TW_BJ,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; Thu, 02 Sep 2010 19:35:09 +0000 Received: from int-mx08.intmail.prod.int.phx2.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o82JZ8IK022641 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 2 Sep 2010 15:35:08 -0400 Received: from valrhona.uglyboxes.com (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx08.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o82JZ5IV005462 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 2 Sep 2010 15:35:06 -0400 Message-ID: <4C7FFC68.8080702@redhat.com> Date: Thu, 02 Sep 2010 22:13:00 -0000 From: Keith Seitz User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.11) Gecko/20100720 Fedora/3.0.6-1.fc12 Lightning/1.0b2pre Thunderbird/3.0.6 MIME-Version: 1.0 To: Tom Tromey CC: gdb-patches@sourceware.org Subject: Re: [RFA] Change to pre-expand symtabs References: <4C4DD835.7060702@redhat.com> In-Reply-To: Content-Type: multipart/mixed; boundary="------------090406020806090805030603" 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: 2010-09/txt/msg00109.txt.bz2 This is a multi-part message in MIME format. --------------090406020806090805030603 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 1163 On 09/01/2010 02:32 PM, Tom Tromey wrote: > 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. Here is a revised version of this patch which should eliminate this problem completely. If the search name contains a '(' (for C++/Java), we pass it to cp_remove_params to strip that information. I tested this with your example, and it parses that properly. [Reminder: This is only the part of the patch requiring changes. The testsuite patch is still in play. This also requires my earlier patch for match_transparent_type to be regression-free.] Tested on x86_64-linux: no regressions. Comments? Keith ChangeLog 2010-09-02 Keith Seitz PR symtab/11743 (partial): * psymtab.c (lookup_symbol_aux_psymtabs): Always return NULL; switching to pre-expanding symtabs instead. (expand_one_symtab_matching_psymtab): Implement. * symtab.c (psymtab_search_name): New function. (lookup_symbol_aux_symtabs): Use psymtab_search_name for psymtab searches. (basic_lookup_transparent_type): Likewise. --------------090406020806090805030603 Content-Type: text/plain; name="expand-psymtabs-overloaded-2.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="expand-psymtabs-overloaded-2.patch" Content-length: 3937 Index: psymtab.c =================================================================== RCS file: /cvs/src/src/gdb/psymtab.c,v retrieving revision 1.12 diff -u -p -r1.12 psymtab.c --- psymtab.c 1 Sep 2010 21:50:26 -0000 1.12 +++ psymtab.c 2 Sep 2010 19:25:24 -0000 @@ -414,15 +414,6 @@ lookup_symbol_aux_psymtabs (struct objfi 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; } @@ -437,6 +428,23 @@ expand_one_symtab_matching_psymtabs (str void *), void *data) { + struct partial_symtab *pst; + const int psymtab_index = (kind == GLOBAL_BLOCK ? 1 : 0); + + 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; } Index: symtab.c =================================================================== RCS file: /cvs/src/src/gdb/symtab.c,v retrieving revision 1.252 diff -u -p -r1.252 symtab.c --- symtab.c 1 Sep 2010 21:50:26 -0000 1.252 +++ symtab.c 2 Sep 2010 19:25:25 -0000 @@ -759,6 +759,40 @@ symbol_search_name (const struct general return symbol_natural_name (gsymbol); } +/* Returns the name used to search psymtabs, which do not, for example, + contain any overload information. If the user is searching for a + specific instance of an overloaded method, it is necessary + to strip this information away before conducting the search. */ + +static const char * +psymtab_search_name (const char *name) +{ + switch (current_language->la_language) + { + case language_cplus: + case language_java: + { + static char *ret = NULL; + + if (ret != NULL) + { + xfree (ret); + ret = NULL; + } + + if (strchr (name, '(')) + ret = cp_remove_params (name); + + return (ret == NULL) ? name : ret; + } + + default: + break; + } + + return name; +} + /* Initialize the structure fields to zero values. */ void init_sal (struct symtab_and_line *sal) @@ -1427,9 +1461,11 @@ lookup_symbol_aux_symtabs (int block_ind if (objfile->sf) { + const char *psym_search_name = psymtab_search_name (name); sym = objfile->sf->qf->expand_one_symtab_matching (objfile, block_index, - name, domain, + psym_search_name, + domain, match_symbol_aux, objfile); if (sym) @@ -1695,12 +1731,14 @@ basic_lookup_transparent_type (const cha struct objfile *objfile; struct block *block; struct type *t; + const char *psym_search_name; /* Now search all the global symbols. Do the symtab's first, then check the psymtab's. If a psymtab indicates the existence of the desired name as a global, then do psymtab-to-symtab conversion on the fly and return the found symbol. */ + psym_search_name = psymtab_search_name (name); ALL_OBJFILES (objfile) { ALL_OBJFILE_SYMTABS (objfile, s) @@ -1719,7 +1757,8 @@ basic_lookup_transparent_type (const cha { sym = objfile->sf->qf->expand_one_symtab_matching (objfile, - GLOBAL_BLOCK, name, + GLOBAL_BLOCK, + psym_search_name, STRUCT_DOMAIN, match_transparent_type, NULL); @@ -1760,7 +1799,8 @@ basic_lookup_transparent_type (const cha { sym = objfile->sf->qf->expand_one_symtab_matching (objfile, - STATIC_BLOCK, name, + STATIC_BLOCK, + psym_search_name, STRUCT_DOMAIN, match_transparent_type, NULL); --------------090406020806090805030603--