Thu Nov 30 00:13:29 2017 UTC ()
Fix 'last argument of ptrace is the thread id' on NetBSD.


(christos)
diff -r1.1.1.1 -r1.2 src/external/gpl3/gdb/dist/gdb/amd64-bsd-nat.c
diff -r1.1.1.1 -r1.2 src/external/gpl3/gdb/dist/gdb/i386-bsd-nat.c
diff -r1.1.1.1 -r1.2 src/external/gpl3/gdb/dist/gdb/m88k-bsd-nat.c
diff -r1.2 -r1.3 src/external/gpl3/gdb/dist/gdb/m68k-bsd-nat.c
diff -r1.3 -r1.4 src/external/gpl3/gdb/dist/gdb/vax-bsd-nat.c

cvs diff -r1.1.1.1 -r1.2 src/external/gpl3/gdb/dist/gdb/amd64-bsd-nat.c (expand / switch to context diff)
--- src/external/gpl3/gdb/dist/gdb/amd64-bsd-nat.c 2017/11/28 18:18:06 1.1.1.1
+++ src/external/gpl3/gdb/dist/gdb/amd64-bsd-nat.c 2017/11/30 00:13:29 1.2
@@ -49,7 +49,7 @@
     {
       struct reg regs;
 
-      if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, 0) == -1)
+      if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs,  ptid_get_lwp (inferior_ptid)) == -1)
 	perror_with_name (_("Couldn't get registers"));
 
       amd64_supply_native_gregset (regcache, &regs, -1);
@@ -66,7 +66,7 @@
       if (x86bsd_xsave_len != 0)
 	{
 	  xstateregs = alloca (x86bsd_xsave_len);
-	  if (ptrace (PT_GETXSTATE, pid, (PTRACE_TYPE_ARG3) xstateregs, 0)
+	  if (ptrace (PT_GETXSTATE, pid, (PTRACE_TYPE_ARG3) xstateregs,  ptid_get_lwp (inferior_ptid))
 	      == -1)
 	    perror_with_name (_("Couldn't get extended state status"));
 
@@ -75,7 +75,7 @@
 	}
 #endif
 
-      if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
+      if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs,  ptid_get_lwp (inferior_ptid)) == -1)
 	perror_with_name (_("Couldn't get floating point status"));
 
       amd64_supply_fxsave (regcache, -1, &fpregs);
@@ -96,12 +96,12 @@
     {
       struct reg regs;
 
-      if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, 0) == -1)
+      if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs,  ptid_get_lwp (inferior_ptid)) == -1)
         perror_with_name (_("Couldn't get registers"));
 
       amd64_collect_native_gregset (regcache, &regs, regnum);
 
-      if (ptrace (PT_SETREGS, pid, (PTRACE_TYPE_ARG3) &regs, 0) == -1)
+      if (ptrace (PT_SETREGS, pid, (PTRACE_TYPE_ARG3) &regs,  ptid_get_lwp (inferior_ptid)) == -1)
         perror_with_name (_("Couldn't write registers"));
 
       if (regnum != -1)
@@ -117,11 +117,11 @@
       if (x86bsd_xsave_len != 0)
 	{
 	  xstateregs = alloca (x86bsd_xsave_len);
-	  if (ptrace (PT_GETXSTATE, pid, (PTRACE_TYPE_ARG3) xstateregs, 0)
+	  if (ptrace (PT_GETXSTATE, pid, (PTRACE_TYPE_ARG3) xstateregs,  ptid_get_lwp (inferior_ptid))
 	      == -1)
 	    perror_with_name (_("Couldn't get extended state status"));
 
-	  amd64_collect_xsave (regcache, regnum, xstateregs, 0);
+	  amd64_collect_xsave (regcache, regnum, xstateregs,  ptid_get_lwp (inferior_ptid));
 
 	  if (ptrace (PT_SETXSTATE, pid, (PTRACE_TYPE_ARG3) xstateregs,
 		      x86bsd_xsave_len) == -1)
@@ -130,12 +130,12 @@
 	}
 #endif
 
-      if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
+      if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs,  ptid_get_lwp (inferior_ptid)) == -1)
 	perror_with_name (_("Couldn't get floating point status"));
 
       amd64_collect_fxsave (regcache, regnum, &fpregs);
 
-      if (ptrace (PT_SETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
+      if (ptrace (PT_SETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs,  ptid_get_lwp (inferior_ptid)) == -1)
 	perror_with_name (_("Couldn't write floating point status"));
     }
 }

cvs diff -r1.1.1.1 -r1.2 src/external/gpl3/gdb/dist/gdb/i386-bsd-nat.c (expand / switch to context diff)
--- src/external/gpl3/gdb/dist/gdb/i386-bsd-nat.c 2017/11/28 18:18:07 1.1.1.1
+++ src/external/gpl3/gdb/dist/gdb/i386-bsd-nat.c 2017/11/30 00:13:29 1.2
@@ -137,7 +137,7 @@
     {
       struct reg regs;
 
-      if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, 0) == -1)
+      if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs,  ptid_get_lwp (inferior_ptid)) == -1)
 	perror_with_name (_("Couldn't get registers"));
 
       i386bsd_supply_gregset (regcache, &regs);
@@ -159,7 +159,7 @@
 
 	  xstateregs = alloca (x86bsd_xsave_len);
 	  if (ptrace (PT_GETXSTATE, pid,
-		      (PTRACE_TYPE_ARG3) xstateregs, 0) == -1)
+		      (PTRACE_TYPE_ARG3) xstateregs,  ptid_get_lwp (inferior_ptid)) == -1)
 	    perror_with_name (_("Couldn't get extended state status"));
 
 	  i387_supply_xsave (regcache, -1, xstateregs);
@@ -169,7 +169,7 @@
       
 #ifdef HAVE_PT_GETXMMREGS
       if (have_ptrace_xmmregs != 0
-	  && ptrace(PT_GETXMMREGS, pid, (PTRACE_TYPE_ARG3) xmmregs, 0) == 0)
+	  && ptrace(PT_GETXMMREGS, pid, (PTRACE_TYPE_ARG3) xmmregs,  ptid_get_lwp (inferior_ptid)) == 0)
 	{
 	  have_ptrace_xmmregs = 1;
 	  i387_supply_fxsave (regcache, -1, xmmregs);
@@ -178,7 +178,7 @@
 	{
 	  have_ptrace_xmmregs = 0;
 #endif
-          if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
+          if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs,  ptid_get_lwp (inferior_ptid)) == -1)
 	    perror_with_name (_("Couldn't get floating point status"));
 
 	  i387_supply_fsave (regcache, -1, &fpregs);
@@ -201,12 +201,12 @@
     {
       struct reg regs;
 
-      if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, 0) == -1)
+      if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs,  ptid_get_lwp (inferior_ptid)) == -1)
         perror_with_name (_("Couldn't get registers"));
 
       i386bsd_collect_gregset (regcache, &regs, regnum);
 
-      if (ptrace (PT_SETREGS, pid, (PTRACE_TYPE_ARG3) &regs, 0) == -1)
+      if (ptrace (PT_SETREGS, pid, (PTRACE_TYPE_ARG3) &regs,  ptid_get_lwp (inferior_ptid)) == -1)
         perror_with_name (_("Couldn't write registers"));
 
       if (regnum != -1)
@@ -227,10 +227,10 @@
 
 	  xstateregs = alloca (x86bsd_xsave_len);
 	  if (ptrace (PT_GETXSTATE, pid,
-		      (PTRACE_TYPE_ARG3) xstateregs, 0) == -1)
+		      (PTRACE_TYPE_ARG3) xstateregs,  ptid_get_lwp (inferior_ptid)) == -1)
 	    perror_with_name (_("Couldn't get extended state status"));
 
-	  i387_collect_xsave (regcache, -1, xstateregs, 0);
+	  i387_collect_xsave (regcache, -1, xstateregs,  ptid_get_lwp (inferior_ptid));
 
 	  if (ptrace (PT_SETXSTATE, pid,
 		      (PTRACE_TYPE_ARG3) xstateregs, x86bsd_xsave_len) == -1)
@@ -241,25 +241,25 @@
 
 #ifdef HAVE_PT_GETXMMREGS
       if (have_ptrace_xmmregs != 0
-	  && ptrace(PT_GETXMMREGS, pid, (PTRACE_TYPE_ARG3) xmmregs, 0) == 0)
+	  && ptrace(PT_GETXMMREGS, pid, (PTRACE_TYPE_ARG3) xmmregs,  ptid_get_lwp (inferior_ptid)) == 0)
 	{
 	  have_ptrace_xmmregs = 1;
 
 	  i387_collect_fxsave (regcache, regnum, xmmregs);
 
-	  if (ptrace (PT_SETXMMREGS, pid, (PTRACE_TYPE_ARG3) xmmregs, 0) == -1)
+	  if (ptrace (PT_SETXMMREGS, pid, (PTRACE_TYPE_ARG3) xmmregs,  ptid_get_lwp (inferior_ptid)) == -1)
             perror_with_name (_("Couldn't write XMM registers"));
 	}
       else
 	{
 	  have_ptrace_xmmregs = 0;
 #endif
-          if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
+          if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs,  ptid_get_lwp (inferior_ptid)) == -1)
 	    perror_with_name (_("Couldn't get floating point status"));
 
           i387_collect_fsave (regcache, regnum, &fpregs);
 
-          if (ptrace (PT_SETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
+          if (ptrace (PT_SETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs,  ptid_get_lwp (inferior_ptid)) == -1)
 	    perror_with_name (_("Couldn't write floating point status"));
 #ifdef HAVE_PT_GETXMMREGS
         }

cvs diff -r1.1.1.1 -r1.2 src/external/gpl3/gdb/dist/gdb/Attic/m88k-bsd-nat.c (expand / switch to context diff)
--- src/external/gpl3/gdb/dist/gdb/Attic/m88k-bsd-nat.c 2017/11/28 18:18:03 1.1.1.1
+++ src/external/gpl3/gdb/dist/gdb/Attic/m88k-bsd-nat.c 2017/11/30 00:13:29 1.2
@@ -69,7 +69,7 @@
   struct reg regs;
 
   if (ptrace (PT_GETREGS, ptid_get_pid (regcache_get_ptid (regcache)),
-	      (PTRACE_TYPE_ARG3) &regs, 0) == -1)
+	      (PTRACE_TYPE_ARG3) &regs,  ptid_get_lwp (inferior_ptid)) == -1)
     perror_with_name (_("Couldn't get registers"));
 
   m88kbsd_supply_gregset (regcache, &regs);
@@ -85,13 +85,13 @@
   struct reg regs;
 
   if (ptrace (PT_GETREGS, ptid_get_pid (regcache_get_ptid (regcache)),
-	      (PTRACE_TYPE_ARG3) &regs, 0) == -1)
+	      (PTRACE_TYPE_ARG3) &regs,  ptid_get_lwp (inferior_ptid)) == -1)
     perror_with_name (_("Couldn't get registers"));
 
   m88kbsd_collect_gregset (regcache, &regs, regnum);
 
   if (ptrace (PT_SETREGS, ptid_get_pid (regcache_get_ptid (regcache)),
-	      (PTRACE_TYPE_ARG3) &regs, 0) == -1)
+	      (PTRACE_TYPE_ARG3) &regs,  ptid_get_lwp (inferior_ptid)) == -1)
     perror_with_name (_("Couldn't write registers"));
 }
 

cvs diff -r1.2 -r1.3 src/external/gpl3/gdb/dist/gdb/m68k-bsd-nat.c (expand / switch to context diff)
--- src/external/gpl3/gdb/dist/gdb/m68k-bsd-nat.c 2017/11/29 18:15:29 1.2
+++ src/external/gpl3/gdb/dist/gdb/m68k-bsd-nat.c 2017/11/30 00:13:29 1.3
@@ -117,7 +117,7 @@
     {
       struct reg regs;
 
-      if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, 0) == -1)
+      if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs,  ptid_get_lwp (inferior_ptid)) == -1)
 	perror_with_name (_("Couldn't get registers"));
 
       m68kbsd_supply_gregset (regcache, &regs);
@@ -127,7 +127,7 @@
     {
       struct fpreg fpregs;
 
-      if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
+      if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs,  ptid_get_lwp (inferior_ptid)) == -1)
 	perror_with_name (_("Couldn't get floating point status"));
 
       m68kbsd_supply_fpregset (regcache, &fpregs);
@@ -147,12 +147,12 @@
     {
       struct reg regs;
 
-      if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, 0) == -1)
+      if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs,  ptid_get_lwp (inferior_ptid)) == -1)
         perror_with_name (_("Couldn't get registers"));
 
       m68kbsd_collect_gregset (regcache, &regs, regnum);
 
-      if (ptrace (PT_SETREGS, pid, (PTRACE_TYPE_ARG3) &regs, 0) == -1)
+      if (ptrace (PT_SETREGS, pid, (PTRACE_TYPE_ARG3) &regs,  ptid_get_lwp (inferior_ptid)) == -1)
         perror_with_name (_("Couldn't write registers"));
     }
 
@@ -160,12 +160,12 @@
     {
       struct fpreg fpregs;
 
-      if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
+      if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs,  ptid_get_lwp (inferior_ptid)) == -1)
 	perror_with_name (_("Couldn't get floating point status"));
 
       m68kbsd_collect_fpregset (regcache, &fpregs, regnum);
 
-      if (ptrace (PT_SETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
+      if (ptrace (PT_SETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs,  ptid_get_lwp (inferior_ptid)) == -1)
 	perror_with_name (_("Couldn't write floating point status"));
     }
 }

cvs diff -r1.3 -r1.4 src/external/gpl3/gdb/dist/gdb/vax-bsd-nat.c (expand / switch to context diff)
--- src/external/gpl3/gdb/dist/gdb/vax-bsd-nat.c 2017/11/29 21:35:26 1.3
+++ src/external/gpl3/gdb/dist/gdb/vax-bsd-nat.c 2017/11/30 00:13:29 1.4
@@ -72,7 +72,7 @@
   struct reg regs;
   pid_t pid = ptid_get_pid (regcache_get_ptid (regcache));
 
-  if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, 0) == -1)
+  if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs,  ptid_get_lwp (inferior_ptid)) == -1)
     perror_with_name (_("Couldn't get registers"));
 
   vaxbsd_supply_gregset (regcache, &regs);
@@ -88,12 +88,12 @@
   struct reg regs;
   pid_t pid = ptid_get_pid (regcache_get_ptid (regcache));
 
-  if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, 0) == -1)
+  if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs,  ptid_get_lwp (inferior_ptid)) == -1)
     perror_with_name (_("Couldn't get registers"));
 
   vaxbsd_collect_gregset (regcache, &regs, regnum);
 
-  if (ptrace (PT_SETREGS, pid, (PTRACE_TYPE_ARG3) &regs, 0) == -1)
+  if (ptrace (PT_SETREGS, pid, (PTRACE_TYPE_ARG3) &regs,  ptid_get_lwp (inferior_ptid)) == -1)
     perror_with_name (_("Couldn't write registers"));
 }