24 #include "elf/common.h"
25 #include <sys/ptrace.h>
55 #define GETREGS_SUPPLIES(regno) \
56 ((0 <= (regno) && (regno) <= 15) || (regno) == I386_LINUX_ORIG_EAX_REGNUM)
58 #define GETFPXREGS_SUPPLIES(regno) \
59 (I386_ST0_REGNUM <= (regno) && (regno) < I386_SSE_NUM_REGS)
61 #define GETXSTATEREGS_SUPPLIES(regno) \
62 (I386_ST0_REGNUM <= (regno) && (regno) < I386_AVX512_NUM_REGS)
66 #ifdef HAVE_PTRACE_GETREGS
82 #ifdef HAVE_PTRACE_GETFPXREGS
113 val =
ptrace (PTRACE_PEEKUSER, tid,
116 error (
_(
"Couldn't read register %s (#%d): %s."),
142 ptrace (PTRACE_POKEUSER, tid,
145 error (
_(
"Couldn't write register %s (#%d): %s."),
179 elf_gregset_t *gregsetp,
int regno)
185 if (regno == -1 || regno == i)
196 #ifdef HAVE_PTRACE_GETREGS
205 elf_gregset_t *regs_p = ®s;
265 elf_fpregset_t *fpregsetp,
int regno)
270 #ifdef HAVE_PTRACE_GETREGS
278 elf_fpregset_t fpregs;
292 elf_fpregset_t fpregs;
333 iov.iov_base = xstateregs;
334 iov.iov_len =
sizeof(xstateregs);
356 iov.iov_base = xstateregs;
357 iov.iov_len =
sizeof(xstateregs);
371 #ifdef HAVE_PTRACE_GETFPXREGS
380 elf_fpxregset_t fpxregs;
385 if (
ptrace (PTRACE_GETFPXREGS, tid, 0, (
int) &fpxregs) < 0)
407 elf_fpxregset_t fpxregs;
412 if (
ptrace (PTRACE_GETFPXREGS, tid, 0, &fpxregs) == -1)
425 if (
ptrace (PTRACE_SETFPXREGS, tid, 0, &fpxregs) == -1)
467 if (regno == -1 || regno == i)
529 _(
"Got request for bad register number %d."), regno);
548 if (regno == -1 || regno == i)
598 _(
"Got request to store bad register number %d."), regno);
607 lwpid_t lwpid,
int idx,
void **base)
609 unsigned int base_addr;
615 *(
int *) base = base_addr;
627 #define LINUX_SYSCALL_LEN (sizeof linux_syscall)
630 #define LINUX_SYSCALL_REGNUM I386_EAX_REGNUM
635 #ifndef SYS_sigreturn
636 #define SYS_sigreturn 0x77
638 #ifndef SYS_rt_sigreturn
639 #define SYS_rt_sigreturn 0xad
643 #define LINUX_SIGCONTEXT_EFLAGS_OFFSET (64)
651 ptid_t ptid,
int step,
enum gdb_signal signal)
657 request = PTRACE_SYSCALL;
659 request = PTRACE_CONT;
669 request = PTRACE_SINGLESTEP;
694 unsigned long int eflags;
void i387_collect_fsave(const struct regcache *regcache, int regnum, void *fsave)
#define GETXSTATEREGS_SUPPLIES(regno)
#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)
struct gdbarch * get_regcache_arch(const struct regcache *regcache)
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)
void internal_error(const char *file, int line, const char *fmt,...)
struct target_ops * x86_linux_create_target(void)
ps_err_e ps_get_thread_area(const struct ps_prochandle *ph, lwpid_t lwpid, int idx, void **base)
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
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_file_ftype(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)
#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)
int ptid_get_pid(ptid_t ptid)
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[]
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)
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,...)
mach_port_t mach_port_t name mach_port_t mach_port_t name error_t int int rusage_t pid_t pid
initialize_file_ftype _initialize_i386_linux_nat