static void ppcnbsd_fetch_inferior_registers (struct target_ops *ops, struct regcache *regcache, int regnum) { struct gdbarch *gdbarch = get_regcache_arch (regcache); if (regnum == -1 || getregs_supplies (gdbarch, regnum)) { struct reg regs; if (ptrace (PT_GETREGS, PIDGET (inferior_ptid), (PTRACE_TYPE_ARG3) ®s, 0) == -1) perror_with_name (_("Couldn't get registers")); ppc_supply_gregset (&ppcnbsd_gregset, regcache, regnum, ®s, sizeof regs); } if (regnum == -1 || getfpregs_supplies (gdbarch, regnum)) { struct fpreg fpregs; if (ptrace (PT_GETFPREGS, PIDGET (inferior_ptid), (PTRACE_TYPE_ARG3) &fpregs, 0) == -1) perror_with_name (_("Couldn't get FP registers")); ppc_supply_fpregset (&ppcnbsd_fpregset, regcache, regnum, &fpregs, sizeof fpregs); } }
void riscv_fbsd_nat_target::store_registers (struct regcache *regcache, int regnum) { pid_t pid = get_ptrace_pid (regcache->ptid ()); struct gdbarch *gdbarch = regcache->arch (); if (regnum == -1 || getregs_supplies (gdbarch, regnum)) { struct reg regs; if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) ®s, 0) == -1) perror_with_name (_("Couldn't get registers")); regcache->collect_regset (&riscv_fbsd_gregset, regnum, ®s, sizeof (regs)); if (ptrace (PT_SETREGS, pid, (PTRACE_TYPE_ARG3) ®s, 0) == -1) perror_with_name (_("Couldn't write registers")); } if (regnum == -1 || getfpregs_supplies (gdbarch, regnum)) { struct fpreg fpregs; if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, 0) == -1) perror_with_name (_("Couldn't get floating point status")); regcache->collect_regset (&riscv_fbsd_fpregset, regnum, &fpregs, sizeof (fpregs)); if (ptrace (PT_SETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, 0) == -1) perror_with_name (_("Couldn't write floating point status")); } }
void riscv_fbsd_nat_target::fetch_registers (struct regcache *regcache, int regnum) { pid_t pid = get_ptrace_pid (regcache->ptid ()); struct gdbarch *gdbarch = regcache->arch (); if (regnum == -1 || regnum == RISCV_ZERO_REGNUM) regcache->raw_supply_zeroed (RISCV_ZERO_REGNUM); if (regnum == -1 || getregs_supplies (gdbarch, regnum)) { struct reg regs; if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) ®s, 0) == -1) perror_with_name (_("Couldn't get registers")); regcache->supply_regset (&riscv_fbsd_gregset, regnum, ®s, sizeof (regs)); } if (regnum == -1 || getfpregs_supplies (gdbarch, regnum)) { struct fpreg fpregs; if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, 0) == -1) perror_with_name (_("Couldn't get floating point status")); regcache->supply_regset (&riscv_fbsd_fpregset, regnum, &fpregs, sizeof (fpregs)); } }
static void m68k_linux_fetch_inferior_registers (struct target_ops *ops, struct regcache *regcache, int regno) { int tid; /* Use the old method of peeking around in `struct user' if the GETREGS request isn't available. */ if (! have_ptrace_getregs) { old_fetch_inferior_registers (regcache, regno); return; } /* GNU/Linux LWP ID's are process ID's. */ tid = TIDGET (inferior_ptid); if (tid == 0) tid = PIDGET (inferior_ptid); /* Not a threaded program. */ /* Use the PTRACE_GETFPXREGS request whenever possible, since it transfers more registers in one system call, and we'll cache the results. But remember that fetch_fpxregs can fail, and return zero. */ if (regno == -1) { fetch_regs (regcache, tid); /* The call above might reset `have_ptrace_getregs'. */ if (! have_ptrace_getregs) { old_fetch_inferior_registers (regcache, -1); return; } fetch_fpregs (regcache, tid); return; } if (getregs_supplies (regno)) { fetch_regs (regcache, tid); return; } if (getfpregs_supplies (regno)) { fetch_fpregs (regcache, tid); return; } internal_error (__FILE__, __LINE__, _("Got request for bad register number %d."), regno); }
/* Store register REGNO back into the child process. If REGNO is -1, do this for all registers (including the floating point and SSE registers). */ static void m68k_linux_store_inferior_registers (struct target_ops *ops, struct regcache *regcache, int regno) { int tid; /* Use the old method of poking around in `struct user' if the SETREGS request isn't available. */ if (! have_ptrace_getregs) { old_store_inferior_registers (regcache, regno); return; } /* GNU/Linux LWP ID's are process ID's. */ tid = TIDGET (inferior_ptid); if (tid == 0) tid = PIDGET (inferior_ptid); /* Not a threaded program. */ /* Use the PTRACE_SETFPREGS requests whenever possible, since it transfers more registers in one system call. But remember that store_fpregs can fail, and return zero. */ if (regno == -1) { store_regs (regcache, tid, regno); store_fpregs (regcache, tid, regno); return; } if (getregs_supplies (regno)) { store_regs (regcache, tid, regno); return; } if (getfpregs_supplies (regno)) { store_fpregs (regcache, tid, regno); return; } internal_error (__FILE__, __LINE__, _("Got request to store bad register number %d."), regno); }
static void ppcobsd_store_registers (struct target_ops *ops, struct regcache *regcache, int regnum) { struct reg regs; if (ptrace (PT_GETREGS, PIDGET (inferior_ptid), (PTRACE_TYPE_ARG3) ®s, 0) == -1) perror_with_name (_("Couldn't get registers")); ppc_collect_gregset (&ppcobsd_gregset, regcache, regnum, ®s, sizeof regs); #ifndef PT_GETFPREGS ppc_collect_fpregset (&ppcobsd_gregset, regcache, regnum, ®s, sizeof regs); #endif if (ptrace (PT_SETREGS, PIDGET (inferior_ptid), (PTRACE_TYPE_ARG3) ®s, 0) == -1) perror_with_name (_("Couldn't write registers")); #ifdef PT_GETFPREGS if (regnum == -1 || getfpregs_supplies (get_regcache_arch (regcache), regnum)) { struct fpreg fpregs; if (ptrace (PT_GETFPREGS, PIDGET (inferior_ptid), (PTRACE_TYPE_ARG3) &fpregs, 0) == -1) perror_with_name (_("Couldn't get floating point status")); ppc_collect_fpregset (&ppcobsd_fpregset, regcache, regnum, &fpregs, sizeof fpregs); if (ptrace (PT_SETFPREGS, PIDGET (inferior_ptid), (PTRACE_TYPE_ARG3) &fpregs, 0) == -1) perror_with_name (_("Couldn't write floating point status")); } #endif }
void store_inferior_registers (int regno) { if (regno == -1 || getregs_supplies (regno)) { struct reg regs; if (ptrace (PT_GETREGS, PIDGET (inferior_ptid), (PTRACE_ARG3_TYPE) ®s, 0) == -1) perror_with_name (_("Couldn't get registers")); ppcfbsd_fill_reg ((char *) ®s, regno); if (ptrace (PT_SETREGS, PIDGET (inferior_ptid), (PTRACE_ARG3_TYPE) ®s, 0) == -1) perror_with_name (_("Couldn't write registers")); if (regno != -1) return; } if (regno == -1 || getfpregs_supplies (regno)) { struct fpreg fpregs; if (ptrace (PT_GETFPREGS, PIDGET (inferior_ptid), (PTRACE_ARG3_TYPE) &fpregs, 0) == -1) perror_with_name (_("Couldn't get FP registers")); ppcfbsd_fill_fpreg ((char *) &fpregs, regno); if (ptrace (PT_SETFPREGS, PIDGET (inferior_ptid), (PTRACE_ARG3_TYPE) &fpregs, 0) == -1) perror_with_name (_("Couldn't set FP registers")); } }