X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=gdb%2Fhppa-linux-nat.c;h=31eeda8ee38736d3fb81778c08bdbb91ec67055f;hb=132c57b47776e318422661c6f9196dc92d96335a;hp=274f14007bb53c7aee8e910c33ec09ca8718c1e1;hpb=7f7fe91e15ea6d4eb8e1f600ce962b944f5df2c0;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/hppa-linux-nat.c b/gdb/hppa-linux-nat.c index 274f14007b..31eeda8ee3 100644 --- a/gdb/hppa-linux-nat.c +++ b/gdb/hppa-linux-nat.c @@ -1,12 +1,12 @@ /* Functions specific to running GDB native on HPPA running GNU/Linux. - Copyright (C) 2004, 2005, 2006, 2007 Free Software Foundation, Inc. + Copyright (C) 2004-2012 Free Software Foundation, Inc. This file is part of GDB. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -15,9 +15,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. */ + along with this program. If not, see . */ #include "defs.h" #include "gdbcore.h" @@ -31,15 +29,12 @@ #include #include -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,43) -#include -#else -#include -#endif +#include +#include "hppa-linux-offsets.h" #include "hppa-tdep.h" -/* Prototypes for supply_gregset etc. */ +/* Prototypes for supply_gregset etc. */ #include "gregset.h" /* These must match the order of the register names. @@ -158,7 +153,7 @@ hppa_linux_register_addr (int regno, CORE_ADDR blockend) { CORE_ADDR addr; - if ((unsigned) regno >= NUM_REGS) + if ((unsigned) regno >= ARRAY_SIZE (u_offsets)) error (_("Invalid register number %d."), regno); if (u_offsets[regno] == -1) @@ -216,14 +211,15 @@ static const int greg_map[] = /* Fetch one register. */ static void -fetch_register (int regno) +fetch_register (struct regcache *regcache, int regno) { + struct gdbarch *gdbarch = get_regcache_arch (regcache); int tid; int val; - if (CANNOT_FETCH_REGISTER (regno)) + if (gdbarch_cannot_fetch_register (gdbarch, regno)) { - regcache_raw_supply (current_regcache, regno, NULL); + regcache_raw_supply (regcache, regno, NULL); return; } @@ -235,21 +231,23 @@ fetch_register (int regno) errno = 0; val = ptrace (PTRACE_PEEKUSER, tid, hppa_linux_register_addr (regno, 0), 0); if (errno != 0) - error (_("Couldn't read register %s (#%d): %s."), REGISTER_NAME (regno), + error (_("Couldn't read register %s (#%d): %s."), + gdbarch_register_name (gdbarch, regno), regno, safe_strerror (errno)); - regcache_raw_supply (current_regcache, regno, &val); + regcache_raw_supply (regcache, regno, &val); } -/* Store one register. */ +/* Store one register. */ static void -store_register (int regno) +store_register (const struct regcache *regcache, int regno) { + struct gdbarch *gdbarch = get_regcache_arch (regcache); int tid; int val; - if (CANNOT_STORE_REGISTER (regno)) + if (gdbarch_cannot_store_register (gdbarch, regno)) return; /* GNU/Linux LWP ID's are process ID's. */ @@ -258,10 +256,11 @@ store_register (int regno) tid = PIDGET (inferior_ptid); /* Not a threaded program. */ errno = 0; - regcache_raw_collect (current_regcache, regno, &val); + regcache_raw_collect (regcache, regno, &val); ptrace (PTRACE_POKEUSER, tid, hppa_linux_register_addr (regno, 0), val); if (errno != 0) - error (_("Couldn't write register %s (#%d): %s."), REGISTER_NAME (regno), + error (_("Couldn't write register %s (#%d): %s."), + gdbarch_register_name (gdbarch, regno), regno, safe_strerror (errno)); } @@ -270,16 +269,19 @@ store_register (int regno) point registers depending upon the value of regno. */ static void -hppa_linux_fetch_inferior_registers (int regno) +hppa_linux_fetch_inferior_registers (struct target_ops *ops, + struct regcache *regcache, int regno) { if (-1 == regno) { - for (regno = 0; regno < NUM_REGS; regno++) - fetch_register (regno); + for (regno = 0; + regno < gdbarch_num_regs (get_regcache_arch (regcache)); + regno++) + fetch_register (regcache, regno); } else { - fetch_register (regno); + fetch_register (regcache, regno); } } @@ -288,16 +290,19 @@ hppa_linux_fetch_inferior_registers (int regno) point registers depending upon the value of regno. */ static void -hppa_linux_store_inferior_registers (int regno) +hppa_linux_store_inferior_registers (struct target_ops *ops, + struct regcache *regcache, int regno) { if (-1 == regno) { - for (regno = 0; regno < NUM_REGS; regno++) - store_register (regno); + for (regno = 0; + regno < gdbarch_num_regs (get_regcache_arch (regcache)); + regno++) + store_register (regcache, regno); } else { - store_register (regno); + store_register (regcache, regno); } } @@ -340,7 +345,7 @@ fill_gregset (const struct regcache *regcache, /* Given a pointer to a floating point register set in /proc format (fpregset_t *), unpack the register contents and supply them as gdb's - idea of the current floating point register values. */ + idea of the current floating point register values. */ void supply_fpregset (struct regcache *regcache, const gdb_fpregset_t *fpregsetp) @@ -359,7 +364,7 @@ supply_fpregset (struct regcache *regcache, const gdb_fpregset_t *fpregsetp) /* Given a pointer to a floating point register set in /proc format (fpregset_t *), update the register specified by REGNO from gdb's idea of the current floating point register set. If REGNO is -1, update - them all. */ + them all. */ void fill_fpregset (const struct regcache *regcache,