From patchwork Tue Oct 3 17:18:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 148022 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2a8e:b0:403:3b70:6f57 with SMTP id in14csp2270265vqb; Tue, 3 Oct 2023 11:22:44 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGsQD9rRIeHfNyylvHup+ekEjFX+vkQrwvBANaalYiQZBe/mv9VsgX7iwm07XoKpD7ZKaPx X-Received: by 2002:a17:906:2097:b0:9ae:53df:9855 with SMTP id 23-20020a170906209700b009ae53df9855mr15419984ejq.58.1696357364061; Tue, 03 Oct 2023 11:22:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696357364; cv=none; d=google.com; s=arc-20160816; b=MeM9+sp7MtE3ygGmMR6MUnTdq1xIq/o6KsQ4fxd2FepcyZ1PXKZ6/8twLBo5Czv0h7 LFu3SUVyPPt+05bUxUjvw4rYgqheYiM2kqvoH7nxMJpxyIqYQJI+RlR00oUwfZo0CJcU RwKr9EcD90c3CbKzVzuaFC+i/rx1UZ8R9h/qbjwweGa/0UC2jlB2aG8Dou2GVVWCh5qA Z07E1GZVj/WMUb3I3n7sgN7X6DpLASQTd5HrwCWwAASGLTwftlyG9LAF8n7lQV61jJK8 ALe3iriygOh5M/Sv3aXm09J8kP0xblwKuUGa2aMU7hjGKdEBtHq4jWdf83Pv9/Qv+xzd fqtg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature:dmarc-filter:delivered-to; bh=boOmGV/6TjOLuBhywtJCzQe4ZAPokQuL6+bf0WcCb/k=; fh=Ogh3zaPUNpdNYHofIVNHsbX+D3lwaT1T8Jhe/MolwAA=; b=dNb8qeH+d1ivhmveU96ETE6lFytowpPA8tvxzD0eqwURmPreTYo1l3l5eypu/gn2hl B1pvB8s3b55j33hNC0P4bAzcvWM1yZvRZ1aGnzIGiuAqf3H8Orky0Luwn8L79S/sCg6G NGQlfM+SEEzl/CT87xsJtmwRwvZalCQzimkovtmAsdZFb0p/F4DYXSqgGBsQ6Xk4mRPP xNL360ENWPmdLJ5UEk2HvJELhABCysJBzBK5MaEioWgzD2janUFNWhD5bMDxmbECa+JV tDeKMpkRGyraVUP/pn+dE1rupdlOplX+rK2pq4WetFCCItdvo0YPiVd/VMyn1Pnq9cC+ oTaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@adacore.com header.s=google header.b=KebqDoEG; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=adacore.com Received: from server2.sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id kt27-20020a170906aadb00b0099bd4f74cbesi860459ejb.615.2023.10.03.11.22.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 11:22:44 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@adacore.com header.s=google header.b=KebqDoEG; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=adacore.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E9F08388267C for ; Tue, 3 Oct 2023 17:19:53 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-il1-x129.google.com (mail-il1-x129.google.com [IPv6:2607:f8b0:4864:20::129]) by sourceware.org (Postfix) with ESMTPS id E3F493858408 for ; Tue, 3 Oct 2023 17:19:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E3F493858408 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com Received: by mail-il1-x129.google.com with SMTP id e9e14a558f8ab-3528bc102adso4209605ab.2 for ; Tue, 03 Oct 2023 10:19:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1696353541; x=1696958341; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=boOmGV/6TjOLuBhywtJCzQe4ZAPokQuL6+bf0WcCb/k=; b=KebqDoEGIrtPHaeZEpTJGlhBmR0dR2iwpCh4PukpO8PgVaA7QyQFGBgNMl0J5rqbkq Mb40GkjQ8KL+f1VJtoE3uElg7Q2CYd286lA3IbpGyZoAWn9gifmhp6cLqxUgSbz/sRMe QqrROcYS6O3bpo63yoMRxiLty5titUVu26RbhmQbBmB29DC9NlTojGnzAlLdxHC6DYHc gYFkS12j52ploEAH28I6SNnMQmSJ0Amu8QN3FluqU6YeABmzbXSBWnG/URM80+tZQsHf +/V0NSAtlPAQulHPiNIjaPy4gyqx6+7NxhAdUVT1xeYrx3AXHJ0erZ4tDAFG23Q8YrDx s0qw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696353541; x=1696958341; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=boOmGV/6TjOLuBhywtJCzQe4ZAPokQuL6+bf0WcCb/k=; b=X1GN8pN5vyBlAdD09LzYIk7zbA8OQJPJ517Ji0uTIjzVLWiT5qhxc9hQZJYiECJQpv ugpejgd2dg7a9UZwok8BucNIvzxOXmqLN0cAvtmhIKQv1pzQ6gcT+TBp62dEpLgAnaFT K2Cg7nhhGSFKMr+gX1N+Q7m0yq2eMOL/uszGJCeVC1rdWDKAsqpW2x66gP1R3IKXIe0U DJRzm/kGUoPn47wsjeub4vqzdP1la80uVcv5Lgm5JbRgShSD7NyiKqA4zzKBstxIb+rr gkBHAWXMDSYWkrtGiryAeYxxsfd4LuDtLqPf8qU5Cs+tbPbokilU1MzQ8jvJqZ62r1D9 zwxw== X-Gm-Message-State: AOJu0YyCwIHhQPMXsPW5Q9MrHM6F8lQpN4jkgn9jn8lWcpFQhoRGSRKb yOfWFPygVrYpVz0otVkPveyjeJKyMjj7twISfHvtmA== X-Received: by 2002:a05:6e02:12e3:b0:350:f442:9a4d with SMTP id l3-20020a056e0212e300b00350f4429a4dmr86082iln.28.1696353541187; Tue, 03 Oct 2023 10:19:01 -0700 (PDT) Received: from localhost.localdomain (71-211-130-31.hlrn.qwest.net. [71.211.130.31]) by smtp.gmail.com with ESMTPSA id p7-20020a92c607000000b0035134215863sm480967ilm.55.2023.10.03.10.19.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 10:19:00 -0700 (PDT) From: Tom Tromey To: gcc-patches@gcc.gnu.org Cc: libstdc++@gcc.gnu.org, Tom Tromey Subject: [PATCH 1/2] libstdc++: Define _versioned_namespace in xmethods.py Date: Tue, 3 Oct 2023 11:18:50 -0600 Message-Id: <20231003171851.1161340-2-tromey@adacore.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231003171851.1161340-1-tromey@adacore.com> References: <20231003171851.1161340-1-tromey@adacore.com> MIME-Version: 1.0 X-Spam-Status: No, score=-13.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=unavailable 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.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778759619322948243 X-GMAIL-MSGID: 1778759619322948243 flake8 pointed out that is_specialization_of in xmethods.py looks at a global that wasn't added to the file. This patch correct the oversight. libstdc++-v3/ChangeLog: * python/libstdcxx/v6/xmethods.py (_versioned_namespace): Define. --- libstdc++-v3/python/libstdcxx/v6/xmethods.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libstdc++-v3/python/libstdcxx/v6/xmethods.py b/libstdc++-v3/python/libstdcxx/v6/xmethods.py index 844c8a2105a..8ccf57c4d6b 100644 --- a/libstdc++-v3/python/libstdcxx/v6/xmethods.py +++ b/libstdc++-v3/python/libstdcxx/v6/xmethods.py @@ -28,6 +28,8 @@ def get_bool_type(): def get_std_size_type(): return gdb.lookup_type('std::size_t') +_versioned_namespace = '__8::' + def is_specialization_of(x, template_name): """ Test whether a type is a specialization of the named class template. From patchwork Tue Oct 3 17:18:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 148010 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2a8e:b0:403:3b70:6f57 with SMTP id in14csp2237815vqb; Tue, 3 Oct 2023 10:23:15 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFFpTm0/iXKwG19C9uuS5s7rlQ+34H1914RI2kI03J8QIMNtT9TUk9FVGs1jourXJ5DLZat X-Received: by 2002:a05:6402:610:b0:522:ca6b:ad7d with SMTP id n16-20020a056402061000b00522ca6bad7dmr13395402edv.9.1696353795634; Tue, 03 Oct 2023 10:23:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696353795; cv=none; d=google.com; s=arc-20160816; b=U4VonyZGv8fQlgsg+QRM0jh3H+NLE2WHhDvZpO2cB40TN84LEehurZKqH7N26lF+Rj HowDPelUi51ldtEIgiHr1+1gU4GPrNI8IeJJlDTBNlves6aqZbazicfKy6JgwN+wAbMX Y/LblvugKjbgdjIDERslfDiUs37CXUfcJyCiXshIsrrauHk30RIW/BVQ4hEi35a+kTdO l2oSAs81lX+dqadR0n+Z4C/N2U1LGmn8B11YbwWL1/ZSqWNqnu6Elx5VT0WsPtpoz44L hydqecePHjy+YiD5HSRTsLL4erdpIFh4RWHyI12v3JNH/vqUgJ+sUvDBT5PPFZT6DzNM zRyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature:dmarc-filter:delivered-to; bh=ZQutYBjZrMl0t1Pwc1HW6mT51dOnPqEHrafNvCrf/HU=; fh=Ogh3zaPUNpdNYHofIVNHsbX+D3lwaT1T8Jhe/MolwAA=; b=M4acur7i8AhmpiHxf6d8r/OHHeH/zGhlklGPJvWx8dAySbLIdFoqvY38cloz1LkVE/ k1W3BSIZmXiKEc4b56L9Y/cFoxfgifnWIm19eGXIIFHGb6GCVxejQ73XvZxcbRmKrxEn vsASMguy7ztv89KFKqsR+WGlhquwA5SMeAINuhuqU7aYpCI4Cs1j7qJ2bvGAsC596LaB vS+kfLAp/0tBqTxvtNYLYBSnNSI09dZszOKpQ3D8bwihBeIJfqGZBA7OfPikL9laKuil dbbjrkN3VNkNes0zOb+LDDJs3759UcpedTzf5C0K+D59fYNmfcGoW1G1naAwvUapcFFB zppQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@adacore.com header.s=google header.b=BHzHOXWx; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=adacore.com Received: from server2.sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id g24-20020aa7d1d8000000b0053624b51694si744524edp.466.2023.10.03.10.23.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 10:23:15 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@adacore.com header.s=google header.b=BHzHOXWx; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=adacore.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 80C9A3831E19 for ; Tue, 3 Oct 2023 17:20:09 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-io1-xd2b.google.com (mail-io1-xd2b.google.com [IPv6:2607:f8b0:4864:20::d2b]) by sourceware.org (Postfix) with ESMTPS id B98653858409 for ; Tue, 3 Oct 2023 17:19:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B98653858409 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com Received: by mail-io1-xd2b.google.com with SMTP id ca18e2360f4ac-79fa425855cso41731339f.2 for ; Tue, 03 Oct 2023 10:19:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1696353542; x=1696958342; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ZQutYBjZrMl0t1Pwc1HW6mT51dOnPqEHrafNvCrf/HU=; b=BHzHOXWxe5ODFqNM02IEqUD59t3V/zchc/+cB15C1DcQHsXF+qfMH29L87jI1gwAbJ 7zAtriqCE/MZRo3SfJuWzIf72W/tyg9/tm1ejFC05CtBAacekMdhVcLkFEbyXSRCtM8P IeaQ/QVs1ER48S5/saxq7oN8+uPtCt9oR/cT3Ot1tB4Dbi5STz74Qw5ooo1Kettb5ddm 6f1klpSmRHpcGff7orwWz5bXherQcMxjIVZH2+c24u6/uclaAA1gVbn4eBzOyxbGUsq/ AqBgmDuuaNJL5vgGOsoyWpHo/wKvuKs+pD7GwiXs6/bkklBjcpaX/oUyc9AAq2+SZndK nBdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696353542; x=1696958342; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ZQutYBjZrMl0t1Pwc1HW6mT51dOnPqEHrafNvCrf/HU=; b=Fq8R6tSwxHhDf86zFnRnw3GjTTlN7W0XA+QC8StDAaA6aKYgFbngF7oxF/ibCS2MN4 GWV/LzdLPvoiCmkQD/POAIxDVJ0SlKiRmwmb8ieiR+Taa9a51WdmhZISoQipgn+9ZDYW urWdgTBR6VS/4RYs6bJqDshhVDVUtcIyzejvkGzPXqlBJzLMR1ZJACeloW5dP+benvln wNLFdBptkWmzZ8YyIG2iBpNBkgdC68KfNEXEh7wn547TraLnzzfEh0VS/db9hubHteFB RELEP6pspg168ws24wxzoT9K5xTcbTW5b52esOC8bDqoxYx3IEmt+DQfuZu6YBXy3gqA ZQEg== X-Gm-Message-State: AOJu0YxmaB9zBZHnx8Tdju1tTK6zhQvOGCvhpE7N2uaLtSTFZ5ycbUgg 8fZOXWJ4Li/Ozl7gbaxCu4sHQAZgMqpfxOLDXFVcrg== X-Received: by 2002:a05:6e02:2189:b0:34f:35e8:5098 with SMTP id j9-20020a056e02218900b0034f35e85098mr88678ila.20.1696353541940; Tue, 03 Oct 2023 10:19:01 -0700 (PDT) Received: from localhost.localdomain (71-211-130-31.hlrn.qwest.net. [71.211.130.31]) by smtp.gmail.com with ESMTPSA id p7-20020a92c607000000b0035134215863sm480967ilm.55.2023.10.03.10.19.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 10:19:01 -0700 (PDT) From: Tom Tromey To: gcc-patches@gcc.gnu.org Cc: libstdc++@gcc.gnu.org, Tom Tromey Subject: [PATCH 2/2] libstdc++: _versioned_namespace is always non-None Date: Tue, 3 Oct 2023 11:18:51 -0600 Message-Id: <20231003171851.1161340-3-tromey@adacore.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231003171851.1161340-1-tromey@adacore.com> References: <20231003171851.1161340-1-tromey@adacore.com> MIME-Version: 1.0 X-Spam-Status: No, score=-11.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP 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.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778755877893433510 X-GMAIL-MSGID: 1778755877893433510 Some code in the pretty-printers seems to assume that the _versioned_namespace global might be None (or the empty string). However, doesn't occur, as the variable is never reassigned. libstdc++-v3/ChangeLog: * python/libstdcxx/v6/printers.py: Assume that _versioned_namespace is non-None. * python/libstdcxx/v6/xmethods.py (is_specialization_of): Assume that _versioned_namespace is non-None. --- libstdc++-v3/python/libstdcxx/v6/printers.py | 15 ++++++--------- libstdc++-v3/python/libstdcxx/v6/xmethods.py | 3 +-- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/libstdc++-v3/python/libstdcxx/v6/printers.py b/libstdc++-v3/python/libstdcxx/v6/printers.py index 23efbd171ec..e370551cbe1 100644 --- a/libstdc++-v3/python/libstdcxx/v6/printers.py +++ b/libstdc++-v3/python/libstdcxx/v6/printers.py @@ -139,7 +139,7 @@ def lookup_templ_spec(templ, *args): except gdb.error as e: # Type not found, try again in versioned namespace. global _versioned_namespace - if _versioned_namespace and _versioned_namespace not in templ: + if _versioned_namespace not in templ: t = t.replace('::', '::' + _versioned_namespace, 1) try: return gdb.lookup_type(t) @@ -211,16 +211,13 @@ def is_specialization_of(x, template_name): global _versioned_namespace if isinstance(x, gdb.Type): x = x.tag - if _versioned_namespace: - template_name = '(%s)?%s' % (_versioned_namespace, template_name) + template_name = '(%s)?%s' % (_versioned_namespace, template_name) return re.match('^std::%s<.*>$' % template_name, x) is not None def strip_versioned_namespace(typename): global _versioned_namespace - if _versioned_namespace: - return typename.replace(_versioned_namespace, '') - return typename + return typename.replace(_versioned_namespace, '') def strip_inline_namespaces(type_str): @@ -2355,7 +2352,7 @@ class Printer(object): # Add a name using _GLIBCXX_BEGIN_NAMESPACE_VERSION. def add_version(self, base, name, function): self.add(base + name, function) - if _versioned_namespace and '__cxx11' not in base: + if '__cxx11' not in base: vbase = re.sub('^(std|__gnu_cxx)::', r'\g<0>%s' % _versioned_namespace, base) self.add(vbase + name, function) @@ -2527,7 +2524,7 @@ def add_one_template_type_printer(obj, name, defargs): printer = TemplateTypePrinter('std::__debug::' + name, defargs) gdb.types.register_type_printer(obj, printer) - if _versioned_namespace and '__cxx11' not in name: + if '__cxx11' not in name: # Add second type printer for same type in versioned namespace: ns = 'std::' + _versioned_namespace # PR 86112 Cannot use dict comprehension here: @@ -2628,7 +2625,7 @@ class FilteringTypePrinter(object): def add_one_type_printer(obj, template, name, targ1=None): printer = FilteringTypePrinter('std::' + template, 'std::' + name, targ1) gdb.types.register_type_printer(obj, printer) - if _versioned_namespace and '__cxx11' not in template: + if '__cxx11' not in template: ns = 'std::' + _versioned_namespace printer = FilteringTypePrinter(ns + template, ns + name, targ1) gdb.types.register_type_printer(obj, printer) diff --git a/libstdc++-v3/python/libstdcxx/v6/xmethods.py b/libstdc++-v3/python/libstdcxx/v6/xmethods.py index 8ccf57c4d6b..42e60eb57b1 100644 --- a/libstdc++-v3/python/libstdcxx/v6/xmethods.py +++ b/libstdc++-v3/python/libstdcxx/v6/xmethods.py @@ -39,8 +39,7 @@ def is_specialization_of(x, template_name): """ if isinstance(x, gdb.Type): x = x.tag - if _versioned_namespace: - template_name = '(%s)?%s' % (_versioned_namespace, template_name) + template_name = '(%s)?%s' % (_versioned_namespace, template_name) return re.match(r'^std::(__\d::)?%s<.*>$' % template_name, x) is not None class LibStdCxxXMethod(gdb.xmethod.XMethod):