Message ID | c471c1e2-fc87-d313-4d01-85b10b9f75d7@gmail.com |
---|---|
State | Committed |
Commit | ace4b7f295f407b16cfbc2e359f4ef7cd61d4a46 |
Headers |
Return-Path: <gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 338683830642 for <patchwork@sourceware.org>; Wed, 25 May 2022 20:28:45 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 338683830642 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1653510525; bh=bDcJv1H0H4F9lQ+vUJZlFQZCqpbW9qkcUIRZeiZPS2Y=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=Gx4fJUa/WxBc9BmsLVOb/003Q6z4lVZaViScTGpzuW/lVOJ9keorvPQC7+Pell4eE m4Yw9vCHTMGlt+2WDngh32p/gUVUkwqZMVxpbQVzXfgaWZ4QSmoetVZyc8CYQFgrDV zgJ7ieU5hEoDCyL+rFr784EdaGAwe73+B3K5QlVE= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) by sourceware.org (Postfix) with ESMTPS id 8D0753830671; Wed, 25 May 2022 20:26:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 8D0753830671 Received: by mail-wr1-x42e.google.com with SMTP id i9so1446443wrc.13; Wed, 25 May 2022 13:26:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent :content-language:to:cc:from:subject; bh=bDcJv1H0H4F9lQ+vUJZlFQZCqpbW9qkcUIRZeiZPS2Y=; b=YUNTDhla/3GpAcZtAkA5KXN9DCl4QPWp4WwxIdWijuf/88eLuwPd4gCdQGsPyGjPm9 Pn8fiRcBW4sqXAkr3edHHkKxuLXi0ZFnGL8W1VZoa6ZZkZ72dDpRhFI5KGmcH3QD1nEu MV+Lutgp1ePZPTjznr6lZDzcFqOHcenhbn//N8Xj19CvTKXVHdWDrK9w4/eTI0ZNuCR/ MRTc0jW7w0PsThjWweyc8V2zsA42X7iNdMr2J2YgNm3nWjOThC91iH0Uhec1Ymj+ULOT +j+tcTScepfaDO75jbX1FRnYLFgDigLzIf3HqLKXzXvodm2ALam1Sso4Y/PZ5imufMkW Qkfw== X-Gm-Message-State: AOAM530DP/3dujafVp89ALLoDg4snn8VTF7yvhhLJyzo/rHwdiCWH63w tRY421fN2pPHObCV73Te7CfDZEM4Z84= X-Google-Smtp-Source: ABdhPJwrilm31NHrdjyC0Eky4sIjTSEeCw8M8bEkYsUv4o1OCZZG1H86Bf6XkFufOwsCnBJKtvGmAA== X-Received: by 2002:a5d:64c7:0:b0:20e:609a:98d5 with SMTP id f7-20020a5d64c7000000b0020e609a98d5mr27964064wri.629.1653510401933; Wed, 25 May 2022 13:26:41 -0700 (PDT) Received: from ?IPV6:2a01:e0a:1dc:b1c0:45dd:426:28b7:68e1? ([2a01:e0a:1dc:b1c0:45dd:426:28b7:68e1]) by smtp.googlemail.com with ESMTPSA id n4-20020a7bc5c4000000b003974d0d981dsm2653617wmk.35.2022.05.25.13.26.41 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 25 May 2022 13:26:41 -0700 (PDT) Content-Type: multipart/mixed; boundary="------------h0dPDWrahi037vCY4mvGgaEh" Message-ID: <c471c1e2-fc87-d313-4d01-85b10b9f75d7@gmail.com> Date: Wed, 25 May 2022 22:26:40 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.1 Content-Language: en-US To: "libstdc++@gcc.gnu.org" <libstdc++@gcc.gnu.org> Subject: [PATCH][_GLIBCXX_INLINE_VERSION] Fix std::span pretty printer X-Spam-Status: No, score=-9.7 required=5.0 tests=BAYES_00, BODY_8BITS, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> From: =?utf-8?q?Fran=C3=A7ois_Dumont_via_Gcc-patches?= <gcc-patches@gcc.gnu.org> Reply-To: =?utf-8?q?Fran=C3=A7ois_Dumont?= <frs.dumont@gmail.com> Cc: gcc-patches <gcc-patches@gcc.gnu.org> Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" <gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org> |
Series |
[_GLIBCXX_INLINE_VERSION] Fix std::span pretty printer
|
|
Commit Message
François Dumont
May 25, 2022, 8:26 p.m. UTC
Hi Here is a patch to fix std::span pretty printer in versioned namespace mode. Note that there is still a problem with std::atomic after this patch. got: $13 = std::atomic<std::__8::shared_ptr<int>> (empty) = {get() = 0x0} FAIL: libstdc++-prettyprinters/cxx20.cc print spe libstdc++: [_GLIBCXX_INLINE_VERSION] Fix std::span pretty printer libstdc++-v3/ChangeLog: * python/libstdcxx/v6/printers.py (StdSpanPrinter.__init__): Strip typename from version namespace. Tested under Linux x86_64 _GLIBCXX_INLINE_VERSION mode. Ok to commit ? François
Comments
On Wed, 25 May 2022 at 21:29, François Dumont via Libstdc++ <libstdc++@gcc.gnu.org> wrote: > > Hi > > Here is a patch to fix std::span pretty printer in versioned > namespace mode. > > Note that there is still a problem with std::atomic after this patch. > > got: $13 = std::atomic<std::__8::shared_ptr<int>> (empty) = {get() = 0x0} > FAIL: libstdc++-prettyprinters/cxx20.cc print spe > > libstdc++: [_GLIBCXX_INLINE_VERSION] Fix std::span pretty printer > > libstdc++-v3/ChangeLog: > > * python/libstdcxx/v6/printers.py (StdSpanPrinter.__init__): > Strip typename from version namespace. > > Tested under Linux x86_64 _GLIBCXX_INLINE_VERSION mode. > > Ok to commit ? OK, thanks.
On Thu, 26 May 2022 at 00:34, Jonathan Wakely <jwakely@redhat.com> wrote: > > On Wed, 25 May 2022 at 21:29, François Dumont via Libstdc++ > <libstdc++@gcc.gnu.org> wrote: > > > > Hi > > > > Here is a patch to fix std::span pretty printer in versioned > > namespace mode. > > > > Note that there is still a problem with std::atomic after this patch. > > > > got: $13 = std::atomic<std::__8::shared_ptr<int>> (empty) = {get() = 0x0} > > FAIL: libstdc++-prettyprinters/cxx20.cc print spe Does this fix it? --- a/libstdc++-v3/python/libstdcxx/v6/printers.py +++ b/libstdc++-v3/python/libstdcxx/v6/printers.py @@ -1734,6 +1734,7 @@ class StdAtomicPrinter: impl = val['_M_impl'] self.shptr_printer = SharedPointerPrinter(typename, impl) self.children = self._shptr_children + self.typename = self.typename.replace(self.value_type.tag, typ) def _shptr_children(self): return SmartPtrIterator(self.shptr_printer.pointer) I'll test it with a versioned-namespace build tomorrow. > > > > libstdc++: [_GLIBCXX_INLINE_VERSION] Fix std::span pretty printer > > > > libstdc++-v3/ChangeLog: > > > > * python/libstdcxx/v6/printers.py (StdSpanPrinter.__init__): > > Strip typename from version namespace. > > > > Tested under Linux x86_64 _GLIBCXX_INLINE_VERSION mode. > > > > Ok to commit ? > > OK, thanks.
On Thu, 26 May 2022 at 00:38, Jonathan Wakely <jwakely@redhat.com> wrote: > > On Thu, 26 May 2022 at 00:34, Jonathan Wakely <jwakely@redhat.com> wrote: > > > > On Wed, 25 May 2022 at 21:29, François Dumont via Libstdc++ > > <libstdc++@gcc.gnu.org> wrote: > > > > > > Hi > > > > > > Here is a patch to fix std::span pretty printer in versioned > > > namespace mode. > > > > > > Note that there is still a problem with std::atomic after this patch. > > > > > > got: $13 = std::atomic<std::__8::shared_ptr<int>> (empty) = {get() = 0x0} > > > FAIL: libstdc++-prettyprinters/cxx20.cc print spe > > Does this fix it? > > --- a/libstdc++-v3/python/libstdcxx/v6/printers.py > +++ b/libstdc++-v3/python/libstdcxx/v6/printers.py > @@ -1734,6 +1734,7 @@ class StdAtomicPrinter: > impl = val['_M_impl'] > self.shptr_printer = SharedPointerPrinter(typename, impl) > self.children = self._shptr_children > + self.typename = self.typename.replace(self.value_type.tag, typ) > > def _shptr_children(self): > return SmartPtrIterator(self.shptr_printer.pointer) > > > I'll test it with a versioned-namespace build tomorrow. No, that didn't work, but the attached patch does. Pushed to trunk. commit 634b0089f664cca96d71262b295025e057054f2c Author: Jonathan Wakely <jwakely@redhat.com> Date: Thu May 26 09:49:40 2022 libstdc++: Fix printing of std::atomic<shared_ptr<T>> for versioned namespace libstdc++-v3/ChangeLog: * python/libstdcxx/v6/printers.py (SharedPointerPrinter): Strip versioned namespace from the template argument too. diff --git a/libstdc++-v3/python/libstdcxx/v6/printers.py b/libstdc++-v3/python/libstdcxx/v6/printers.py index 0bd793c0897..17d5e5b5731 100644 --- a/libstdc++-v3/python/libstdcxx/v6/printers.py +++ b/libstdc++-v3/python/libstdcxx/v6/printers.py @@ -242,6 +242,7 @@ class SharedPointerPrinter: state = 'empty' refcounts = self._get_refcounts() targ = self.val.type.template_argument(0) + targ = strip_versioned_namespace(str(targ)) if refcounts != 0: usecount = refcounts['_M_use_count'] @@ -250,7 +251,7 @@ class SharedPointerPrinter: state = 'expired, weak count %d' % weakcount else: state = 'use count %d, weak count %d' % (usecount, weakcount - 1) - return '%s<%s> (%s)' % (self.typename, str(targ), state) + return '%s<%s> (%s)' % (self.typename, targ, state) def _tuple_impl_get(val): "Return the tuple element stored in a _Tuple_impl<N, T> base class."
diff --git a/libstdc++-v3/python/libstdcxx/v6/printers.py b/libstdc++-v3/python/libstdcxx/v6/printers.py index 0bd793c0897..fafdff3e5c0 100644 --- a/libstdc++-v3/python/libstdcxx/v6/printers.py +++ b/libstdc++-v3/python/libstdcxx/v6/printers.py @@ -1687,7 +1687,7 @@ class StdSpanPrinter: return '[%d]' % count, (self.begin + count).dereference() def __init__(self, typename, val): - self.typename = typename + self.typename = strip_versioned_namespace(typename) self.val = val if val.type.template_argument(1) == gdb.parse_and_eval('static_cast<std::size_t>(-1)'): self.size = val['_M_extent']['_M_extent_value'] @@ -1994,7 +1994,7 @@ class FilteringTypePrinter(object): self.enabled = True class _recognizer(object): - "The recognizer class for TemplateTypePrinter." + "The recognizer class for FilteringTypePrinter." def __init__(self, match, name): self.match = match