24 #include "elf/common.h" 56 #define GETREGS_SUPPLIES(regno) \ 57 ((0 <= (regno) && (regno) <= 15) || (regno) == I386_LINUX_ORIG_EAX_REGNUM) 59 #define GETFPXREGS_SUPPLIES(regno) \ 60 (I386_ST0_REGNUM <= (regno) && (regno) < I386_SSE_NUM_REGS) 62 #define GETXSTATEREGS_SUPPLIES(regno) \ 63 (I386_ST0_REGNUM <= (regno) && (regno) < I386_PKEYS_NUM_REGS) 67 #ifdef HAVE_PTRACE_GETREGS 83 #ifdef HAVE_PTRACE_GETFPXREGS 114 error (
_(
"Couldn't read register %s (#%d): %s."),
140 error (
_(
"Couldn't write register %s (#%d): %s."),
174 elf_gregset_t *gregsetp,
int regno)
180 if (regno == -1 || regno == i)
191 #ifdef HAVE_PTRACE_GETREGS 200 elf_gregset_t *regs_p = ®s;
260 elf_fpregset_t *fpregsetp,
int regno)
265 #ifdef HAVE_PTRACE_GETREGS 273 elf_fpregset_t fpregs;
287 elf_fpregset_t fpregs;
328 iov.iov_base = xstateregs;
329 iov.iov_len =
sizeof(xstateregs);
351 iov.iov_base = xstateregs;
352 iov.iov_len =
sizeof(xstateregs);
366 #ifdef HAVE_PTRACE_GETFPXREGS 375 elf_fpxregset_t fpxregs;
380 if (
ptrace (PTRACE_GETFPXREGS,
tid, 0, (
int) &fpxregs) < 0)
402 elf_fpxregset_t fpxregs;
407 if (
ptrace (PTRACE_GETFPXREGS,
tid, 0, &fpxregs) == -1)
420 if (
ptrace (PTRACE_SETFPXREGS,
tid, 0, &fpxregs) == -1)
462 if (regno == -1 || regno == i)
521 _(
"Got request for bad register number %d."), regno);
540 if (regno == -1 || regno == i)
587 _(
"Got request to store bad register number %d."), regno);
596 lwpid_t lwpid,
int idx,
void **base)
598 unsigned int base_addr;
604 *(
int *) base = base_addr;
616 #define LINUX_SYSCALL_LEN (sizeof linux_syscall) 619 #define LINUX_SYSCALL_REGNUM I386_EAX_REGNUM 624 #ifndef SYS_sigreturn 625 #define SYS_sigreturn 0x77 627 #ifndef SYS_rt_sigreturn 628 #define SYS_rt_sigreturn 0xad 632 #define LINUX_SIGCONTEXT_EFLAGS_OFFSET (64) 640 ptid_t ptid,
int step,
enum gdb_signal signal)
646 request = PTRACE_SYSCALL;
648 request = PTRACE_CONT;
658 request = PTRACE_SINGLESTEP;
683 unsigned long int eflags;
void i387_collect_fsave(const struct regcache *regcache, int regnum, void *fsave)
#define GETXSTATEREGS_SUPPLIES(regno)
static constexpr ptid_t tid
#define GETREGS_SUPPLIES(regno)
int catch_syscall_enabled(void)
static void i386_linux_resume(struct target_ops *ops, ptid_t ptid, int step, enum gdb_signal signal)
struct regcache * get_thread_regcache(ptid_t ptid)
mach_port_t mach_port_t name mach_port_t mach_port_t name kern_return_t int int rusage_t pid_t pid
void fill_gregset(const struct regcache *regcache, elf_gregset_t *gregsetp, int regno)
void i387_supply_fxsave(struct regcache *regcache, int regnum, const void *fxsave)
static void fetch_regs(struct regcache *regcache, int tid)
ptid_t regcache_get_ptid(const struct regcache *regcache)
void internal_error(const char *file, int line, const char *fmt,...)
struct target_ops * x86_linux_create_target(void)
void supply_fpregset(struct regcache *regcache, const elf_fpregset_t *fpregsetp)
ps_err_e x86_linux_get_thread_area(pid_t pid, void *addr, unsigned int *base_addr)
void i387_supply_fsave(struct regcache *regcache, int regnum, const void *fsave)
int gdbarch_num_regs(struct gdbarch *gdbarch)
int have_ptrace_getfpxregs
ps_err_e ps_get_thread_area(struct ps_prochandle *ph, lwpid_t lwpid, int idx, void **base)
static void store_register(const struct regcache *regcache, int regno)
static int store_fpxregs(const struct regcache *regcache, int tid, int regno)
#define LINUX_SIGCONTEXT_EFLAGS_OFFSET
enum tribool have_ptrace_getregset
void i387_collect_fxsave(const struct regcache *regcache, int regnum, void *fxsave)
void _initialize_i386_linux_nat(void)
static void i386_linux_store_inferior_registers(struct target_ops *ops, struct regcache *regcache, int regno)
static const unsigned char linux_syscall[]
enum register_status regcache_cooked_read_unsigned(struct regcache *regcache, int regnum, ULONGEST *val)
void(* to_resume)(struct target_ops *, ptid_t, int TARGET_DEBUG_PRINTER(target_debug_print_step), enum gdb_signal) TARGET_DEFAULT_NORETURN(noprocess())
enum bfd_endian gdbarch_byte_order(struct gdbarch *gdbarch)
int gdb_signal_to_host(enum gdb_signal)
static void store_fpregs(const struct regcache *regcache, int tid, int regno)
void x86_linux_add_target(struct target_ops *t)
void fill_fpregset(const struct regcache *regcache, elf_fpregset_t *fpregsetp, int regno)
const char * gdbarch_register_name(struct gdbarch *gdbarch, int regnr)
#define LINUX_SYSCALL_LEN
void read_memory(CORE_ADDR memaddr, gdb_byte *myaddr, ssize_t len)
static int store_xstateregs(const struct regcache *regcache, int tid, int regno)
long ptid_get_lwp(const ptid_t &ptid)
#define X86_XSTATE_MAX_SIZE
static void fetch_fpregs(struct regcache *regcache, int tid)
void i387_collect_xsave(const struct regcache *regcache, int regnum, void *xsave, int gcore)
void(* to_fetch_registers)(struct target_ops *, struct regcache *, int) TARGET_DEFAULT_IGNORE()
#define I386_LINUX_ORIG_EAX_REGNUM
void void void void void void void void void perror_with_name(const char *string) ATTRIBUTE_NORETURN
static int fetch_fpxregs(struct regcache *regcache, int tid)
int target_read_memory(CORE_ADDR memaddr, gdb_byte *myaddr, ssize_t len)
char * safe_strerror(int)
#define LINUX_SYSCALL_REGNUM
void supply_gregset(struct regcache *regcache, const elf_gregset_t *gregsetp)
static int fetch_xstateregs(struct regcache *regcache, int tid)
static void fetch_register(struct regcache *regcache, int regno)
void regcache_raw_supply(struct regcache *regcache, int regnum, const void *buf)
static void i386_linux_fetch_inferior_registers(struct target_ops *ops, struct regcache *regcache, int regno)
unsigned long long ULONGEST
int i386_linux_gregset_reg_offset[]
void regcache_raw_collect(const struct regcache *regcache, int regnum, void *buf)
int gdbarch_pc_regnum(struct gdbarch *gdbarch)
pid_t get_ptrace_pid(ptid_t ptid)
ULONGEST read_memory_unsigned_integer(CORE_ADDR memaddr, int len, enum bfd_endian byte_order)
void write_memory(CORE_ADDR memaddr, const bfd_byte *myaddr, ssize_t len)
static void store_regs(const struct regcache *regcache, int tid, int regno)
void i387_supply_xsave(struct regcache *regcache, int regnum, const void *xsave)
void(* to_store_registers)(struct target_ops *, struct regcache *, int) TARGET_DEFAULT_NORETURN(noprocess())
#define GETFPXREGS_SUPPLIES(regno)
enum bfd_endian byte_order
void error(const char *fmt,...)