Error when gdb_is_target_1 is called without running gdb instance
[binutils-gdb.git] / gdb / ppc-netbsd-nat.c
index 6ecff11823807b6667584ad12a6e4e62e5235c0f..fb2dce501a4c70f4a90dec59b42e348eb9cb2ba3 100644 (file)
@@ -1,6 +1,6 @@
 /* Native-dependent code for NetBSD/powerpc.
 
-   Copyright (C) 2002-2020 Free Software Foundation, Inc.
+   Copyright (C) 2002-2022 Free Software Foundation, Inc.
 
    Contributed by Wasabi Systems, Inc.
 
@@ -52,14 +52,14 @@ static ppc_nbsd_nat_target the_ppc_nbsd_nat_target;
 static int
 getregs_supplies (struct gdbarch *gdbarch, int regnum)
 {
-  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+  ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
 
   return ((regnum >= tdep->ppc_gp0_regnum
-           && regnum < tdep->ppc_gp0_regnum + ppc_num_gprs)
-          || regnum == tdep->ppc_lr_regnum
-          || regnum == tdep->ppc_cr_regnum
-          || regnum == tdep->ppc_xer_regnum
-          || regnum == tdep->ppc_ctr_regnum
+          && regnum < tdep->ppc_gp0_regnum + ppc_num_gprs)
+         || regnum == tdep->ppc_lr_regnum
+         || regnum == tdep->ppc_cr_regnum
+         || regnum == tdep->ppc_xer_regnum
+         || regnum == tdep->ppc_ctr_regnum
          || regnum == gdbarch_pc_regnum (gdbarch));
 }
 
@@ -68,7 +68,7 @@ getregs_supplies (struct gdbarch *gdbarch, int regnum)
 static int
 getfpregs_supplies (struct gdbarch *gdbarch, int regnum)
 {
-  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+  ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
 
   /* FIXME: jimb/2004-05-05: Some PPC variants don't have floating
      point registers.  Traditionally, GDB's register set has still
@@ -83,7 +83,7 @@ getfpregs_supplies (struct gdbarch *gdbarch, int regnum)
   gdb_assert (ppc_floating_point_unit_p (gdbarch));
 
   return ((regnum >= tdep->ppc_fp0_regnum
-           && regnum < tdep->ppc_fp0_regnum + ppc_num_fprs)
+          && regnum < tdep->ppc_fp0_regnum + ppc_num_fprs)
          || regnum == tdep->ppc_fpscr_regnum);
 }
 
@@ -99,7 +99,7 @@ ppc_nbsd_nat_target::fetch_registers (struct regcache *regcache, int regnum)
       struct reg regs;
 
       if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, lwp) == -1)
-        perror_with_name (_("Couldn't get registers"));
+       perror_with_name (_("Couldn't get registers"));
 
       ppc_supply_gregset (&ppcnbsd_gregset, regcache,
                          regnum, &regs, sizeof regs);
@@ -159,7 +159,7 @@ ppcnbsd_supply_pcb (struct regcache *regcache, struct pcb *pcb)
   struct switchframe sf;
   struct callframe cf;
   struct gdbarch *gdbarch = regcache->arch ();
-  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+  ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
   int i;
 
   /* The stack pointer shouldn't be zero.  */