From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15560 invoked by alias); 1 Feb 2012 15:07:47 -0000 Received: (qmail 15545 invoked by uid 22791); 1 Feb 2012 15:07:45 -0000 X-SWARE-Spam-Status: No, hits=-6.2 required=5.0 tests=AWL,BAYES_00,KAM_STOCKGEN,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,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 Feb 2012 15:07:31 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q11F7AwA017698 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 1 Feb 2012 10:07:10 -0500 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q11F79aw027524; Wed, 1 Feb 2012 10:07:09 -0500 Received: from barimba (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 q11F77Lh017226; Wed, 1 Feb 2012 10:07:08 -0500 From: Tom Tromey To: Joel Brobecker Cc: Jan Kratochvil , gdb-patches@sourceware.org Subject: Re: Performance regression (12x): Re: RFC: add relative file name handling for linespecs References: <20120119153236.GA6229@host2.jankratochvil.net> <20120201102137.GF31383@adacore.com> Date: Wed, 01 Feb 2012 15:07:00 -0000 In-Reply-To: <20120201102137.GF31383@adacore.com> (Joel Brobecker's message of "Wed, 1 Feb 2012 14:21:38 +0400") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain 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: 2012-02/txt/msg00009.txt.bz2 >>>>> "Joel" == Joel Brobecker writes: Joel> [...], but in the end, I'm just thinking I should just add the Joel> parameter and update all callers. Here's the patch. Let me know what you think. I'm running regression tests on it now, but I don't expect any problems. Tom 2012-02-01 Tom Tromey * ada-lang.c (resolve_subexp): Update. (ada_lookup_symbol_list): Add 'full_search' argument. (ada_iterate_over_symbols): Pass 0 as full_search argument to ada_lookup_symbol_list. (ada_lookup_encoded_symbol): Update. (get_var_value): Update. * ada-exp.y (block_lookup): Update. (write_var_or_type): Update. (write_name_assoc): Update. * ada-lang.h (ada_lookup_symbol_list): Update. diff --git a/gdb/ada-exp.y b/gdb/ada-exp.y index d8c21a4..d1c7367 100644 --- a/gdb/ada-exp.y +++ b/gdb/ada-exp.y @@ -1021,7 +1021,7 @@ block_lookup (struct block *context, char *raw_name) else name = ada_encode (raw_name); - nsyms = ada_lookup_symbol_list (name, context, VAR_DOMAIN, &syms); + nsyms = ada_lookup_symbol_list (name, context, VAR_DOMAIN, &syms, 1); if (context == NULL && (nsyms == 0 || SYMBOL_CLASS (syms[0].sym) != LOC_BLOCK)) symtab = lookup_symtab (name); @@ -1278,7 +1278,7 @@ write_var_or_type (struct block *block, struct stoken name0) encoded_name[tail_index] = '\0'; nsyms = ada_lookup_symbol_list (encoded_name, block, - VAR_DOMAIN, &syms); + VAR_DOMAIN, &syms, 1); encoded_name[tail_index] = terminator; /* A single symbol may rename a package or object. */ @@ -1427,7 +1427,7 @@ write_name_assoc (struct stoken name) { struct ada_symbol_info *syms; int nsyms = ada_lookup_symbol_list (name.ptr, expression_context_block, - VAR_DOMAIN, &syms); + VAR_DOMAIN, &syms, 1); if (nsyms != 1 || SYMBOL_CLASS (syms[0].sym) == LOC_TYPEDEF) write_exp_op_with_string (OP_NAME, name); else diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index 55e318f..de165fa 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -3057,7 +3057,7 @@ resolve_subexp (struct expression **expp, int *pos, int deprocedure_p, ada_lookup_symbol_list (SYMBOL_LINKAGE_NAME (exp->elts[pc + 2].symbol), exp->elts[pc + 1].block, VAR_DOMAIN, - &candidates); + &candidates, 1); if (n_candidates > 1) { @@ -3149,7 +3149,7 @@ resolve_subexp (struct expression **expp, int *pos, int deprocedure_p, ada_lookup_symbol_list (SYMBOL_LINKAGE_NAME (exp->elts[pc + 5].symbol), exp->elts[pc + 4].block, VAR_DOMAIN, - &candidates); + &candidates, 1); if (n_candidates == 1) i = 0; else @@ -3201,7 +3201,7 @@ resolve_subexp (struct expression **expp, int *pos, int deprocedure_p, n_candidates = ada_lookup_symbol_list (ada_encode (ada_decoded_op_name (op)), (struct block *) NULL, VAR_DOMAIN, - &candidates); + &candidates, 1); i = ada_resolve_function (candidates, n_candidates, argvec, nargs, ada_decoded_op_name (op), NULL); if (i < 0) @@ -4979,16 +4979,18 @@ add_nonlocal_symbols (struct obstack *obstackp, const char *name, the next call of ada_lookup_symbol_list. Any non-function/non-enumeral symbol match within the nest of blocks whose innermost member is BLOCK0, is the one match returned (no other matches in that or - enclosing blocks is returned). If there are any matches in or - surrounding BLOCK0, then these alone are returned. Otherwise, the - search extends to global and file-scope (static) symbol tables. + enclosing blocks is returned). If there are any matches in or + surrounding BLOCK0, then these alone are returned. Otherwise, if + FULL_SEARCH is non-zero, then the search extends to global and + file-scope (static) symbol tables. Names prefixed with "standard__" are handled specially: "standard__" is first stripped off, and only static and global symbols are searched. */ int ada_lookup_symbol_list (const char *name0, const struct block *block0, - domain_enum namespace, - struct ada_symbol_info **results) + domain_enum namespace, + struct ada_symbol_info **results, + int full_search) { struct symbol *sym; struct block *block; @@ -5026,7 +5028,7 @@ ada_lookup_symbol_list (const char *name0, const struct block *block0, ada_add_local_symbols (&symbol_list_obstack, name, block, namespace, wild_match); - if (num_defns_collected (&symbol_list_obstack) > 0) + if (num_defns_collected (&symbol_list_obstack) > 0 || !full_search) goto done; /* No non-global symbols found. Check our cache to see if we have @@ -5106,7 +5108,7 @@ ada_iterate_over_symbols (const struct block *block, int ndefs, i; struct ada_symbol_info *results; - ndefs = ada_lookup_symbol_list (name, block, domain, &results); + ndefs = ada_lookup_symbol_list (name, block, domain, &results, 0); for (i = 0; i < ndefs; ++i) { if (! (*callback) (results[i].sym, data)) @@ -5121,7 +5123,8 @@ ada_lookup_encoded_symbol (const char *name, const struct block *block0, struct ada_symbol_info *candidates; int n_candidates; - n_candidates = ada_lookup_symbol_list (name, block0, namespace, &candidates); + n_candidates = ada_lookup_symbol_list (name, block0, namespace, &candidates, + 1); if (n_candidates == 0) return NULL; @@ -10359,7 +10362,7 @@ get_var_value (char *name, char *err_msg) int nsyms; nsyms = ada_lookup_symbol_list (name, get_selected_block (0), VAR_DOMAIN, - &syms); + &syms, 1); if (nsyms != 1) { diff --git a/gdb/ada-lang.h b/gdb/ada-lang.h index 9ab7b2d..375fab0 100644 --- a/gdb/ada-lang.h +++ b/gdb/ada-lang.h @@ -219,7 +219,8 @@ extern enum language ada_update_initial_language (enum language); extern void clear_ada_sym_cache (void); extern int ada_lookup_symbol_list (const char *, const struct block *, - domain_enum, struct ada_symbol_info**); + domain_enum, struct ada_symbol_info**, + int); extern char *ada_fold_name (const char *);