GDB (xrefs)
Classes | Macros | Typedefs | Functions | Variables
/tmp/gdb-7.10/gdb/aarch64-linux-nat.c File Reference
#include "defs.h"
#include "inferior.h"
#include "gdbcore.h"
#include "regcache.h"
#include "linux-nat.h"
#include "target-descriptions.h"
#include "auxv.h"
#include "gdbcmd.h"
#include "aarch64-tdep.h"
#include "aarch64-linux-tdep.h"
#include "elf/common.h"
#include <sys/ptrace.h>
#include <sys/utsname.h>
#include <asm/ptrace.h>
#include "gregset.h"
#include "gdb_proc_service.h"

Go to the source code of this file.

Classes

struct  aarch64_debug_reg_state
 
struct  aarch64_process_info
 
struct  arch_lwp_info
 
struct  aarch64_dr_update_callback_param
 

Macros

#define TRAP_HWBKPT   0x0004
 
#define AARCH64_HBP_MAX_NUM   16
 
#define AARCH64_HWP_MAX_NUM   16
 
#define AARCH64_HBP_ALIGNMENT   4
 
#define AARCH64_HWP_ALIGNMENT   8
 
#define AARCH64_HWP_MAX_LEN_PER_REG   8
 
#define AARCH64_DEBUG_NUM_SLOTS(x)   ((x) & 0xff)
 
#define AARCH64_DEBUG_ARCH(x)   (((x) >> 8) & 0xff)
 
#define AARCH64_DEBUG_ARCH_V8   0x6
 
#define DR_MARK_ALL_CHANGED(x, m)
 
#define DR_MARK_N_CHANGED(x, n)
 
#define DR_CLEAR_CHANGED(x)
 
#define DR_HAS_CHANGED(x)   ((x) != 0)
 
#define DR_N_HAS_CHANGED(x, n)   ((x) & ((dr_changed_t)1 << (n)))
 
#define DR_CONTROL_ENABLED(ctrl)   (((ctrl) & 0x1) == 1)
 
#define DR_CONTROL_LENGTH(ctrl)   (((ctrl) >> 5) & 0xff)
 

Typedefs

typedef ULONGEST dr_changed_t
 

Functions

static int get_thread_id (ptid_t ptid)
 
static struct aarch64_process_infoaarch64_find_process_pid (pid_t pid)
 
static struct aarch64_process_infoaarch64_add_process (pid_t pid)
 
static struct aarch64_process_infoaarch64_process_info_get (pid_t pid)
 
static void aarch64_forget_process (pid_t pid)
 
static struct aarch64_debug_reg_stateaarch64_get_debug_reg_state (pid_t pid)
 
static void aarch64_linux_set_debug_regs (const struct aarch64_debug_reg_state *state, int tid, int watchpoint)
 
static int debug_reg_change_callback (struct lwp_info *lwp, void *ptr)
 
static void aarch64_notify_debug_reg_change (const struct aarch64_debug_reg_state *state, int is_watchpoint, unsigned int idx)
 
static void aarch64_show_debug_reg_state (struct aarch64_debug_reg_state *state, const char *func, CORE_ADDR addr, int len, int type)
 
static void fetch_gregs_from_thread (struct regcache *regcache)
 
static void store_gregs_to_thread (const struct regcache *regcache)
 
static void fetch_fpregs_from_thread (struct regcache *regcache)
 
static void store_fpregs_to_thread (const struct regcache *regcache)
 
static void aarch64_linux_fetch_inferior_registers (struct target_ops *ops, struct regcache *regcache, int regno)
 
static void aarch64_linux_store_inferior_registers (struct target_ops *ops, struct regcache *regcache, int regno)
 
void fill_gregset (const struct regcache *regcache, gdb_gregset_t *gregsetp, int regno)
 
void supply_gregset (struct regcache *regcache, const gdb_gregset_t *gregsetp)
 
void fill_fpregset (const struct regcache *regcache, gdb_fpregset_t *fpregsetp, int regno)
 
void supply_fpregset (struct regcache *regcache, const gdb_fpregset_t *fpregsetp)
 
static void aarch64_linux_prepare_to_resume (struct lwp_info *lwp)
 
static void aarch64_linux_new_thread (struct lwp_info *lp)
 
static void aarch64_linux_new_fork (struct lwp_info *parent, pid_t child_pid)
 
ps_err_e ps_get_thread_area (const struct ps_prochandle *ph, lwpid_t lwpid, int idx, void **base)
 
static void aarch64_linux_get_debug_reg_capacity (void)
 
static void aarch64_linux_child_post_startup_inferior (struct target_ops *self, ptid_t ptid)
 
static const struct target_descaarch64_linux_read_description (struct target_ops *ops)
 
static void aarch64_align_watchpoint (CORE_ADDR addr, int len, CORE_ADDR *aligned_addr_p, int *aligned_len_p, CORE_ADDR *next_addr_p, int *next_len_p)
 
static int aarch64_linux_can_use_hw_breakpoint (struct target_ops *self, int type, int cnt, int othertype)
 
static unsigned int aarch64_watchpoint_length (unsigned int ctrl)
 
static unsigned int aarch64_point_encode_ctrl_reg (int type, int len)
 
static int aarch64_point_is_aligned (int is_watchpoint, CORE_ADDR addr, int len)
 
static int aarch64_dr_state_insert_one_point (struct aarch64_debug_reg_state *state, int type, CORE_ADDR addr, int len)
 
static int aarch64_dr_state_remove_one_point (struct aarch64_debug_reg_state *state, int type, CORE_ADDR addr, int len)
 
static int aarch64_handle_breakpoint (int type, CORE_ADDR addr, int len, int is_insert)
 
static int aarch64_linux_insert_hw_breakpoint (struct target_ops *self, struct gdbarch *gdbarch, struct bp_target_info *bp_tgt)
 
static int aarch64_linux_remove_hw_breakpoint (struct target_ops *self, struct gdbarch *gdbarch, struct bp_target_info *bp_tgt)
 
static int aarch64_handle_aligned_watchpoint (int type, CORE_ADDR addr, int len, int is_insert)
 
static int aarch64_handle_unaligned_watchpoint (int type, CORE_ADDR addr, int len, int is_insert)
 
static int aarch64_handle_watchpoint (int type, CORE_ADDR addr, int len, int is_insert)
 
static int aarch64_linux_insert_watchpoint (struct target_ops *self, CORE_ADDR addr, int len, int type, struct expression *cond)
 
static int aarch64_linux_remove_watchpoint (struct target_ops *self, CORE_ADDR addr, int len, int type, struct expression *cond)
 
static int aarch64_linux_region_ok_for_hw_watchpoint (struct target_ops *self, CORE_ADDR addr, int len)
 
static int aarch64_linux_stopped_data_address (struct target_ops *target, CORE_ADDR *addr_p)
 
static int aarch64_linux_stopped_by_watchpoint (struct target_ops *ops)
 
static int aarch64_linux_watchpoint_addr_within_range (struct target_ops *target, CORE_ADDR addr, CORE_ADDR start, int length)
 
static void add_show_debug_regs_command (void)
 
void _initialize_aarch64_linux_nat (void)
 

Variables

static int aarch64_num_bp_regs
 
static int aarch64_num_wp_regs
 
static struct aarch64_process_infoaarch64_process_list = NULL
 
static void(* super_post_startup_inferior )(struct target_ops *self, ptid_t ptid)
 

Macro Definition Documentation

#define AARCH64_DEBUG_ARCH (   x)    (((x) >> 8) & 0xff)

Definition at line 108 of file aarch64-linux-nat.c.

Referenced by aarch64_linux_get_debug_reg_capacity().

#define AARCH64_DEBUG_ARCH_V8   0x6

Definition at line 111 of file aarch64-linux-nat.c.

Referenced by aarch64_linux_get_debug_reg_capacity().

#define AARCH64_DEBUG_NUM_SLOTS (   x)    ((x) & 0xff)

Definition at line 107 of file aarch64-linux-nat.c.

Referenced by aarch64_linux_get_debug_reg_capacity().

#define AARCH64_HBP_ALIGNMENT   4

Definition at line 90 of file aarch64-linux-nat.c.

Referenced by aarch64_point_is_aligned().

#define AARCH64_HBP_MAX_NUM   16

Definition at line 75 of file aarch64-linux-nat.c.

Referenced by aarch64_linux_get_debug_reg_capacity().

#define AARCH64_HWP_ALIGNMENT   8

Definition at line 91 of file aarch64-linux-nat.c.

Referenced by aarch64_align_watchpoint(), and aarch64_point_is_aligned().

#define AARCH64_HWP_MAX_LEN_PER_REG   8
#define AARCH64_HWP_MAX_NUM   16

Definition at line 76 of file aarch64-linux-nat.c.

Referenced by aarch64_linux_get_debug_reg_capacity().

#define DR_CLEAR_CHANGED (   x)
Value:
do \
{ \
(x) = 0; \
} while (0)

Definition at line 158 of file aarch64-linux-nat.c.

Referenced by aarch64_linux_prepare_to_resume().

#define DR_CONTROL_ENABLED (   ctrl)    (((ctrl) & 0x1) == 1)

Definition at line 941 of file aarch64-linux-nat.c.

Referenced by aarch64_linux_stopped_data_address().

#define DR_CONTROL_LENGTH (   ctrl)    (((ctrl) >> 5) & 0xff)

Definition at line 942 of file aarch64-linux-nat.c.

Referenced by aarch64_watchpoint_length().

#define DR_HAS_CHANGED (   x)    ((x) != 0)

Definition at line 164 of file aarch64-linux-nat.c.

Referenced by aarch64_linux_prepare_to_resume().

#define DR_MARK_ALL_CHANGED (   x,
 
)
Value:
do \
{ \
gdb_assert (sizeof ((x)) * 8 >= (m)); \
(x) = (((dr_changed_t)1 << (m)) - 1); \
} while (0)
tuple m
Definition: arm-linux.py:44
ULONGEST dr_changed_t

Definition at line 145 of file aarch64-linux-nat.c.

Referenced by aarch64_linux_new_thread().

#define DR_MARK_N_CHANGED (   x,
 
)
Value:
do \
{ \
(x) |= ((dr_changed_t)1 << (n)); \
} while (0)
ULONGEST dr_changed_t

Definition at line 152 of file aarch64-linux-nat.c.

Referenced by debug_reg_change_callback().

#define DR_N_HAS_CHANGED (   x,
 
)    ((x) & ((dr_changed_t)1 << (n)))

Definition at line 165 of file aarch64-linux-nat.c.

#define TRAP_HWBKPT   0x0004

Typedef Documentation

Definition at line 141 of file aarch64-linux-nat.c.

Function Documentation

void _initialize_aarch64_linux_nat ( void  )
static struct aarch64_process_info* aarch64_add_process ( pid_t  pid)
static
static void aarch64_align_watchpoint ( CORE_ADDR  addr,
int  len,
CORE_ADDR aligned_addr_p,
int aligned_len_p,
CORE_ADDR next_addr_p,
int next_len_p 
)
static
static int aarch64_dr_state_insert_one_point ( struct aarch64_debug_reg_state state,
int  type,
CORE_ADDR  addr,
int  len 
)
static
static int aarch64_dr_state_remove_one_point ( struct aarch64_debug_reg_state state,
int  type,
CORE_ADDR  addr,
int  len 
)
static
static struct aarch64_process_info* aarch64_find_process_pid ( pid_t  pid)
static

Definition at line 209 of file aarch64-linux-nat.c.

References aarch64_process_info::next, and aarch64_process_info::pid.

Referenced by aarch64_process_info_get().

static void aarch64_forget_process ( pid_t  pid)
static
static struct aarch64_debug_reg_state* aarch64_get_debug_reg_state ( pid_t  pid)
static
static int aarch64_handle_aligned_watchpoint ( int  type,
CORE_ADDR  addr,
int  len,
int  is_insert 
)
static
static int aarch64_handle_breakpoint ( int  type,
CORE_ADDR  addr,
int  len,
int  is_insert 
)
static
static int aarch64_handle_unaligned_watchpoint ( int  type,
CORE_ADDR  addr,
int  len,
int  is_insert 
)
static
static int aarch64_handle_watchpoint ( int  type,
CORE_ADDR  addr,
int  len,
int  is_insert 
)
static
static int aarch64_linux_can_use_hw_breakpoint ( struct target_ops self,
int  type,
int  cnt,
int  othertype 
)
static

Definition at line 926 of file aarch64-linux-nat.c.

Referenced by _initialize_aarch64_linux_nat().

static void aarch64_linux_child_post_startup_inferior ( struct target_ops self,
ptid_t  ptid 
)
static
static void aarch64_linux_fetch_inferior_registers ( struct target_ops ops,
struct regcache regcache,
int  regno 
)
static
static void aarch64_linux_get_debug_reg_capacity ( void  )
static
static int aarch64_linux_insert_hw_breakpoint ( struct target_ops self,
struct gdbarch gdbarch,
struct bp_target_info bp_tgt 
)
static
static int aarch64_linux_insert_watchpoint ( struct target_ops self,
CORE_ADDR  addr,
int  len,
int  type,
struct expression cond 
)
static
static void aarch64_linux_new_fork ( struct lwp_info parent,
pid_t  child_pid 
)
static
static void aarch64_linux_new_thread ( struct lwp_info lp)
static
static void aarch64_linux_prepare_to_resume ( struct lwp_info lwp)
static
static const struct target_desc* aarch64_linux_read_description ( struct target_ops ops)
static

Definition at line 829 of file aarch64-linux-nat.c.

References tdesc_aarch64.

Referenced by _initialize_aarch64_linux_nat().

static int aarch64_linux_region_ok_for_hw_watchpoint ( struct target_ops self,
CORE_ADDR  addr,
int  len 
)
static
static int aarch64_linux_remove_hw_breakpoint ( struct target_ops self,
struct gdbarch gdbarch,
struct bp_target_info bp_tgt 
)
static
static int aarch64_linux_remove_watchpoint ( struct target_ops self,
CORE_ADDR  addr,
int  len,
int  type,
struct expression cond 
)
static
static void aarch64_linux_set_debug_regs ( const struct aarch64_debug_reg_state state,
int  tid,
int  watchpoint 
)
static
static int aarch64_linux_stopped_by_watchpoint ( struct target_ops ops)
static

Definition at line 1467 of file aarch64-linux-nat.c.

References aarch64_linux_stopped_data_address().

Referenced by _initialize_aarch64_linux_nat().

static int aarch64_linux_stopped_data_address ( struct target_ops target,
CORE_ADDR addr_p 
)
static
static void aarch64_linux_store_inferior_registers ( struct target_ops ops,
struct regcache regcache,
int  regno 
)
static
static int aarch64_linux_watchpoint_addr_within_range ( struct target_ops target,
CORE_ADDR  addr,
CORE_ADDR  start,
int  length 
)
static

Definition at line 1477 of file aarch64-linux-nat.c.

Referenced by _initialize_aarch64_linux_nat().

static void aarch64_notify_debug_reg_change ( const struct aarch64_debug_reg_state state,
int  is_watchpoint,
unsigned int  idx 
)
static
static unsigned int aarch64_point_encode_ctrl_reg ( int  type,
int  len 
)
static
static int aarch64_point_is_aligned ( int  is_watchpoint,
CORE_ADDR  addr,
int  len 
)
static
static struct aarch64_process_info* aarch64_process_info_get ( pid_t  pid)
static

Definition at line 241 of file aarch64-linux-nat.c.

References aarch64_add_process(), and aarch64_find_process_pid().

Referenced by aarch64_get_debug_reg_state().

static void aarch64_show_debug_reg_state ( struct aarch64_debug_reg_state state,
const char *  func,
CORE_ADDR  addr,
int  len,
int  type 
)
static
static unsigned int aarch64_watchpoint_length ( unsigned int  ctrl)
inlinestatic

Definition at line 952 of file aarch64-linux-nat.c.

References DR_CONTROL_LENGTH.

Referenced by aarch64_linux_stopped_data_address().

static void add_show_debug_regs_command ( void  )
static
static int debug_reg_change_callback ( struct lwp_info lwp,
void *  ptr 
)
static
static void fetch_fpregs_from_thread ( struct regcache regcache)
static
static void fetch_gregs_from_thread ( struct regcache regcache)
static
void fill_fpregset ( const struct regcache regcache,
gdb_fpregset_t fpregsetp,
int  regno 
)
void fill_gregset ( const struct regcache regcache,
gdb_gregset_t gregsetp,
int  regno 
)
static int get_thread_id ( ptid_t  ptid)
static
ps_err_e ps_get_thread_area ( const struct ps_prochandle ph,
lwpid_t  lwpid,
int  idx,
void **  base 
)

Definition at line 737 of file aarch64-linux-nat.c.

static void store_fpregs_to_thread ( const struct regcache regcache)
static
static void store_gregs_to_thread ( const struct regcache regcache)
static
void supply_fpregset ( struct regcache regcache,
const gdb_fpregset_t fpregsetp 
)
void supply_gregset ( struct regcache regcache,
const gdb_gregset_t gregsetp 
)

Variable Documentation

int aarch64_num_bp_regs
static
int aarch64_num_wp_regs
static
struct aarch64_process_info* aarch64_process_list = NULL
static

Definition at line 204 of file aarch64-linux-nat.c.

Referenced by aarch64_add_process(), and aarch64_forget_process().

void(* super_post_startup_inferior) (struct target_ops *self, ptid_t ptid)
static