static void alphabsd_fetch_inferior_registers (struct target_ops *ops, struct regcache *regcache, int regno) { if (regno == -1 || getregs_supplies (regno)) { struct reg gregs; if (ptrace (PT_GETREGS, ptid_get_pid (regcache_get_ptid (regcache)), (PTRACE_TYPE_ARG3) &gregs, 0) == -1) perror_with_name (_("Couldn't get registers")); alphabsd_supply_reg (regcache, (char *) &gregs, regno); if (regno != -1) return; } if (regno == -1 || regno >= gdbarch_fp0_regnum (get_regcache_arch (regcache))) { struct fpreg fpregs; if (ptrace (PT_GETFPREGS, ptid_get_pid (regcache_get_ptid (regcache)), (PTRACE_TYPE_ARG3) &fpregs, 0) == -1) perror_with_name (_("Couldn't get floating point status")); alphabsd_supply_fpreg (regcache, (char *) &fpregs, regno); } }
static void shnbsd_store_inferior_registers (struct target_ops *ops, struct regcache *regcache, int regno) { pid_t pid = ptid_get_pid (regcache_get_ptid (regcache)); if (regno == -1 || GETREGS_SUPPLIES (regcache->arch (), regno)) { struct reg inferior_registers; if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &inferior_registers, 0) == -1) perror_with_name (_("Couldn't get registers")); sh_corefile_collect_regset (&sh_corefile_gregset, regcache, regno, (char *) &inferior_registers, SHNBSD_SIZEOF_GREGS); if (ptrace (PT_SETREGS, pid, (PTRACE_TYPE_ARG3) &inferior_registers, 0) == -1) perror_with_name (_("Couldn't set registers")); if (regno != -1) return; } }
static void ppcobsd_fetch_registers (struct target_ops *ops, struct regcache *regcache, int regnum) { struct reg regs; pid_t pid = ptid_get_pid (regcache_get_ptid (regcache)); if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) ®s, 0) == -1) perror_with_name (_("Couldn't get registers")); ppc_supply_gregset (&ppcobsd_gregset, regcache, -1, ®s, sizeof regs); #ifndef PT_GETFPREGS ppc_supply_fpregset (&ppcobsd_gregset, regcache, -1, ®s, sizeof regs); #endif #ifdef PT_GETFPREGS if (regnum == -1 || getfpregs_supplies (regcache->arch (), regnum)) { struct fpreg fpregs; if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, 0) == -1) perror_with_name (_("Couldn't get floating point status")); ppc_supply_fpregset (&ppcobsd_fpregset, regcache, -1, &fpregs, sizeof fpregs); } #endif }
static void mips_fbsd_store_inferior_registers (struct target_ops *ops, struct regcache *regcache, int regnum) { pid_t pid = get_ptrace_pid (regcache_get_ptid (regcache)); 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")); mips_fbsd_collect_gregs (regcache, regnum, (char *) ®s, sizeof (register_t)); 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")); mips_fbsd_collect_fpregs (regcache, regnum, (char *) &fpregs, sizeof (f_register_t)); if (ptrace (PT_SETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, 0) == -1) perror_with_name (_("Couldn't write floating point status")); } }
static void i386bsd_fetch_inferior_registers (struct target_ops *ops, struct regcache *regcache, int regnum) { pid_t pid = get_ptrace_pid (regcache_get_ptid (regcache)); if (regnum == -1 || GETREGS_SUPPLIES (regnum)) { struct reg regs; if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) ®s, 0) == -1) perror_with_name (_("Couldn't get registers")); i386bsd_supply_gregset (regcache, ®s); if (regnum != -1) return; } if (regnum == -1 || regnum >= I386_ST0_REGNUM) { struct fpreg fpregs; #ifdef HAVE_PT_GETXMMREGS char xmmregs[512]; #endif #ifdef PT_GETXSTATE_INFO if (x86bsd_xsave_len != 0) { void *xstateregs; xstateregs = alloca (x86bsd_xsave_len); if (ptrace (PT_GETXSTATE, pid, (PTRACE_TYPE_ARG3) xstateregs, 0) == -1) perror_with_name (_("Couldn't get extended state status")); i387_supply_xsave (regcache, -1, xstateregs); return; } #endif #ifdef HAVE_PT_GETXMMREGS if (have_ptrace_xmmregs != 0 && ptrace(PT_GETXMMREGS, pid, (PTRACE_TYPE_ARG3) xmmregs, 0) == 0) { have_ptrace_xmmregs = 1; i387_supply_fxsave (regcache, -1, xmmregs); } else { have_ptrace_xmmregs = 0; #endif if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, 0) == -1) perror_with_name (_("Couldn't get floating point status")); i387_supply_fsave (regcache, -1, &fpregs); #ifdef HAVE_PT_GETXMMREGS } #endif } }
static void fetch_inferior_registers (struct target_ops *ops, struct regcache *regcache, int regnum) { elf_gregset_t regs; pid_t tid = get_ptrace_pid (regcache_get_ptid (regcache)); if (ptrace (PTRACE_GETREGS, tid, 0, (PTRACE_TYPE_ARG3) ®s) < 0) perror_with_name (_("Couldn't get registers")); supply_gregset (regcache, (const elf_gregset_t *)®s); }
static void store_inferior_registers (struct target_ops *ops, struct regcache *regcache, int regnum) { elf_gregset_t regs; pid_t tid = get_ptrace_pid (regcache_get_ptid (regcache)); if (ptrace (PTRACE_GETREGS, tid, 0, (PTRACE_TYPE_ARG3) ®s) < 0) perror_with_name (_("Couldn't get registers")); fill_gregset (regcache, ®s, regnum); if (ptrace (PTRACE_SETREGS, tid, 0, (PTRACE_TYPE_ARG3) ®s) < 0) perror_with_name (_("Couldn't write registers")); }
static void store_register (const struct regcache *regcache, int regno) { struct gdbarch *gdbarch = get_regcache_arch (regcache); pid_t tid; int val; if (gdbarch_cannot_store_register (gdbarch, regno)) return; tid = get_ptrace_pid (regcache_get_ptid (regcache)); errno = 0; regcache_raw_collect (regcache, regno, &val); ptrace (PTRACE_POKEUSER, tid, hppa_linux_register_addr (regno, 0), val); if (errno != 0) error (_("Couldn't write register %s (#%d): %s."), gdbarch_register_name (gdbarch, regno), regno, safe_strerror (errno)); }
static void fetch_register (struct regcache *regcache, int regno) { struct gdbarch *gdbarch = get_regcache_arch (regcache); pid_t tid; int val; if (gdbarch_cannot_fetch_register (gdbarch, regno)) { regcache_raw_supply (regcache, regno, NULL); return; } tid = get_ptrace_pid (regcache_get_ptid (regcache)); errno = 0; val = ptrace (PTRACE_PEEKUSER, tid, hppa_linux_register_addr (regno, 0), 0); if (errno != 0) error (_("Couldn't read register %s (#%d): %s."), gdbarch_register_name (gdbarch, regno), regno, safe_strerror (errno)); regcache_raw_supply (regcache, regno, &val); }