* remote.c (struct remote_state): Add BUF and BUF_SIZE.
[deliverable/binutils-gdb.git] / gdb / amd64-linux-nat.c
index ab4725e1dd6055d7ac8becb25c86eeb2c5f41760..b4a71125a3e27a26bee35724a421dec4213fd8b8 100644 (file)
@@ -1,6 +1,7 @@
 /* Native-dependent code for GNU/Linux x86-64.
 
-   Copyright 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+   Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006
+   Free Software Foundation, Inc.
    Contributed by Jiri Smid, SuSE Labs.
 
    This file is part of GDB.
@@ -17,8 +18,8 @@
 
    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., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
+   Foundation, Inc., 51 Franklin Street, Fifth Floor,
+   Boston, MA 02110-1301, USA.  */
 
 #include "defs.h"
 #include "inferior.h"
@@ -147,8 +148,8 @@ fill_fpregset (elf_fpregset_t *fpregsetp, int regnum)
    this for all registers (including the floating point and SSE
    registers).  */
 
-void
-fetch_inferior_registers (int regnum)
+static void
+amd64_linux_fetch_inferior_registers (int regnum)
 {
   int tid;
 
@@ -162,7 +163,7 @@ fetch_inferior_registers (int regnum)
       elf_gregset_t regs;
 
       if (ptrace (PTRACE_GETREGS, tid, 0, (long) &regs) < 0)
-       perror_with_name ("Couldn't get registers");
+       perror_with_name (_("Couldn't get registers"));
 
       amd64_supply_native_gregset (current_regcache, &regs, -1);
       if (regnum != -1)
@@ -174,7 +175,7 @@ fetch_inferior_registers (int regnum)
       elf_fpregset_t fpregs;
 
       if (ptrace (PTRACE_GETFPREGS, tid, 0, (long) &fpregs) < 0)
-       perror_with_name ("Couldn't get floating point status");
+       perror_with_name (_("Couldn't get floating point status"));
 
       amd64_supply_fxsave (current_regcache, -1, &fpregs);
     }
@@ -184,8 +185,8 @@ fetch_inferior_registers (int regnum)
    -1, do this for all registers (including the floating-point and SSE
    registers).  */
 
-void
-store_inferior_registers (int regnum)
+static void
+amd64_linux_store_inferior_registers (int regnum)
 {
   int tid;
 
@@ -199,12 +200,12 @@ store_inferior_registers (int regnum)
       elf_gregset_t regs;
 
       if (ptrace (PTRACE_GETREGS, tid, 0, (long) &regs) < 0)
-       perror_with_name ("Couldn't get registers");
+       perror_with_name (_("Couldn't get registers"));
 
       amd64_collect_native_gregset (current_regcache, &regs, regnum);
 
       if (ptrace (PTRACE_SETREGS, tid, 0, (long) &regs) < 0)
-       perror_with_name ("Couldn't write registers");
+       perror_with_name (_("Couldn't write registers"));
 
       if (regnum != -1)
        return;
@@ -215,12 +216,12 @@ store_inferior_registers (int regnum)
       elf_fpregset_t fpregs;
 
       if (ptrace (PTRACE_GETFPREGS, tid, 0, (long) &fpregs) < 0)
-       perror_with_name ("Couldn't get floating point status");
+       perror_with_name (_("Couldn't get floating point status"));
 
       amd64_collect_fxsave (current_regcache, regnum, &fpregs);
 
       if (ptrace (PTRACE_SETFPREGS, tid, 0, (long) &fpregs) < 0)
-       perror_with_name ("Couldn't write floating point status");
+       perror_with_name (_("Couldn't write floating point status"));
 
       return;
     }
@@ -248,7 +249,7 @@ amd64_linux_dr_get (int regnum)
                  offsetof (struct user, u_debugreg[regnum]), 0);
   if (errno != 0)
 #if 0
-    perror_with_name ("Couldn't read debug register");
+    perror_with_name (_("Couldn't read debug register"));
 #else
     return 0;
 #endif
@@ -269,7 +270,7 @@ amd64_linux_dr_set (int regnum, unsigned long value)
   errno = 0;
   ptrace (PT_WRITE_U, tid, offsetof (struct user, u_debugreg[regnum]), value);
   if (errno != 0)
-    perror_with_name ("Couldn't write debug register");
+    perror_with_name (_("Couldn't write debug register"));
 }
 
 void
@@ -360,11 +361,13 @@ ps_get_thread_area (const struct ps_prochandle *ph,
 }
 \f
 
-void
-child_post_startup_inferior (ptid_t ptid)
+static void (*super_post_startup_inferior) (ptid_t ptid);
+
+static void
+amd64_linux_child_post_startup_inferior (ptid_t ptid)
 {
   i386_cleanup_dregs ();
-  linux_child_post_startup_inferior (ptid);
+  super_post_startup_inferior (ptid);
 }
 \f
 
@@ -374,6 +377,8 @@ void _initialize_amd64_linux_nat (void);
 void
 _initialize_amd64_linux_nat (void)
 {
+  struct target_ops *t;
+
   amd64_native_gregset32_reg_offset = amd64_linux_gregset32_reg_offset;
   amd64_native_gregset32_num_regs = I386_LINUX_NUM_REGS;
   amd64_native_gregset64_reg_offset = amd64_linux_gregset64_reg_offset;
@@ -382,4 +387,18 @@ _initialize_amd64_linux_nat (void)
              == amd64_native_gregset32_num_regs);
   gdb_assert (ARRAY_SIZE (amd64_linux_gregset64_reg_offset)
              == amd64_native_gregset64_num_regs);
+
+  /* Fill in the generic GNU/Linux methods.  */
+  t = linux_target ();
+
+  /* Override the GNU/Linux inferior startup hook.  */
+  super_post_startup_inferior = t->to_post_startup_inferior;
+  t->to_post_startup_inferior = amd64_linux_child_post_startup_inferior;
+
+  /* Add our register access methods.  */
+  t->to_fetch_registers = amd64_linux_fetch_inferior_registers;
+  t->to_store_registers = amd64_linux_store_inferior_registers;
+
+  /* Register the target.  */
+  linux_nat_add_target (t);
 }
This page took 0.04199 seconds and 4 git commands to generate.