* gdbarch.sh (software_single_step): Replace REGCACHE argument by
[deliverable/binutils-gdb.git] / gdb / amd64-linux-nat.c
index b4a71125a3e27a26bee35724a421dec4213fd8b8..09899a45a14939837b7209f74d06f8057535e9e1 100644 (file)
@@ -1,6 +1,6 @@
 /* Native-dependent code for GNU/Linux x86-64.
 
-   Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006
+   Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007
    Free Software Foundation, Inc.
    Contributed by Jiri Smid, SuSE Labs.
 
@@ -26,6 +26,7 @@
 #include "gdbcore.h"
 #include "regcache.h"
 #include "linux-nat.h"
+#include "amd64-linux-tdep.h"
 
 #include "gdb_assert.h"
 #include "gdb_string.h"
@@ -68,7 +69,12 @@ static int amd64_linux_gregset64_reg_offset[] =
   RIP * 8, EFLAGS * 8,         /* %rip, %eflags */
   CS * 8, SS * 8,              /* %cs, %ss */
   DS * 8, ES * 8,              /* %ds, %es */
-  FS * 8, GS * 8               /* %fs, %gs */
+  FS * 8, GS * 8,              /* %fs, %gs */
+  -1, -1, -1, -1, -1, -1, -1, -1,
+  -1, -1, -1, -1, -1, -1, -1, -1,
+  -1, -1, -1, -1, -1, -1, -1, -1,
+  -1, -1, -1, -1, -1, -1, -1, -1, -1,
+  ORIG_RAX * 8
 };
 \f
 
@@ -105,9 +111,9 @@ static int amd64_linux_gregset32_reg_offset[] =
    in *GREGSETP.  */
 
 void
-supply_gregset (elf_gregset_t *gregsetp)
+supply_gregset (struct regcache *regcache, const elf_gregset_t *gregsetp)
 {
-  amd64_supply_native_gregset (current_regcache, gregsetp, -1);
+  amd64_supply_native_gregset (regcache, gregsetp, -1);
 }
 
 /* Fill register REGNUM (if it is a general-purpose register) in
@@ -115,9 +121,10 @@ supply_gregset (elf_gregset_t *gregsetp)
    do this for all registers.  */
 
 void
-fill_gregset (elf_gregset_t *gregsetp, int regnum)
+fill_gregset (const struct regcache *regcache,
+             elf_gregset_t *gregsetp, int regnum)
 {
-  amd64_collect_native_gregset (current_regcache, gregsetp, regnum);
+  amd64_collect_native_gregset (regcache, gregsetp, regnum);
 }
 
 /* Transfering floating-point registers between GDB, inferiors and cores.  */
@@ -126,9 +133,9 @@ fill_gregset (elf_gregset_t *gregsetp, int regnum)
    values in *FPREGSETP.  */
 
 void
-supply_fpregset (elf_fpregset_t *fpregsetp)
+supply_fpregset (struct regcache *regcache, const elf_fpregset_t *fpregsetp)
 {
-  amd64_supply_fxsave (current_regcache, -1, fpregsetp);
+  amd64_supply_fxsave (regcache, -1, fpregsetp);
 }
 
 /* Fill register REGNUM (if it is a floating-point or SSE register) in
@@ -136,9 +143,10 @@ supply_fpregset (elf_fpregset_t *fpregsetp)
    -1, do this for all registers.  */
 
 void
-fill_fpregset (elf_fpregset_t *fpregsetp, int regnum)
+fill_fpregset (const struct regcache *regcache,
+              elf_fpregset_t *fpregsetp, int regnum)
 {
-  amd64_collect_fxsave (current_regcache, regnum, fpregsetp);
+  amd64_collect_fxsave (regcache, regnum, fpregsetp);
 }
 \f
 
@@ -149,7 +157,7 @@ fill_fpregset (elf_fpregset_t *fpregsetp, int regnum)
    registers).  */
 
 static void
-amd64_linux_fetch_inferior_registers (int regnum)
+amd64_linux_fetch_inferior_registers (struct regcache *regcache, int regnum)
 {
   int tid;
 
@@ -165,7 +173,7 @@ amd64_linux_fetch_inferior_registers (int regnum)
       if (ptrace (PTRACE_GETREGS, tid, 0, (long) &regs) < 0)
        perror_with_name (_("Couldn't get registers"));
 
-      amd64_supply_native_gregset (current_regcache, &regs, -1);
+      amd64_supply_native_gregset (regcache, &regs, -1);
       if (regnum != -1)
        return;
     }
@@ -177,7 +185,7 @@ amd64_linux_fetch_inferior_registers (int regnum)
       if (ptrace (PTRACE_GETFPREGS, tid, 0, (long) &fpregs) < 0)
        perror_with_name (_("Couldn't get floating point status"));
 
-      amd64_supply_fxsave (current_regcache, -1, &fpregs);
+      amd64_supply_fxsave (regcache, -1, &fpregs);
     }
 }
 
@@ -186,7 +194,7 @@ amd64_linux_fetch_inferior_registers (int regnum)
    registers).  */
 
 static void
-amd64_linux_store_inferior_registers (int regnum)
+amd64_linux_store_inferior_registers (struct regcache *regcache, int regnum)
 {
   int tid;
 
@@ -202,7 +210,7 @@ amd64_linux_store_inferior_registers (int regnum)
       if (ptrace (PTRACE_GETREGS, tid, 0, (long) &regs) < 0)
        perror_with_name (_("Couldn't get registers"));
 
-      amd64_collect_native_gregset (current_regcache, &regs, regnum);
+      amd64_collect_native_gregset (regcache, &regs, regnum);
 
       if (ptrace (PTRACE_SETREGS, tid, 0, (long) &regs) < 0)
        perror_with_name (_("Couldn't write registers"));
@@ -218,7 +226,7 @@ amd64_linux_store_inferior_registers (int regnum)
       if (ptrace (PTRACE_GETFPREGS, tid, 0, (long) &fpregs) < 0)
        perror_with_name (_("Couldn't get floating point status"));
 
-      amd64_collect_fxsave (current_regcache, regnum, &fpregs);
+      amd64_collect_fxsave (regcache, regnum, &fpregs);
 
       if (ptrace (PTRACE_SETFPREGS, tid, 0, (long) &fpregs) < 0)
        perror_with_name (_("Couldn't write floating point status"));
@@ -382,6 +390,7 @@ _initialize_amd64_linux_nat (void)
   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;
+  amd64_native_gregset64_num_regs = AMD64_LINUX_NUM_REGS;
 
   gdb_assert (ARRAY_SIZE (amd64_linux_gregset32_reg_offset)
              == amd64_native_gregset32_num_regs);
This page took 0.028807 seconds and 4 git commands to generate.