34 #include <elf/common.h> 37 #include <sys/utsname.h> 38 #include <sys/procfs.h> 48 #ifndef PTRACE_GET_THREAD_AREA 49 #define PTRACE_GET_THREAD_AREA 22 52 #ifndef PTRACE_GETWMMXREGS 53 #define PTRACE_GETWMMXREGS 18 54 #define PTRACE_SETWMMXREGS 19 57 #ifndef PTRACE_GETVFPREGS 58 #define PTRACE_GETVFPREGS 27 59 #define PTRACE_SETVFPREGS 28 62 #ifndef PTRACE_GETHBPREGS 63 #define PTRACE_GETHBPREGS 29 64 #define PTRACE_SETHBPREGS 30 121 elf_fpregset_t fpregs;
124 iov.iov_base = &fpregs;
125 iov.iov_len =
sizeof (fpregs);
176 iov.iov_base = ®s;
177 iov.iov_len =
sizeof (regs);
204 iov.iov_base = ®s;
205 iov.iov_len =
sizeof (regs);
221 iov.iov_base = ®s;
222 iov.iov_len =
sizeof (regs);
236 #define IWMMXT_REGS_SIZE (16 * 8 + 6 * 4) 251 for (regno = 0; regno < 16; regno++)
255 for (regno = 0; regno < 2; regno++)
257 ®buf[16 * 8 + regno * 4]);
259 for (regno = 0; regno < 4; regno++)
261 ®buf[16 * 8 + 2 * 4 + regno * 4]);
277 for (regno = 0; regno < 16; regno++)
283 for (regno = 0; regno < 2; regno++)
287 ®buf[16 * 8 + regno * 4]);
289 for (regno = 0; regno < 4; regno++)
293 ®buf[16 * 8 + 2 * 4 + regno * 4]);
316 iov.iov_base = regbuf;
345 iov.iov_base = regbuf;
362 iov.iov_base = regbuf;
485 lwpid_t lwpid,
int idx,
void **base)
493 *base = (
void *) ((
char *)*base - idx);
505 elf_gregset_t gpregs;
509 iov.iov_base = &gpregs;
510 iov.iov_len =
sizeof (gpregs);
602 warning (
_(
"arm-linux-gdb supports %d hardware watchpoints but target \ 609 warning (
_(
"arm-linux-gdb supports %d hardware breakpoints but target \ 625 return cap != NULL ? cap->
bp_count : 0;
633 return cap != NULL ? cap->
wp_count : 0;
650 else if (cnt + ot > count)
659 else if (cnt > count)
829 gdb_assert ((byte_address_select & ~0xffU) == 0);
831 || ((byte_address_select & 0xfU) != 0));
833 return (byte_address_select << 5) | (hwbp_type << 3) | (3 << 1) |
enable;
840 return control & 0x1;
847 return control & ~0x1;
873 p->
address = (
unsigned int) address;
903 mask = (1 << len) - 1;
905 p->
address = (
unsigned int) addr;
932 if (
lwp->arch_private == NULL)
938 lwp->arch_private->wpts_changed[data->
index] = 1;
940 lwp->arch_private->bpts_changed[data->
index] = 1;
976 for (i = 0; i < count; ++i)
1015 for (i = 0; i < count; ++i)
1080 if (cap == NULL || cap->
wp_count == 0)
1093 if ((len & (len - 1)) != 0)
1150 if (siginfo.si_signo != SIGTRAP
1151 || (siginfo.si_code & 0xffff) != 0x0004 )
1158 slot = siginfo.si_errno;
1165 *addr_p = (
CORE_ADDR) (uintptr_t) siginfo.si_addr;
1182 return start <= addr && start + length - 1 >= addr;
1230 if (arm_lwp_info == NULL)
1242 if (bpts[i].control != 0)
1259 if (wpts[i].control != 0)
1291 *child_state = *parent_state;
struct arch_lwp_info * arch_private
#define PTRACE_SETHBPREGS
static int update_registers_callback(struct lwp_info *lwp, void *arg)
static constexpr ptid_t tid
struct target_desc * tdesc_arm_with_iwmmxt
#define PTRACE_SETVFPREGS
static const struct arm_linux_hwbp_cap * arm_linux_get_hwbp_cap(void)
static void arm_linux_delete_thread(struct arch_lwp_info *arch_lwp)
const struct target_desc *(* to_read_description)(struct target_ops *ops) TARGET_DEFAULT_RETURN(NULL)
void arm_linux_supply_nwfpe(const struct regset *regset, struct regcache *regcache, int regnum, const void *regs_buf, size_t len)
int ptid_get_pid(const ptid_t &ptid)
static void store_fpregs(const struct regcache *regcache)
void linux_stop_lwp(struct lwp_info *lwp)
struct arm_linux_hw_breakpoint wpts[MAX_WPTS]
mach_port_t mach_port_t name mach_port_t mach_port_t name kern_return_t int int rusage_t pid_t pid
static void store_wmmx_regs(const struct regcache *regcache)
static struct arm_linux_process_info * arm_linux_find_process_pid(pid_t pid)
void linux_nat_set_new_thread(struct target_ops *t, void(*new_thread)(struct lwp_info *))
struct target_desc * tdesc_arm_with_vfpv2
void warning(const char *fmt,...)
#define PTRACE_GET_THREAD_AREA
#define NWFPE_FPSR_OFFSET
void aarch32_gp_regcache_collect(const struct regcache *regcache, uint32_t *regs, int arm_apcs_32)
static int arm_linux_get_hw_watchpoint_count(void)
static void arm_linux_hw_breakpoint_initialize(struct gdbarch *gdbarch, struct bp_target_info *bp_tgt, struct arm_linux_hw_breakpoint *p)
void collect_nwfpe_register(const struct regcache *regcache, int regno, gdb_byte *regs)
static void store_regs(const struct regcache *regcache)
#define PTRACE_GETWMMXREGS
static void fetch_regs(struct regcache *regcache)
ptid_t regcache_get_ptid(const struct regcache *regcache)
static void fetch_wmmx_regs(struct regcache *regcache)
static int arm_hwbp_control_is_enabled(arm_hwbp_control_t control)
struct target_desc * tdesc_arm_with_neon
static struct arm_linux_debug_reg_state * arm_linux_get_debug_reg_state(pid_t pid)
static arm_hwbp_control_t arm_hwbp_control_disable(arm_hwbp_control_t control)
int(* to_remove_watchpoint)(struct target_ops *, CORE_ADDR, int, enum target_hw_bp_type, struct expression *) TARGET_DEFAULT_RETURN(-1)
static void fetch_vfp_regs(struct regcache *regcache)
int(* to_region_ok_for_hw_watchpoint)(struct target_ops *, CORE_ADDR, int) TARGET_DEFAULT_FUNC(default_region_ok_for_hw_watchpoint)
int(* to_can_use_hw_breakpoint)(struct target_ops *, enum bptype, int, int) TARGET_DEFAULT_RETURN(0)
int linux_nat_get_siginfo(ptid_t ptid, siginfo_t *siginfo)
struct gdbarch_tdep * gdbarch_tdep(struct gdbarch *gdbarch)
static int arm_linux_remove_watchpoint(struct target_ops *self, CORE_ADDR addr, int len, enum target_hw_bp_type rw, struct expression *cond)
void linux_nat_set_new_fork(struct target_ops *t, linux_nat_new_fork_ftype *new_fork)
#define PTRACE_GETVFPREGS
static void arm_linux_forget_process(pid_t pid)
static void arm_linux_prepare_to_resume(struct lwp_info *lwp)
#define PTRACE_GETHBPREGS
unsigned int arm_hwbp_control_t
static void arm_linux_new_thread(struct lwp_info *lp)
struct arm_linux_process_info * next
static void arm_linux_store_inferior_registers(struct target_ops *ops, struct regcache *regcache, int regno)
enum tribool have_ptrace_getregset
static void arm_linux_hw_watchpoint_initialize(CORE_ADDR addr, int len, enum target_hw_bp_type type, struct arm_linux_hw_breakpoint *p)
void fill_fpregset(const struct regcache *regcache, gdb_fpregset_t *fpregsetp, int regno)
void aarch32_vfp_regcache_supply(struct regcache *regcache, gdb_byte *regs, const int vfp_register_count)
arm_hwbp_control_t control
int(* to_watchpoint_addr_within_range)(struct target_ops *, CORE_ADDR, CORE_ADDR, int) TARGET_DEFAULT_FUNC(default_watchpoint_addr_within_range)
GDB_GREGSET_T gdb_gregset_t
static void arm_linux_fetch_inferior_registers(struct target_ops *ops, struct regcache *regcache, int regno)
static const struct target_desc * arm_linux_read_description(struct target_ops *ops)
void arm_linux_collect_gregset(const struct regset *regset, const struct regcache *regcache, int regnum, void *gregs_buf, size_t len)
char bpts_changed[MAX_BPTS]
int target_auxv_search(struct target_ops *ops, CORE_ADDR match, CORE_ADDR *valp)
GDB_FPREGSET_T gdb_fpregset_t
ptid_t pid_to_ptid(int pid)
void linux_nat_set_prepare_to_resume(struct target_ops *t, void(*prepare_to_resume)(struct lwp_info *))
void supply_fpregset(struct regcache *regcache, const gdb_fpregset_t *fpregsetp)
static void arm_linux_insert_hw_breakpoint1(const struct arm_linux_hw_breakpoint *bpt, int watchpoint)
static arm_hwbp_control_t arm_hwbp_control_initialize(unsigned byte_address_select, arm_hwbp_type hwbp_type, int enable)
void linux_nat_add_target(struct target_ops *t)
int(* to_insert_watchpoint)(struct target_ops *, CORE_ADDR, int, enum target_hw_bp_type, struct expression *) TARGET_DEFAULT_RETURN(-1)
static int arm_linux_region_ok_for_hw_watchpoint(struct target_ops *self, CORE_ADDR addr, int len)
struct target_ops * linux_target(void)
long ptid_get_lwp(const ptid_t &ptid)
int arm_pc_is_thumb(struct gdbarch *gdbarch, CORE_ADDR memaddr)
int(* to_insert_hw_breakpoint)(struct target_ops *, struct gdbarch *, struct bp_target_info *) TARGET_DEFAULT_RETURN(-1)
static int arm_linux_insert_hw_breakpoint(struct target_ops *self, struct gdbarch *gdbarch, struct bp_target_info *bp_tgt)
static struct arm_linux_process_info * arm_linux_process_info_get(pid_t pid)
static int arm_linux_remove_hw_breakpoint(struct target_ops *self, struct gdbarch *gdbarch, struct bp_target_info *bp_tgt)
static void fetch_fpregs(struct regcache *regcache)
static int arm_linux_get_hw_breakpoint_count(void)
int(* to_remove_hw_breakpoint)(struct target_ops *, struct gdbarch *, struct bp_target_info *) TARGET_DEFAULT_RETURN(-1)
static int arm_linux_hw_breakpoint_equal(const struct arm_linux_hw_breakpoint *p1, const struct arm_linux_hw_breakpoint *p2)
void arm_linux_supply_gregset(const struct regset *regset, struct regcache *regcache, int regnum, const void *gregs_buf, size_t len)
static void store_vfp_regs(const struct regcache *regcache)
void(* to_fetch_registers)(struct target_ops *, struct regcache *, int) TARGET_DEFAULT_IGNORE()
void arm_linux_collect_nwfpe(const struct regset *regset, const struct regcache *regcache, int regnum, void *regs_buf, size_t len)
void void void void void void void void void perror_with_name(const char *string) ATTRIBUTE_NORETURN
#define PTRACE_SETWMMXREGS
static int arm_linux_watchpoint_addr_within_range(struct target_ops *target, CORE_ADDR addr, CORE_ADDR start, int length)
enum register_status regcache_register_status(const struct regcache *regcache, int regnum)
static int arm_linux_insert_watchpoint(struct target_ops *self, CORE_ADDR addr, int len, enum target_hw_bp_type rw, struct expression *cond)
struct arm_linux_debug_reg_state state
void supply_nwfpe_register(struct regcache *regcache, int regno, const gdb_byte *regs)
static int arm_linux_stopped_by_watchpoint(struct target_ops *ops)
static int arm_linux_can_use_hw_breakpoint(struct target_ops *self, enum bptype type, int cnt, int ot)
static struct arm_linux_process_info * arm_linux_add_process(pid_t pid)
static constexpr ptid_t lwp
void _initialize_arm_linux_nat(void)
void fill_gregset(const struct regcache *regcache, gdb_gregset_t *gregsetp, int regno)
int(* to_stopped_by_watchpoint)(struct target_ops *) TARGET_DEFAULT_RETURN(0)
void regcache_raw_supply(struct regcache *regcache, int regnum, const void *buf)
void supply_gregset(struct regcache *regcache, const gdb_gregset_t *gregsetp)
void aarch32_vfp_regcache_collect(const struct regcache *regcache, gdb_byte *regs, const int vfp_register_count)
void aarch32_gp_regcache_supply(struct regcache *regcache, uint32_t *regs, int arm_apcs_32)
static struct arm_linux_process_info * arm_linux_process_list
void regcache_raw_collect(const struct regcache *regcache, int regnum, void *buf)
void linux_nat_set_forget_process(struct target_ops *t, linux_nat_forget_process_ftype *fn)
static arm_hwbp_type arm_linux_get_hwbp_type(enum target_hw_bp_type type)
int(* to_stopped_data_address)(struct target_ops *, CORE_ADDR *) TARGET_DEFAULT_RETURN(0)
void(* to_store_registers)(struct target_ops *, struct regcache *, int) TARGET_DEFAULT_NORETURN(noprocess())
struct lwp_info * iterate_over_lwps(ptid_t filter, iterate_over_lwps_ftype callback, void *data)
void linux_nat_set_delete_thread(struct target_ops *t, void(*delete_thread)(struct arch_lwp_info *))
struct target_desc * tdesc_arm_with_vfpv3
ps_err_e ps_get_thread_area(struct ps_prochandle *ph, lwpid_t lwpid, int idx, void **base)
static void arm_linux_remove_hw_breakpoint1(const struct arm_linux_hw_breakpoint *bpt, int watchpoint)
static int arm_linux_stopped_data_address(struct target_ops *target, CORE_ADDR *addr_p)
#define ARM_LINUX_SIZEOF_NWFPE
struct target_ops * beneath
char wpts_changed[MAX_WPTS]
static void arm_linux_new_fork(struct lwp_info *parent, pid_t child_pid)
struct arm_linux_hw_breakpoint bpts[MAX_BPTS]