From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gateway31.websitewelcome.com (gateway31.websitewelcome.com [192.185.144.97]) by sourceware.org (Postfix) with ESMTPS id BA5FC3857C40 for ; Wed, 12 Aug 2020 15:17:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org BA5FC3857C40 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=tromey.com Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=tom@tromey.com Received: from cm11.websitewelcome.com (cm11.websitewelcome.com [100.42.49.5]) by gateway31.websitewelcome.com (Postfix) with ESMTP id 3D68C35BAC for ; Wed, 12 Aug 2020 10:17:19 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id 5sVDkh7IOOIGp5sVDkOqel; Wed, 12 Aug 2020 10:17:19 -0500 X-Authority-Reason: nr=8 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=yMnEVXnWLugxKVBBto9tW568il1YIDxanRK/vquXC+Y=; b=UWU9LcQ0OzzVi19pRLubxptuVs JcCjLKJRLaN8wVDOonlrIDyiqHIH8Z4fO7ii7JQgawq1ZNnf+gAgzmeALnAsspNGe3uDTTKre2Tq6 ryOW6QvfrktH2GwkUuQUNGYrY; Received: from 75-166-101-103.hlrn.qwest.net ([75.166.101.103]:54302 helo=murgatroyd) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1k5sVC-0042yk-RW; Wed, 12 Aug 2020 09:17:18 -0600 From: Tom Tromey To: Tom Tromey Cc: Simon Marchi via Gdb-patches , Simon Marchi , Morichetti@sourceware.org, Laurent Subject: Re: [PATCH 4/4] gdb: change regcache list to be a map References: <20200720204101.2849535-1-simon.marchi@efficios.com> <20200720204101.2849535-5-simon.marchi@efficios.com> <87tux8hvr1.fsf@tromey.com> X-Attribution: Tom Date: Wed, 12 Aug 2020 09:17:17 -0600 In-Reply-To: <87tux8hvr1.fsf@tromey.com> (Tom Tromey's message of "Wed, 12 Aug 2020 06:52:18 -0600") Message-ID: <875z9nj3lu.fsf@tromey.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box5379.bluehost.com X-AntiAbuse: Original Domain - sourceware.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tromey.com X-BWhitelist: no X-Source-IP: 75.166.101.103 X-Source-L: No X-Exim-ID: 1k5sVC-0042yk-RW X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 75-166-101-103.hlrn.qwest.net (murgatroyd) [75.166.101.103]:54302 X-Source-Auth: tom+tromey.com X-Email-Count: 1 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-Spam-Status: No, score=-3033.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, JMQ_SPF_NEUTRAL, RCVD_IN_ABUSEAT, RCVD_IN_BL_SPAMCOP_NET, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_NEUTRAL, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org 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: , X-List-Received-Date: Wed, 12 Aug 2020 15:17:21 -0000 Tom> A simple fix would be to fall back to iterating over the map in the Tom> is_pid case. I don't know whether this would reintroduce the Tom> performance issue that prompted the patch, though. FWIW this worked for my test case. I also have some ravenscar-thread changes, though I'm not sure yet if those are really needed. Tom diff --git a/gdb/regcache.c b/gdb/regcache.c index cd54bc6b5f9..d409b8c2f25 100644 --- a/gdb/regcache.c +++ b/gdb/regcache.c @@ -486,7 +486,15 @@ registers_changed_ptid (process_stratum_target *target, ptid_t ptid) if (ptid_regc_map_it != regcaches.end ()) { auto &ptid_regc_map = ptid_regc_map_it->second; - ptid_regc_map.erase (ptid); + + auto last = ptid_regc_map.end (); + for (auto i = ptid_regc_map.begin (); i != last; ) + { + if (i->first.matches (ptid)) + i = ptid_regc_map.erase (i); + else + ++i; + } } } else