From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 104986 invoked by alias); 20 Jul 2017 19:00:59 -0000 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 Received: (qmail 104564 invoked by uid 89); 20 Jul 2017 19:00:37 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.9 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,KAM_LAZY_DOMAIN_SECURITY,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=56616, progression 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 ESMTP; Thu, 20 Jul 2017 19:00:18 +0000 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9F04F85547 for ; Thu, 20 Jul 2017 19:00:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 9F04F85547 Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=palves@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 9F04F85547 Received: from [127.0.0.1] (ovpn04.gateway.prod.ext.ams2.redhat.com [10.39.146.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id 52B0E7C1E0; Thu, 20 Jul 2017 19:00:06 +0000 (UTC) Subject: Re: [PATCH 25/40] Introduce lookup_name_info and generalize Ada's FULL/WILD name matching To: Keith Seitz , gdb-patches@sourceware.org References: <1496406158-12663-1-git-send-email-palves@redhat.com> <1496406158-12663-26-git-send-email-palves@redhat.com> <596E6C31.1060908@redhat.com> <918c8d65-4c5d-7c04-c2a3-736b7a20d454@redhat.com> From: Pedro Alves Message-ID: <1fa29e48-cbcd-0b88-41ad-f2bd05650b00@redhat.com> Date: Thu, 20 Jul 2017 19:00:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <918c8d65-4c5d-7c04-c2a3-736b7a20d454@redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-SW-Source: 2017-07/txt/msg00310.txt.bz2 On 07/18/2017 11:30 PM, Pedro Alves wrote: > On 07/18/2017 09:14 PM, Keith Seitz wrote: >> On 06/02/2017 05:22 AM, Pedro Alves wrote: >> I'm seeing regressions with this patch (no subsequent patch seems to fix it, either): >> I setup a F21 VM w/ gcc-gnat-4.9, and was able to reproduce them. The problem was that there were some code paths that would result in GDB Ada-encoding an already-encoded name. Looking at https://sourceware.org/bugzilla/show_bug.cgi?id=12607 I realized that my "progression" was really a sign of a regression, and the cause was the same (the resolve_subexp hunk below). Below's the patch on top of patch #25 that fixes the regressions. It's the same as you've tested, only cleaned up a little. Thanks much for noticing this, and for testing the earlier patch too. I'll send the updated patch #25 as a reply. >From 5fe82c63f79a3600247f8cd73540eac28e8a0b13 Mon Sep 17 00:00:00 2001 From: Pedro Alves Date: Thu, 20 Jul 2017 12:01:50 +0100 Subject: [PATCH] Fix regressions seen with gcc-gnat-4.9 on F21 --- gdb/ada-lang.c | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index 94b6757..25cde2c 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -3579,7 +3579,7 @@ resolve_subexp (struct expression **expp, int *pos, int deprocedure_p, int n_candidates; n_candidates = - ada_lookup_symbol_list (ada_encode (ada_decoded_op_name (op)), + ada_lookup_symbol_list (ada_decoded_op_name (op), (struct block *) NULL, VAR_DOMAIN, &candidates); i = ada_resolve_function (candidates, n_candidates, argvec, nargs, @@ -5661,7 +5661,6 @@ add_nonlocal_symbols (struct obstack *obstackp, memset (&data, 0, sizeof data); data.obstackp = obstackp; - const char *name = ada_lookup_name (lookup_name); bool is_wild_match = lookup_name.ada ().wild_match_p (); ALL_OBJFILES (objfile) @@ -5669,12 +5668,14 @@ add_nonlocal_symbols (struct obstack *obstackp, data.objfile = objfile; if (is_wild_match) - objfile->sf->qf->map_matching_symbols (objfile, name, domain, global, + objfile->sf->qf->map_matching_symbols (objfile, lookup_name.name ().c_str (), + domain, global, aux_add_nonlocal_symbols, &data, symbol_name_match_type::WILD, NULL); else - objfile->sf->qf->map_matching_symbols (objfile, name, domain, global, + objfile->sf->qf->map_matching_symbols (objfile, lookup_name.name ().c_str (), + domain, global, aux_add_nonlocal_symbols, &data, symbol_name_match_type::FULL, compare_names); @@ -5692,14 +5693,14 @@ add_nonlocal_symbols (struct obstack *obstackp, if (num_defns_collected (obstackp) == 0 && global && !is_wild_match) { + const char *name = ada_lookup_name (lookup_name); + std::string name1 = std::string ("<_ada_") + name + '>'; + ALL_OBJFILES (objfile) { - char *name1 = (char *) alloca (strlen (name) + sizeof ("_ada_")); - strcpy (name1, "_ada_"); - strcpy (name1 + sizeof ("_ada_") - 1, name); data.objfile = objfile; - objfile->sf->qf->map_matching_symbols (objfile, name1, domain, - global, + objfile->sf->qf->map_matching_symbols (objfile, name1.c_str (), + domain, global, aux_add_nonlocal_symbols, &data, symbol_name_match_type::FULL, @@ -5888,10 +5889,19 @@ ada_lookup_encoded_symbol (const char *name, const struct block *block, struct block_symbol *candidates; int n_candidates; + /* Since we already have an encoded name, wrap it in '<>' to force a + verbatim match. Otherwise, if the name happens to not look like + an encoded name (because it doesn't include a "__"), + ada_lookup_name_info would re-encode/fold it again, and that + would e.g., incorrectly lowercase object renaming names like + "R28b" -> "r28b". */ + std::string verbatim = std::string ("<") + name + '>'; + gdb_assert (info != NULL); memset (info, 0, sizeof (struct block_symbol)); - n_candidates = ada_lookup_symbol_list (name, block, domain, &candidates); + n_candidates = ada_lookup_symbol_list (verbatim.c_str (), block, + domain, &candidates); if (n_candidates == 0) return; -- 2.5.5