This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[rfc] [02/05] Get rid of current_gdbarch in hppa-linux-nat.c
- From: Markus Deuling <deuling at de dot ibm dot com>
- To: GDB Patches <gdb-patches at sourceware dot org>
- Cc: Ulrich Weigand <uweigand at de dot ibm dot com>
- Date: Wed, 07 Nov 2007 12:11:02 +0100
- Subject: [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),