Module Name: src Committed By: christos Date: Thu May 30 01:19:36 UTC 2019
Modified Files: src/external/gpl3/gdb/dist/gdb: aarch64-nbsd-nat.c alpha-bsd-nat.c arm-nbsd-nat.c hppa-nbsd-nat.c i386-bsd-nat.c m68k-bsd-nat.c mips-nbsd-nat.c ppc-nbsd-nat.c sh-nbsd-nat.c sparc-nat.c sparc-nbsd-nat.c sparc64-nbsd-nat.c vax-bsd-nat.c x86-bsd-nat.c Log Message: more cleanups and homogenization To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/external/gpl3/gdb/dist/gdb/aarch64-nbsd-nat.c cvs rdiff -u -r1.7 -r1.8 src/external/gpl3/gdb/dist/gdb/alpha-bsd-nat.c \ src/external/gpl3/gdb/dist/gdb/mips-nbsd-nat.c cvs rdiff -u -r1.9 -r1.10 src/external/gpl3/gdb/dist/gdb/arm-nbsd-nat.c cvs rdiff -u -r1.6 -r1.7 src/external/gpl3/gdb/dist/gdb/hppa-nbsd-nat.c \ src/external/gpl3/gdb/dist/gdb/ppc-nbsd-nat.c \ src/external/gpl3/gdb/dist/gdb/sh-nbsd-nat.c \ src/external/gpl3/gdb/dist/gdb/sparc-nbsd-nat.c \ src/external/gpl3/gdb/dist/gdb/sparc64-nbsd-nat.c \ src/external/gpl3/gdb/dist/gdb/vax-bsd-nat.c \ src/external/gpl3/gdb/dist/gdb/x86-bsd-nat.c cvs rdiff -u -r1.4 -r1.5 src/external/gpl3/gdb/dist/gdb/i386-bsd-nat.c cvs rdiff -u -r1.5 -r1.6 src/external/gpl3/gdb/dist/gdb/m68k-bsd-nat.c cvs rdiff -u -r1.13 -r1.14 src/external/gpl3/gdb/dist/gdb/sparc-nat.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/external/gpl3/gdb/dist/gdb/aarch64-nbsd-nat.c diff -u src/external/gpl3/gdb/dist/gdb/aarch64-nbsd-nat.c:1.3 src/external/gpl3/gdb/dist/gdb/aarch64-nbsd-nat.c:1.4 --- src/external/gpl3/gdb/dist/gdb/aarch64-nbsd-nat.c:1.3 Wed May 29 18:10:38 2019 +++ src/external/gpl3/gdb/dist/gdb/aarch64-nbsd-nat.c Wed May 29 21:19:36 2019 @@ -36,6 +36,14 @@ /* Determine if PT_GETREGS fetches REGNUM. */ +struct aarch64_nbsd_nat_target final : public nbsd_nat_target +{ + void fetch_registers (struct regcache *, int) override; + void store_registers (struct regcache *, int) override; +}; + +static aarch64_nbsd_nat_target the_aarch64_nbsd_nat_target; + static bool getregs_supplies (struct gdbarch *gdbarch, int regnum) { @@ -50,23 +58,19 @@ getfpregs_supplies (struct gdbarch *gdba return (regnum >= AARCH64_V0_REGNUM && regnum <= AARCH64_FPCR_REGNUM); } -/* Fetch register REGNUM from the inferior. If REGNUM is -1, do this - for all registers. */ - -static void -aarch64_nbsd_fetch_inferior_registers (struct target_ops *ops, - struct regcache *regcache, int regnum) -{ - ptid_t ptid = regcache_get_ptid (regcache); - pid_t pid = ptid_get_pid (ptid); - int tid = ptid_get_lwp (ptid); +void +aarch64_nbsd_nat_target::fetch_registers (struct regcache *regcache, int regno) +{ + ptid_t ptid = regcache->ptid (); + pid_t pid = ptid.pid (); + int lwp = ptid.lwp (); struct gdbarch *gdbarch = regcache->arch (); if (regnum == -1 || getregs_supplies (gdbarch, regnum)) { struct reg regs; - if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) ®s, tid) == -1) + if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) ®s, lwp) == -1) perror_with_name (_("Couldn't get registers")); regcache_supply_regset (&aarch64_nbsd_gregset, regcache, regnum, ®s, @@ -77,7 +81,7 @@ aarch64_nbsd_fetch_inferior_registers (s { struct fpreg fpregs; - if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, tid) == -1) + if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, lwp) == -1) perror_with_name (_("Couldn't get floating point status")); regcache_supply_regset (&aarch64_nbsd_fpregset, regcache, regnum, &fpregs, @@ -88,20 +92,19 @@ aarch64_nbsd_fetch_inferior_registers (s /* Store register REGNUM back into the inferior. If REGNUM is -1, do this for all registers. */ -static void -aarch64_nbsd_store_inferior_registers (struct target_ops *ops, - struct regcache *regcache, int regnum) -{ - ptid_t ptid = regcache_get_ptid (regcache); - pid_t pid = ptid_get_pid (ptid); - int tid = ptid_get_lwp (ptid); +void +aarch64_nbsd_nat_target::store_registers (struct regcache *regcache, int regno) +{ + ptid_t ptid = regcache->ptid (); + pid_t pid = ptid.pid (); + int lwp = ptid.lwp (); struct gdbarch *gdbarch = regcache->arch (); if (regnum == -1 || getregs_supplies (gdbarch, regnum)) { struct reg regs; - if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) ®s, tid) == -1) + if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) ®s, lwp) == -1) perror_with_name (_("Couldn't get registers")); regcache_collect_regset (&aarch64_nbsd_gregset, regcache,regnum, ®s, @@ -173,12 +176,7 @@ aarch64_nbsd_supply_pcb (struct regcache void _initialize_aarch64_nbsd_nat (void) { - struct target_ops *t; - - t = inf_ptrace_target (); - t->to_fetch_registers = aarch64_nbsd_fetch_inferior_registers; - t->to_store_registers = aarch64_nbsd_store_inferior_registers; - nbsd_nat_add_target (t); + add_inf_child_target (&the_aarch64_nbsd_nat_target); /* Support debugging kernel virtual memory images. */ bsd_kvm_add_target (aarch64_nbsd_supply_pcb); Index: src/external/gpl3/gdb/dist/gdb/alpha-bsd-nat.c diff -u src/external/gpl3/gdb/dist/gdb/alpha-bsd-nat.c:1.7 src/external/gpl3/gdb/dist/gdb/alpha-bsd-nat.c:1.8 --- src/external/gpl3/gdb/dist/gdb/alpha-bsd-nat.c:1.7 Tue May 28 11:30:39 2019 +++ src/external/gpl3/gdb/dist/gdb/alpha-bsd-nat.c Wed May 29 21:19:36 2019 @@ -47,7 +47,12 @@ typedef struct fpreg fpregset_t; #include "gregset.h" +#ifdef __NetBSD__ +#include nbsd-nat.h" +struct alpha_bsd_nat_target final : public nbsd_nat_target +#else struct alpha_bsd_nat_target final : public inf_ptrace_target +#endif { void fetch_registers (struct regcache *, int) override; void store_registers (struct regcache *, int) override; @@ -98,12 +103,15 @@ getregs_supplies (int regno) void alpha_bsd_nat_target::fetch_registers (struct regcache *regcache, int regno) { + ptid_t ptid = regcache->ptid (); + pid_t pid = ptid.pid (); + int lwp = ptid.lwp (); + if (regno == -1 || getregs_supplies (regno)) { struct reg gregs; - if (ptrace (PT_GETREGS, regcache->ptid ().pid (), - (PTRACE_TYPE_ARG3) &gregs, inferior_ptid.lwp ()) == -1) + if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &gregs, lwp) == -1) perror_with_name (_("Couldn't get registers")); alphabsd_supply_reg (regcache, (char *) &gregs, regno); @@ -116,8 +124,7 @@ alpha_bsd_nat_target::fetch_registers (s { struct fpreg fpregs; - if (ptrace (PT_GETFPREGS, regcache->ptid ().pid (), - (PTRACE_TYPE_ARG3) &fpregs, inferior_ptid.lwp ()) == -1) + if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, lwp) == -1) perror_with_name (_("Couldn't get floating point status")); alphabsd_supply_fpreg (regcache, (char *) &fpregs, regno); @@ -130,17 +137,20 @@ alpha_bsd_nat_target::fetch_registers (s void alpha_bsd_nat_target::store_registers (struct regcache *regcache, int regno) { + ptid_t ptid = regcache->ptid (); + pid_t pid = ptid.pid (); + int lwp = ptid.lwp (); + if (regno == -1 || getregs_supplies (regno)) { struct reg gregs; - if (ptrace (PT_GETREGS, regcache->ptid ().pid (), - (PTRACE_TYPE_ARG3) &gregs, inferior_ptid.lwp ()) == -1) + if (ptrace (PT_GETREGS, pid, + (PTRACE_TYPE_ARG3) &gregs, lwp) == -1) perror_with_name (_("Couldn't get registers")); alphabsd_fill_reg (regcache, (char *) &gregs, regno); - if (ptrace (PT_SETREGS, regcache->ptid ().pid (), - (PTRACE_TYPE_ARG3) &gregs, inferior_ptid.lwp ()) == -1) + if (ptrace (PT_SETREGS, pid, (PTRACE_TYPE_ARG3) &gregs, lwp) == -1) perror_with_name (_("Couldn't write registers")); if (regno != -1) @@ -152,14 +162,13 @@ alpha_bsd_nat_target::store_registers (s { struct fpreg fpregs; - if (ptrace (PT_GETFPREGS, regcache->ptid ().pid (), - (PTRACE_TYPE_ARG3) &fpregs, inferior_ptid.lwp ()) == -1) + if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, lwp) == -1) perror_with_name (_("Couldn't get floating point status")); alphabsd_fill_fpreg (regcache, (char *) &fpregs, regno); - if (ptrace (PT_SETFPREGS, regcache->ptid ().pid (), - (PTRACE_TYPE_ARG3) &fpregs, inferior_ptid.lwp ()) == -1) + if (ptrace (PT_SETFPREGS, pid, + (PTRACE_TYPE_ARG3) &fpregs, lwp) == -1) perror_with_name (_("Couldn't write floating point status")); } } Index: src/external/gpl3/gdb/dist/gdb/mips-nbsd-nat.c diff -u src/external/gpl3/gdb/dist/gdb/mips-nbsd-nat.c:1.7 src/external/gpl3/gdb/dist/gdb/mips-nbsd-nat.c:1.8 --- src/external/gpl3/gdb/dist/gdb/mips-nbsd-nat.c:1.7 Tue May 28 11:30:39 2019 +++ src/external/gpl3/gdb/dist/gdb/mips-nbsd-nat.c Wed May 29 21:19:36 2019 @@ -46,7 +46,7 @@ typedef struct fpreg fpregset_t; #include "machine/pcb.h" -class mips_nbsd_nat_target final : public inf_ptrace_target +class mips_nbsd_nat_target final : public nbsd_nat_target { void fetch_registers (struct regcache *, int) override; void store_registers (struct regcache *, int) override; @@ -65,15 +65,16 @@ getregs_supplies (struct gdbarch *gdbarc void mips_nbsd_nat_target::fetch_registers (struct regcache *regcache, int regno) { - pid_t pid = regcache->ptid ().pid (); + ptid_t ptid = regcache->ptid (); + pid_t pid = ptid.pid (); + int lwp = ptid.lwp (); struct gdbarch *gdbarch = regcache->arch (); if (regno == -1 || getregs_supplies (gdbarch, regno)) { struct reg regs; - if (ptrace (PT_GETREGS, ptid_get_pid (inferior_ptid), - (PTRACE_TYPE_ARG3) ®s, inferior_ptid.lwp ()) == -1) + if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) ®s, lwp) == -1) perror_with_name (_("Couldn't get registers")); mipsnbsd_supply_reg (regcache, (char *) ®s, regno); @@ -86,8 +87,7 @@ mips_nbsd_nat_target::fetch_registers (s { struct fpreg fpregs; - if (ptrace (PT_GETFPREGS, ptid_get_pid (inferior_ptid), - (PTRACE_TYPE_ARG3) &fpregs, inferior_ptid.lwp ()) == -1) + if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, lwp) == -1) perror_with_name (_("Couldn't get floating point status")); mipsnbsd_supply_fpreg (regcache, (char *) &fpregs, regno); @@ -97,21 +97,21 @@ mips_nbsd_nat_target::fetch_registers (s void mips_nbsd_nat_target::store_registers (struct regcache *regcache, int regno) { - pid_t pid = regcache->ptid ().pid (); + ptid_t ptid = regcache->ptid (); + pid_t pid = ptid.pid (); + int lwp = ptid.lwp (); struct gdbarch *gdbarch = regcache->arch (); if (regno == -1 || getregs_supplies (gdbarch, regno)) { struct reg regs; - if (ptrace (PT_GETREGS, ptid_get_pid (inferior_ptid), - (PTRACE_TYPE_ARG3) ®s, inferior_ptid.lwp ()) == -1) + if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) ®s, lwp) == -1) perror_with_name (_("Couldn't get registers")); mipsnbsd_fill_reg (regcache, (char *) ®s, regno); - if (ptrace (PT_SETREGS, ptid_get_pid (inferior_ptid), - (PTRACE_TYPE_ARG3) ®s, inferior_ptid.lwp ()) == -1) + if (ptrace (PT_SETREGS, pid, (PTRACE_TYPE_ARG3) ®s, lwp) == -1) perror_with_name (_("Couldn't write registers")); if (regno != -1) @@ -123,14 +123,12 @@ mips_nbsd_nat_target::store_registers (s { struct fpreg fpregs; - if (ptrace (PT_GETFPREGS, ptid_get_pid (inferior_ptid), - (PTRACE_TYPE_ARG3) &fpregs, inferior_ptid.lwp ()) == -1) + if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, lwp) == -1) perror_with_name (_("Couldn't get floating point status")); mipsnbsd_fill_fpreg (regcache, (char *) &fpregs, regno); - if (ptrace (PT_SETFPREGS, ptid_get_pid (inferior_ptid), - (PTRACE_TYPE_ARG3) &fpregs, inferior_ptid.lwp ()) == -1) + if (ptrace (PT_SETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, lwp) == -1) perror_with_name (_("Couldn't write floating point status")); } } Index: src/external/gpl3/gdb/dist/gdb/arm-nbsd-nat.c diff -u src/external/gpl3/gdb/dist/gdb/arm-nbsd-nat.c:1.9 src/external/gpl3/gdb/dist/gdb/arm-nbsd-nat.c:1.10 --- src/external/gpl3/gdb/dist/gdb/arm-nbsd-nat.c:1.9 Wed May 29 18:10:38 2019 +++ src/external/gpl3/gdb/dist/gdb/arm-nbsd-nat.c Wed May 29 21:19:36 2019 @@ -50,7 +50,7 @@ typedef struct fpreg fpregset_t; #include "gregset.h" -class arm_netbsd_nat_target final : public inf_ptrace_target +class arm_nbsd_nat_target final : public nbsd_nat_target { public: /* Add our register access methods. */ @@ -58,7 +58,7 @@ public: void store_registers (struct regcache *, int) override; }; -static arm_netbsd_nat_target the_arm_netbsd_nat_target; +static arm_nbsd_nat_target the_arm_nbsd_nat_target; extern int arm_apcs_32; @@ -136,20 +136,21 @@ arm_supply_vfpregset (struct regcache *r int regno; for (regno = ARM_F0_REGNUM; regno <= ARM_F7_REGNUM; regno++) - regcache->raw_supply (regno, - (char *) &fparegset->fpr[regno - ARM_F0_REGNUM]); + regcache->raw_supply (regno, (char *) &fparegset->fpr[regno - ARM_F0_REGNUM]); regcache->raw_supply (ARM_FPS_REGNUM, (char *) &fparegset->fpr_fpsr); } static void -fetch_register (struct regcache *regcache, int regno) +arm_nbsd_nat_fetch_register (struct regcache *regcache, int regno) { - struct reg inferior_registers; + struct reg regs; + ptid_t ptid = regcache->ptid (); + pid_t pid = ptid.pid (); + int lwp = ptid.lwp (); int ret; - ret = ptrace (PT_GETREGS, regcache->ptid ().pid (), - (PTRACE_TYPE_ARG3) &inferior_registers, inferior_ptid.lwp ()); + ret = ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) ®s, lwp); if (ret < 0) { @@ -160,32 +161,28 @@ fetch_register (struct regcache *regcach switch (regno) { case ARM_SP_REGNUM: - regcache->raw_supply (ARM_SP_REGNUM, (char *) &inferior_registers.r_sp); + regcache->raw_supply (ARM_SP_REGNUM, (char *) ®s.r_sp); break; case ARM_LR_REGNUM: - regcache->raw_supply (ARM_LR_REGNUM, (char *) &inferior_registers.r_lr); + regcache->raw_supply (ARM_LR_REGNUM, (char *) ®s.r_lr); break; case ARM_PC_REGNUM: /* This is ok: we're running native... */ - inferior_registers.r_pc = gdbarch_addr_bits_remove - (regcache->arch (), - inferior_registers.r_pc); - regcache->raw_supply (ARM_PC_REGNUM, (char *) &inferior_registers.r_pc); + regs.r_pc = gdbarch_addr_bits_remove (regcache->arch (), regs.r_pc); + regcache->raw_supply (ARM_PC_REGNUM, (char *) ®s.r_pc); break; case ARM_PS_REGNUM: if (arm_apcs_32) - regcache->raw_supply (ARM_PS_REGNUM, - (char *) &inferior_registers.r_cpsr); + regcache->raw_supply (ARM_PS_REGNUM, (char *) ®s.r_cpsr); else - regcache->raw_supply (ARM_PS_REGNUM, - (char *) &inferior_registers.r_pc); + regcache->raw_supply (ARM_PS_REGNUM, (char *) ®s.r_pc); break; default: - regcache->raw_supply (regno, (char *) &inferior_registers.r[regno]); + regcache->raw_supply (regno, (char *) ®s.r[regno]); break; } } @@ -193,12 +190,14 @@ fetch_register (struct regcache *regcach static void fetch_regs (struct regcache *regcache) { - struct reg inferior_registers; + ptid_t ptid = regcache->ptid (); + pid_t pid = ptid.pid (); + int lwp = ptid.lwp (); + struct reg regs; int ret; int regno; - ret = ptrace (PT_GETREGS, regcache->ptid ().pid (), - (PTRACE_TYPE_ARG3) &inferior_registers, inferior_ptid.lwp ()); + ret = ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) ®s, lwp); if (ret < 0) { @@ -206,17 +205,17 @@ fetch_regs (struct regcache *regcache) return; } - arm_supply_gregset (regcache, &inferior_registers); + arm_supply_gregset (regcache, ®s); } static void fetch_fp_register (struct regcache *regcache, int regno) { - struct fpreg inferior_fp_registers; + struct fpreg fpregs; int ret; - ret = ptrace (PT_GETFPREGS, regcache->ptid ().pid (), - (PTRACE_TYPE_ARG3) &inferior_fp_registers, inferior_ptid.lwp ()); + ret = ptrace (PT_GETFPREGS, pid, + (PTRACE_TYPE_ARG3) &fpregs, lwp); if (ret < 0) { @@ -228,12 +227,12 @@ fetch_fp_register (struct regcache *regc { case ARM_FPS_REGNUM: regcache->raw_supply (ARM_FPS_REGNUM, - (char *) &inferior_fp_registers.fpr_fpsr); + (char *) &fpregs.fpr_fpsr); break; default: regcache->raw_supply - (regno, (char *) &inferior_fp_registers.fpr[regno - ARM_F0_REGNUM]); + (regno, (char *) &fpregs.fpr[regno - ARM_F0_REGNUM]); break; } } @@ -241,11 +240,13 @@ fetch_fp_register (struct regcache *regc static void fetch_fp_regs (struct regcache *regcache) { - struct fpreg inferior_fp_registers; + ptid_t ptid = regcache->ptid (); + pid_t pid = ptid.pid (); + int lwp = ptid.lwp (); + struct fpreg fpregs; int ret; - ret = ptrace (PT_GETFPREGS, regcache->ptid ().pid (), - (PTRACE_TYPE_ARG3) &inferior_fp_registers, inferior_ptid.lwp ()); + ret = ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, lwp); if (ret < 0) { @@ -253,7 +254,7 @@ fetch_fp_regs (struct regcache *regcache return; } - arm_supply_vfpregset (regcache, &inferior_fp_registers); + arm_supply_vfpregset (regcache, &fpregs); } void @@ -278,11 +279,13 @@ static void store_register (const struct regcache *regcache, int regno) { struct gdbarch *gdbarch = regcache->arch (); - struct reg inferior_registers; + struct reg regs; int ret; + ptid_t ptid = regcache->ptid (); + pid_t pid = ptid.pid (); + int lwp = ptid.lwp (); - ret = ptrace (PT_GETREGS, regcache->ptid ().pid (), - (PTRACE_TYPE_ARG3) &inferior_registers, inferior_ptid.lwp ()); + ret = ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) ®s, lwp); if (ret < 0) { @@ -293,17 +296,16 @@ store_register (const struct regcache *r switch (regno) { case ARM_SP_REGNUM: - regcache->raw_collect (ARM_SP_REGNUM, (char *) &inferior_registers.r_sp); + regcache->raw_collect (ARM_SP_REGNUM, (char *) ®s.r_sp); break; case ARM_LR_REGNUM: - regcache->raw_collect (ARM_LR_REGNUM, (char *) &inferior_registers.r_lr); + regcache->raw_collect (ARM_LR_REGNUM, (char *) ®s.r_lr); break; case ARM_PC_REGNUM: if (arm_apcs_32) - regcache->raw_collect (ARM_PC_REGNUM, - (char *) &inferior_registers.r_pc); + regcache->raw_collect (ARM_PC_REGNUM, (char *) ®s.r_pc); else { unsigned pc_val; @@ -311,16 +313,14 @@ store_register (const struct regcache *r regcache->raw_collect (ARM_PC_REGNUM, (char *) &pc_val); pc_val = gdbarch_addr_bits_remove (gdbarch, pc_val); - inferior_registers.r_pc ^= gdbarch_addr_bits_remove - (gdbarch, inferior_registers.r_pc); - inferior_registers.r_pc |= pc_val; + regs.r_pc ^= gdbarch_addr_bits_remove (gdbarch, regs.r_pc); + regs.r_pc |= pc_val; } break; case ARM_PS_REGNUM: if (arm_apcs_32) - regcache->raw_collect (ARM_PS_REGNUM, - (char *) &inferior_registers.r_cpsr); + regcache->raw_collect (ARM_PS_REGNUM, (char *) ®s.r_cpsr); else { unsigned psr_val; @@ -328,19 +328,17 @@ store_register (const struct regcache *r regcache->raw_collect (ARM_PS_REGNUM, (char *) &psr_val); psr_val ^= gdbarch_addr_bits_remove (gdbarch, psr_val); - inferior_registers.r_pc = gdbarch_addr_bits_remove - (gdbarch, inferior_registers.r_pc); - inferior_registers.r_pc |= psr_val; + regs.r_pc = gdbarch_addr_bits_remove (gdbarch, regs.r_pc); + regs.r_pc |= psr_val; } break; default: - regcache->raw_collect (regno, (char *) &inferior_registers.r[regno]); + regcache->raw_collect (regno, (char *) ®s.r[regno]); break; } - ret = ptrace (PT_SETREGS, regcache->ptid ().pid (), - (PTRACE_TYPE_ARG3) &inferior_registers, inferior_ptid.lwp ()); + ret = ptrace (PT_SETREGS, pid, (PTRACE_TYPE_ARG3) ®s, lwp); if (ret < 0) warning (_("unable to write register %d to inferior"), regno); @@ -350,22 +348,24 @@ static void store_regs (const struct regcache *regcache) { struct gdbarch *gdbarch = regcache->arch (); - struct reg inferior_registers; + ptid_t ptid = regcache->ptid (); + pid_t pid = ptid.pid (); + int lwp = ptid.lwp (); + struct reg regs; int ret; int regno; for (regno = ARM_A1_REGNUM; regno < ARM_SP_REGNUM; regno++) - regcache->raw_collect (regno, (char *) &inferior_registers.r[regno]); + regcache->raw_collect (regno, (char *) ®s.r[regno]); - regcache->raw_collect (ARM_SP_REGNUM, (char *) &inferior_registers.r_sp); - regcache->raw_collect (ARM_LR_REGNUM, (char *) &inferior_registers.r_lr); + regcache->raw_collect (ARM_SP_REGNUM, (char *) ®s.r_sp); + regcache->raw_collect (ARM_LR_REGNUM, (char *) ®s.r_lr); if (arm_apcs_32) { - regcache->raw_collect (ARM_PC_REGNUM, (char *) &inferior_registers.r_pc); - regcache->raw_collect (ARM_PS_REGNUM, - (char *) &inferior_registers.r_cpsr); + regcache->raw_collect (ARM_PC_REGNUM, (char *) ®s.r_pc); + regcache->raw_collect (ARM_PS_REGNUM, (char *) ®s.r_cpsr); } else { @@ -378,11 +378,10 @@ store_regs (const struct regcache *regca pc_val = gdbarch_addr_bits_remove (gdbarch, pc_val); psr_val ^= gdbarch_addr_bits_remove (gdbarch, psr_val); - inferior_registers.r_pc = pc_val | psr_val; + regs.r_pc = pc_val | psr_val; } - ret = ptrace (PT_SETREGS, regcache->ptid ().pid (), - (PTRACE_TYPE_ARG3) &inferior_registers, inferior_ptid.lwp ()); + ret = ptrace (PT_SETREGS, pid, (PTRACE_TYPE_ARG3) ®s, lwp); if (ret < 0) warning (_("unable to store general registers")); @@ -391,11 +390,13 @@ store_regs (const struct regcache *regca static void store_fp_register (const struct regcache *regcache, int regno) { - struct fpreg inferior_fp_registers; + struct fpreg fpregs; + ptid_t ptid = regcache->ptid (); + pid_t pid = ptid.pid (); + int lwp = ptid.lwp (); int ret; - ret = ptrace (PT_GETFPREGS, regcache->ptid ().pid (), - (PTRACE_TYPE_ARG3) &inferior_fp_registers, inferior_ptid.lwp ()); + ret = ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, lwp); if (ret < 0) { @@ -406,18 +407,15 @@ store_fp_register (const struct regcache switch (regno) { case ARM_FPS_REGNUM: - regcache->raw_collect (ARM_FPS_REGNUM, - (char *) &inferior_fp_registers.fpr_fpsr); + regcache->raw_collect (ARM_FPS_REGNUM, (char *) &fpregs.fpr_fpsr); break; default: - regcache->raw_collect - (regno, (char *) &inferior_fp_registers.fpr[regno - ARM_F0_REGNUM]); + regcache->raw_collect (regno, (char *) &fpregs.fpr[regno - ARM_F0_REGNUM]); break; } - ret = ptrace (PT_SETFPREGS, regcache->ptid ().pid (), - (PTRACE_TYPE_ARG3) &inferior_fp_registers, inferior_ptid.lwp ()); + ret = ptrace (PT_SETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, lwp); if (ret < 0) warning (_("unable to write register %d to inferior"), regno); @@ -426,20 +424,20 @@ store_fp_register (const struct regcache static void store_fp_regs (const struct regcache *regcache) { - struct fpreg inferior_fp_registers; + ptid_t ptid = regcache->ptid (); + pid_t pid = ptid.pid (); + int lwp = ptid.lwp (); + struct fpreg fpregs; int ret; int regno; for (regno = ARM_F0_REGNUM; regno <= ARM_F7_REGNUM; regno++) - regcache->raw_collect - (regno, (char *) &inferior_fp_registers.fpr[regno - ARM_F0_REGNUM]); + regcache->raw_collect (regno, (char *) &fpregs.fpr[regno - ARM_F0_REGNUM]); - regcache->raw_collect (ARM_FPS_REGNUM, - (char *) &inferior_fp_registers.fpr_fpsr); + regcache->raw_collect (ARM_FPS_REGNUM, (char *) &fpregs.fpr_fpsr); - ret = ptrace (PT_SETFPREGS, regcache->ptid ().pid (), - (PTRACE_TYPE_ARG3) &inferior_fp_registers, inferior_ptid.lwp ()); + ret = ptrace (PT_SETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, lwp); if (ret < 0) warning (_("unable to store floating-point registers")); @@ -542,7 +540,7 @@ static struct core_fns arm_netbsd_elfcor void _initialize_arm_netbsd_nat (void) { - add_inf_child_target (&the_arm_netbsd_nat_target); + add_inf_child_target (&the_arm_nbsd_nat_target); deprecated_add_core_fns (&arm_netbsd_core_fns); deprecated_add_core_fns (&arm_netbsd_elfcore_fns); Index: src/external/gpl3/gdb/dist/gdb/hppa-nbsd-nat.c diff -u src/external/gpl3/gdb/dist/gdb/hppa-nbsd-nat.c:1.6 src/external/gpl3/gdb/dist/gdb/hppa-nbsd-nat.c:1.7 --- src/external/gpl3/gdb/dist/gdb/hppa-nbsd-nat.c:1.6 Tue May 28 11:30:39 2019 +++ src/external/gpl3/gdb/dist/gdb/hppa-nbsd-nat.c Wed May 29 21:19:36 2019 @@ -168,14 +168,15 @@ void hppa_nbsd_nat_target::fetch_registers (struct regcache *regcache, int regnum) { - pid_t pid = regcache->ptid ().pid (); + ptid_t ptid = regcache->ptid (); + pid_t pid = ptid.pid (); + int lwp = ptid.lwp (); if (regnum == -1 || hppanbsd_gregset_supplies_p (regnum)) { struct reg regs; - if (ptrace (PT_GETREGS, ptid_get_pid (inferior_ptid), - (PTRACE_TYPE_ARG3) ®s, inferior_ptid.lwp ()) == -1) + if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) ®s, lwp) == -1) perror_with_name (_("Couldn't get registers")); hppanbsd_supply_gregset (regcache, ®s); @@ -185,8 +186,7 @@ hppa_nbsd_nat_target::fetch_registers (s { struct fpreg fpregs; - if (ptrace (PT_GETFPREGS, ptid_get_pid (inferior_ptid), - (PTRACE_TYPE_ARG3) &fpregs, inferior_ptid.lwp ()) == -1) + if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, lwp) == -1) perror_with_name (_("Couldn't get floating point status")); hppanbsd_supply_fpregset (regcache, &fpregs); @@ -199,20 +199,20 @@ hppa_nbsd_nat_target::fetch_registers (s void hppa_nbsd_nat_target::store_registers (struct regcache *regcache, int regnum) { - pid_t pid = regcache->ptid ().pid (); + ptid_t ptid = regcache->ptid (); + pid_t pid = ptid.pid (); + int lwp = ptid.lwp (); if (regnum == -1 || hppanbsd_gregset_supplies_p (regnum)) { struct reg regs; - if (ptrace (PT_GETREGS, ptid_get_pid (inferior_ptid), - (PTRACE_TYPE_ARG3) ®s, inferior_ptid.lwp ()) == -1) + if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) ®s, lwp) == -1) perror_with_name (_("Couldn't get registers")); hppanbsd_collect_gregset (regcache, ®s, regnum); - if (ptrace (PT_SETREGS, ptid_get_pid (inferior_ptid), - (PTRACE_TYPE_ARG3) ®s, inferior_ptid.lwp ()) == -1) + if (ptrace (PT_SETREGS, pid, (PTRACE_TYPE_ARG3) ®s, lwp) == -1) perror_with_name (_("Couldn't write registers")); } @@ -220,14 +220,12 @@ hppa_nbsd_nat_target::store_registers (s { struct fpreg fpregs; - if (ptrace (PT_GETFPREGS, ptid_get_pid (inferior_ptid), - (PTRACE_TYPE_ARG3) &fpregs, inferior_ptid.lwp ()) == -1) + if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, lwp) == -1) perror_with_name (_("Couldn't get floating point status")); hppanbsd_collect_fpregset (regcache, &fpregs, regnum); - if (ptrace (PT_SETFPREGS, ptid_get_pid (inferior_ptid), - (PTRACE_TYPE_ARG3) &fpregs, inferior_ptid.lwp ()) == -1) + if (ptrace (PT_SETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, lwp) == -1) perror_with_name (_("Couldn't write floating point status")); } } Index: src/external/gpl3/gdb/dist/gdb/ppc-nbsd-nat.c diff -u src/external/gpl3/gdb/dist/gdb/ppc-nbsd-nat.c:1.6 src/external/gpl3/gdb/dist/gdb/ppc-nbsd-nat.c:1.7 --- src/external/gpl3/gdb/dist/gdb/ppc-nbsd-nat.c:1.6 Tue May 28 11:30:39 2019 +++ src/external/gpl3/gdb/dist/gdb/ppc-nbsd-nat.c Wed May 29 21:19:36 2019 @@ -40,7 +40,7 @@ #include "bsd-kvm.h" #include "inf-ptrace.h" -struct ppc_nbsd_nat_target final : public inf_ptrace_target +struct ppc_nbsd_nat_target final : public nbsd_nat_target { void fetch_registers (struct regcache *, int) override; void store_registers (struct regcache *, int) override; @@ -92,14 +92,15 @@ void ppc_nbsd_nat_target::fetch_registers (struct regcache *regcache, int regnum) { struct gdbarch *gdbarch = regcache->arch (); - pid_t pid = regcache->ptid ().pid (); + ptid_t ptid = regcache->ptid (); + pid_t pid = ptid.pid (); + int lwp = ptid.lwp (); if (regnum == -1 || getregs_supplies (gdbarch, regnum)) { struct reg regs; - if (ptrace (PT_GETREGS, ptid_get_pid (inferior_ptid), - (PTRACE_TYPE_ARG3) ®s, inferior_ptid.lwp ()) == -1) + if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) ®s, lwp) == -1) perror_with_name (_("Couldn't get registers")); ppc_supply_gregset (&ppcnbsd_gregset, regcache, @@ -110,8 +111,7 @@ ppc_nbsd_nat_target::fetch_registers (st { struct fpreg fpregs; - if (ptrace (PT_GETFPREGS, ptid_get_pid (inferior_ptid), - (PTRACE_TYPE_ARG3) &fpregs, inferior_ptid.lwp ()) == -1) + if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, lwp) == -1) perror_with_name (_("Couldn't get FP registers")); ppc_supply_fpregset (&ppcnbsd_fpregset, regcache, @@ -123,21 +123,21 @@ void ppc_nbsd_nat_target::store_registers (struct regcache *regcache, int regnum) { struct gdbarch *gdbarch = regcache->arch (); - pid_t pid = regcache->ptid ().pid (); + ptid_t ptid = regcache->ptid (); + pid_t pid = ptid.pid (); + int lwp = ptid.lwp (); if (regnum == -1 || getregs_supplies (gdbarch, regnum)) { struct reg regs; - if (ptrace (PT_GETREGS, ptid_get_pid (inferior_ptid), - (PTRACE_TYPE_ARG3) ®s, inferior_ptid.lwp ()) == -1) + if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) ®s, lwp) == -1) perror_with_name (_("Couldn't get registers")); ppc_collect_gregset (&ppcnbsd_gregset, regcache, regnum, ®s, sizeof regs); - if (ptrace (PT_SETREGS, ptid_get_pid (inferior_ptid), - (PTRACE_TYPE_ARG3) ®s, inferior_ptid.lwp ()) == -1) + if (ptrace (PT_SETREGS, pid, (PTRACE_TYPE_ARG3) ®s, lwp) == -1) perror_with_name (_("Couldn't write registers")); } @@ -145,51 +145,17 @@ ppc_nbsd_nat_target::store_registers (st { struct fpreg fpregs; - if (ptrace (PT_GETFPREGS, ptid_get_pid (inferior_ptid), - (PTRACE_TYPE_ARG3) &fpregs, inferior_ptid.lwp ()) == -1) + if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, lwp) == -1) perror_with_name (_("Couldn't get FP registers")); ppc_collect_fpregset (&ppcnbsd_fpregset, regcache, regnum, &fpregs, sizeof fpregs); - if (ptrace (PT_SETFPREGS, ptid_get_pid (inferior_ptid), - (PTRACE_TYPE_ARG3) &fpregs, inferior_ptid.lwp ()) == -1) + if (ptrace (PT_SETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, lwp) == -1) perror_with_name (_("Couldn't set FP registers")); } } -void -supply_gregset (struct regcache *regcache, const gregset_t *gregs) -{ - if (ptrace (PT_SETREGS, ptid_get_pid (inferior_ptid), - (PTRACE_TYPE_ARG3) gregs, inferior_ptid.lwp ()) == -1) - perror_with_name (_("Couldn't write registers")); -} - -void -supply_fpregset (struct regcache *regcache, const fpregset_t *fpregs) -{ - if (ptrace (PT_SETFPREGS, ptid_get_pid (inferior_ptid), - (PTRACE_TYPE_ARG3) fpregs, inferior_ptid.lwp ()) == -1) - perror_with_name (_("Couldn't set FP registers")); -} - -void -fill_gregset (const struct regcache *regcache, gregset_t *gregs, int regnum) -{ - if (ptrace (PT_GETREGS, ptid_get_pid (inferior_ptid), - (PTRACE_TYPE_ARG3) gregs, inferior_ptid.lwp ()) == -1) - perror_with_name (_("Couldn't get registers")); -} - -void -fill_fpregset (const struct regcache *regcache, fpregset_t *fpregs, int regnum) -{ - if (ptrace (PT_GETFPREGS, ptid_get_pid (inferior_ptid), - (PTRACE_TYPE_ARG3) fpregs, inferior_ptid.lwp ()) == -1) - perror_with_name (_("Couldn't get FP registers")); -} - static int ppcnbsd_supply_pcb (struct regcache *regcache, struct pcb *pcb) { Index: src/external/gpl3/gdb/dist/gdb/sh-nbsd-nat.c diff -u src/external/gpl3/gdb/dist/gdb/sh-nbsd-nat.c:1.6 src/external/gpl3/gdb/dist/gdb/sh-nbsd-nat.c:1.7 --- src/external/gpl3/gdb/dist/gdb/sh-nbsd-nat.c:1.6 Tue May 28 11:30:39 2019 +++ src/external/gpl3/gdb/dist/gdb/sh-nbsd-nat.c Wed May 29 21:19:36 2019 @@ -30,8 +30,9 @@ #include "inf-ptrace.h" #include "regcache.h" #include "inf-ptrace.h" +#include "nbsd-nat.h" -struct sh_nbsd_nat_target final : public inf_ptrace_target +struct sh_nbsd_nat_target final : public nbsd_nat_target { void fetch_registers (struct regcache *, int) override; void store_registers (struct regcache *, int) override; @@ -39,14 +40,6 @@ struct sh_nbsd_nat_target final : public static sh_nbsd_nat_target the_sh_nbsd_nat_target; -#ifndef HAVE_GREGSET_T -typedef struct reg gregset_t; -#endif - -#ifndef HAVE_FPREGSET_T -struct fpreg { }; -typedef struct fpreg fpregset_t; -#endif #include "gregset.h" /* Determine if PT_GETREGS fetches this register. */ @@ -62,18 +55,19 @@ typedef struct fpreg fpregset_t; void sh_nbsd_nat_target::fetch_registers (struct regcache *regcache, int regno) { - pid_t pid = regcache->ptid ().pid (); + ptid_t ptid = regcache->ptid (); + pid_t pid = ptid.pid (); + int lwp = ptid.lwp (); if (regno == -1 || GETREGS_SUPPLIES (regcache->arch (), regno)) { - struct reg inferior_registers; + struct reg regs; - if (ptrace (PT_GETREGS, ptid_get_pid (inferior_ptid), - (PTRACE_TYPE_ARG3) &inferior_registers, inferior_ptid.lwp ()) == -1) + if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) ®s, lwp) == -1) perror_with_name (_("Couldn't get registers")); sh_corefile_supply_regset (&sh_corefile_gregset, regcache, regno, - (char *) &inferior_registers, + (char *) ®s, SHNBSD_SIZEOF_GREGS); if (regno != -1) @@ -84,22 +78,22 @@ sh_nbsd_nat_target::fetch_registers (str void sh_nbsd_nat_target::store_registers (struct regcache *regcache, int regno) { - pid_t pid = regcache->ptid ().pid (); + ptid_t ptid = regcache->ptid (); + pid_t pid = ptid.pid (); + int lwp = ptid.lwp (); if (regno == -1 || GETREGS_SUPPLIES (regcache->arch (), regno)) { - struct reg inferior_registers; + struct reg regs; - if (ptrace (PT_GETREGS, ptid_get_pid (inferior_ptid), - (PTRACE_TYPE_ARG3) &inferior_registers, inferior_ptid.lwp ()) == -1) + if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) ®s, lwp) == -1) perror_with_name (_("Couldn't get registers")); sh_corefile_collect_regset (&sh_corefile_gregset, regcache, regno, - (char *) &inferior_registers, + (char *) ®s, SHNBSD_SIZEOF_GREGS); - if (ptrace (PT_SETREGS, ptid_get_pid (inferior_ptid), - (PTRACE_TYPE_ARG3) &inferior_registers, inferior_ptid.lwp ()) == -1) + if (ptrace (PT_SETREGS, pid, (PTRACE_TYPE_ARG3) ®s, lwp) == -1) perror_with_name (_("Couldn't set registers")); if (regno != -1) Index: src/external/gpl3/gdb/dist/gdb/sparc-nbsd-nat.c diff -u src/external/gpl3/gdb/dist/gdb/sparc-nbsd-nat.c:1.6 src/external/gpl3/gdb/dist/gdb/sparc-nbsd-nat.c:1.7 --- src/external/gpl3/gdb/dist/gdb/sparc-nbsd-nat.c:1.6 Wed May 29 18:08:28 2019 +++ src/external/gpl3/gdb/dist/gdb/sparc-nbsd-nat.c Wed May 29 21:19:36 2019 @@ -34,39 +34,6 @@ #include "bsd-kvm.h" -#ifndef HAVE_GREGSET_T -typedef struct reg gregset_t; -#endif - -#ifndef HAVE_FPREGSET_T -typedef struct fpreg fpregset_t; -#endif -#include "gregset.h" - -void -supply_gregset (struct regcache *regcache, const gregset_t *gregs) -{ - sparc_supply_gregset (sparc_gregmap, regcache, -1, gregs); -} - -void -supply_fpregset (struct regcache *regcache, const fpregset_t *fpregs) -{ - sparc_supply_fpregset (sparc_fpregmap, regcache, -1, fpregs); -} - -void -fill_gregset (const struct regcache *regcache, gregset_t *gregs, int regnum) -{ - sparc_collect_gregset (sparc_gregmap, regcache, regnum, gregs); -} - -void -fill_fpregset (const struct regcache *regcache, fpregset_t *fpregs, int regnum) -{ - sparc_collect_fpregset (sparc_fpregmap, regcache, regnum, fpregs); -} - static int sparc32nbsd_supply_pcb (struct regcache *regcache, struct pcb *pcb) { @@ -96,7 +63,6 @@ static sparc_target<nbsd_nat_target> the void _initialize_sparcnbsd_nat (void) { - struct target_ops *t; sparc_gregmap = &sparc32nbsd_gregmap; sparc_fpregmap = &sparc32_bsd_fpregmap; Index: src/external/gpl3/gdb/dist/gdb/sparc64-nbsd-nat.c diff -u src/external/gpl3/gdb/dist/gdb/sparc64-nbsd-nat.c:1.6 src/external/gpl3/gdb/dist/gdb/sparc64-nbsd-nat.c:1.7 --- src/external/gpl3/gdb/dist/gdb/sparc64-nbsd-nat.c:1.6 Wed May 29 18:08:28 2019 +++ src/external/gpl3/gdb/dist/gdb/sparc64-nbsd-nat.c Wed May 29 21:19:36 2019 @@ -110,8 +110,6 @@ sparc64nbsd_gregset_supplies_p (struct g return 0; } -/* Determine whether `fpregset_t' contains register REGNUM. */ - static int sparc64nbsd_fpregset_supplies_p (struct gdbarch *gdbarch, int regnum) { Index: src/external/gpl3/gdb/dist/gdb/vax-bsd-nat.c diff -u src/external/gpl3/gdb/dist/gdb/vax-bsd-nat.c:1.6 src/external/gpl3/gdb/dist/gdb/vax-bsd-nat.c:1.7 --- src/external/gpl3/gdb/dist/gdb/vax-bsd-nat.c:1.6 Tue May 28 11:30:39 2019 +++ src/external/gpl3/gdb/dist/gdb/vax-bsd-nat.c Wed May 29 21:19:36 2019 @@ -32,7 +32,13 @@ #include "vax-tdep.h" #include "inf-ptrace.h" +#ifdef __NetBSD__ +#include "nbsd-nat.h" +struct vax_bsd_nat_target final : public nbsd_nat_target +#else struct vax_bsd_nat_target final : public inf_ptrace_target +#endif + { void fetch_registers (struct regcache *, int) override; void store_registers (struct regcache *, int) override; @@ -45,7 +51,7 @@ static vax_bsd_nat_target the_vax_bsd_na 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++) @@ -59,7 +65,7 @@ static void vaxbsd_collect_gregset (const struct regcache *regcache, void *gregs, int regnum) { - gdb_byte *regs = gregs; + gdb_byte *regs = (gdb_byte *)gregs; int i; for (i = 0; i <= VAX_NUM_REGS; i++) @@ -77,9 +83,11 @@ void vax_bsd_nat_target::fetch_registers (struct regcache *regcache, int regnum) { struct reg regs; - pid_t pid = regcache->ptid ().pid (); + ptid_t ptid = regcache->ptid (); + pid_t pid = ptid.pid (); + int lwp = ptid.lwp (); - if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) ®s, inferior_ptid.lwp ()) == -1) + if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) ®s, lwp) == -1) perror_with_name (_("Couldn't get registers")); vaxbsd_supply_gregset (regcache, ®s); @@ -92,14 +100,16 @@ void vax_bsd_nat_target::store_registers (struct regcache *regcache, int regnum) { struct reg regs; - pid_t pid = regcache->ptid ().pid (); + ptid_t ptid = regcache->ptid (); + pid_t pid = ptid.pid (); + int lwp = ptid.lwp (); - if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) ®s, inferior_ptid.lwp ()) == -1) + if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) ®s, lwp) == -1) perror_with_name (_("Couldn't get registers")); vaxbsd_collect_gregset (regcache, ®s, regnum); - if (ptrace (PT_SETREGS, pid, (PTRACE_TYPE_ARG3) ®s, inferior_ptid.lwp ()) == -1) + if (ptrace (PT_SETREGS, pid, (PTRACE_TYPE_ARG3) ®s, lwp) == -1) perror_with_name (_("Couldn't write registers")); } Index: src/external/gpl3/gdb/dist/gdb/x86-bsd-nat.c diff -u src/external/gpl3/gdb/dist/gdb/x86-bsd-nat.c:1.6 src/external/gpl3/gdb/dist/gdb/x86-bsd-nat.c:1.7 --- src/external/gpl3/gdb/dist/gdb/x86-bsd-nat.c:1.6 Tue May 28 11:30:39 2019 +++ src/external/gpl3/gdb/dist/gdb/x86-bsd-nat.c Wed May 29 21:19:36 2019 @@ -83,7 +83,7 @@ x86bsd_dr_set (int regnum, unsigned long for (thread_info *thread : current_inferior ()->non_exited_threads ()) { if (ptrace (PT_SETDBREGS, get_ptrace_pid (thread->ptid), - (PTRACE_TYPE_ARG3) &dbregs, inferior_ptid.lwp ()) == -1) + (PTRACE_TYPE_ARG3) &dbregs, thread->ptid.lwp ()) == -1) perror_with_name (_("Couldn't write debug registers")); } } Index: src/external/gpl3/gdb/dist/gdb/i386-bsd-nat.c diff -u src/external/gpl3/gdb/dist/gdb/i386-bsd-nat.c:1.4 src/external/gpl3/gdb/dist/gdb/i386-bsd-nat.c:1.5 --- src/external/gpl3/gdb/dist/gdb/i386-bsd-nat.c:1.4 Tue May 28 11:30:39 2019 +++ src/external/gpl3/gdb/dist/gdb/i386-bsd-nat.c Wed May 29 21:19:36 2019 @@ -131,12 +131,13 @@ void i386bsd_fetch_inferior_registers (struct regcache *regcache, int regnum) { pid_t pid = get_ptrace_pid (regcache->ptid ()); + int lwp = regcache->ptid ().lwp (); if (regnum == -1 || GETREGS_SUPPLIES (regnum)) { struct reg regs; - if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) ®s, inferior_ptid.lwp ()) == -1) + if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) ®s, lwp) == -1) perror_with_name (_("Couldn't get registers")); i386bsd_supply_gregset (regcache, ®s); @@ -158,7 +159,7 @@ i386bsd_fetch_inferior_registers (struct xstateregs = alloca (x86bsd_xsave_len); if (ptrace (PT_GETXSTATE, pid, - (PTRACE_TYPE_ARG3) xstateregs, inferior_ptid.lwp ()) == -1) + (PTRACE_TYPE_ARG3) xstateregs, lwp) == -1) perror_with_name (_("Couldn't get extended state status")); i387_supply_xsave (regcache, -1, xstateregs); @@ -168,7 +169,7 @@ i386bsd_fetch_inferior_registers (struct #ifdef HAVE_PT_GETXMMREGS if (have_ptrace_xmmregs != 0 - && ptrace(PT_GETXMMREGS, pid, (PTRACE_TYPE_ARG3) xmmregs, inferior_ptid.lwp ()) == 0) + && ptrace(PT_GETXMMREGS, pid, (PTRACE_TYPE_ARG3) xmmregs, lwp) == 0) { have_ptrace_xmmregs = 1; i387_supply_fxsave (regcache, -1, xmmregs); @@ -177,7 +178,7 @@ i386bsd_fetch_inferior_registers (struct { have_ptrace_xmmregs = 0; #endif - if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, inferior_ptid.lwp ()) == -1) + if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, lwp) == -1) perror_with_name (_("Couldn't get floating point status")); i387_supply_fsave (regcache, -1, &fpregs); @@ -194,17 +195,18 @@ void i386bsd_store_inferior_registers (struct regcache *regcache, int regnum) { pid_t pid = get_ptrace_pid (regcache->ptid ()); + int lwp = regcache->ptid ().lwp (); if (regnum == -1 || GETREGS_SUPPLIES (regnum)) { struct reg regs; - if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) ®s, inferior_ptid.lwp ()) == -1) + if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) ®s, lwp) == -1) perror_with_name (_("Couldn't get registers")); i386bsd_collect_gregset (regcache, ®s, regnum); - if (ptrace (PT_SETREGS, pid, (PTRACE_TYPE_ARG3) ®s, inferior_ptid.lwp ()) == -1) + if (ptrace (PT_SETREGS, pid, (PTRACE_TYPE_ARG3) ®s, lwp) == -1) perror_with_name (_("Couldn't write registers")); if (regnum != -1) @@ -225,10 +227,10 @@ i386bsd_store_inferior_registers (struct xstateregs = alloca (x86bsd_xsave_len); if (ptrace (PT_GETXSTATE, pid, - (PTRACE_TYPE_ARG3) xstateregs, inferior_ptid.lwp ()) == -1) + (PTRACE_TYPE_ARG3) xstateregs, lwp) == -1) perror_with_name (_("Couldn't get extended state status")); - i387_collect_xsave (regcache, -1, xstateregs, inferior_ptid.lwp ()); + i387_collect_xsave (regcache, -1, xstateregs, lwp); if (ptrace (PT_SETXSTATE, pid, (PTRACE_TYPE_ARG3) xstateregs, x86bsd_xsave_len) == -1) @@ -239,25 +241,25 @@ i386bsd_store_inferior_registers (struct #ifdef HAVE_PT_GETXMMREGS if (have_ptrace_xmmregs != 0 - && ptrace(PT_GETXMMREGS, pid, (PTRACE_TYPE_ARG3) xmmregs, inferior_ptid.lwp ()) == 0) + && ptrace(PT_GETXMMREGS, pid, (PTRACE_TYPE_ARG3) xmmregs, lwp) == 0) { have_ptrace_xmmregs = 1; i387_collect_fxsave (regcache, regnum, xmmregs); - if (ptrace (PT_SETXMMREGS, pid, (PTRACE_TYPE_ARG3) xmmregs, inferior_ptid.lwp ()) == -1) + if (ptrace (PT_SETXMMREGS, pid, (PTRACE_TYPE_ARG3) xmmregs, lwp) == -1) perror_with_name (_("Couldn't write XMM registers")); } else { have_ptrace_xmmregs = 0; #endif - if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, inferior_ptid.lwp ()) == -1) + if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, lwp) == -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, inferior_ptid.lwp ()) == -1) + if (ptrace (PT_SETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, lwp) == -1) perror_with_name (_("Couldn't write floating point status")); #ifdef HAVE_PT_GETXMMREGS } Index: src/external/gpl3/gdb/dist/gdb/m68k-bsd-nat.c diff -u src/external/gpl3/gdb/dist/gdb/m68k-bsd-nat.c:1.5 src/external/gpl3/gdb/dist/gdb/m68k-bsd-nat.c:1.6 --- src/external/gpl3/gdb/dist/gdb/m68k-bsd-nat.c:1.5 Tue May 28 11:30:39 2019 +++ src/external/gpl3/gdb/dist/gdb/m68k-bsd-nat.c Wed May 29 21:19:36 2019 @@ -29,7 +29,12 @@ #include "m68k-tdep.h" #include "inf-ptrace.h" +#ifdef __NetBSD__ +#include "nbsd-nat.h" +struct m68k_bsd_nat_target final : public nbsd_nat_target +#else struct m68k_bsd_nat_target final : public inf_ptrace_target +#endif { void fetch_registers (struct regcache *, int) override; void store_registers (struct regcache *, int) override; Index: src/external/gpl3/gdb/dist/gdb/sparc-nat.c diff -u src/external/gpl3/gdb/dist/gdb/sparc-nat.c:1.13 src/external/gpl3/gdb/dist/gdb/sparc-nat.c:1.14 --- src/external/gpl3/gdb/dist/gdb/sparc-nat.c:1.13 Wed May 29 18:08:28 2019 +++ src/external/gpl3/gdb/dist/gdb/sparc-nat.c Wed May 29 21:19:36 2019 @@ -138,6 +138,7 @@ sparc_fetch_inferior_registers (struct r { struct gdbarch *gdbarch = regcache->arch (); pid_t pid; + int lwp = regcache->ptid ().lwp (); /* NOTE: cagney/2002-12-03: This code assumes that the currently selected light weight processes' registers can be written @@ -166,7 +167,7 @@ sparc_fetch_inferior_registers (struct r { gregset_t regs; - if (ptrace (PTRACE_GETREGS, pid, (PTRACE_TYPE_ARG3) ®s, inferior_ptid.lwp ()) == -1) + if (ptrace (PTRACE_GETREGS, pid, (PTRACE_TYPE_ARG3) ®s, lwp) == -1) perror_with_name (_("Couldn't get registers")); sparc_supply_gregset (sparc_gregmap, regcache, -1, ®s); @@ -178,7 +179,7 @@ sparc_fetch_inferior_registers (struct r { fpregset_t fpregs; - if (ptrace (PTRACE_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, inferior_ptid.lwp ()) == -1) + if (ptrace (PTRACE_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, lwp) == -1) perror_with_name (_("Couldn't get floating point status")); sparc_supply_fpregset (sparc_fpregmap, regcache, -1, &fpregs); @@ -190,6 +191,7 @@ sparc_store_inferior_registers (struct r { struct gdbarch *gdbarch = regcache->arch (); pid_t pid; + int lwp = regcache->ptid ().lwp (); /* NOTE: cagney/2002-12-02: See comment in fetch_inferior_registers about threaded assumptions. */ @@ -199,7 +201,7 @@ sparc_store_inferior_registers (struct r { gregset_t regs; - if (ptrace (PTRACE_GETREGS, pid, (PTRACE_TYPE_ARG3) ®s, inferior_ptid.lwp ()) == -1) + if (ptrace (PTRACE_GETREGS, pid, (PTRACE_TYPE_ARG3) ®s, lwp) == -1) perror_with_name (_("Couldn't get registers")); sparc_collect_gregset (sparc_gregmap, regcache, regnum, ®s); @@ -225,7 +227,7 @@ sparc_store_inferior_registers (struct r { fpregset_t fpregs, saved_fpregs; - if (ptrace (PTRACE_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, inferior_ptid.lwp ()) == -1) + if (ptrace (PTRACE_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, lwp) == -1) perror_with_name (_("Couldn't get floating-point registers")); memcpy (&saved_fpregs, &fpregs, sizeof (fpregs)); @@ -238,7 +240,7 @@ sparc_store_inferior_registers (struct r if (memcmp (&saved_fpregs, &fpregs, sizeof (fpregs)) != 0) { if (ptrace (PTRACE_SETFPREGS, pid, - (PTRACE_TYPE_ARG3) &fpregs, inferior_ptid.lwp ()) == -1) + (PTRACE_TYPE_ARG3) &fpregs, lwp) == -1) perror_with_name (_("Couldn't write floating-point registers")); }