static void arm_linux_fetch_inferior_registers (struct target_ops *ops, struct regcache *regcache, int regno) { struct gdbarch *gdbarch = get_regcache_arch (regcache); struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); if (-1 == regno) { fetch_regs (regcache); fetch_fpregs (regcache); if (tdep->have_wmmx_registers) fetch_wmmx_regs (regcache); if (tdep->vfp_register_count > 0) fetch_vfp_regs (regcache); } else { if (regno < ARM_F0_REGNUM || regno == ARM_PS_REGNUM) fetch_regs (regcache); else if (regno >= ARM_F0_REGNUM && regno <= ARM_FPS_REGNUM) fetch_fpregs (regcache); else if (tdep->have_wmmx_registers && regno >= ARM_WR0_REGNUM && regno <= ARM_WCGR7_REGNUM) fetch_wmmx_regs (regcache); else if (tdep->vfp_register_count > 0 && regno >= ARM_D0_REGNUM && regno <= ARM_D0_REGNUM + tdep->vfp_register_count) fetch_vfp_regs (regcache); } }
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); }
static void arm_linux_fetch_inferior_registers (struct target_ops *ops, struct regcache *regcache, int regno) { if (-1 == regno) { fetch_regs (regcache); fetch_fpregs (regcache); if (arm_linux_has_wmmx_registers) fetch_wmmx_regs (regcache); if (arm_linux_vfp_register_count > 0) fetch_vfp_regs (regcache); } else { if (regno < ARM_F0_REGNUM || regno == ARM_PS_REGNUM) fetch_register (regcache, regno); else if (regno >= ARM_F0_REGNUM && regno <= ARM_FPS_REGNUM) fetch_fpregister (regcache, regno); else if (arm_linux_has_wmmx_registers && regno >= ARM_WR0_REGNUM && regno <= ARM_WCGR7_REGNUM) fetch_wmmx_regs (regcache); else if (arm_linux_vfp_register_count > 0 && regno >= ARM_D0_REGNUM && regno <= ARM_D0_REGNUM + arm_linux_vfp_register_count) fetch_vfp_regs (regcache); } }
/* Fetch register REGNO, or all regs if REGNO is -1. */ static void gnu_fetch_registers (struct target_ops *ops, struct regcache *regcache, int regno) { struct proc *thread; /* Make sure we know about new threads. */ inf_update_procs (gnu_current_inf); thread = inf_tid_to_thread (gnu_current_inf, ptid_get_tid (inferior_ptid)); if (!thread) error (_("Can't fetch registers from thread %s: No such thread"), target_pid_to_str (inferior_ptid)); if (regno < I386_NUM_GREGS || regno == -1) { thread_state_t state; /* This does the dirty work for us. */ state = proc_get_state (thread, 0); if (!state) { warning (_("Couldn't fetch registers from %s"), proc_string (thread)); return; } if (regno == -1) { int i; proc_debug (thread, "fetching all register"); for (i = 0; i < I386_NUM_GREGS; i++) regcache_raw_supply (regcache, i, REG_ADDR (state, i)); thread->fetched_regs = ~0; } else { proc_debug (thread, "fetching register %s", gdbarch_register_name (get_regcache_arch (regcache), regno)); regcache_raw_supply (regcache, regno, REG_ADDR (state, regno)); thread->fetched_regs |= (1 << regno); } } if (regno >= I386_NUM_GREGS || regno == -1) { proc_debug (thread, "fetching floating-point registers"); fetch_fpregs (regcache, thread); } }
/* Fetch register REGNO, or all regs if REGNO is -1. */ void gnu_fetch_registers (int regno) { struct proc *thread; /* Make sure we know about new threads. */ inf_update_procs (current_inferior); thread = inf_tid_to_thread (current_inferior, PIDGET (inferior_ptid)); if (!thread) error ("Can't fetch registers from thread %d: No such thread", PIDGET (inferior_ptid)); if (regno < I386_NUM_GREGS || regno == -1) { thread_state_t state; /* This does the dirty work for us. */ state = proc_get_state (thread, 0); if (!state) { warning ("Couldn't fetch registers from %s", proc_string (thread)); return; } if (regno == -1) { int i; proc_debug (thread, "fetching all register"); for (i = 0; i < I386_NUM_GREGS; i++) supply_register (i, REG_ADDR (state, i)); thread->fetched_regs = ~0; } else { proc_debug (thread, "fetching register %s", REGISTER_NAME (regno)); supply_register (regno, REG_ADDR (state, regno)); thread->fetched_regs |= (1 << regno); } } if (regno >= I386_NUM_GREGS || regno == -1) { proc_debug (thread, "fetching floating-point registers"); fetch_fpregs (thread); } }
/* Fetch register REGNUM from the child process. If REGNUM is -1, do this for all registers. */ void fetch_inferior_registers (int regnum) { int tid = s390_inferior_tid (); if (regnum == -1 || (regnum < S390_NUM_REGS && regmap_gregset[regnum] != -1)) fetch_regs (tid); if (regnum == -1 || (regnum < S390_NUM_REGS && regmap_fpregset[regnum] != -1)) fetch_fpregs (tid); }
/* Fetch register REGNUM from the child process. If REGNUM is -1, do this for all registers. */ static void s390_linux_fetch_inferior_registers (struct regcache *regcache, int regnum) { int tid = s390_inferior_tid (); if (regnum == -1 || (regnum < S390_NUM_REGS && regmap_gregset[regnum] != -1)) fetch_regs (regcache, tid); if (regnum == -1 || (regnum < S390_NUM_REGS && regmap_fpregset[regnum] != -1)) fetch_fpregs (regcache, tid); }
void fetch_inferior_registers (int regno) { if (-1 == regno) { fetch_regs (); fetch_fpregs (); } else { if (regno < F0_REGNUM || regno > FPS_REGNUM) fetch_register (regno); if (regno >= F0_REGNUM && regno <= FPS_REGNUM) fetch_fpregister (regno); } }
static void i386_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) { int i; for (i = 0; i < gdbarch_num_regs (get_regcache_arch (regcache)); i++) if (regno == -1 || regno == i) fetch_register (regcache, i); return; } /* GNU/Linux LWP ID's are process ID's. */ tid = ptid_get_lwp (inferior_ptid); if (tid == 0) tid = ptid_get_pid (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) { i386_linux_fetch_inferior_registers (ops, regcache, regno); return; } if (fetch_xstateregs (regcache, tid)) return; if (fetch_fpxregs (regcache, tid)) return; fetch_fpregs (regcache, tid); return; } if (GETREGS_SUPPLIES (regno)) { fetch_regs (regcache, tid); return; } if (GETXSTATEREGS_SUPPLIES (regno)) { if (fetch_xstateregs (regcache, tid)) return; } if (GETFPXREGS_SUPPLIES (regno)) { if (fetch_fpxregs (regcache, tid)) return; /* Either our processor or our kernel doesn't support the SSE registers, so read the FP registers in the traditional way, and fill the SSE registers with dummy values. It would be more graceful to handle differences in the register set using gdbarch. Until then, this will at least make things work plausibly. */ fetch_fpregs (regcache, tid); return; } internal_error (__FILE__, __LINE__, _("Got request for bad register number %d."), regno); }