From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 120657 invoked by alias); 15 Dec 2016 14:37:28 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 120616 invoked by uid 89); 15 Dec 2016 14:37:27 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-5.0 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy= X-Spam-User: qpsmtpd, 2 recipients 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, 15 Dec 2016 14:37:26 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DF0893D967; Thu, 15 Dec 2016 14:37:24 +0000 (UTC) Received: from localhost (ovpn-116-120.ams2.redhat.com [10.36.116.120]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id uBFEbNBo009618; Thu, 15 Dec 2016 09:37:24 -0500 Date: Thu, 15 Dec 2016 14:51:00 -0000 From: Jonathan Wakely To: =?iso-8859-1?Q?Fran=E7ois?= Dumont Cc: "libstdc++@gcc.gnu.org" , gcc-patches Subject: Re: Pretty printers for versioned namespace Message-ID: <20161215143723.GA22266@redhat.com> References: <37f043c2-5022-feb2-598b-5cb8ba11d762@gmail.com> <20161129201709.GL3301@redhat.com> <71a8120b-494a-c074-bb13-1ddfa560fdf2@gmail.com> <20161202004150.GI3301@redhat.com> <1a5de3bf-9cfc-3569-6dc8-7ffcd99c286f@gmail.com> <20161209151830.GH6326@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1; format=flowed Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Clacks-Overhead: GNU Terry Pratchett User-Agent: Mutt/1.7.1 (2016-10-04) X-SW-Source: 2016-12/txt/msg01373.txt.bz2 On 14/12/16 22:49 +0100, François Dumont wrote: >@@ -1321,7 +1328,7 @@ def register_type_printers(obj): > if not _use_type_printing: > return > >- for pfx in ('', 'w'): >+ for pfx in ('', 'w', vers_nsp, vers_nsp + 'w'): > add_one_type_printer(obj, 'basic_string', pfx + 'string') > add_one_type_printer(obj, 'basic_string_view', pfx + 'string_view') > add_one_type_printer(obj, 'basic_ios', pfx + 'ios') Looking at this part again, can't we handle the std::__7:: cases inside add_one_type_printer instead of here? The "pfx" prefixes here are intended for names that are imilar, like std::string and std::wstring. If we want to handle both with an alternative namespace then the place to do that is where we prepend the namespace, surely? def add_one_type_printer(obj, match, name): printer = FilteringTypePrinter(match, 'std::' + name) gdb.types.register_type_printer(obj, printer) + printer = FilteringTypePrinter(match, 'std::__7::' + name) + gdb.types.register_type_printer(obj, printer) That will make the patch *much* smaller, and the logic is easier to follow. For the template type printers I think we just want to add (__7::)? to the regular expressions. If we get a type like std::__7::vector > Then I think we want to print that as std::vector, without __7::.