From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4706 invoked by alias); 15 Dec 2017 18:57:09 -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 4697 invoked by uid 89); 15 Dec 2017 18:57:09 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,SPF_HELO_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=xmas, palves, woke 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; Fri, 15 Dec 2017 18:57:07 +0000 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7434D5D697; Fri, 15 Dec 2017 18:57:06 +0000 (UTC) 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 A69E66266B; Fri, 15 Dec 2017 18:57:05 +0000 (UTC) Subject: Re: [RFC] regresssion(internal-error) printing subprogram argument To: Joel Brobecker References: <20171213103655.msbaxfrykc36f4a7@adacore.com> <20171215094755.dwocipbcwvtdm6f6@adacore.com> <00320239-44c8-b9c3-013b-b27c771e3401@redhat.com> Cc: gdb-patches@sourceware.org From: Pedro Alves Message-ID: <07a154ef-b6f5-ad86-1410-a73620de4b5b@redhat.com> Date: Fri, 15 Dec 2017 18:57: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: <00320239-44c8-b9c3-013b-b27c771e3401@redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-SW-Source: 2017-12/txt/msg00390.txt.bz2 On 12/15/2017 11:02 AM, Pedro Alves wrote: > Hi Joel, > > I woke up realizing that I completely forgot that psymbols have no > overload/function parameter info in C++, so a straight strcmp probably > doesn't work properly for C++. Indeed, I remembered now to do > "maint check-psymtabs" when debugging gdb, and I get back a few > problems: > > (top-gdb) maint check-psymtabs > Global symbol `__gnu_cxx::operator!= >' only found in src/gdb/cli/cli-cmds.c psymtab > Global symbol `__gnu_cxx::operator- >' only found in src/gdb/cli/cli-cmds.c psymtab > [...] > > Maybe what we need is to be a little less aggressive then and > add a new symbol_name_match_type::SEARCH_SYMBOL instead that takes as > input a non-user-input search symbol like symbol_name_match_type::LITERAL > was, and then we skip any decoding/demangling steps (like LITERAL) and make: > - Ada treat that as a verbatim match, > - other languages treat it as symbol_name_match_type::FULL. > > I can't look at this right now, though I'll try to play with it a bit > more later today. I'm a bit worried on timing since I'm going to be > away next week (today's my last official day before xmas holiday). :-/ > Errr, it turns out that I had done the above on the wrong branch... I get the above output even if I use the system gdb (7.10) to debug the new gdb, and then do "maint check-psymtabs". So those are not a regression. However, (as suspected) with the LITERAL patch things indeed got worse for C++: Global symbol `error' only found in src/gdb/common/errors.c psymtab Global symbol `internal_error' only found in src/gdb/common/errors.c psymtab Global symbol `internal_warning' only found in src/gdb/common/errors.c psymtab Global symbol `warning' only found in src/gdb/common/errors.c psymtab Static symbol `info_command' only found in src/gdb/cli/cli-cmds.c psymtab Static symbol `show_command' only found in src/gdb/cli/cli-cmds.c psymtab Static symbol `help_command' only found in src/gdb/cli/cli-cmds.c psymtab Static symbol `complete_command' only found in src/gdb/cli/cli-cmds.c psymtab Static symbol `show_version' only found in src/gdb/cli/cli-cmds.c psymtab Static symbol `show_configuration' only found in src/gdb/cli/cli-cmds.c psymtab Static symbol `pwd_command' only found in src/gdb/cli/cli-cmds.c psymtab Static symbol `show_script_ext_mode' only found in src/gdb/cli/cli-cmds.c psymtab Static symbol `source_script_from_stream' only found in src/gdb/cli/cli-cmds.c psymtab [...many more...] With the patch below applied on top, which is a minimal version of the design change I suggested (LITERAL -> SEARCH_SYMBOL), I now get again the same "maint check-psymtabs" output that I get with system gdb. So seems like this is on the good track. Your internal-error test still passes as well as the new "maint check-psymtabs" for gdb.ada/ testcase. I've pushed the current state to users/palves/literal-matching. I probably won't be able to look at this more today. >From 6b4025034b0b0e8b2511e4c355365c9ff69be822 Mon Sep 17 00:00:00 2001 From: Pedro Alves Date: Fri, 15 Dec 2017 17:46:56 +0000 Subject: [PATCH] Move literal matching to Ada --- gdb/ada-lang.c | 8 ++++++++ gdb/cp-support.c | 1 + gdb/language.c | 9 +++------ gdb/symtab.c | 12 ++++++++---- 4 files changed, 20 insertions(+), 10 deletions(-) diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index 9e637eb..5f4e255 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -14065,12 +14065,20 @@ ada_symbol_name_matches (const char *symbol_search_name, comp_match_res); } +bool +literal_symbol_name_matcher (const char *symbol_search_name, + const lookup_name_info &lookup_name, + completion_match_result *comp_match_res); + /* Implement the "la_get_symbol_name_matcher" language_defn method for Ada. */ static symbol_name_matcher_ftype * ada_get_symbol_name_matcher (const lookup_name_info &lookup_name) { + if (lookup_name.match_type () == symbol_name_match_type::LITERAL) + return literal_symbol_name_matcher; + if (lookup_name.completion_mode ()) return ada_symbol_name_matches; else diff --git a/gdb/cp-support.c b/gdb/cp-support.c index 34a8439..7c14423 100644 --- a/gdb/cp-support.c +++ b/gdb/cp-support.c @@ -1793,6 +1793,7 @@ cp_get_symbol_name_matcher (const lookup_name_info &lookup_name) { case symbol_name_match_type::FULL: case symbol_name_match_type::EXPRESSION: + case symbol_name_match_type::LITERAL: return cp_fq_symbol_name_matches; case symbol_name_match_type::WILD: return cp_symbol_name_matches; diff --git a/gdb/language.c b/gdb/language.c index 5bcdfb9..44afdef 100644 --- a/gdb/language.c +++ b/gdb/language.c @@ -727,7 +727,7 @@ default_symbol_name_matcher (const char *symbol_search_name, /* A name matcher that matches the symbol name exactly, with strcmp. */ -static bool +bool literal_symbol_name_matcher (const char *symbol_search_name, const lookup_name_info &lookup_name, completion_match_result *comp_match_res) @@ -753,13 +753,10 @@ symbol_name_matcher_ftype * language_get_symbol_name_matcher (const language_defn *lang, const lookup_name_info &lookup_name) { - if (lookup_name.match_type () == symbol_name_match_type::LITERAL) - return literal_symbol_name_matcher; - if (lang->la_get_symbol_name_matcher != nullptr) return lang->la_get_symbol_name_matcher (lookup_name); - - return default_symbol_name_matcher; + else + return default_symbol_name_matcher; } /* Define the language that is no language. */ diff --git a/gdb/symtab.c b/gdb/symtab.c index 78018a1..6957757 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -1775,14 +1775,18 @@ demangle_for_lookup_info::demangle_for_lookup_info if (without_params != NULL) { - m_demangled_name = demangle_for_lookup (without_params.get (), - lang, storage); + if (lookup_name.match_type () != symbol_name_match_type::LITERAL) + m_demangled_name = demangle_for_lookup (without_params.get (), + lang, storage); return; } } - m_demangled_name = demangle_for_lookup (lookup_name.name ().c_str (), - lang, storage); + if (lookup_name.match_type () == symbol_name_match_type::LITERAL) + m_demangled_name = lookup_name.name (); + else + m_demangled_name = demangle_for_lookup (lookup_name.name ().c_str (), + lang, storage); } /* See symtab.h. */ -- 2.5.5