22 #include "arch/arm-linux.h" 23 #include "arch/arm-get-next-pcs.h" 34 #include <sys/syscall.h> 49 #ifndef PTRACE_GET_THREAD_AREA 50 #define PTRACE_GET_THREAD_AREA 22 53 #ifndef PTRACE_GETWMMXREGS 54 # define PTRACE_GETWMMXREGS 18 55 # define PTRACE_SETWMMXREGS 19 58 #ifndef PTRACE_GETVFPREGS 59 # define PTRACE_GETVFPREGS 27 60 # define PTRACE_SETVFPREGS 28 63 #ifndef PTRACE_GETHBPREGS 64 #define PTRACE_GETHBPREGS 29 65 #define PTRACE_SETHBPREGS 30 124 #define HWCAP_IWMMXT 512 125 #define HWCAP_NEON 4096 126 #define HWCAP_VFPv3 8192 127 #define HWCAP_VFPv3D16 16384 129 #ifdef HAVE_SYS_REG_H 133 #define arm_num_regs 26 136 0, 4, 8, 12, 16, 20, 24, 28,
137 32, 36, 40, 44, 48, 52, 56, 60,
138 -1, -1, -1, -1, -1, -1, -1, -1, -1,
160 arm_linux_get_next_pcs_fixup,
183 for (i = 0; i < 16; i++)
187 for (i = 0; i < 6; i++)
189 (
char *) buf + 16 * 8 + i * 4);
200 for (i = 0; i < 16; i++)
204 for (i = 0; i < 6; i++)
206 (
char *) buf + 16 * 8 + i * 4);
229 return UNMAKE_THUMB_ADDR (val);
275 lwpid_t lwpid,
int idx,
void **base)
283 *base = (
void *) ((
char *)*base - idx);
308 internal_error (__FILE__, __LINE__,
"Unsupported number of watchpoints");
310 internal_error (__FILE__, __LINE__,
"Unsupported number of breakpoints");
343 gdb_assert ((byte_address_select & ~0xffU) == 0);
345 || ((byte_address_select & 0xfU) != 0));
347 return (byte_address_select << 5) | (hwbp_type << 3) | (3 << 1) | enable;
354 return control & 0x1;
368 return control & ~0x1;
442 if ((len & (len - 1)) != 0)
451 mask = (1 << len) - 1;
454 p->
address = (
unsigned int) addr;
511 return watch == -1 ? 1 : -1;
525 for (i = 0; i < count; i++)
570 for (i = 0; i < count; i++)
606 if (siginfo.si_signo != SIGTRAP
607 || (siginfo.si_code & 0xffff) != 0x0004 )
612 if (siginfo.si_errno >= 0)
617 = (
CORE_ADDR) (uintptr_t) siginfo.si_addr;
702 *child_proc_info = *parent_proc_info;
776 unsigned long sp_data;
782 gdb_assert (svc_number == __NR_sigreturn || svc_number == __NR_rt_sigreturn);
787 pc_offset = arm_linux_sigreturn_next_pc_offset
788 (
sp, sp_data, svc_number, __NR_sigreturn == svc_number ? 1 : 0);
794 *is_thumb = ((cpsr & CPSR_T) != 0);
817 unsigned long this_instr;
818 unsigned long svc_operand;
821 svc_operand = (0x00ffffff & this_instr);
825 svc_number = svc_operand - 0x900000;
836 if (svc_number == __NR_sigreturn || svc_number == __NR_rt_sigreturn)
845 next_pc = MAKE_THUMB_ADDR (next_pc);
853 unsigned char *data = (
unsigned char *)
alloca (8);
858 unsigned int *data_p = (
unsigned int *)data;
859 if (data_p[0] == AT_HWCAP)
876 unsigned long arm_hwcap = 0;
904 buf = (
char *)
xmalloc (32 * 8 + 4);
928 iov.iov_base = gpregs;
929 iov.iov_len =
sizeof (gpregs);
940 static std::vector<CORE_ADDR>
943 struct arm_get_next_pcs next_pcs_ctx;
945 arm_get_next_pcs_ctor (&next_pcs_ctx,
953 return arm_get_next_pcs (&next_pcs_ctx);
982 unsigned long svc_operand = (0x00ffffff & insn);
987 *sysno = svc_operand - 0x900000;
1001 { PTRACE_GETREGS, PTRACE_SETREGS, 0, 18 * 4,
const struct target_desc * tdesc
struct arch_lwp_info * arch_private
int arm_breakpoint_at(CORE_ADDR where)
const struct target_desc * tdesc_arm_with_neon
static CORE_ADDR get_next_pcs_syscall_next_pc(struct arm_get_next_pcs *self)
void arm_store_gregset(struct regcache *regcache, const void *buf)
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)
constexpr int pid() const
static void xfree(T *ptr)
static int arm_linux_get_hw_breakpoint_count(void)
static int arm_hwbp_control_is_initialized(arm_hwbp_control_t control)
static void arm_get_syscall_trapinfo(struct regcache *regcache, int *sysno)
static int arm_hwbp_control_is_enabled(arm_hwbp_control_t control)
static void arm_linux_init_hwbp_cap(int pid)
static void arm_new_thread(struct lwp_info *lwp)
static CORE_ADDR arm_sigreturn_next_pc(struct regcache *regcache, int svc_number, int *is_thumb)
static const struct aarch64_register sp
static void arm_arch_setup(void)
CORE_ADDR regcache_read_pc(struct regcache *regcache)
static int arm_remove_point(enum raw_bkpt_type type, CORE_ADDR addr, int len, struct raw_breakpoint *bp)
static long lwpid_of(const thread_info *thread)
static CORE_ADDR get_next_pcs_addr_bits_remove(struct arm_get_next_pcs *self, CORE_ADDR val)
void initialize_low_arch_aarch32(void)
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,...)
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)
int target_read_memory(CORE_ADDR memaddr, gdb_byte *myaddr, ssize_t len)
int have_ptrace_getregset
#define PTRACE_SETHBPREGS
static void arm_prepare_to_resume(struct lwp_info *lwp)
struct regs_info regs_info_aarch32
static void for_each_thread(Func func)
static void arm_fill_wmmxregset(struct regcache *regcache, void *buf)
#define get_thread_lwp(thr)
static int pid_of(const thread_info *thread)
static void arm_delete_thread(struct arch_lwp_info *arch_lwp)
struct target_ops * the_target
static struct usrregs_info arm_usrregs_info
const struct target_desc * tdesc
const gdb_byte * arm_sw_breakpoint_from_kind(int kind, int *size)
static int arm_stopped_by_watchpoint(void)
static struct regs_info regs_info_arm
static ULONGEST get_next_pcs_read_memory_unsigned_integer(CORE_ADDR memaddr, int len, int byte_order)
static int arm_supports_hardware_single_step(void)
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]
CORE_ADDR linux_get_pc_32bit(struct regcache *regcache)
#define PTRACE_GETHBPREGS
void collect_register_by_name(struct regcache *regcache, const char *name, void *buf)
void init_registers_arm_with_iwmmxt(void)
int arm_breakpoint_kind_from_pc(CORE_ADDR *pcptr)
arm_hwbp_control_t control
process_info * find_process_pid(int pid)
int arm_breakpoint_kind_from_current_state(CORE_ADDR *pcptr)
static struct regset_info arm_regsets[]
char bpts_changed[MAX_BPTS]
int arm_is_thumb_mode(void)
#define gdb_assert_not_reached(message)
static void update_registers_callback(thread_info *thread, int watch, int i)
static arm_hwbp_type raw_bkpt_type_to_arm_hwbp_type(enum raw_bkpt_type raw_type)
#define get_lwp_thread(lwp)
const struct target_desc * tdesc_arm_with_iwmmxt
#define PTRACE_GETVFPREGS
struct arm_linux_hw_breakpoint bpts[MAX_BPTS]
static struct arm_get_next_pcs_ops get_next_pcs_ops
#define PTRACE_GETWMMXREGS
struct process_info * current_process(void)
ps_err_e ps_get_thread_area(struct ps_prochandle *ph, lwpid_t lwpid, int idx, void **base)
struct process_info_private * priv
#define PTRACE_SETWMMXREGS
static void arm_new_fork(struct process_info *parent, struct process_info *child)
static void arm_delete_process(struct arch_process_info *info)
void arm_fill_gregset(struct regcache *regcache, void *buf)
struct linux_target_ops the_low_target
void initialize_low_arch(void)
void linux_set_pc_32bit(struct regcache *regcache, CORE_ADDR pc)
void arm_fill_vfpregset_num(struct regcache *regcache, void *buf, int num)
#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
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)
#define Z_PACKET_ACCESS_WP
void perror_with_name(const char *string)
static int arm_cannot_fetch_register(int regno)
unsigned long long ULONGEST
static int arm_supports_z_point_type(char z_type)
static CORE_ADDR arm_stopped_data_address(void)
static int get_next_pcs_is_thumb(struct arm_get_next_pcs *self)
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 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)
void init_registers_arm_with_vfpv2(void)
static int arm_get_hwcap(unsigned long *valp)
unsigned int arm_hwbp_control_t
static struct @3 arm_linux_hwbp_cap
static struct arch_process_info * arm_new_process(void)
unsigned char max_wp_length
void arm_store_vfpregset_num(struct regcache *regcache, const void *buf, int num)
#define Z_PACKET_WRITE_WP
char wpts_changed[MAX_WPTS]
struct thread_info * thread
static std::vector< CORE_ADDR > arm_gdbserver_get_next_pcs(struct regcache *regcache)