Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Ulrich Weigand" <uweigand@de.ibm.com>
To: pedro@codesourcery.com (Pedro Alves)
Cc: gdb-patches@sourceware.org
Subject: [patch] Multi-architecture debugging regression (Re: performance of multithreading gets gradually worse under gdb)
Date: Wed, 26 Oct 2011 17:20:00 -0000	[thread overview]
Message-ID: <201110261714.p9QHEBT8020920@d06av02.portsmouth.uk.ibm.com> (raw)
In-Reply-To: <201102041557.58160.pedro@codesourcery.com> from "Pedro Alves" at Feb 04, 2011 03:57:57 PM

Pedro Alves wrote:

> 2011-02-04  Pedro Alves  <pedro@codesourcery.com>
> 
> 	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 = &current_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


  reply	other threads:[~2011-10-26 17:14 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <201102032140.p13Le89f031563@d06av02.portsmouth.uk.ibm.com>
     [not found] ` <201102041455.20607.pedro@codesourcery.com>
     [not found]   ` <m34o8jddod.fsf@fleche.redhat.com>
2011-02-04 15:56     ` performance of multithreading gets gradually worse under gdb Pedro Alves
2011-02-04 15:58       ` Pedro Alves
2011-10-26 17:20         ` Ulrich Weigand [this message]
2011-10-26 17:25           ` [patch] Multi-architecture debugging regression (Re: performance of multithreading gets gradually worse under gdb) Pedro Alves
2011-10-26 18:14             ` Ulrich Weigand
     [not found]     ` <201102041555.52179.pedro__21913.9744448059$1296834976$gmane$org@codesourcery.com>
2011-02-04 17:02       ` performance of multithreading gets gradually worse under gdb Tom Tromey
2011-02-05  9:34         ` Markus Alber
2011-02-07 14:05         ` Markus Alber

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201110261714.p9QHEBT8020920@d06av02.portsmouth.uk.ibm.com \
    --to=uweigand@de.ibm.com \
    --cc=gdb-patches@sourceware.org \
    --cc=pedro@codesourcery.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox