From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2140) id C61F7385B51D; Fri, 3 Mar 2023 19:10:35 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C61F7385B51D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1677870635; bh=jWyNt7R9bHvKByOmh1A6m7mS51RSVL5gCBeF7E4VFkU=; h=From:To:Subject:Date:From; b=ERWFnGRTT+80MjnXrZdLZ5PHYKY5q9tIZkpVDAPwMiV0J7Y+Xw9lEEPB0TmxWhOmE 2dHGH2TRcwIV8SWK7Tei6rm/ro1UaIdfp3zj+Np4/p8XPbIh4Qh6gKJpAQC6BUKN4y T3Ngovs7bFj6Y9fHftLCrJJZKN3aIupI2EPmsH8A= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Alexandre Oliva To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org Subject: [gcc r13-6462] [libstdc++] [prettyprint] add local std::string use to more tests X-Act-Checkin: gcc X-Git-Author: Alexandre Oliva X-Git-Refname: refs/heads/master X-Git-Oldrev: 21edd841611a97442a6b95e8ec7e91ff8fd3a451 X-Git-Newrev: 8be49eb927e1e65a715bc6eb73b9ce271c8b24c2 Message-Id: <20230303191035.C61F7385B51D@sourceware.org> Date: Fri, 3 Mar 2023 19:10:35 +0000 (GMT) List-Id: https://gcc.gnu.org/g:8be49eb927e1e65a715bc6eb73b9ce271c8b24c2 commit r13-6462-g8be49eb927e1e65a715bc6eb73b9ce271c8b24c2 Author: Alexandre Oliva Date: Fri Mar 3 15:59:33 2023 -0300 [libstdc++] [prettyprint] add local std::string use to more tests 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. for libstdc++-v3/ChangeLog * testsuite/libstdc++-prettyprinters/80276.cc: Add std::string to debug info. * testsuite/libstdc++-prettyprinters/libfundts.cc: Likewise. Diff: --- libstdc++-v3/testsuite/libstdc++-prettyprinters/80276.cc | 5 +++++ libstdc++-v3/testsuite/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 db4de593808..1d6b0207106 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 b1c91033cc8..29e8bc8f194 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\"" } }