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]

[rfc] [02/05] Get rid of current_gdbarch in hppa-linux-nat.c


Hi,

this patch adds gdbarch as a parameter to hppa_linux_register_addr.

Tested with gdb_mbuild. Ok to commit ?

ChangeLog:

	* hppa-linux-nat.c (hppa_linux_register_addr): Add gdbarch as parameter.
	Replace current_gdbarch by gdbarch.
	(fetch_register, store_register): Update caller of
	hppa_linux_register_addr.


-- Markus Deuling GNU Toolchain for Linux on Cell BE deuling@de.ibm.com



diff -urpN src/gdb/hppa-linux-nat.c dev/gdb/hppa-linux-nat.c
--- src/gdb/hppa-linux-nat.c	2007-10-08 14:50:56.000000000 +0200
+++ dev/gdb/hppa-linux-nat.c	2007-11-07 09:00:34.000000000 +0100
@@ -152,11 +152,12 @@ static const int u_offsets[] =
   };
 
 static CORE_ADDR
-hppa_linux_register_addr (int regno, CORE_ADDR blockend)
+hppa_linux_register_addr (struct gdbarch *gdbarch, int regno,
+			  CORE_ADDR blockend)
 {
   CORE_ADDR addr;
 
-  if ((unsigned) regno >= gdbarch_num_regs (current_gdbarch))
+  if ((unsigned) regno >= gdbarch_num_regs (gdbarch))
     error (_("Invalid register number %d."), regno);
 
   if (u_offsets[regno] == -1)
@@ -232,7 +233,8 @@ fetch_register (struct regcache *regcach
     tid = PIDGET (inferior_ptid); /* Not a threaded program.  */
 
   errno = 0;
-  val = ptrace (PTRACE_PEEKUSER, tid, hppa_linux_register_addr (regno, 0), 0);
+  val = ptrace (PTRACE_PEEKUSER, tid,
+		hppa_linux_register_addr (gdbarch, regno, 0), 0);
   if (errno != 0)
     error (_("Couldn't read register %s (#%d): %s."), 
 	   gdbarch_register_name (gdbarch, regno),
@@ -260,7 +262,8 @@ store_register (const struct regcache *r
 
   errno = 0;
   regcache_raw_collect (regcache, regno, &val);
-  ptrace (PTRACE_POKEUSER, tid, hppa_linux_register_addr (regno, 0), val);
+  ptrace (PTRACE_POKEUSER, tid,
+	  hppa_linux_register_addr (gdbarch, regno, 0), val);
   if (errno != 0)
     error (_("Couldn't write register %s (#%d): %s."),
 	   gdbarch_register_name (gdbarch, regno),



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