From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2835 invoked by alias); 12 Jun 2007 14:10:26 -0000 Received: (qmail 2825 invoked by uid 22791); 12 Jun 2007 14:10:25 -0000 X-Spam-Check-By: sourceware.org Received: from NaN.false.org (HELO nan.false.org) (208.75.86.248) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 12 Jun 2007 14:10:23 +0000 Received: from nan.false.org (localhost [127.0.0.1]) by nan.false.org (Postfix) with ESMTP id 6063E982DE; Tue, 12 Jun 2007 14:10:21 +0000 (GMT) Received: from caradoc.them.org (22.svnf5.xdsl.nauticom.net [209.195.183.55]) by nan.false.org (Postfix) with ESMTP id 19D36982DC; Tue, 12 Jun 2007 14:10:20 +0000 (GMT) Received: from drow by caradoc.them.org with local (Exim 4.67) (envelope-from ) id 1Hy74t-00040k-Ek; Tue, 12 Jun 2007 10:10:35 -0400 Date: Tue, 12 Jun 2007 14:10:00 -0000 From: Daniel Jacobowitz To: Ulrich Weigand Cc: gdb-patches@sourceware.org Subject: Re: [rfc] Eliminate current_regcache global variable Message-ID: <20070612141035.GF7815@caradoc.them.org> Mail-Followup-To: Ulrich Weigand , gdb-patches@sourceware.org References: <200706072119.l57LJJ3j030038@d12av02.megacenter.de.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200706072119.l57LJJ3j030038@d12av02.megacenter.de.ibm.com> User-Agent: Mutt/1.5.15 (2007-04-09) 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: 2007-06/txt/msg00160.txt.bz2 On Thu, Jun 07, 2007 at 11:19:19PM +0200, Ulrich Weigand wrote: > Hello, > > as a follow-on to the patch set eliminating read_register, this patch > gets rid of the global current_regcache variable, and makes a first step > into the direction of real per-thread register caches. The idea sounds fine. I just looked at the Linux bits. > diff -urNp gdb-orig/gdb/linux-nat.c gdb-head/gdb/linux-nat.c > --- gdb-orig/gdb/linux-nat.c 2007-06-01 18:51:01.000000000 +0200 > +++ gdb-head/gdb/linux-nat.c 2007-06-06 19:49:08.553079253 +0200 > @@ -2580,19 +2580,26 @@ linux_nat_do_thread_registers (bfd *obfd > gdb_fpxregset_t fpxregs; > #endif > unsigned long lwp = ptid_get_lwp (ptid); > - struct gdbarch *gdbarch = current_gdbarch; > + struct regcache *regcache = get_thread_regcache (ptid); > + struct gdbarch *gdbarch = get_regcache_arch (regcache); > const struct regset *regset; > int core_regset_p; > + ptid_t saved_ptid; > + > + saved_ptid = inferior_ptid; > + inferior_ptid = ptid; > + target_fetch_registers (regcache, -1); > + inferior_ptid = saved_ptid; Shouldn't we use a cleanup for this? > @@ -2672,15 +2670,11 @@ static char * > linux_nat_do_registers (bfd *obfd, ptid_t ptid, > char *note_data, int *note_size) > { > - registers_changed (); > - /* FIXME should not be necessary; fill_gregset should do it automatically. */ > - target_fetch_registers (current_regcache, -1); > return linux_nat_do_thread_registers (obfd, > ptid_build (ptid_get_pid (inferior_ptid), > ptid_get_pid (inferior_ptid), > 0), > note_data, note_size); > - return note_data; > } Why'd the return value go? -- Daniel Jacobowitz CodeSourcery