33 #include <sys/ptrace.h>
35 #include <sys/ioctl.h>
37 #include <sys/procfs.h>
46 #include "floatformat.h"
54 #ifndef PTRACE_GET_THREAD_AREA
55 #define PTRACE_GET_THREAD_AREA 25
61 PT_D0, PT_D1, PT_D2, PT_D3, PT_D4, PT_D5, PT_D6, PT_D7,
62 PT_A0, PT_A1, PT_A2, PT_A3, PT_A4, PT_A5, PT_A6, PT_USP,
65 21, 24, 27, 30, 33, 36, 39, 42,
72 #define NUM_GREGS (18)
73 #define MAX_NUM_REGS (NUM_GREGS + 11)
89 #ifdef HAVE_PTRACE_GETREGS
117 regaddr = 4 *
regmap[regno];
121 val =
ptrace (PTRACE_PEEKUSER, tid, regaddr, 0);
122 memcpy (&buf[i], &val,
sizeof (
long));
123 regaddr +=
sizeof (
long);
125 error (
_(
"Couldn't read register %s (#%d): %s."),
171 regaddr = 4 *
regmap[regno];
180 memcpy (&val, &buf[i],
sizeof (
long));
181 ptrace (PTRACE_POKEUSER, tid, regaddr, val);
182 regaddr +=
sizeof (
long);
184 error (
_(
"Couldn't write register %s (#%d): %s."),
220 const elf_greg_t *regp = (
const elf_greg_t *) gregsetp;
238 elf_gregset_t *gregsetp,
int regno)
240 elf_greg_t *regp = (elf_greg_t *) gregsetp;
244 if (regno == -1 || regno == i)
248 #ifdef HAVE_PTRACE_GETREGS
307 #define FPREG_ADDR(f, n) (&(f)->fpregs[(n) * 3])
334 elf_fpregset_t *fpregsetp,
int regno)
342 if (regno == -1 || regno == i)
349 if (regno == -1 || regno == i)
354 #ifdef HAVE_PTRACE_GETREGS
362 elf_fpregset_t fpregs;
376 elf_fpregset_t fpregs;
456 _(
"Got request for bad register number %d."), regno);
504 _(
"Got request to store bad register number %d."), regno);
512 lwpid_t lwpid,
int idx,
void **base)
520 *base = (
char *) *base - idx;
static void store_regs(const struct regcache *regcache, int tid, int regno)
struct gdbarch * get_regcache_arch(const struct regcache *regcache)
static int getregs_supplies(int regno)
void internal_error(const char *file, int line, const char *fmt,...)
static void m68k_linux_fetch_inferior_registers(struct target_ops *ops, struct regcache *regcache, int regno)
static void old_fetch_inferior_registers(struct regcache *regcache, int regno)
void fill_gregset(const struct regcache *regcache, elf_gregset_t *gregsetp, int regno)
int gdbarch_num_regs(struct gdbarch *gdbarch)
int gdbarch_ps_regnum(struct gdbarch *gdbarch)
void fill_fpregset(const struct regcache *regcache, elf_fpregset_t *fpregsetp, int regno)
void supply_gregset(struct regcache *regcache, const elf_gregset_t *gregsetp)
static void store_register(const struct regcache *regcache, int regno)
static void fetch_regs(struct regcache *regcache, int tid)
int gdbarch_sp_regnum(struct gdbarch *gdbarch)
static void m68k_linux_store_inferior_registers(struct target_ops *ops, struct regcache *regcache, int regno)
static void fetch_register(struct regcache *regcache, int regno)
#define PTRACE_GET_THREAD_AREA
const char * gdbarch_register_name(struct gdbarch *gdbarch, int regnr)
void linux_nat_add_target(struct target_ops *t)
static int have_ptrace_getregs
struct target_ops * linux_target(void)
int ptid_get_pid(ptid_t ptid)
static void fetch_fpregs(struct regcache *regcache, int tid)
void(* to_fetch_registers)(struct target_ops *, struct regcache *, int) TARGET_DEFAULT_IGNORE()
void void void void void void void void void perror_with_name(const char *string) ATTRIBUTE_NORETURN
int gdbarch_fp0_regnum(struct gdbarch *gdbarch)
char * safe_strerror(int)
void regcache_raw_supply(struct regcache *regcache, int regnum, const void *buf)
void _initialize_m68k_linux_nat(void)
static void old_store_inferior_registers(const struct regcache *regcache, int regno)
int register_size(struct gdbarch *gdbarch, int regnum)
long ptid_get_lwp(ptid_t ptid)
void regcache_raw_collect(const struct regcache *regcache, int regnum, void *buf)
int gdbarch_pc_regnum(struct gdbarch *gdbarch)
void supply_fpregset(struct regcache *regcache, const elf_fpregset_t *fpregsetp)
static int getfpregs_supplies(int regno)
void(* to_store_registers)(struct target_ops *, struct regcache *, int) TARGET_DEFAULT_NORETURN(noprocess())
void error(const char *fmt,...)
static const int regmap[]
ps_err_e ps_get_thread_area(const struct ps_prochandle *ph, lwpid_t lwpid, int idx, void **base)
static void store_fpregs(const struct regcache *regcache, int tid, int regno)