From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from rock.gnat.com (rock.gnat.com [IPv6:2620:20:4000:0:a9e:1ff:fe9b:1d1]) by sourceware.org (Postfix) with ESMTPS id 1B6773858D37; Fri, 3 Mar 2023 17:50:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 1B6773858D37 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: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id DB60111659D; Fri, 3 Mar 2023 12:50:14 -0500 (EST) X-Virus-Scanned: Debian amavisd-new at gnat.com Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id x1p+9BsmESJ6; Fri, 3 Mar 2023 12:50:14 -0500 (EST) Received: from free.home (tron.gnat.com [IPv6:2620:20:4000:0:46a8:42ff:fe0e:e294]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by rock.gnat.com (Postfix) with ESMTPS id A14A0116598; Fri, 3 Mar 2023 12:50:14 -0500 (EST) Received: from livre (livre.home [172.31.160.2]) by free.home (8.15.2/8.15.2) with ESMTPS id 323Ho74a606305 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Fri, 3 Mar 2023 14:50:07 -0300 From: Alexandre Oliva To: gcc-patches@gcc.gnu.org, libstdc++@gcc.gnu.org Cc: tromey@adacore.com Subject: [PATCH] [libstdc++] [prettyprint] add local std::string use to more tests Organization: Free thinker, does not speak for AdaCore Errors-To: aoliva@lxoliva.fsfla.org Date: Fri, 03 Mar 2023 14:50:07 -0300 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Scanned-By: MIMEDefang 2.84 X-Spam-Status: No, score=-12.3 required=5.0 tests=BAYES_00,GIT_PATCH_0,KAM_DMARC_STATUS,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 List-Id: We're getting regressions after ugprading to GDB 13 in a few of the libstdc++ pretty-printing tests. It might seem like a GDB regression, but that update has a new symbol reader, and Tom Tromey says it exposes a latent problem in the pretty-printer, namely, when a name is not defined locally in the local translation unit, GDB will look for it in other units, and if multiple different definitions are available, there are no guarantees as to which one it will find. Since libstdc++ contains units in which std::string maps to different types, in order to ensure the tests get the std::string definition we expect, we need std::string to be present in the debug information for the test itself, as we already do in other tests. Regstrapped on x86_64-linux-gnu. Ok to install? for libstdc++-v3/ChangeLog * testsuite/libstdc++-pretty-printers/80276.cc: Add std::string to debug info. * testsuite/libstdc++-pretty-printers/libfundts.cc: Likewise. Change-Id: I928617d44679c63d634c26f6db17d7580a9bcd8f TN: W223-034 --- .../testsuite/libstdc++-prettyprinters/80276.cc | 5 +++++ .../libstdc++-prettyprinters/libfundts.cc | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/libstdc++-v3/testsuite/libstdc++-prettyprinters/80276.cc b/libstdc++-v3/testsuite/libstdc++-prettyprinters/80276.cc index db4de593808e3..1d6b0207106a6 100644 --- a/libstdc++-v3/testsuite/libstdc++-prettyprinters/80276.cc +++ b/libstdc++-v3/testsuite/libstdc++-prettyprinters/80276.cc @@ -36,6 +36,11 @@ int main() { using namespace std; + // Ensure debug info for std::string is issued in the local + // translation unit, so that GDB won't pick up any alternate + // std::string notion that might be present in libstdc++.so. + string bah = "hi"; + (void)bah; unique_ptr*>>> p1; unique_ptr*>>[]> p2; unique_ptr*>>[10]> p3; diff --git a/libstdc++-v3/testsuite/libstdc++-prettyprinters/libfundts.cc b/libstdc++-v3/testsuite/libstdc++-prettyprinters/libfundts.cc index b1c91033cc8e6..29e8bc8f194e3 100644 --- a/libstdc++-v3/testsuite/libstdc++-prettyprinters/libfundts.cc +++ b/libstdc++-v3/testsuite/libstdc++-prettyprinters/libfundts.cc @@ -32,6 +32,12 @@ using std::experimental::string_view; int main() { + // Ensure debug info for std::string is issued in the local + // translation unit, so that GDB won't pick up any alternate + // std::string notion that might be present in libstdc++.so. + std::string bah = "hi"; + (void)bah; + string_view str = "string"; // { dg-final { note-test str "\"string\"" } } -- Alexandre Oliva, happy hacker https://FSFLA.org/blogs/lxo/ Free Software Activist GNU Toolchain Engineer Disinformation flourishes because many people care deeply about injustice but very few check the facts. Ask me about