27 #include <sys/ptrace.h>
46 #ifndef PTRACE_GET_THREAD_AREA
47 #define PTRACE_GET_THREAD_AREA 22
50 #ifndef PTRACE_GETWMMXREGS
51 # define PTRACE_GETWMMXREGS 18
52 # define PTRACE_SETWMMXREGS 19
55 #ifndef PTRACE_GETVFPREGS
56 # define PTRACE_GETVFPREGS 27
57 # define PTRACE_SETVFPREGS 28
60 #ifndef PTRACE_GETHBPREGS
61 #define PTRACE_GETHBPREGS 29
62 #define PTRACE_SETHBPREGS 30
123 #define HWCAP_IWMMXT 512
124 #define HWCAP_NEON 4096
125 #define HWCAP_VFPv3 8192
126 #define HWCAP_VFPv3D16 16384
128 #ifdef HAVE_SYS_REG_H
132 #define arm_num_regs 26
135 0, 4, 8, 12, 16, 20, 24, 28,
136 32, 36, 40, 44, 48, 52, 56, 60,
137 -1, -1, -1, -1, -1, -1, -1, -1, -1,
169 memset (zerobuf, 0, 8);
185 for (i = 0; i < 16; i++)
189 for (i = 0; i < 6; i++)
191 (
char *) buf + 16 * 8 + i * 4);
202 for (i = 0; i < 16; i++)
206 for (i = 0; i < 6; i++)
208 (
char *) buf + 16 * 8 + i * 4);
225 for (i = 0; i < num; i++)
245 for (i = 0; i < num; i++)
266 unsigned long newpc = pc;
272 #define arm_breakpoint_len 4
338 lwpid_t lwpid,
int idx,
void **base)
346 *base = (
void *) ((
char *)*base - idx);
371 internal_error (__FILE__, __LINE__,
"Unsupported number of watchpoints");
373 internal_error (__FILE__, __LINE__,
"Unsupported number of breakpoints");
406 gdb_assert ((byte_address_select & ~0xffU) == 0);
408 || ((byte_address_select & 0xfU) != 0));
410 return (byte_address_select << 5) | (hwbp_type << 3) | (3 << 1) | enable;
417 return control & 0x1;
431 return control & ~0x1;
505 if ((len & (len - 1)) != 0)
510 aligned_addr = addr & ~(max_wp_length - 1);
511 if (aligned_addr + max_wp_length < addr + len)
514 mask = (1 << len) - 1;
517 p->
address = (
unsigned int) addr;
587 return watch == -1 ? 1 : -1;
601 for (i = 0; i < count; i++)
641 for (i = 0; i < count; i++)
672 if (siginfo.si_signo != SIGTRAP
673 || (siginfo.si_code & 0xffff) != 0x0004 )
678 if (siginfo.si_errno >= 0)
683 = (
CORE_ADDR) (uintptr_t) siginfo.si_addr;
749 *child_proc_info = *parent_proc_info;
818 unsigned char *data =
alloca (8);
823 unsigned int *data_p = (
unsigned int *)data;
824 if (data_p[0] == AT_HWCAP)
893 { PTRACE_GETREGS, PTRACE_SETREGS, 0, 18 * 4,
902 { 0, 0, 0, -1, -1, NULL, NULL }
918 static struct regs_info regs_info =
925 static const struct regs_info *
const struct target_desc * tdesc
static unsigned long arm_hwcap
struct arch_lwp_info * arch_private
struct thread_info * current_thread
void collect_register(struct regcache *regcache, int n, void *buf)
static arm_hwbp_control_t arm_hwbp_control_initialize(unsigned byte_address_select, arm_hwbp_type hwbp_type, int enable)
static int arm_linux_get_hw_breakpoint_count(void)
static int arm_hwbp_control_is_initialized(arm_hwbp_control_t control)
const struct target_desc * tdesc_arm_with_neon
static int arm_hwbp_control_is_enabled(arm_hwbp_control_t control)
static void arm_linux_init_hwbp_cap(int pid)
void init_registers_arm_with_neon(void)
void supply_register_by_name(struct regcache *regcache, const char *name, const void *buf)
static int update_registers_callback(struct inferior_list_entry *entry, void *arg)
static void arm_new_thread(struct lwp_info *lwp)
static void arm_arch_setup(void)
static int arm_breakpoint_at(CORE_ADDR where)
static int arm_remove_point(enum raw_bkpt_type type, CORE_ADDR addr, int len, struct raw_breakpoint *bp)
struct lwp_info * find_lwp_pid(ptid_t ptid)
const struct target_desc * tdesc_arm_with_vfpv2
void internal_error(const char *file, int line, const char *fmt,...)
struct process_info * find_process_pid(int pid)
static int arm_linux_hw_point_initialize(enum raw_bkpt_type raw_type, CORE_ADDR addr, int len, struct arm_linux_hw_breakpoint *p)
static const struct target_desc * arm_read_description(void)
#define PTRACE_SETHBPREGS
static void arm_prepare_to_resume(struct lwp_info *lwp)
static void arm_fill_wmmxregset(struct regcache *regcache, void *buf)
static struct @1 arm_linux_hwbp_cap
#define get_thread_lwp(thr)
struct target_ops * the_target
static struct usrregs_info arm_usrregs_info
const struct target_desc * tdesc
static int arm_stopped_by_watchpoint(void)
static struct regs_info regs_info
struct arch_process_info * arch_private
const struct target_desc * tdesc_arm_with_vfpv3
static int arm_cannot_store_register(int regno)
struct arm_linux_hw_breakpoint wpts[MAX_WPTS]
#define arm_breakpoint_len
#define PTRACE_GETHBPREGS
void collect_register_by_name(struct regcache *regcache, const char *name, void *buf)
static void arm_set_pc(struct regcache *regcache, CORE_ADDR pc)
void init_registers_arm_with_iwmmxt(void)
arm_hwbp_control_t control
static void arm_fill_gregset(struct regcache *regcache, void *buf)
static struct regset_info arm_regsets[]
char bpts_changed[MAX_BPTS]
#define gdb_assert_not_reached(message)
#define get_lwp_thread(lwp)
static int raw_bkpt_type_to_arm_hwbp_type(enum raw_bkpt_type raw_type)
const struct target_desc * tdesc_arm_with_iwmmxt
static const unsigned short thumb_breakpoint
#define PTRACE_GETVFPREGS
struct arm_linux_hw_breakpoint bpts[MAX_BPTS]
static const unsigned short thumb2_breakpoint[]
#define PTRACE_GETWMMXREGS
struct process_info * current_process(void)
struct process_info_private * priv
struct inferior_list all_threads
static void arm_store_gregset(struct regcache *regcache, const void *buf)
#define PTRACE_SETWMMXREGS
static void arm_new_fork(struct process_info *parent, struct process_info *child)
static CORE_ADDR arm_reinsert_addr(void)
void initialize_low_arch(void)
static const unsigned long arm_breakpoint
#define PTRACE_GETSIGINFO
static int arm_linux_get_hw_watchpoint_count(void)
static void arm_fill_vfpregset(struct regcache *regcache, void *buf)
const struct target_desc * tdesc_arm
static arm_hwbp_control_t arm_hwbp_control_disable(arm_hwbp_control_t control)
static int arm_linux_get_hw_watchpoint_max_length(void)
static struct regsets_info arm_regsets_info
int find_regno(const struct target_desc *tdesc, const char *name)
static int arm_insert_point(enum raw_bkpt_type type, CORE_ADDR addr, int len, struct raw_breakpoint *bp)
void init_registers_arm(void)
void init_registers_arm_with_vfpv3(void)
static void arm_store_wmmxregset(struct regcache *regcache, const void *buf)
int(* read_auxv)(CORE_ADDR offset, unsigned char *myaddr, unsigned int len)
#define PTRACE_SETVFPREGS
int(* read_memory)(CORE_ADDR memaddr, unsigned char *myaddr, int len)
struct regcache * get_thread_regcache(struct thread_info *thread, int fetch)
static CORE_ADDR arm_get_pc(struct regcache *regcache)
#define Z_PACKET_ACCESS_WP
void perror_with_name(const char *string)
static int arm_cannot_fetch_register(int regno)
static int arm_supports_z_point_type(char z_type)
static CORE_ADDR arm_stopped_data_address(void)
CORE_ADDR stopped_data_address
static const struct regs_info * arm_regs_info(void)
static int arm_linux_hw_breakpoint_equal(const struct arm_linux_hw_breakpoint *p1, const struct arm_linux_hw_breakpoint *p2)
#define PTRACE_GET_THREAD_AREA
void debug_printf(const char *fmt,...)
ps_err_e ps_get_thread_area(const struct ps_prochandle *ph, lwpid_t lwpid, int idx, void **base)
void linux_stop_lwp(struct lwp_info *lwp)
static void arm_store_vfpregset(struct regcache *regcache, const void *buf)
void supply_register(struct regcache *regcache, int n, const void *buf)
PTR xcalloc(size_t number, size_t size)
void init_registers_arm_with_vfpv2(void)
static int arm_get_hwcap(unsigned long *valp)
static const unsigned long arm_eabi_breakpoint
unsigned int arm_hwbp_control_t
static struct arch_process_info * arm_new_process(void)
unsigned char max_wp_length
#define Z_PACKET_WRITE_WP
char wpts_changed[MAX_WPTS]
struct inferior_list_entry * find_inferior(struct inferior_list *list, int(*func)(struct inferior_list_entry *, void *), void *arg)