From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23935 invoked by alias); 26 Aug 2011 18:31:34 -0000 Received: (qmail 23924 invoked by uid 22791); 26 Aug 2011 18:31:31 -0000 X-SWARE-Spam-Status: No, hits=-6.8 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,SPF_HELO_PASS 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; Fri, 26 Aug 2011 18:31:13 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p7QIVCLp015955 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 26 Aug 2011 14:31:12 -0400 Received: from host1.jankratochvil.net (ovpn-116-38.ams2.redhat.com [10.36.116.38]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p7QIVA7L012593 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 26 Aug 2011 14:31:12 -0400 Received: from host1.jankratochvil.net (localhost [127.0.0.1]) by host1.jankratochvil.net (8.14.4/8.14.4) with ESMTP id p7QIV9BT027356; Fri, 26 Aug 2011 20:31:09 +0200 Received: (from jkratoch@localhost) by host1.jankratochvil.net (8.14.4/8.14.4/Submit) id p7QIV81V027355; Fri, 26 Aug 2011 20:31:08 +0200 Date: Fri, 26 Aug 2011 18:31:00 -0000 From: Jan Kratochvil To: Keith Seitz Cc: gdb-patches@sourceware.org Subject: Re: [RFC] 12266 Fallout Message-ID: <20110826183108.GA25559@host1.jankratochvil.net> References: <4E56D4A3.7000306@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4E56D4A3.7000306@redhat.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes 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: 2011-08/txt/msg00503.txt.bz2 On Fri, 26 Aug 2011 01:02:59 +0200, Keith Seitz wrote: > The reporter's test case (C++): > > typedef std::string foo; > void calltest (foo) {} > > Setting a break at "calltest(foo)" does not work because > inspect_type (part of 12266 patchset) uses check_typedef, which > resolves foo -> std::string -> std::basic_string std::char_traits, std::alloactor >. But because we are > no longer using DMGL_VERBOSE in dwarf2_physname (and other places) > to do demangling, the symbol table actually stores > "calltest(std::string)". check_typedef always unwinds only the toplevel typedefs, not any inner ones. I think you should move the comparison block /* Ignore any typedefs that should not be substituted. */ for (i = 0; i < ARRAY_SIZE (ignore_typedefs); ++i) { if (strcmp (name, ignore_typedefs[i]) == 0) return 0; } into the later comparisons: /* Find the last typedef for the type. */ while (TYPE_TARGET_TYPE (last) != NULL && (TYPE_CODE (TYPE_TARGET_TYPE (last)) == TYPE_CODE_TYPEDEF)) last = TYPE_TARGET_TYPE (last); and it would get properly caught, wouldn't be? > There are two ways I can see to fix this. > 1) Add DMGL_VERBOSE where it is needed so that NO typedefs ever > appear in a (non-TYPE_CODE_TYPEDEF) symbol's name, i.e, store > "calltest(std::basic_string<...>)" in the symbol table instead of > "calltest(std::string)". > Actually in this case, the "right" output would be "calltest(foo)", > but that is a different, but related, problem, for which I developed > a patch a long time ago, part of the first 12266 patch submissions > (dwarf2_print_name). As I stated off-list before I agree the primary goal is to make working `break func(any_form_of_types)'. And as also Tom said when there is the possibility to print the DWARF type - incl. typedefs - it should be also printed as was implemented in: But if you just lookup the minimal (ELF) symbol - where the dwarf2_print_name form cannot apply - by: (gdb) info sym 0x0000003f1b25ed70 I guess it should say: std::hash::operator()(std::string) const in section .text of /usr/lib64/libstdc++.so.6 and not: std::hash, std::allocator > >::operator()(std::basic_string, std::allocator >) const in section .text of /usr/lib64/libstdc++.so.6 while nm -C says: 0000003f1b25ed70 T std::hash::operator()(std::string) const IMO if GDB starts to use DMGL_VERBOSE we should ask binutils to use DMGL_VERBOSE for `nm -C' and other tools there. > So, I humbly ask maintainers: > > - Shall I continue #1 and start submitting patches? > - Shall I start teaching gdb about std::string et al and how to deal > with them in the environment we have today? > - Have I missed something that would be preferable to anything I've > mentioned? I would prefer to keep `std::string' to be `std::string' as possible, which I naively believe could be done without modifying/duplicating check_typedef by the change suggested above. Thanks, Jan