From patchwork Sat Nov 10 15:00:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philippe Waroquiers X-Patchwork-Id: 30105 Received: (qmail 66348 invoked by alias); 10 Nov 2018 15:01:02 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 66220 invoked by uid 89); 10 Nov 2018 15:01:01 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.3 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_STOCKGEN, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mailsec107.isp.belgacom.be Received: from mailsec107.isp.belgacom.be (HELO mailsec107.isp.belgacom.be) (195.238.20.103) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 10 Nov 2018 15:01:00 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=skynet.be; i=@skynet.be; q=dns/txt; s=securemail; t=1541862060; x=1573398060; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=UIZJ/ankPJfThKHHFVGCyjVzUBTtW3YQb7OVeUKocFk=; b=vDnH7pT0e2O/4jUbmytsTcwR3/F/Ddrbj+rQYF3K7QRQTJk/y8EDUjPQ +CJvumCUD45Q/LFej+XS6GrLxRKIPA==; Received: from 110.212-243-81.adsl-dyn.isp.belgacom.be (HELO md.home) ([81.243.212.110]) by relay.skynet.be with ESMTP/TLS/DHE-RSA-AES128-GCM-SHA256; 10 Nov 2018 16:00:54 +0100 From: Philippe Waroquiers To: gdb-patches@sourceware.org Cc: Philippe Waroquiers Subject: [RFAv2 1/2] Fix regression 'info variables' does not show minimal symbols. Date: Sat, 10 Nov 2018 16:00:47 +0100 Message-Id: <20181110150048.21031-2-philippe.waroquiers@skynet.be> In-Reply-To: <20181110150048.21031-1-philippe.waroquiers@skynet.be> References: <20181110150048.21031-1-philippe.waroquiers@skynet.be> MIME-Version: 1.0 X-IsSubscribed: yes 12615cba8411c8 Add [-q] [-t TYPEREGEXP] [NAMEREGEXP] args to info [args|functions|locals|variables] introduced a regression that minimal symbols were not listed anymore, due to a wrong condition checking the absence of a type regexp in the loop scanning the minimal symbols. Instead, before entering the loop scanning the minimal symbols, check that we do not have a type regexp, as we will never match a minimal symbol with this type regexp. With the fix in this patch, for this part of the code, we basically go back to the GDB 8.2 logic, with just the addition of && !treg.has_value ()) to 'enter' in the minsym case. This should ensure that at least there is no regression compared to 8.2, when not using the new type matching argument, as there was no treg in 8.2. 2018-11-10 Philippe Waroquiers * symtab.c (search_symbols): Properly check absence of type regexp before entering the loop scanning the minimal symbols. --- gdb/symtab.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/gdb/symtab.c b/gdb/symtab.c index 2e9e6325ad..7a77bcfb18 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -4544,9 +4544,12 @@ search_symbols (const char *regexp, enum search_domain kind, sort_search_symbols_remove_dups (&result); /* If there are no eyes, avoid all contact. I mean, if there are - no debug symbols, then add matching minsyms. */ + no debug symbols, then add matching minsyms. But if the user wants + to see symbols matching a type regexp, then never give a minimal symbol, + as we assume that a minimal symbol does not have a type. */ - if (found_misc || (nfiles == 0 && kind != FUNCTIONS_DOMAIN)) + if ((found_misc || (nfiles == 0 && kind != FUNCTIONS_DOMAIN)) + && !treg.has_value ()) { ALL_MSYMBOLS (objfile, msymbol) { @@ -4560,13 +4563,9 @@ search_symbols (const char *regexp, enum search_domain kind, || MSYMBOL_TYPE (msymbol) == ourtype3 || MSYMBOL_TYPE (msymbol) == ourtype4) { - /* If the user wants to see var matching a type regexp, - then never give a minimal symbol. */ - if (kind != VARIABLES_DOMAIN - && !treg.has_value () /* minimal symbol has never a type ???? */ - && (!preg.has_value () - || preg->exec (MSYMBOL_NATURAL_NAME (msymbol), 0, - NULL, 0) == 0)) + if (!preg.has_value () + || preg->exec (MSYMBOL_NATURAL_NAME (msymbol), 0, + NULL, 0) == 0) { /* For functions we can do a quick check of whether the symbol might be found via find_pc_symtab. */