Automatic date update in version.in
[deliverable/binutils-gdb.git] / gdb / vax-bsd-nat.c
index 527d718fc9f0e0ed1f68825fa064547f00cc9d3e..bffcfb954560f7af942201be4f5df5b90367ac97 100644 (file)
@@ -1,6 +1,6 @@
 /* Native-dependent code for modern VAX BSD's.
 
-   Copyright (C) 2004-2018 Free Software Foundation, Inc.
+   Copyright (C) 2004-2021 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -17,6 +17,8 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+/* We define this to get types like register_t.  */
+#define _KERNTYPES
 #include "defs.h"
 #include "inferior.h"
 #include "regcache.h"
@@ -28,8 +30,9 @@
 
 #include "vax-tdep.h"
 #include "inf-ptrace.h"
+#include "netbsd-nat.h"
 
-struct vax_bsd_nat_target final : public inf_ptrace_target
+struct vax_bsd_nat_target final : public nbsd_nat_target
 {
   void fetch_registers (struct regcache *, int) override;
   void store_registers (struct regcache *, int) override;
@@ -42,7 +45,7 @@ static vax_bsd_nat_target the_vax_bsd_nat_target;
 static void
 vaxbsd_supply_gregset (struct regcache *regcache, const void *gregs)
 {
-  const gdb_byte *regs = gregs;
+  const gdb_byte *regs = (const gdb_byte *)gregs;
   int regnum;
 
   for (regnum = 0; regnum < VAX_NUM_REGS; regnum++)
@@ -56,13 +59,13 @@ static void
 vaxbsd_collect_gregset (const struct regcache *regcache,
                        void *gregs, int regnum)
 {
-  gdb_byte *regs = gregs;
+  gdb_byte *regs = (void *)gregs;
   int i;
 
   for (i = 0; i <= VAX_NUM_REGS; i++)
     {
       if (regnum == -1 || regnum == i)
-       regcache_raw_collect (regcache, i, regs + i * 4);
+       regcache->raw_collect (i, regs + i * 4);
     }
 }
 \f
@@ -74,9 +77,10 @@ void
 vax_bsd_nat_target::fetch_registers (struct regcache *regcache, int regnum)
 {
   struct reg regs;
-  pid_t pid = ptid_get_pid (regcache->ptid ());
+  pid_t pid = regcache->ptid ().pid ();
+  int lwp = regcache->ptid ().lwp ();
 
-  if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, 0) == -1)
+  if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, lwp) == -1)
     perror_with_name (_("Couldn't get registers"));
 
   vaxbsd_supply_gregset (regcache, &regs);
@@ -89,14 +93,15 @@ void
 vax_bsd_nat_target::store_registers (struct regcache *regcache, int regnum)
 {
   struct reg regs;
-  pid_t pid = ptid_get_pid (regcache->ptid ());
+  pid_t pid = regcache->ptid ().pid ();
+  int lwp = regcache->ptid ().lwp ();
 
-  if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, 0) == -1)
+  if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, lwp) == -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, lwp) == -1)
     perror_with_name (_("Couldn't write registers"));
 }
 \f
@@ -132,8 +137,9 @@ vaxbsd_supply_pcb (struct regcache *regcache, struct pcb *pcb)
   return 1;
 }
 
+void _initialize_vaxbsd_nat ();
 void
-_initialize_vaxbsd_nat (void)
+_initialize_vaxbsd_nat ()
 {
   add_inf_child_target (&the_vax_bsd_nat_target);
 
This page took 0.027944 seconds and 4 git commands to generate.