X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=gdb%2Ftilegx-linux-nat.c;h=ac40baf4482c65518cc6867f549e2027c33913df;hb=b899eb3bb807be1094fde9a2f1c8628232bc0743;hp=c5c3a14352dac9792e33b1e4c4b1bac9fc5debae;hpb=481695ed5f6e0a8a9c9c50bfac1cdd2b3151e6c9;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/tilegx-linux-nat.c b/gdb/tilegx-linux-nat.c index c5c3a14352..ac40baf448 100644 --- a/gdb/tilegx-linux-nat.c +++ b/gdb/tilegx-linux-nat.c @@ -1,6 +1,6 @@ /* Native-dependent code for GNU/Linux TILE-Gx. - Copyright (C) 2012-2017 Free Software Foundation, Inc. + Copyright (C) 2012-2020 Free Software Foundation, Inc. This file is part of GDB. @@ -34,6 +34,16 @@ /* Prototypes for supply_gregset etc. */ #include "gregset.h" +class tilegx_linux_nat_target final : public linux_nat_target +{ +public: + /* Add our register access methods. */ + void fetch_registers (struct regcache *, int) override; + void store_registers (struct regcache *, int) override; +}; + +static tilegx_linux_nat_target the_tilegx_linux_nat_target; + /* The register sets used in GNU/Linux ELF core-dumps are identical to the register sets in `struct user' that is used for a.out core-dumps, and is also used by `ptrace'. The corresponding types @@ -78,7 +88,7 @@ supply_gregset (struct regcache* regcache, for (i = 0; i < sizeof (regmap) / sizeof (regmap[0]); i++) if (regmap[i] >= 0) - regcache_raw_supply (regcache, i, regp + regmap[i]); + regcache->raw_supply (i, regp + regmap[i]); } /* Fill registers in *GREGSETPS with the values in GDB's @@ -93,7 +103,7 @@ fill_gregset (const struct regcache* regcache, for (i = 0; i < sizeof (regmap) / sizeof (regmap[0]); i++) if (regmap[i] >= 0) - regcache_raw_collect (regcache, i, regp + regmap[i]); + regcache->raw_collect (i, regp + regmap[i]); } /* Transfering floating-point registers between GDB, inferiors and cores. */ @@ -122,12 +132,12 @@ fill_fpregset (const struct regcache *regcache, /* Fetch register REGNUM from the inferior. If REGNUM is -1, do this for all registers. */ -static void -fetch_inferior_registers (struct target_ops *ops, - struct regcache *regcache, int regnum) +void +tilegx_linux_nat_target::fetch_registers (struct regcache *regcache, + int regnum) { elf_gregset_t regs; - pid_t tid = get_ptrace_pid (regcache_get_ptid (regcache)); + pid_t tid = get_ptrace_pid (regcache->ptid ()); if (ptrace (PTRACE_GETREGS, tid, 0, (PTRACE_TYPE_ARG3) ®s) < 0) perror_with_name (_("Couldn't get registers")); @@ -138,12 +148,12 @@ fetch_inferior_registers (struct target_ops *ops, /* Store register REGNUM back into the inferior. If REGNUM is -1, do this for all registers. */ -static void -store_inferior_registers (struct target_ops *ops, - struct regcache *regcache, int regnum) +void +tilegx_linux_nat_target::store_registers (struct regcache *regcache, + int regnum) { elf_gregset_t regs; - pid_t tid = get_ptrace_pid (regcache_get_ptid (regcache)); + pid_t tid = get_ptrace_pid (regcache->ptid ()); if (ptrace (PTRACE_GETREGS, tid, 0, (PTRACE_TYPE_ARG3) ®s) < 0) perror_with_name (_("Couldn't get registers")); @@ -157,15 +167,6 @@ store_inferior_registers (struct target_ops *ops, void _initialize_tile_linux_nat (void) { - struct target_ops *t; - - /* Fill in the generic GNU/Linux methods. */ - t = linux_target (); - - /* Add our register access methods. */ - t->to_fetch_registers = fetch_inferior_registers; - t->to_store_registers = store_inferior_registers; - - /* Register the target. */ - linux_nat_add_target (t); + linux_target = &the_tilegx_linux_nat_target; + add_inf_child_target (&the_tilegx_linux_nat_target); }