From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29693 invoked by alias); 4 Feb 2011 15:58:07 -0000 Received: (qmail 29681 invoked by uid 22791); 4 Feb 2011 15:58:05 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00,TW_EG,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (38.113.113.100) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 04 Feb 2011 15:58:01 +0000 Received: (qmail 27962 invoked from network); 4 Feb 2011 15:57:59 -0000 Received: from unknown (HELO scottsdale.localnet) (pedro@127.0.0.2) by mail.codesourcery.com with ESMTPA; 4 Feb 2011 15:57:59 -0000 From: Pedro Alves To: gdb-patches@sourceware.org Subject: Re: performance of multithreading gets gradually worse under gdb Date: Fri, 04 Feb 2011 15:58:00 -0000 User-Agent: KMail/1.13.5 (Linux/2.6.35-25-generic; KDE/4.5.1; x86_64; ; ) References: <201102032140.p13Le89f031563@d06av02.portsmouth.uk.ibm.com> <201102041555.52179.pedro@codesourcery.com> In-Reply-To: <201102041555.52179.pedro@codesourcery.com> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201102041557.58160.pedro@codesourcery.com> X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2011-02/txt/msg00062.txt.bz2 On Friday 04 February 2011 15:55:51, Pedro Alves wrote: > [Adding gdb-patches@] ... > Okay, thanks, I've applied it. "it" being... -- Pedro Alves 2011-02-04 Pedro Alves gdb/ * regcache.c (registers_changed_ptid): Don't explictly always clear `current_regcache'. Only clear current_thread_ptid and current_thread_arch when PTID matches. Only reinit the frame cache if PTID matches the current inferior_ptid. Move alloca(0) call to ... (registers_changed): ... here. --- gdb/regcache.c | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) Index: src/gdb/regcache.c =================================================================== --- src.orig/gdb/regcache.c 2011-02-01 15:27:37.000000000 +0000 +++ src/gdb/regcache.c 2011-02-04 11:56:49.273328004 +0000 @@ -530,6 +530,7 @@ void registers_changed_ptid (ptid_t ptid) { struct regcache_list *list, **list_link; + int wildcard = ptid_equal (ptid, minus_one_ptid); list = current_regcache; list_link = ¤t_regcache; @@ -550,13 +551,24 @@ registers_changed_ptid (ptid_t ptid) list = *list_link; } - current_regcache = NULL; + if (wildcard || ptid_equal (ptid, current_thread_ptid)) + { + current_thread_ptid = null_ptid; + current_thread_arch = NULL; + } - current_thread_ptid = null_ptid; - current_thread_arch = NULL; + if (wildcard || ptid_equal (ptid, inferior_ptid)) + { + /* We just deleted the regcache of the current thread. Need to + forget about any frames we have cached, too. */ + reinit_frame_cache (); + } +} - /* Need to forget about any frames we have cached, too. */ - reinit_frame_cache (); +void +registers_changed (void) +{ + registers_changed_ptid (minus_one_ptid); /* Force cleanup of any alloca areas if using C alloca instead of a builtin alloca. This particular call is used to clean up @@ -567,12 +579,6 @@ registers_changed_ptid (ptid_t ptid) } void -registers_changed (void) -{ - registers_changed_ptid (minus_one_ptid); -} - -void regcache_raw_read (struct regcache *regcache, int regnum, gdb_byte *buf) { gdb_assert (regcache != NULL && buf != NULL);