From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 82439 invoked by alias); 17 Nov 2018 12:24:41 -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 82316 invoked by uid 89); 17 Nov 2018 12:24:22 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.7 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 spammy=driven, H*M:1531 X-HELO: mailsec112.isp.belgacom.be Received: from mailsec112.isp.belgacom.be (HELO mailsec112.isp.belgacom.be) (195.238.20.108) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 17 Nov 2018 12:24:21 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=skynet.be; i=@skynet.be; q=dns/txt; s=securemail; t=1542457456; x=1573993456; h=message-id:subject:from:to:date:in-reply-to:references: mime-version:content-transfer-encoding; bh=/AbYIU7stNPRh/LuGYNz74YkvY+D5SL3p8Amxe2q4p0=; b=aicA1YEWulprXsPwHtgluDkCCU4DT1nf/caHgwfssxWXDna7uDMNH9Dm 7MDhMIArmG6ZZT3Ou00NeaSSRleF6w==; Received: from 110.212-243-81.adsl-dyn.isp.belgacom.be (HELO md) ([81.243.212.110]) by relay.skynet.be with ESMTP/TLS/AES256-GCM-SHA384; 17 Nov 2018 13:24:13 +0100 Message-ID: <1542457452.1531.12.camel@skynet.be> Subject: Re: [RFA 2/5] Use scoped_switch_auto_to_sym_language in symtab.c to switch language. From: Philippe Waroquiers To: Pedro Alves , gdb-patches@sourceware.org Date: Sat, 17 Nov 2018 12:24:00 -0000 In-Reply-To: <5c4edf47-cdb1-640b-6127-f14842a9707d@redhat.com> References: <20181028144614.14149-1-philippe.waroquiers@skynet.be> <20181028144614.14149-3-philippe.waroquiers@skynet.be> <5c4edf47-cdb1-640b-6127-f14842a9707d@redhat.com> Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-IsSubscribed: yes X-SW-Source: 2018-11/txt/msg00269.txt.bz2 On Fri, 2018-11-16 at 18:28 +0000, Pedro Alves wrote: > On 10/28/2018 02:46 PM, Philippe Waroquiers wrote: > > > > if (symbol_lookup_debug > 1) > > { > > @@ -4601,6 +4598,7 @@ print_symbol_info (enum search_domain kind, > > struct symbol *sym, > > int block, const char *last) > > { > > + scoped_switch_auto_to_sym_language l (sym); > > Sounds unnecessarily inefficient to use the scoped switch here > instead of at the caller to avoid the back and forth for each > symbol, but probably this isn't in any hot path, so it's fine. Yes, I do not think this is performance critical, and also, switching of language is not very expensive : it implies to construct/destroy scoped_switch_auto_to_sym_language l, which do calls to functions setting enumeration values for the language and case settings. > > > struct symtab *s = symbol_symtab (sym); > > > > if (last != NULL) > > diff --git a/gdb/testsuite/gdb.dwarf2/dw2-case-insensitive.exp b/gdb/testsuite/gdb.dwarf2/dw2-case-insensitive.exp > > index b15dcafa00..2e3397865a 100644 > > --- a/gdb/testsuite/gdb.dwarf2/dw2-case-insensitive.exp > > +++ b/gdb/testsuite/gdb.dwarf2/dw2-case-insensitive.exp > > @@ -42,8 +42,10 @@ gdb_test "info functions fUnC_lang" \ > > gdb_test "set case-sensitive off" {warning: the current case sensitivity setting does not match the language\.} > > > > # The dot-leading symbol is for ppc64 function descriptors. > > +# Note that info functions gives the FUNC_lang result using the fortran syntax > > +# as specific in dw-case-insensitive-debug.S DW_AT_language. > > gdb_test "info functions fUnC_lang" \ > > - "All functions matching regular expression \"fUnC_lang\":\[\r\n\]+File file1.txt:\r\n\tfoo FUNC_lang\\(void\\);(\r\n\r\nNon-debugging symbols:\r\n0x\[0-9a-f\]+ +\\.FUNC_lang)?" \ > > + "All functions matching regular expression \"fUnC_lang\":\[\r\n\]+File file1.txt:\r\n\tfoo FUNC_lang\\(\\);(\r\n\r\nNon-debugging symbols:\r\n0x\[0-9a-f\]+ +\\.FUNC_lang)?" \ > > "regexp case-sensitive off" > > OOC, the actual name & type matching respect the symbol's language, right? Yes, effectively, the previous patch series that introduced e.g. 'info function -t TYPEREGEXP' was already switching to the entity language to do the matching of the type. The only somewhat (strange ? non intuitive ?) behavior remaining is that the entity names are printed (and matched) not according to the language setting, but according to the 'set print demangle' setting. For example, in the below, you see that with set lang c, the var name is still printed with a . after global_pack, while intuitively, one would have expected the 'raw' name with __. The __ are shown when demangling is off. (gdb) set lang c Warning: the current language does not match this frame. (gdb) info var some_struct_in_ada All variables matching regular expression "some_struct_in_ada": File /bd/home/philippe/gdb/git/info_t/gdb/testsuite/gdb.ada/info_auto_lang/global_pack.ads: 24: struct global_pack__some_type_in_ada global_pack.some_struct_in_ada; (gdb) set print demangle off (gdb) info var some_struct_in_ada All variables matching regular expression "some_struct_in_ada": File /bd/home/philippe/gdb/git/info_t/gdb/testsuite/gdb.ada/info_auto_lang/global_pack.ads: 24: struct global_pack__some_type_in_ada global_pack__some_struct_in_ada; (gdb)  I guess that changing this would mean to have demangling be driven by language setting (not too sure how the demangling logic works now). Thanks for the review, I think I handled all your comments/suggestions in RFAv2. Philippe