From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22763 invoked by alias); 26 Oct 2011 17:14:35 -0000 Received: (qmail 22751 invoked by uid 22791); 26 Oct 2011 17:14:33 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00,MSGID_FROM_MTA_HEADER,RP_MATCHES_RCVD,TW_EG X-Spam-Check-By: sourceware.org Received: from mtagate3.uk.ibm.com (HELO mtagate3.uk.ibm.com) (194.196.100.163) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 26 Oct 2011 17:14:15 +0000 Received: from d06nrmr1806.portsmouth.uk.ibm.com (d06nrmr1806.portsmouth.uk.ibm.com [9.149.39.193]) by mtagate3.uk.ibm.com (8.13.1/8.13.1) with ESMTP id p9QHEDIa017877 for ; Wed, 26 Oct 2011 17:14:13 GMT Received: from d06av02.portsmouth.uk.ibm.com (d06av02.portsmouth.uk.ibm.com [9.149.37.228]) by d06nrmr1806.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p9QHEDkQ2572352 for ; Wed, 26 Oct 2011 18:14:13 +0100 Received: from d06av02.portsmouth.uk.ibm.com (loopback [127.0.0.1]) by d06av02.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p9QHECGX020946 for ; Wed, 26 Oct 2011 11:14:13 -0600 Received: from tuxmaker.boeblingen.de.ibm.com (tuxmaker.boeblingen.de.ibm.com [9.152.85.9]) by d06av02.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with SMTP id p9QHEBT8020920; Wed, 26 Oct 2011 11:14:11 -0600 Message-Id: <201110261714.p9QHEBT8020920@d06av02.portsmouth.uk.ibm.com> Received: by tuxmaker.boeblingen.de.ibm.com (sSMTP sendmail emulation); Wed, 26 Oct 2011 19:14:11 +0200 Subject: [patch] Multi-architecture debugging regression (Re: performance of multithreading gets gradually worse under gdb) To: pedro@codesourcery.com (Pedro Alves) Date: Wed, 26 Oct 2011 17:20:00 -0000 From: "Ulrich Weigand" Cc: gdb-patches@sourceware.org In-Reply-To: <201102041557.58160.pedro@codesourcery.com> from "Pedro Alves" at Feb 04, 2011 03:57:57 PM MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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-10/txt/msg00698.txt.bz2 Pedro Alves wrote: > 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. It seems this patch broke multi-architecture debugging on Cell/B.E. since the cached thread architecture is sometimes not invalidated when it should be. This happens when resume is called with a PTID that refers to all threads of a process. The problem is that your patch specifically handles PTIDs that refer to one particular thread, and also handles a wildcard PTID that refers to all threads of all processes. But it does not handle PTIDs that refer to all threads of one single process. I think the code should simply use ptid_match here (as is already done elsewhere, even in this same function). This fixes the problem on Cell/B.E. for me ... Tested on powerpc-linux (Cell/B.E.). Does this look OK to you? Bye, Ulrich ChangeLog: * regcache.c (registers_changed_ptid): Invalidate thread architecture and frame caches if PTID refers to all threads of a process. Index: gdb/regcache.c =================================================================== RCS file: /cvs/src/src/gdb/regcache.c,v retrieving revision 1.194 diff -u -p -r1.194 regcache.c --- gdb/regcache.c 11 Oct 2011 18:35:25 -0000 1.194 +++ gdb/regcache.c 24 Oct 2011 11:02:46 -0000 @@ -548,7 +548,6 @@ 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; @@ -569,13 +568,13 @@ registers_changed_ptid (ptid_t ptid) list = *list_link; } - if (wildcard || ptid_equal (ptid, current_thread_ptid)) + if (ptid_match (current_thread_ptid, ptid)) { current_thread_ptid = null_ptid; current_thread_arch = NULL; } - if (wildcard || ptid_equal (ptid, inferior_ptid)) + if (ptid_match (inferior_ptid, ptid)) { /* We just deleted the regcache of the current thread. Need to forget about any frames we have cached, too. */ -- Dr. Ulrich Weigand GNU Toolchain for Linux on System z and Cell BE Ulrich.Weigand@de.ibm.com