GDB (xrefs)
Classes | Defines | Typedefs | Functions | Variables
/home/stan/gdb/src/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 "gregset.h"
#include "features/aarch64.c"
#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

Defines

#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 unsigned LONGEST dr_changed_t

Functions

static int get_thread_id (ptid_t ptid)
static struct
aarch64_process_info
aarch64_find_process_pid (pid_t pid)
static struct
aarch64_process_info
aarch64_add_process (pid_t pid)
static struct
aarch64_process_info
aarch64_process_info_get (pid_t pid)
static void aarch64_forget_process (pid_t pid)
static struct
aarch64_debug_reg_state
aarch64_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 (ptid_t ptid)
static 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 (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 gdbarch *gdbarch, struct bp_target_info *bp_tgt)
static int aarch64_linux_remove_hw_breakpoint (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 (CORE_ADDR addr, int len, int type, struct expression *cond)
static int aarch64_linux_remove_watchpoint (CORE_ADDR addr, int len, int type, struct expression *cond)
static int aarch64_linux_region_ok_for_hw_watchpoint (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 (void)
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 int debug_hw_points
static struct
aarch64_process_info
aarch64_process_list = NULL
static void(* super_post_startup_inferior )(ptid_t ptid)

Define Documentation

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

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

Referenced by aarch64_linux_get_debug_reg_capacity().

#define AARCH64_DEBUG_ARCH_V8   0x6

Definition at line 112 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 108 of file aarch64-linux-nat.c.

Referenced by aarch64_linux_get_debug_reg_capacity().

#define AARCH64_HBP_ALIGNMENT   4

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

Referenced by aarch64_point_is_aligned().

#define AARCH64_HBP_MAX_NUM   16

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

Referenced by aarch64_linux_get_debug_reg_capacity().

#define AARCH64_HWP_ALIGNMENT   8

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

Referenced by aarch64_align_watchpoint(), and aarch64_point_is_aligned().

#define AARCH64_HWP_MAX_NUM   16

Definition at line 77 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 163 of file aarch64-linux-nat.c.

Referenced by aarch64_linux_prepare_to_resume().

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

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

Referenced by aarch64_linux_stopped_data_address().

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

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

Referenced by aarch64_watchpoint_length().

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

Definition at line 169 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)

Definition at line 150 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)

Definition at line 157 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 170 of file aarch64-linux-nat.c.

#define TRAP_HWBKPT   0x0004

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

Referenced by aarch64_linux_stopped_data_address().


Typedef Documentation

typedef unsigned LONGEST dr_changed_t

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


Function Documentation

static struct aarch64_process_info* aarch64_add_process ( pid_t  pid) [static, read]
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, read]

Definition at line 214 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, read]
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 ( int  type,
int  cnt,
int  othertype 
) [static]

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

Referenced by _initialize_aarch64_linux_nat().

static void aarch64_linux_child_post_startup_inferior ( 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 gdbarch gdbarch,
struct bp_target_info bp_tgt 
) [static]
static int aarch64_linux_insert_watchpoint ( 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 struct target_desc* aarch64_linux_read_description ( struct target_ops ops) [static, read]

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

References initialize_tdesc_aarch64(), and tdesc_aarch64.

Referenced by _initialize_aarch64_linux_nat().

static int aarch64_linux_region_ok_for_hw_watchpoint ( CORE_ADDR  addr,
int  len 
) [static]
static int aarch64_linux_remove_hw_breakpoint ( struct gdbarch gdbarch,
struct bp_target_info bp_tgt 
) [static]
static int aarch64_linux_remove_watchpoint ( 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 ( void  ) [static]
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 1486 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, read]

Definition at line 246 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) [inline, static]

Definition at line 966 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 753 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

struct aarch64_process_info* aarch64_process_list = NULL [static]

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

Referenced by aarch64_add_process(), and aarch64_forget_process().

int debug_hw_points [static]
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines