* dwarf2loc.c (dwarf_expr_frame_base): Error out on missing
[deliverable/binutils-gdb.git] / gdb / hppa-linux-nat.c
index ee24856855d04a4cb4fedff1bfefddb0ff9d9e4d..a92510b94aeb4d7444130956aa963ad24028870d 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, 2005, 2006, 2007, 2008 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"
 
@@ -158,7 +153,7 @@ hppa_linux_register_addr (int regno, CORE_ADDR blockend)
 {
   CORE_ADDR addr;
 
 {
   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)
     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 (CANNOT_FETCH_REGISTER (regno))
+  if (gdbarch_cannot_fetch_register (gdbarch, regno))
     {
       regcache_raw_supply (regcache, regno, NULL);
       return;
     {
       regcache_raw_supply (regcache, regno, NULL);
       return;
@@ -235,7 +231,8 @@ fetch_register (struct regcache *regcache, int regno)
   errno = 0;
   val = ptrace (PTRACE_PEEKUSER, tid, hppa_linux_register_addr (regno, 0), 0);
   if (errno != 0)
   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 (regcache, regno, &val);
           regno, safe_strerror (errno));
 
   regcache_raw_supply (regcache, regno, &val);
@@ -246,10 +243,11 @@ fetch_register (struct regcache *regcache, int regno)
 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 (CANNOT_STORE_REGISTER (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.  */
@@ -261,7 +259,8 @@ store_register (const struct regcache *regcache, int regno)
   regcache_raw_collect (regcache, regno, &val);
   ptrace (PTRACE_POKEUSER, tid, hppa_linux_register_addr (regno, 0), val);
   if (errno != 0)
   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));
 }
 
           regno, safe_strerror (errno));
 }
 
@@ -274,7 +273,9 @@ hppa_linux_fetch_inferior_registers (struct regcache *regcache, int regno)
 {
   if (-1 == regno)
     {
 {
   if (-1 == regno)
     {
-      for (regno = 0; regno < NUM_REGS; regno++)
+      for (regno = 0;
+          regno < gdbarch_num_regs (get_regcache_arch (regcache));
+          regno++)
         fetch_register (regcache, regno);
     }
   else 
         fetch_register (regcache, regno);
     }
   else 
@@ -292,7 +293,9 @@ hppa_linux_store_inferior_registers (struct regcache *regcache, int regno)
 {
   if (-1 == regno)
     {
 {
   if (-1 == regno)
     {
-      for (regno = 0; regno < NUM_REGS; regno++)
+      for (regno = 0;
+          regno < gdbarch_num_regs (get_regcache_arch (regcache));
+          regno++)
        store_register (regcache, regno);
     }
   else
        store_register (regcache, regno);
     }
   else
This page took 0.03373 seconds and 4 git commands to generate.