From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR03-AM7-obe.outbound.protection.outlook.com (mail-am7eur03on2086.outbound.protection.outlook.com [40.107.105.86]) by sourceware.org (Postfix) with ESMTPS id 649663858CDA for ; Thu, 14 Sep 2023 19:14:31 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 649663858CDA Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=arm.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=H6a1T5MLt2aBS8fWRmYDNEDISjV+N8VuZnR72qso1os=; b=2fQ2ElGkab4ovh12ecn4K1AJDbXhXhyvD2ldj4hhRhMPqOYDY/ulHAuQE3utvUQyZMkX5T6eACeeDlDkrajM8Q3Xt4Wf9hURihPbzN4GEDBDyoeHnExU5e+fuxOyOdEXdnn7PhEiDKam3cVKMh4qoBwZeBL9eRcb30oqCw17hJ8= Received: from DU7PR01CA0031.eurprd01.prod.exchangelabs.com (2603:10a6:10:50e::10) by AS8PR08MB9528.eurprd08.prod.outlook.com (2603:10a6:20b:61c::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6768.30; Thu, 14 Sep 2023 19:14:27 +0000 Received: from DBAEUR03FT023.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:50e:cafe::1e) by DU7PR01CA0031.outlook.office365.com (2603:10a6:10:50e::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.20 via Frontend Transport; Thu, 14 Sep 2023 19:14:27 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; pr=C Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by DBAEUR03FT023.mail.protection.outlook.com (100.127.142.253) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.21 via Frontend Transport; Thu, 14 Sep 2023 19:14:27 +0000 Received: ("Tessian outbound c99fbc01d472:v175"); Thu, 14 Sep 2023 19:14:27 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 1eca104fd87c6108 X-CR-MTA-TID: 64aa7808 Received: from 6ab3981c528b.2 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 862F06A5-465A-4A6D-81C4-76335EDBF7D1.1; Thu, 14 Sep 2023 19:14:20 +0000 Received: from EUR04-HE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 6ab3981c528b.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Thu, 14 Sep 2023 19:14:20 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=f2ctjD0SckUSAa7rAKeDdX+y4hRpe5OqnU7armCiYfKox3MEyFOZfUnPGd+w3QWlsnKE72oEd9QigrMmXneEJVBh0PugIsqqOW3Vt/T4k9Aer3t7W67E2Tu7DISHKSwBIW5WR6ktkbX0g/Mz7dyfotA1ccHGKpc1R3cKb6nbnxSS/y0KQa70YbmJg8sH9GP8HtL+wi5cRwL82hbPz/0jkXRsWCtE3m7X4UAAAzbVqG0G5gM6WIwqyybQW5vzEkohuLk4utGxAEhzW8LxOtNbWPUzAr7Cl10ZHd2r+/3FveAarFUKVsocSZshR5M3AJdxe/ItcNyx7ZEo6j3cAR1yzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=H6a1T5MLt2aBS8fWRmYDNEDISjV+N8VuZnR72qso1os=; b=gMJxkcqSi0I+HvG5rA+h31Poe6rKZvC3bE6z7aZJ2t3r8vp3T7lkV6ifJOp9KOfj3jL6w2iZN1/JDS21fnWlg9GMsCQDD8PVFH9BK6VpTcpMBqz++WELyW39uRkQi3n+ujpSJr2GYRJ+lYrI3J338C7C3+u5ZJk9iV5Q24U8h8G+DiBKxOW2Xkl8iPy6mukiMC2ypn5F/TSiQEgchbeHPn2azMC8wL7hNKcK+XJk98ivmY9qQB/r2qc9FWezdJLWI5B1i8QVE1LYvmSDNS6VTKfEYJR3rox2FNgSRbcTwvc2uUhC7nkC94FgoJAWQixdprPxaomkSLhha81ZLg2zXg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=H6a1T5MLt2aBS8fWRmYDNEDISjV+N8VuZnR72qso1os=; b=2fQ2ElGkab4ovh12ecn4K1AJDbXhXhyvD2ldj4hhRhMPqOYDY/ulHAuQE3utvUQyZMkX5T6eACeeDlDkrajM8Q3Xt4Wf9hURihPbzN4GEDBDyoeHnExU5e+fuxOyOdEXdnn7PhEiDKam3cVKMh4qoBwZeBL9eRcb30oqCw17hJ8= Received: from DB9PR08MB6474.eurprd08.prod.outlook.com (2603:10a6:10:255::17) by VI1PR08MB10241.eurprd08.prod.outlook.com (2603:10a6:800:1be::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.19; Thu, 14 Sep 2023 19:14:17 +0000 Received: from DB9PR08MB6474.eurprd08.prod.outlook.com ([fe80::1e3e:abb0:9157:6fb9]) by DB9PR08MB6474.eurprd08.prod.outlook.com ([fe80::1e3e:abb0:9157:6fb9%3]) with mapi id 15.20.6792.020; Thu, 14 Sep 2023 19:14:17 +0000 From: Vaseeharan Vinayagamoorthy To: Tom Tromey , Simon Marchi CC: "gdb-patches@sourceware.org" , Vaseeharan Vinayagamoorthy Subject: Re: [PATCH] Specialize std::hash for ptid_t Thread-Topic: [PATCH] Specialize std::hash for ptid_t Thread-Index: AQHZ5L7ujinWup2eiEKyFAiskkFixbAVvs6AgAATtKKAAArAgIAE1W1c Date: Thu, 14 Sep 2023 19:14:17 +0000 Message-ID: References: <20230911144718.3425981-1-tromey@adacore.com> <99e5e4c7-9530-4eaa-8062-c13abb66b7b2@polymtl.ca> <878r9cllbs.fsf@tromey.com> <8d359fca-6e2a-406e-a99a-d9623cbd37be@polymtl.ca> In-Reply-To: <8d359fca-6e2a-406e-a99a-d9623cbd37be@polymtl.ca> Accept-Language: en-GB, en-US Content-Language: en-GB X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: Authentication-Results-Original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; x-ms-traffictypediagnostic: DB9PR08MB6474:EE_|VI1PR08MB10241:EE_|DBAEUR03FT023:EE_|AS8PR08MB9528:EE_ X-MS-Office365-Filtering-Correlation-Id: fabb765b-def9-4524-2f57-08dbb556d0b4 x-checkrecipientrouted: true nodisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: aEmfiA9z/xW7ppp3og1syxahadPhuRtoz4QUQIftqrNUp/TbOcpT1edL0KJRKlbd+032GsbspgCcKpcI2JSOLHeSZ9pVycjSwSReXzfEIFOvitUSqKJm+131V7M6yoR+1f/2cdg7ontxhHnoM3q8JAegmE2MgN/ph0hJadqMZCFeNHZjGnB0sTNqgNPGHQ0hqvym5EnL4B4CZRfoYxHuaHP3fXqcmOZRM6/O7/ZxaU3SIk2atEQWheewubD+QjHwO4Lvr6hX6zAfohZPJKJlIUeJNrDwx2AZCSV/25kcVPzEOs5TXATqVkk9d1+HiUevfIgOA6Ul280UMWr0eoQ7wmGpxP7qagqbrSn8kzuiBjAnqHMYRKWBAb8PA75uWNq+RzTjYr6dDCD85ZeY29QMbginXTHrvxTOCWGgX+SM0RjD8dWM1gWF054dvPYT73y1ZxVMbpQeYXtSHex7E/RnUYGzrtyIZjqh9Dtkp1gnFSGxkx4WlM5z4U5Vhp3bXBomQ7jcWyzY5xfwN4iUDeMUkDJfUIdc7hkJh/TQFjTfF/g+RfhaR9byNFfqsQUkBAiqCKaPK5ow+LjLww/WD6HqWaSsjhZFWtkW4AO7F22VV4AOnwBcMncE8SSAV/MAn5R4 X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DB9PR08MB6474.eurprd08.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(376002)(366004)(346002)(396003)(39860400002)(136003)(451199024)(1800799009)(186009)(19627405001)(71200400001)(6506007)(53546011)(66946007)(5660300002)(2906002)(64756008)(8936002)(316002)(55016003)(4326008)(54906003)(8676002)(52536014)(66476007)(66446008)(33656002)(38100700002)(66556008)(41300700001)(9686003)(110136005)(7696005)(38070700005)(26005)(76116006)(122000001)(91956017)(86362001)(83380400001)(478600001);DIR:OUT;SFP:1101; Content-Type: multipart/alternative; boundary="_000_DB9PR08MB6474C569B8D5FEADF717E01481F7ADB9PR08MB6474eurp_" MIME-Version: 1.0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB10241 Original-Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DBAEUR03FT023.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 8e9f79f9-39fb-4ec2-1d2f-08dbb556ca88 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: pNt8GjMcrZ3agp7pDY8O3RkfkeRgQhBG2ZE80xemYDgH6/2iTwMAOav21XISmeSFR2PjAz3I9AO5u0VUCg4w3HJOtEN88W4zd9roV2N4oJc8PqB/9OC6HWfEp0T9/LYIiyITJjlPnumwyBS3cqqV967Pist6uuAf6WAbO8rsR7qGkYun0GtTElkm3iN0t4hXZTiwnFnpim1IGkev/DnXSHTQHuJ3MZ5gdtWZxaK49+o6h4Hc5Rx2CobZ+IULC6Vl3kOPVuHAd2xdgqPb45uhO4LsIjW55WoPcyQF10TTkcwaMdpa0y23w7OIOkILwqcurHgktuiDSfz4scZfHpoGZ17IBOp4HTQLya26TIrIhuODJjJhgowrn+iuG26Rn9maRmYEIbQ76jK/CgWFygEQZ9oE2/L5nQuvVWAeGnkLxvgBdO++JNQeb2G3J+PcUjOjGd9ziWvHbZdWNYEjeM4TLgEz2gvwCvfWTdw9lqD5qorZu+dX3vZZ+q3gi63vq9DzR5UC+wk6e68qhsUpPx/BfU9YkWwofkHJMQWJWrMF22SffoIRgi9L4fx6YU8IQsnJGmf+PfT5GvA0cZ17kiWU3ye8TFqg1ebKyXz9m/O97NE+Z1B25ysxupcYWiy7mZIrfJC681BSE5ajKTg7cmzZFe2d9O+fCzEn9RI4Jvwwd+tDUgTc883oC6dyr5/VjwWNKtO4i8+AA0MSXF0TlUW4ESU1+Yp3bJNOVQ8tiqj+qgI= X-Forefront-Antispam-Report: CIP:63.35.35.123;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:64aa7808-outbound-1.mta.getcheckrecipient.com;PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com;CAT:NONE;SFS:(13230031)(4636009)(376002)(39860400002)(346002)(396003)(136003)(1800799009)(451199024)(82310400011)(186009)(40470700004)(36840700001)(46966006)(110136005)(53546011)(86362001)(6506007)(7696005)(40460700003)(41300700001)(316002)(356005)(40480700001)(82740400003)(81166007)(54906003)(70586007)(70206006)(55016003)(8936002)(8676002)(4326008)(33656002)(2906002)(478600001)(336012)(83380400001)(19627405001)(5660300002)(9686003)(52536014)(26005)(47076005)(36860700001);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Sep 2023 19:14:27.6185 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: fabb765b-def9-4524-2f57-08dbb556d0b4 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d;Ip=[63.35.35.123];Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: DBAEUR03FT023.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB9528 X-Spam-Status: No, score=-12.0 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,FORGED_SPF_HELO,GIT_PATCH_0,HTML_MESSAGE,KAM_DMARC_NONE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE,TXREP,UNPARSEABLE_RELAY 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: --_000_DB9PR08MB6474C569B8D5FEADF717E01481F7ADB9PR08MB6474eurp_ Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable Hello, I think that after this patch is when I am seeing these errors when buildin= g cross toolchains, for arm-none-eabi and aarch64-none-elf, using gcc 4.8. The errors are: In file included from /=85/src/binutils-gdb--gdb/gdbsupport/common-defs.h:2= 06:0, from /=85/src/binutils-gdb--gdb/gdbsupport/common-exceptio= ns.cc:20: /=85/src/binutils-gdb--gdb/gdbsupport/ptid.h:161:13: error: specialization = of =91template struct std::hash=92 in different namespace [-fper= missive] struct std::hash ^ Kind regards, Vasee ________________________________ From: Gdb-patches o= n behalf of Simon Marchi via Gdb-patches Sent: 11 September 2023 18:14 To: Tom Tromey Cc: gdb-patches@sourceware.org Subject: Re: [PATCH] Specialize std::hash for ptid_t On 9/11/23 12:35, Tom Tromey wrote: >>>>>> "Simon" =3D=3D Simon Marchi writes: > > Simon> When searching on that topic, I found some sources advising against > Simon> opening namespace std, like this one: > ... > > Sounds good, here's v2. > > Tom > > commit 1d5a09c85bf97846438246397aaf4aae360c3783 > Author: Tom Tromey > Date: Mon Sep 11 08:45:37 2023 -0600 > > Specialize std::hash for ptid_t > > This changes hash_ptid to instead be a specialization of std::hash. > This makes it a little easier to use with standard containers. > > diff --git a/gdb/inferior.h b/gdb/inferior.h > index 04672582984..29c90d15efa 100644 > --- a/gdb/inferior.h > +++ b/gdb/inferior.h > @@ -462,7 +462,7 @@ class inferior : public refcounted_object, > > /* A map of ptid_t to thread_info*, for average O(1) ptid_t lookup. > Exited threads do not appear in the map. */ > - std::unordered_map ptid_thread_map; > + std::unordered_map ptid_thread_map; > > /* Returns a range adapter covering the inferior's threads, > including exited threads. Used like this: > diff --git a/gdb/regcache.c b/gdb/regcache.c > index 9b71931bb0b..91b20b7a2a2 100644 > --- a/gdb/regcache.c > +++ b/gdb/regcache.c > @@ -329,7 +329,7 @@ reg_buffer::assert_regnum (int regnum) const > regcaches, associated to different gdbarches). */ > > using ptid_regcache_map > - =3D std::unordered_multimap; > + =3D std::unordered_multimap; > > /* Type holding regcaches for a given pid. */ > > diff --git a/gdbsupport/ptid.h b/gdbsupport/ptid.h > index aa296b83181..f8644d47633 100644 > --- a/gdbsupport/ptid.h > +++ b/gdbsupport/ptid.h > @@ -157,9 +157,8 @@ class ptid_t > tid_type m_tid; > }; > > -/* Functor to hash a ptid. */ > - > -struct hash_ptid > +template<> > +struct std::hash > { > size_t operator() (const ptid_t &ptid) const > { LGTM, thanks. Approved-By: Simon Marchi Simon --_000_DB9PR08MB6474C569B8D5FEADF717E01481F7ADB9PR08MB6474eurp_--