OSDN Git Service

Update copyright year in most headers.
[pf3gnuchains/pf3gnuchains3x.git] / gdb / ia64-linux-nat.c
index fb29d8c..e6a7077 100644 (file)
@@ -1,8 +1,8 @@
 /* Functions specific to running gdb native on IA-64 running
    GNU/Linux.
 
-   Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
-   Free Software Foundation, Inc.
+   Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
+   2009, 2010 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -302,11 +302,11 @@ static int u_offsets[] =
   };
 
 static CORE_ADDR
-ia64_register_addr (int regno)
+ia64_register_addr (struct gdbarch *gdbarch, int regno)
 {
   CORE_ADDR addr;
 
-  if (regno < 0 || regno >= gdbarch_num_regs (current_gdbarch))
+  if (regno < 0 || regno >= gdbarch_num_regs (gdbarch))
     error (_("Invalid register number %d."), regno);
 
   if (u_offsets[regno] == -1)
@@ -318,15 +318,15 @@ ia64_register_addr (int regno)
 }
 
 static int
-ia64_cannot_fetch_register (int regno)
+ia64_cannot_fetch_register (struct gdbarch *gdbarch, int regno)
 {
   return regno < 0
-        || regno >= gdbarch_num_regs (current_gdbarch)
+        || regno >= gdbarch_num_regs (gdbarch)
         || u_offsets[regno] == -1;
 }
 
 static int
-ia64_cannot_store_register (int regno)
+ia64_cannot_store_register (struct gdbarch *gdbarch, int regno)
 {
   /* Rationale behind not permitting stores to bspstore...
   
@@ -358,7 +358,7 @@ ia64_cannot_store_register (int regno)
      back.)  */
 
   return regno < 0
-        || regno >= gdbarch_num_regs (current_gdbarch)
+        || regno >= gdbarch_num_regs (gdbarch)
         || u_offsets[regno] == -1
          || regno == IA64_BSPSTORE_REGNUM;
 }
@@ -674,12 +674,13 @@ ia64_linux_can_use_hw_breakpoint (int type, int cnt, int othertype)
 static void
 ia64_linux_fetch_register (struct regcache *regcache, int regnum)
 {
+  struct gdbarch *gdbarch = get_regcache_arch (regcache);
   CORE_ADDR addr;
   size_t size;
   PTRACE_TYPE_RET *buf;
   int pid, i;
 
-  if (ia64_cannot_fetch_register (regnum))
+  if (ia64_cannot_fetch_register (gdbarch, regnum))
     {
       regcache_raw_supply (regcache, regnum, NULL);
       return;
@@ -692,8 +693,8 @@ ia64_linux_fetch_register (struct regcache *regcache, int regnum)
     pid = ptid_get_pid (inferior_ptid);
 
   /* This isn't really an address, but ptrace thinks of it as one.  */
-  addr = ia64_register_addr (regnum);
-  size = register_size (current_gdbarch, regnum);
+  addr = ia64_register_addr (gdbarch, regnum);
+  size = register_size (gdbarch, regnum);
 
   gdb_assert ((size % sizeof (PTRACE_TYPE_RET)) == 0);
   buf = alloca (size);
@@ -705,7 +706,7 @@ ia64_linux_fetch_register (struct regcache *regcache, int regnum)
       buf[i] = ptrace (PT_READ_U, pid, (PTRACE_TYPE_ARG3)addr, 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);
@@ -717,10 +718,13 @@ ia64_linux_fetch_register (struct regcache *regcache, int regnum)
    for all registers.  */
 
 static void
-ia64_linux_fetch_registers (struct regcache *regcache, int regnum)
+ia64_linux_fetch_registers (struct target_ops *ops,
+                           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++)
       ia64_linux_fetch_register (regcache, regnum);
   else
     ia64_linux_fetch_register (regcache, regnum);
@@ -731,12 +735,13 @@ ia64_linux_fetch_registers (struct regcache *regcache, int regnum)
 static void
 ia64_linux_store_register (const struct regcache *regcache, int regnum)
 {
+  struct gdbarch *gdbarch = get_regcache_arch (regcache);
   CORE_ADDR addr;
   size_t size;
   PTRACE_TYPE_RET *buf;
   int pid, i;
 
-  if (ia64_cannot_store_register (regnum))
+  if (ia64_cannot_store_register (gdbarch, regnum))
     return;
 
   /* Cater for systems like GNU/Linux, that implement threads as
@@ -746,8 +751,8 @@ ia64_linux_store_register (const struct regcache *regcache, int regnum)
     pid = ptid_get_pid (inferior_ptid);
 
   /* This isn't really an address, but ptrace thinks of it as one.  */
-  addr = ia64_register_addr (regnum);
-  size = register_size (current_gdbarch, regnum);
+  addr = ia64_register_addr (gdbarch, regnum);
+  size = register_size (gdbarch, regnum);
 
   gdb_assert ((size % sizeof (PTRACE_TYPE_RET)) == 0);
   buf = alloca (size);
@@ -760,7 +765,7 @@ ia64_linux_store_register (const struct regcache *regcache, int regnum)
       ptrace (PT_WRITE_U, pid, (PTRACE_TYPE_ARG3)addr, buf[i]);
       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);
@@ -771,10 +776,13 @@ ia64_linux_store_register (const struct regcache *regcache, int regnum)
    this for all registers.  */
 
 static void
-ia64_linux_store_registers (struct regcache *regcache, int regnum)
+ia64_linux_store_registers (struct target_ops *ops,
+                           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++)
       ia64_linux_store_register (regcache, regnum);
   else
     ia64_linux_store_register (regcache, regnum);
@@ -804,7 +812,7 @@ void _initialize_ia64_linux_nat (void);
 void
 _initialize_ia64_linux_nat (void)
 {
-  struct target_ops *t = linux_target ();
+  struct target_ops *t;
 
   /* Fill in the generic GNU/Linux methods.  */
   t = linux_target ();