35#include <elf/common.h>
38#include <sys/utsname.h>
39#include <sys/procfs.h>
50#ifndef PTRACE_GET_THREAD_AREA
51#define PTRACE_GET_THREAD_AREA 22
54#ifndef PTRACE_GETWMMXREGS
55#define PTRACE_GETWMMXREGS 18
56#define PTRACE_SETWMMXREGS 19
59#ifndef PTRACE_GETVFPREGS
60#define PTRACE_GETVFPREGS 27
61#define PTRACE_SETVFPREGS 28
64#ifndef PTRACE_GETHBPREGS
65#define PTRACE_GETHBPREGS 29
66#define PTRACE_SETHBPREGS 30
135 ret =
ptrace (PT_GETFPREGS, tid, 0, fp);
138 perror_with_name (_(
"Unable to fetch the floating point registers"));
163 elf_fpregset_t fpregs;
166 iov.iov_base = &fpregs;
167 iov.iov_len =
sizeof (fpregs);
172 ret =
ptrace (PT_GETFPREGS, tid, 0, fp);
175 perror_with_name (_(
"Unable to fetch the floating point registers"));
199 perror_with_name (_(
"Unable to store floating point registers"));
218 iov.iov_base = ®s;
219 iov.iov_len =
sizeof (regs);
227 perror_with_name (_(
"Unable to fetch general registers"));
246 iov.iov_base = ®s;
247 iov.iov_len =
sizeof (regs);
255 perror_with_name (_(
"Unable to fetch general registers"));
263 iov.iov_base = ®s;
264 iov.iov_len =
sizeof (regs);
272 perror_with_name (_(
"Unable to store general registers"));
289 perror_with_name (_(
"Unable to fetch WMMX registers"));
291 for (regno = 0; regno < 16; regno++)
294 for (regno = 0; regno < 2; regno++)
296 ®buf[16 * 8 + regno * 4]);
298 for (regno = 0; regno < 4; regno++)
300 ®buf[16 * 8 + 2 * 4 + regno * 4]);
314 perror_with_name (_(
"Unable to fetch WMMX registers"));
316 for (regno = 0; regno < 16; regno++)
320 for (regno = 0; regno < 2; regno++)
323 ®buf[16 * 8 + regno * 4]);
325 for (regno = 0; regno < 4; regno++)
328 ®buf[16 * 8 + 2 * 4 + regno * 4]);
333 perror_with_name (_(
"Unable to store WMMX registers"));
351 iov.iov_base = regbuf;
359 perror_with_name (_(
"Unable to fetch VFP registers"));
380 iov.iov_base = regbuf;
388 perror_with_name (_(
"Unable to fetch VFP registers (for update)"));
397 iov.iov_base = regbuf;
405 perror_with_name (_(
"Unable to store VFP registers"));
439 && (regno < ARM_D0_REGNUM + tdep->vfp_register_count
476 && (regno < ARM_D0_REGNUM + tdep->vfp_register_count
518 lwpid_t lwpid,
int idx,
void **base)
526 *base = (
void *) ((
char *)*base - idx);
541 elf_gregset_t gpregs;
545 iov.iov_base = &gpregs;
546 iov.iov_len =
sizeof (gpregs);
619 info.arch = (gdb_byte)((val >> 24) & 0xff);
620 info.max_wp_length = (gdb_byte)((val >> 16) & 0xff);
621 info.wp_count = (gdb_byte)((val >> 8) & 0xff);
622 info.bp_count = (gdb_byte)(val & 0xff);
626 warning (_(
"arm-linux-gdb supports %d hardware watchpoints but target \
627 supports %d"),
MAX_WPTS, info.wp_count);
633 warning (_(
"arm-linux-gdb supports %d hardware breakpoints but target \
634 supports %d"),
MAX_BPTS, info.bp_count);
649 return cap != NULL ? cap->
bp_count : 0;
657 return cap != NULL ? cap->
wp_count : 0;
673 else if (cnt + ot > count)
682 else if (cnt > count)
686 gdb_assert_not_reached (
"unknown breakpoint type");
852 gdb_assert ((byte_address_select & ~0xffU) == 0);
854 || ((byte_address_select & 0xfU) != 0));
856 return (byte_address_select << 5) | (hwbp_type << 3) | (3 << 1) |
enable;
863 return control & 0x1;
870 return control & ~0x1;
896 p->
address = (
unsigned int) address;
907 else if (
type == hw_write)
917 enum target_hw_bp_type
type,
923 gdb_assert (cap != NULL);
926 mask = (1 << len) - 1;
928 p->
address = (
unsigned int) addr;
977 pid_ptid = ptid_t (
pid);
990 for (i = 0; i < count; ++i)
1003 gdb_assert (i != count);
1018 pid_ptid = ptid_t (
pid);
1031 for (i = 0; i < count; ++i)
1044 gdb_assert (i != count);
1087 CORE_ADDR max_wp_length, aligned_addr;
1094 if (cap == NULL || cap->
wp_count == 0)
1100 aligned_addr = addr & ~(max_wp_length - 1);
1102 if (aligned_addr + max_wp_length < addr + len)
1107 if ((len & (len - 1)) != 0)
1117 enum target_hw_bp_type rw,
1135 int len,
enum target_hw_bp_type rw,
1161 if (siginfo.si_signo != SIGTRAP
1162 || (siginfo.si_code & 0xffff) != 0x0004 )
1169 slot = siginfo.si_errno;
1176 *addr_p = (CORE_ADDR) (uintptr_t) siginfo.si_addr;
1193 return start <= addr && start + length - 1 >= addr;
1209 info->bpts_changed[i] = 1;
1210 info->wpts_changed[i] = 1;
1241 if (arm_lwp_info == NULL)
1251 perror_with_name (_(
"Unexpected error setting breakpoint"));
1253 if (bpts[i].control != 0)
1256 perror_with_name (_(
"Unexpected error setting breakpoint"));
1268 perror_with_name (_(
"Unexpected error setting watchpoint"));
1270 if (wpts[i].control != 0)
1273 perror_with_name (_(
"Unexpected error setting watchpoint"));
1299 parent_pid = parent->
ptid.pid ();
1302 *child_state = *parent_state;
void aarch32_gp_regcache_collect(const struct regcache *regcache, uint32_t *regs, int arm_apcs_32)
void aarch32_gp_regcache_supply(struct regcache *regcache, uint32_t *regs, int arm_apcs_32)
void aarch32_vfp_regcache_collect(const struct regcache *regcache, gdb_byte *regs, const int vfp_register_count)
void aarch32_vfp_regcache_supply(struct regcache *regcache, gdb_byte *regs, const int vfp_register_count)
const target_desc * aarch32_read_description()
#define PTRACE_GET_THREAD_AREA
static int arm_linux_get_hw_watchpoint_count(void)
void _initialize_arm_linux_nat()
static int arm_linux_hw_breakpoint_equal(const struct arm_linux_hw_breakpoint *p1, const struct arm_linux_hw_breakpoint *p2)
void supply_gregset(struct regcache *regcache, const gdb_gregset_t *gregsetp)
static void fetch_wmmx_regs(struct regcache *regcache)
static struct arm_linux_process_info * arm_linux_add_process(pid_t pid)
static void store_fpregs(const struct regcache *regcache)
unsigned int arm_hwbp_control_t
static void fetch_vfp_regs(struct regcache *regcache)
static arm_linux_nat_target the_arm_linux_nat_target
#define PTRACE_SETHBPREGS
static void fetch_fpregs(struct regcache *regcache)
static void store_wmmx_regs(const struct regcache *regcache)
void fill_gregset(const struct regcache *regcache, gdb_gregset_t *gregsetp, int regno)
static void fetch_regs(struct regcache *regcache)
static arm_hwbp_type arm_linux_get_hwbp_type(enum target_hw_bp_type type)
#define PTRACE_GETWMMXREGS
void supply_fpregset(struct regcache *regcache, const gdb_fpregset_t *fpregsetp)
ps_err_e ps_get_thread_area(struct ps_prochandle *ph, lwpid_t lwpid, int idx, void **base)
static arm_hwbp_control_t arm_hwbp_control_initialize(unsigned byte_address_select, arm_hwbp_type hwbp_type, int enable)
static int update_registers_callback(struct lwp_info *lwp, int watch, int index)
#define PTRACE_SETWMMXREGS
static void arm_linux_remove_hw_breakpoint1(const struct arm_linux_hw_breakpoint *bpt, int watchpoint)
static void arm_linux_hw_breakpoint_initialize(struct gdbarch *gdbarch, struct bp_target_info *bp_tgt, struct arm_linux_hw_breakpoint *p)
static void arm_linux_insert_hw_breakpoint1(const struct arm_linux_hw_breakpoint *bpt, int watchpoint)
static void store_regs(const struct regcache *regcache)
static arm_hwbp_control_t arm_hwbp_control_disable(arm_hwbp_control_t control)
#define PTRACE_GETVFPREGS
static void store_vfp_regs(const struct regcache *regcache)
static struct arm_linux_process_info * arm_linux_find_process_pid(pid_t pid)
void fill_fpregset(const struct regcache *regcache, gdb_fpregset_t *fpregsetp, int regno)
static void arm_linux_hw_watchpoint_initialize(CORE_ADDR addr, int len, enum target_hw_bp_type type, struct arm_linux_hw_breakpoint *p)
#define PTRACE_GETHBPREGS
static struct arm_linux_process_info * arm_linux_process_list
static struct arm_linux_process_info * arm_linux_process_info_get(pid_t pid)
#define PTRACE_SETVFPREGS
static int arm_hwbp_control_is_enabled(arm_hwbp_control_t control)
static struct arm_linux_debug_reg_state * arm_linux_get_debug_reg_state(pid_t pid)
static const struct arm_linux_hwbp_cap * arm_linux_get_hwbp_cap(void)
static int arm_linux_get_hw_breakpoint_count(void)
void arm_linux_supply_gregset(const struct regset *regset, struct regcache *regcache, int regnum, const void *gregs_buf, size_t len)
void arm_linux_supply_nwfpe(const struct regset *regset, struct regcache *regcache, int regnum, const void *regs_buf, size_t len)
void supply_nwfpe_register(struct regcache *regcache, int regno, const gdb_byte *regs)
void arm_linux_collect_nwfpe(const struct regset *regset, const struct regcache *regcache, int regnum, void *regs_buf, size_t len)
void collect_nwfpe_register(const struct regcache *regcache, int regno, gdb_byte *regs)
void arm_linux_collect_gregset(const struct regset *regset, const struct regcache *regcache, int regnum, void *gregs_buf, size_t len)
#define ARM_LINUX_SIZEOF_NWFPE
#define NWFPE_FPSR_OFFSET
int arm_pc_is_thumb(struct gdbarch *gdbarch, CORE_ADDR memaddr)
const target_desc * arm_read_description(arm_fp_type fp_type, bool tls)
#define ARM_VFP3_REGS_SIZE
int remove_hw_breakpoint(struct gdbarch *, struct bp_target_info *) override
int region_ok_for_hw_watchpoint(CORE_ADDR, int) override
int insert_watchpoint(CORE_ADDR, int, enum target_hw_bp_type, struct expression *) override
void low_new_fork(struct lwp_info *parent, pid_t child_pid) override
bool stopped_data_address(CORE_ADDR *) override
void low_new_thread(struct lwp_info *lp) override
void low_delete_thread(struct arch_lwp_info *lp) override
void store_registers(struct regcache *, int) override
bool stopped_by_watchpoint() override
int can_use_hw_breakpoint(enum bptype, int, int) override
const struct target_desc * read_description() override
bool watchpoint_addr_within_range(CORE_ADDR, CORE_ADDR, int) override
void fetch_registers(struct regcache *, int) override
int remove_watchpoint(CORE_ADDR, int, enum target_hw_bp_type, struct expression *) override
void low_forget_process(pid_t pid) override
int insert_hw_breakpoint(struct gdbarch *, struct bp_target_info *) override
void low_prepare_to_resume(struct lwp_info *lp) override
const target_info & info() const override
void raw_collect(int regnum, void *buf) const override
void raw_supply(int regnum, const void *buf) override
enum register_status get_register_status(int regnum) const override
#define ptrace(request, pid, addr, data)
mach_port_t mach_port_t name mach_port_t mach_port_t name kern_return_t int int rusage_t pid_t pid
GDB_FPREGSET_T gdb_fpregset_t
GDB_GREGSET_T gdb_gregset_t
void add_inf_child_target(inf_child_target *target)
void linux_stop_lwp(struct lwp_info *lwp)
bool linux_nat_get_siginfo(ptid_t ptid, siginfo_t *siginfo)
struct lwp_info * iterate_over_lwps(ptid_t filter, gdb::function_view< iterate_over_lwps_ftype > callback)
struct linux_nat_target * linux_target
enum tribool have_ptrace_getregset
CORE_ADDR linux_get_hwcap()
char bpts_changed[MAX_BPTS]
char wpts_changed[MAX_WPTS]
struct arm_linux_hw_breakpoint wpts[MAX_WPTS]
struct arm_linux_hw_breakpoint bpts[MAX_BPTS]
arm_hwbp_control_t control
struct arm_linux_debug_reg_state state
struct arm_linux_process_info * next
struct arch_lwp_info * arch_private
target_ops * beneath() const
virtual const struct target_desc * read_description() TARGET_DEFAULT_RETURN(NULL)