From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id ueMYJIvzfGKu2gUAWB0awg (envelope-from ) for ; Thu, 12 May 2022 07:46:19 -0400 Received: by simark.ca (Postfix, from userid 112) id 86A691E220; Thu, 12 May 2022 07:46:19 -0400 (EDT) Authentication-Results: simark.ca; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=G6TBc38o; dkim-atps=neutral X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RDNS_DYNAMIC,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 02D0E1E01D for ; Thu, 12 May 2022 07:46:19 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C7FBD3846409 for ; Thu, 12 May 2022 11:46:17 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C7FBD3846409 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1652355977; bh=kkYaQLZeh63mGPC4RkWJYE6zcnEfvYmR17nrdhmFyAw=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=G6TBc38o8AJgoisEE+3R7YvnmT2Fx9s7tlLLQHqEK9PsSMteF6oZFMrQgpD7FAONr KYayYvSXo3nvYRQ6AZV0XHhK7ZQJjsGl2CtOcy3GdFZEn9sbu7VyjZenamj593OfbB zweFl33Oqtq0gscfcthDlp3GcRSMJQUf0IqBUIrA= Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by sourceware.org (Postfix) with ESMTPS id 458D53843884 for ; Thu, 12 May 2022 11:45:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 458D53843884 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 793301F88F; Thu, 12 May 2022 11:45:58 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 56BFA13A84; Thu, 12 May 2022 11:45:58 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 5NIgFHbzfGJffAAAMHmgww (envelope-from ); Thu, 12 May 2022 11:45:58 +0000 Date: Thu, 12 May 2022 13:45:56 +0200 To: gdb-patches@sourceware.org Subject: [PATCH][gdb/testsuite] Fix gdb.cp/break-f-std-string.cc with older gcc Message-ID: <20220512114555.GA21719@delia> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Tom de Vries via Gdb-patches Reply-To: Tom de Vries Cc: Pedro Alves Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" Hi, When running test-case gdb.cp/break-f-std-string.exp on openSUSE Leap 15.3 with system gcc 7.5.0, I run into: ... (gdb) whatis /r std::string^M No symbol "string" in namespace "std".^M (gdb) FAIL: gdb.cp/break-f-std-string.exp: _GLIBCXX_USE_CXX11_ABI=1: \ whatis /r std::string ... The same for gcc 8.2.1, but it passes with gcc 9.3.1. At source level (as we can observe in the .ii file with -save-temps) we have indeed: ... namespace std { namespace __cxx11 { typedef basic_string string; } } ... while with gcc 9.3.1, we have instead: ... namespace std { namespace __cxx11 { ... } typedef basic_string string; } ... due to gcc commit 33b43b0d8cd ("Define std::string and related typedefs outside __cxx11 namespace"). Fix this by adding the missing typedef for gcc version 5 (the first version to have the dual abi) to 8 (the last version missing aforementioned gcc commit). Tested on x86_64-linux, with: - system gcc 7.5.0 - gcc 4.8.5, 8.2.1, 9.3.1, 10.3.0, 11.2.1 - clang 8.0.1, 12.0.1 Any comments? Thanks, - Tom [gdb/testsuite] Fix gdb.cp/break-f-std-string.cc with older gcc --- gdb/testsuite/gdb.cp/break-f-std-string.cc | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/gdb/testsuite/gdb.cp/break-f-std-string.cc b/gdb/testsuite/gdb.cp/break-f-std-string.cc index 454ab4c42ea..cbbfeebac60 100644 --- a/gdb/testsuite/gdb.cp/break-f-std-string.cc +++ b/gdb/testsuite/gdb.cp/break-f-std-string.cc @@ -17,6 +17,20 @@ #include +#if _GLIBCXX_USE_CXX11_ABI == 1 +#if defined (__GNUC__) && (__GNUC__ >= 5) && (__GNUC__ <= 8) + +// Work around missing std::string typedef before gcc commit +// "Define std::string and related typedefs outside __cxx11 namespace". + +namespace std { +using namespace __cxx11; +typedef __cxx11::string string; +} + +#endif +#endif + void f (std::string s) {