* x86-64-linux-nat.c (child_xfer_memory): x86-64 ptrace() ABI change sync
authorMichal Ludvig <mludvig@suse.cz>
Thu, 4 Apr 2002 13:18:59 +0000 (13:18 +0000)
committerMichal Ludvig <mludvig@suse.cz>
Thu, 4 Apr 2002 13:18:59 +0000 (13:18 +0000)
gdb/ChangeLog
gdb/x86-64-linux-nat.c

index 0f807ca..96384fe 100644 (file)
@@ -1,3 +1,8 @@
+2002-04-04  Michal Ludvig  <mludvig@suse.cz>
+
+       * x86-64-linux-nat.c (child_xfer_memory): x86-64 ptrace() ABI 
+       change sync with glibc.
+
 2002-04-03  Jim Blandy  <jimb@redhat.com>
 
        * configure.in: Call AC_C_INLINE.
index 4e15cb9..596e393 100644 (file)
@@ -43,7 +43,7 @@ static int x86_64_regmap[] = {
   RSI, RDI, RBP, RSP,
   R8, R9, R10, R11,
   R12, R13, R14, R15,
-  RIP, EFLAGS, 
+  RIP, EFLAGS,
   DS, ES, FS, GS
 };
 
@@ -87,8 +87,7 @@ x86_64_linux_dr_set (int regnum, unsigned long value)
   tid = PIDGET (inferior_ptid);
 
   errno = 0;
-  ptrace (PT_WRITE_U, tid,
-         offsetof (struct user, u_debugreg[regnum]), value);
+  ptrace (PT_WRITE_U, tid, offsetof (struct user, u_debugreg[regnum]), value);
   if (errno != 0)
     perror_with_name ("Couldn't write debug register");
 }
@@ -173,7 +172,7 @@ fetch_regs (int tid)
   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");
 
   supply_gregset (&regs);
 }
@@ -441,16 +440,17 @@ child_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write,
       if (addr != memaddr || len < (int) sizeof (PTRACE_XFER_TYPE))
        {
          /* Need part of initial word -- fetch it.  */
-         ptrace (PT_READ_I, PIDGET (inferior_ptid),
-                 (PTRACE_ARG3_TYPE) addr, buffer);
+         buffer[0] = ptrace (PT_READ_I, PIDGET (inferior_ptid),
+                             (PTRACE_ARG3_TYPE) addr, 0);
        }
 
       if (count > 1)           /* FIXME, avoid if even boundary */
        {
-         ptrace (PT_READ_I, PIDGET (inferior_ptid),
-                 ((PTRACE_ARG3_TYPE)
-                  (addr + (count - 1) * sizeof (PTRACE_XFER_TYPE))),
-                 buffer + count - 1);
+         buffer[count - 1] = ptrace (PT_READ_I, PIDGET (inferior_ptid),
+                                     ((PTRACE_ARG3_TYPE)
+                                      (addr +
+                                       (count -
+                                        1) * sizeof (PTRACE_XFER_TYPE))), 0);
        }
 
       /* Copy data to be written over corresponding part of buffer */
@@ -486,8 +486,8 @@ child_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write,
       for (i = 0; i < count; i++, addr += sizeof (PTRACE_XFER_TYPE))
        {
          errno = 0;
-         ptrace (PT_READ_I, PIDGET (inferior_ptid),
-                 (PTRACE_ARG3_TYPE) addr, buffer + i);
+         buffer[i] = ptrace (PT_READ_I, PIDGET (inferior_ptid),
+                             (PTRACE_ARG3_TYPE) addr, 0);
          if (errno)
            return 0;
        }
@@ -580,12 +580,12 @@ x86_64_register_u_addr (CORE_ADDR blockend, int regnum)
   CORE_ADDR fpstate;
   CORE_ADDR ubase;
   ubase = blockend;
-  if (IS_FP_REGNUM(regnum))
+  if (IS_FP_REGNUM (regnum))
     {
       fpstate = ubase + ((char *) &u.i387.st_space - (char *) &u);
       return (fpstate + 16 * (regnum - FP0_REGNUM));
     }
-  else if (IS_SSE_REGNUM(regnum))
+  else if (IS_SSE_REGNUM (regnum))
     {
       fpstate = ubase + ((char *) &u.i387.xmm_space - (char *) &u);
       return (fpstate + 16 * (regnum - XMM0_REGNUM));