This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [rfc] Eliminate current_regcache global variable


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]