bfd/
[deliverable/binutils-gdb.git] / gdb / hppa-linux-nat.c
index 6897e9f24c46cab8e916669c01803ebe7f1cb220..3d8496c2ef23a6275083769683a2d03b8de9a235 100644 (file)
@@ -1,12 +1,12 @@
 /* Functions specific to running GDB native on HPPA running GNU/Linux.
 
 /* Functions specific to running GDB native on HPPA running GNU/Linux.
 
-   Copyright (C) 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
+   Copyright (C) 2004-2013 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
 
    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,
    (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
    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 <http://www.gnu.org/licenses/>.  */
 
 #include "defs.h"
 #include "gdbcore.h"
 
 #include "defs.h"
 #include "gdbcore.h"
 #include <sys/ptrace.h>
 #include <linux/version.h>
 
 #include <sys/ptrace.h>
 #include <linux/version.h>
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,43)
-#include <asm/offset.h>
-#else
-#include <asm/offsets.h>
-#endif
+#include <asm/ptrace.h>
+#include "hppa-linux-offsets.h"
 
 #include "hppa-tdep.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.
 #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;
 
 {
   CORE_ADDR addr;
 
-  if ((unsigned) regno >= gdbarch_num_regs (current_gdbarch))
+  if ((unsigned) regno >= ARRAY_SIZE (u_offsets))
     error (_("Invalid register number %d."), regno);
 
   if (u_offsets[regno] == -1)
     error (_("Invalid register number %d."), regno);
 
   if (u_offsets[regno] == -1)
@@ -218,10 +213,11 @@ static const int greg_map[] =
 static void
 fetch_register (struct regcache *regcache, int regno)
 {
 static void
 fetch_register (struct regcache *regcache, int regno)
 {
+  struct gdbarch *gdbarch = get_regcache_arch (regcache);
   int tid;
   int val;
 
   int tid;
   int val;
 
-  if (gdbarch_cannot_fetch_register (current_gdbarch, regno))
+  if (gdbarch_cannot_fetch_register (gdbarch, regno))
     {
       regcache_raw_supply (regcache, regno, NULL);
       return;
     {
       regcache_raw_supply (regcache, regno, NULL);
       return;
@@ -236,21 +232,22 @@ fetch_register (struct regcache *regcache, int regno)
   val = ptrace (PTRACE_PEEKUSER, tid, hppa_linux_register_addr (regno, 0), 0);
   if (errno != 0)
     error (_("Couldn't read register %s (#%d): %s."), 
   val = ptrace (PTRACE_PEEKUSER, tid, hppa_linux_register_addr (regno, 0), 0);
   if (errno != 0)
     error (_("Couldn't read register %s (#%d): %s."), 
-          gdbarch_register_name (current_gdbarch, regno),
+          gdbarch_register_name (gdbarch, regno),
           regno, safe_strerror (errno));
 
   regcache_raw_supply (regcache, regno, &val);
 }
 
           regno, safe_strerror (errno));
 
   regcache_raw_supply (regcache, regno, &val);
 }
 
-/* Store one register. */
+/* Store one register.  */
 
 static void
 store_register (const struct regcache *regcache, int regno)
 {
 
 static void
 store_register (const struct regcache *regcache, int regno)
 {
+  struct gdbarch *gdbarch = get_regcache_arch (regcache);
   int tid;
   int val;
 
   int tid;
   int val;
 
-  if (gdbarch_cannot_store_register (current_gdbarch, regno))
+  if (gdbarch_cannot_store_register (gdbarch, regno))
     return;
 
   /* GNU/Linux LWP ID's are process ID's.  */
     return;
 
   /* GNU/Linux LWP ID's are process ID's.  */
@@ -263,7 +260,7 @@ store_register (const struct regcache *regcache, int regno)
   ptrace (PTRACE_POKEUSER, tid, hppa_linux_register_addr (regno, 0), val);
   if (errno != 0)
     error (_("Couldn't write register %s (#%d): %s."),
   ptrace (PTRACE_POKEUSER, tid, hppa_linux_register_addr (regno, 0), val);
   if (errno != 0)
     error (_("Couldn't write register %s (#%d): %s."),
-          gdbarch_register_name (current_gdbarch, regno),
+          gdbarch_register_name (gdbarch, regno),
           regno, safe_strerror (errno));
 }
 
           regno, safe_strerror (errno));
 }
 
@@ -272,11 +269,14 @@ store_register (const struct regcache *regcache, int regno)
    point registers depending upon the value of regno.  */
 
 static void
    point registers depending upon the value of regno.  */
 
 static void
-hppa_linux_fetch_inferior_registers (struct regcache *regcache, int regno)
+hppa_linux_fetch_inferior_registers (struct target_ops *ops,
+                                    struct regcache *regcache, int regno)
 {
   if (-1 == regno)
     {
 {
   if (-1 == regno)
     {
-      for (regno = 0; regno < gdbarch_num_regs (current_gdbarch); regno++)
+      for (regno = 0;
+          regno < gdbarch_num_regs (get_regcache_arch (regcache));
+          regno++)
         fetch_register (regcache, regno);
     }
   else 
         fetch_register (regcache, regno);
     }
   else 
@@ -290,11 +290,14 @@ hppa_linux_fetch_inferior_registers (struct regcache *regcache, int regno)
    point registers depending upon the value of regno.  */
 
 static void
    point registers depending upon the value of regno.  */
 
 static void
-hppa_linux_store_inferior_registers (struct regcache *regcache, int regno)
+hppa_linux_store_inferior_registers (struct target_ops *ops,
+                                    struct regcache *regcache, int regno)
 {
   if (-1 == regno)
     {
 {
   if (-1 == regno)
     {
-      for (regno = 0; regno < gdbarch_num_regs (current_gdbarch); regno++)
+      for (regno = 0;
+          regno < gdbarch_num_regs (get_regcache_arch (regcache));
+          regno++)
        store_register (regcache, regno);
     }
   else
        store_register (regcache, regno);
     }
   else
@@ -342,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
 
 /*  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)
 
 void
 supply_fpregset (struct regcache *regcache, const gdb_fpregset_t *fpregsetp)
@@ -361,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
 /*  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,
 
 void
 fill_fpregset (const struct regcache *regcache,
This page took 0.028722 seconds and 4 git commands to generate.