* symtab.h (enum address_class): Remove LOC_INDIRECT and
[deliverable/binutils-gdb.git] / gdb / hppa-hpux-nat.c
index 70924f0f7b04d18c1be95a26d04f105eab01b143..2f92d402ec39120243ae2c75d89504d9bb553507 100644 (file)
@@ -1,12 +1,12 @@
 /* Native-dependent code for PA-RISC HP-UX.
 
-   Copyright (C) 2004, 2005, 2007 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2005, 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
-   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 <http://www.gnu.org/licenses/>.  */
 
 #include "defs.h"
 #include "inferior.h"
@@ -89,6 +87,7 @@ hppa_hpux_save_state_offset (struct regcache *regcache, int regnum)
 static void
 hppa_hpux_fetch_register (struct regcache *regcache, int regnum)
 {
+  struct gdbarch *gdbarch = get_regcache_arch (regcache);
   CORE_ADDR addr;
   size_t size;
   PTRACE_TYPE_RET *buf;
@@ -99,7 +98,7 @@ hppa_hpux_fetch_register (struct regcache *regcache, int regnum)
 
   /* This isn't really an address, but ptrace thinks of it as one.  */
   addr = hppa_hpux_save_state_offset (regcache, regnum);
-  size = register_size (current_gdbarch, regnum);
+  size = register_size (gdbarch, regnum);
 
   gdb_assert (size == 4 || size == 8);
   buf = alloca (size);
@@ -110,7 +109,7 @@ hppa_hpux_fetch_register (struct regcache *regcache, int regnum)
 
     if (ttrace (TT_LWP_RUREGS, pid, lwp, addr, size, (uintptr_t)buf) == -1)
       error (_("Couldn't read register %s (#%d): %s"),
-            gdbarch_register_name (current_gdbarch, regnum),
+            gdbarch_register_name (gdbarch, regnum),
             regnum, safe_strerror (errno));
   }
 #else
@@ -124,7 +123,7 @@ hppa_hpux_fetch_register (struct regcache *regcache, int regnum)
        buf[i] = ptrace (PT_RUREGS, pid, (PTRACE_TYPE_ARG3) addr, 0, 0);
        if (errno != 0)
          error (_("Couldn't read register %s (#%d): %s"),
-                gdbarch_register_name (current_gdbarch, regnum),
+                gdbarch_register_name (gdbarch, regnum),
                 regnum, safe_strerror (errno));
 
        addr += sizeof (PTRACE_TYPE_RET);
@@ -147,7 +146,9 @@ static void
 hppa_hpux_fetch_inferior_registers (struct regcache *regcache, int regnum)
 {
   if (regnum == -1)
-    for (regnum = 0; regnum < gdbarch_num_regs (current_gdbarch); regnum++)
+    for (regnum = 0;
+        regnum < gdbarch_num_regs (get_regcache_arch (regcache));
+        regnum++)
       hppa_hpux_fetch_register (regcache, regnum);
   else
     hppa_hpux_fetch_register (regcache, regnum);
@@ -158,6 +159,7 @@ hppa_hpux_fetch_inferior_registers (struct regcache *regcache, int regnum)
 static void
 hppa_hpux_store_register (struct regcache *regcache, int regnum)
 {
+  struct gdbarch *gdbarch = get_regcache_arch (regcache);
   CORE_ADDR addr;
   size_t size;
   PTRACE_TYPE_RET *buf;
@@ -167,7 +169,7 @@ hppa_hpux_store_register (struct regcache *regcache, int regnum)
 
   /* This isn't really an address, but ptrace thinks of it as one.  */
   addr = hppa_hpux_save_state_offset (regcache, regnum);
-  size = register_size (current_gdbarch, regnum);
+  size = register_size (gdbarch, regnum);
 
   gdb_assert (size == 4 || size == 8);
   buf = alloca (size);
@@ -189,7 +191,7 @@ hppa_hpux_store_register (struct regcache *regcache, int regnum)
 
     if (ttrace (TT_LWP_WUREGS, pid, lwp, addr, size, (uintptr_t)buf) == -1)
       error (_("Couldn't write register %s (#%d): %s"),
-            gdbarch_register_name (current_gdbarch, regnum),
+            gdbarch_register_name (gdbarch, regnum),
             regnum, safe_strerror (errno));
   }
 #else
@@ -203,7 +205,7 @@ hppa_hpux_store_register (struct regcache *regcache, int regnum)
        ptrace (PT_WUREGS, pid, (PTRACE_TYPE_ARG3) addr, buf[i], 0);
        if (errno != 0)
          error (_("Couldn't write register %s (#%d): %s"),
-                gdbarch_register_name (current_gdbarch, regnum),
+                gdbarch_register_name (gdbarch, regnum),
                 regnum, safe_strerror (errno));
 
        addr += sizeof (PTRACE_TYPE_RET);
@@ -219,7 +221,9 @@ static void
 hppa_hpux_store_inferior_registers (struct regcache *regcache, int regnum)
 {
   if (regnum == -1)
-    for (regnum = 0; regnum < gdbarch_num_regs (current_gdbarch); regnum++)
+    for (regnum = 0;
+        regnum < gdbarch_num_regs (get_regcache_arch (regcache));
+        regnum++)
       hppa_hpux_store_register (regcache, regnum);
   else
     hppa_hpux_store_register (regcache, regnum);
This page took 0.173156 seconds and 4 git commands to generate.