GDBserver
Classes | Defines | Typedefs | Enumerations | Functions | Variables
/home/stan/gdb/src/gdb/gdbserver/linux-aarch64-low.c File Reference
#include "server.h"
#include "linux-low.h"
#include "elf/common.h"
#include <signal.h>
#include <sys/user.h>
#include <sys/ptrace.h>
#include <sys/uio.h>
#include "gdb_proc_service.h"

Go to the source code of this file.

Classes

struct  aarch64_debug_reg_state
struct  arch_process_info
struct  arch_lwp_info
struct  aarch64_dr_update_callback_param

Defines

#define AARCH64_X_REGS_NUM   31
#define AARCH64_V_REGS_NUM   32
#define AARCH64_X0_REGNO   0
#define AARCH64_SP_REGNO   31
#define AARCH64_PC_REGNO   32
#define AARCH64_CPSR_REGNO   33
#define AARCH64_V0_REGNO   34
#define AARCH64_NUM_REGS   (AARCH64_V0_REGNO + AARCH64_V_REGS_NUM)
#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 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 Z_PACKET_SW_BP   '0'
#define Z_PACKET_HW_BP   '1'
#define Z_PACKET_WRITE_WP   '2'
#define Z_PACKET_READ_WP   '3'
#define Z_PACKET_ACCESS_WP   '4'
#define aarch64_breakpoint_len   4
#define DR_CONTROL_ENABLED(ctrl)   (((ctrl) & 0x1) == 1)
#define DR_CONTROL_LENGTH(ctrl)   (((ctrl) >> 5) & 0xff)
#define AARCH64_DEBUG_NUM_SLOTS(x)   ((x) & 0xff)
#define AARCH64_DEBUG_ARCH(x)   (((x) >> 8) & 0xff)
#define AARCH64_DEBUG_ARCH_V8   0x6

Typedefs

typedef unsigned long long dr_changed_t

Enumerations

enum  target_point_type {
  hw_execute = 0, hw_read = 1, hw_write = 2, hw_access = 3,
  point_type_unsupported
}

Functions

void init_registers_aarch64 (void)
static enum target_point_type Z_packet_to_point_type (char type)
static int aarch64_cannot_store_register (int regno)
static int aarch64_cannot_fetch_register (int regno)
static void aarch64_fill_gregset (struct regcache *regcache, void *buf)
static void aarch64_store_gregset (struct regcache *regcache, const void *buf)
static void aarch64_fill_fpregset (struct regcache *regcache, void *buf)
static void aarch64_store_fpregset (struct regcache *regcache, const void *buf)
static CORE_ADDR aarch64_get_pc (struct regcache *regcache)
static void aarch64_set_pc (struct regcache *regcache, CORE_ADDR pc)
static int aarch64_breakpoint_at (CORE_ADDR where)
static void aarch64_show_debug_reg_state (struct aarch64_debug_reg_state *state, const char *func, CORE_ADDR addr, int len, enum target_point_type type)
static void aarch64_init_debug_reg_state (struct aarch64_debug_reg_state *state)
static unsigned int aarch64_watchpoint_length (unsigned int ctrl)
static unsigned int aarch64_point_encode_ctrl_reg (enum target_point_type type, int len)
static int aarch64_point_is_aligned (int is_watchpoint, CORE_ADDR addr, int len)
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 void aarch64_linux_set_debug_regs (const struct aarch64_debug_reg_state *state, int tid, int watchpoint)
static int debug_reg_change_callback (struct inferior_list_entry *entry, void *ptr)
void aarch64_notify_debug_reg_change (const struct aarch64_debug_reg_state *state, int is_watchpoint, unsigned int idx)
static struct
aarch64_debug_reg_state
aarch64_get_debug_reg_state ()
static int aarch64_dr_state_insert_one_point (struct aarch64_debug_reg_state *state, enum target_point_type type, CORE_ADDR addr, int len)
static int aarch64_dr_state_remove_one_point (struct aarch64_debug_reg_state *state, enum target_point_type type, CORE_ADDR addr, int len)
static int aarch64_handle_breakpoint (enum target_point_type type, CORE_ADDR addr, int len, int is_insert)
static int aarch64_handle_aligned_watchpoint (enum target_point_type type, CORE_ADDR addr, int len, int is_insert)
static int aarch64_handle_unaligned_watchpoint (enum target_point_type type, CORE_ADDR addr, int len, int is_insert)
static int aarch64_handle_watchpoint (enum target_point_type type, CORE_ADDR addr, int len, int is_insert)
static int aarch64_insert_point (char type, CORE_ADDR addr, int len)
static int aarch64_remove_point (char type, CORE_ADDR addr, int len)
static CORE_ADDR aarch64_stopped_data_address (void)
static int aarch64_stopped_by_watchpoint (void)
ps_err_e ps_get_thread_area (const struct ps_prochandle *ph, lwpid_t lwpid, int idx, void **base)
static struct arch_process_infoaarch64_linux_new_process (void)
static struct arch_lwp_infoaarch64_linux_new_thread (void)
static void aarch64_linux_prepare_to_resume (struct lwp_info *lwp)
static void aarch64_arch_setup (void)
static struct regs_infoaarch64_regs_info (void)
void initialize_low_arch (void)

Variables

struct target_desctdesc_aarch64
static int aarch64_regmap []
static int aarch64_num_bp_regs
static int aarch64_num_wp_regs
int debug_hw_points
int debug_threads
static const unsigned long aarch64_breakpoint = 0x00800011
static struct regset_info aarch64_regsets []
static struct regsets_info aarch64_regsets_info
static struct usrregs_info aarch64_usrregs_info
static struct regs_info regs_info
struct linux_target_ops the_low_target

Define Documentation

#define aarch64_breakpoint_len   4

Definition at line 339 of file linux-aarch64-low.c.

#define AARCH64_CPSR_REGNO   33

Definition at line 46 of file linux-aarch64-low.c.

Referenced by aarch64_fill_gregset(), and aarch64_store_gregset().

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

Definition at line 1183 of file linux-aarch64-low.c.

Referenced by aarch64_arch_setup().

#define AARCH64_DEBUG_ARCH_V8   0x6

Definition at line 1184 of file linux-aarch64-low.c.

Referenced by aarch64_arch_setup().

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

Definition at line 1182 of file linux-aarch64-low.c.

Referenced by aarch64_arch_setup().

#define AARCH64_HBP_ALIGNMENT   4

Definition at line 103 of file linux-aarch64-low.c.

Referenced by aarch64_point_is_aligned().

#define AARCH64_HBP_MAX_NUM   16

Definition at line 86 of file linux-aarch64-low.c.

Referenced by aarch64_arch_setup(), and aarch64_init_debug_reg_state().

#define AARCH64_HWP_ALIGNMENT   8

Definition at line 104 of file linux-aarch64-low.c.

Referenced by aarch64_align_watchpoint(), and aarch64_point_is_aligned().

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

Referenced by aarch64_align_watchpoint().

#define AARCH64_HWP_MAX_NUM   16

Definition at line 87 of file linux-aarch64-low.c.

Referenced by aarch64_arch_setup(), and aarch64_init_debug_reg_state().

#define AARCH64_PC_REGNO   32

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

Referenced by aarch64_fill_gregset(), and aarch64_store_gregset().

#define AARCH64_SP_REGNO   31

Definition at line 44 of file linux-aarch64-low.c.

Referenced by aarch64_fill_gregset(), and aarch64_store_gregset().

#define AARCH64_V0_REGNO   34

Definition at line 47 of file linux-aarch64-low.c.

Referenced by aarch64_fill_fpregset(), and aarch64_store_fpregset().

#define AARCH64_V_REGS_NUM   32

Definition at line 42 of file linux-aarch64-low.c.

Referenced by aarch64_fill_fpregset(), and aarch64_store_fpregset().

#define AARCH64_X0_REGNO   0

Definition at line 43 of file linux-aarch64-low.c.

Referenced by aarch64_fill_gregset(), and aarch64_store_gregset().

#define AARCH64_X_REGS_NUM   31

Definition at line 41 of file linux-aarch64-low.c.

Referenced by aarch64_fill_gregset(), and aarch64_store_gregset().

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

Definition at line 147 of file linux-aarch64-low.c.

Referenced by aarch64_linux_prepare_to_resume().

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

Definition at line 418 of file linux-aarch64-low.c.

Referenced by aarch64_stopped_data_address().

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

Definition at line 419 of file linux-aarch64-low.c.

Referenced by aarch64_watchpoint_length().

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

Definition at line 153 of file linux-aarch64-low.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 134 of file linux-aarch64-low.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 141 of file linux-aarch64-low.c.

Referenced by debug_reg_change_callback().

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

Definition at line 154 of file linux-aarch64-low.c.

#define Z_PACKET_ACCESS_WP   '4'

Definition at line 228 of file linux-aarch64-low.c.

Referenced by Z_packet_to_point_type().

#define Z_PACKET_HW_BP   '1'

Definition at line 225 of file linux-aarch64-low.c.

Referenced by Z_packet_to_point_type().

#define Z_PACKET_READ_WP   '3'

Definition at line 227 of file linux-aarch64-low.c.

Referenced by Z_packet_to_point_type().

#define Z_PACKET_SW_BP   '0'

Definition at line 224 of file linux-aarch64-low.c.

Referenced by Z_packet_to_point_type().

#define Z_PACKET_WRITE_WP   '2'

Definition at line 226 of file linux-aarch64-low.c.

Referenced by Z_packet_to_point_type().


Typedef Documentation

typedef unsigned long long dr_changed_t

Definition at line 130 of file linux-aarch64-low.c.


Enumeration Type Documentation

Enumerator:
hw_execute 
hw_read 
hw_write 
hw_access 
point_type_unsupported 

Definition at line 215 of file linux-aarch64-low.c.


Function Documentation

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 void aarch64_arch_setup ( void  ) [static]
static int aarch64_breakpoint_at ( CORE_ADDR  where) [static]

Definition at line 344 of file linux-aarch64-low.c.

References aarch64_breakpoint, target_ops::read_memory, and the_target.

static int aarch64_cannot_fetch_register ( int  regno) [static]

Definition at line 261 of file linux-aarch64-low.c.

References AARCH64_NUM_REGS.

static int aarch64_cannot_store_register ( int  regno) [static]

Definition at line 255 of file linux-aarch64-low.c.

References AARCH64_NUM_REGS.

static int aarch64_dr_state_insert_one_point ( struct aarch64_debug_reg_state state,
enum target_point_type  type,
CORE_ADDR  addr,
int  len 
) [static]
static int aarch64_dr_state_remove_one_point ( struct aarch64_debug_reg_state state,
enum target_point_type  type,
CORE_ADDR  addr,
int  len 
) [static]
static void aarch64_fill_fpregset ( struct regcache regcache,
void *  buf 
) [static]

Definition at line 293 of file linux-aarch64-low.c.

References AARCH64_V0_REGNO, AARCH64_V_REGS_NUM, and collect_register().

static void aarch64_fill_gregset ( struct regcache regcache,
void *  buf 
) [static]
static struct aarch64_debug_reg_state* aarch64_get_debug_reg_state ( ) [static, read]
static CORE_ADDR aarch64_get_pc ( struct regcache regcache) [static]

Definition at line 320 of file linux-aarch64-low.c.

References collect_register_by_name(), and debug_threads.

static int aarch64_handle_aligned_watchpoint ( enum target_point_type  type,
CORE_ADDR  addr,
int  len,
int  is_insert 
) [static]
static int aarch64_handle_breakpoint ( enum target_point_type  type,
CORE_ADDR  addr,
int  len,
int  is_insert 
) [static]
static int aarch64_handle_unaligned_watchpoint ( enum target_point_type  type,
CORE_ADDR  addr,
int  len,
int  is_insert 
) [static]
static int aarch64_handle_watchpoint ( enum target_point_type  type,
CORE_ADDR  addr,
int  len,
int  is_insert 
) [static]
static void aarch64_init_debug_reg_state ( struct aarch64_debug_reg_state state) [static]
static int aarch64_insert_point ( char  type,
CORE_ADDR  addr,
int  len 
) [static]
static struct arch_process_info* aarch64_linux_new_process ( void  ) [static, read]
static struct arch_lwp_info* aarch64_linux_new_thread ( void  ) [static, read]
static void aarch64_linux_prepare_to_resume ( struct lwp_info lwp) [static]
static void aarch64_linux_set_debug_regs ( const struct aarch64_debug_reg_state state,
int  tid,
int  watchpoint 
) [static]
void aarch64_notify_debug_reg_change ( const struct aarch64_debug_reg_state state,
int  is_watchpoint,
unsigned int  idx 
)
static unsigned int aarch64_point_encode_ctrl_reg ( enum target_point_type  type,
int  len 
) [static]
static int aarch64_point_is_aligned ( int  is_watchpoint,
CORE_ADDR  addr,
int  len 
) [static]
static struct regs_info* aarch64_regs_info ( void  ) [static, read]

Definition at line 1273 of file linux-aarch64-low.c.

References regs_info.

static int aarch64_remove_point ( char  type,
CORE_ADDR  addr,
int  len 
) [static]
static void aarch64_set_pc ( struct regcache regcache,
CORE_ADDR  pc 
) [static]

Definition at line 331 of file linux-aarch64-low.c.

References supply_register_by_name().

static void aarch64_show_debug_reg_state ( struct aarch64_debug_reg_state state,
const char *  func,
CORE_ADDR  addr,
int  len,
enum target_point_type  type 
) [static]
static int aarch64_stopped_by_watchpoint ( void  ) [static]

Definition at line 1080 of file linux-aarch64-low.c.

References aarch64_stopped_data_address().

static CORE_ADDR aarch64_stopped_data_address ( void  ) [static]
static void aarch64_store_fpregset ( struct regcache regcache,
const void *  buf 
) [static]

Definition at line 303 of file linux-aarch64-low.c.

References AARCH64_V0_REGNO, AARCH64_V_REGS_NUM, and supply_register().

static void aarch64_store_gregset ( struct regcache regcache,
const void *  buf 
) [static]
static unsigned int aarch64_watchpoint_length ( unsigned int  ctrl) [inline, static]

Definition at line 429 of file linux-aarch64-low.c.

References DR_CONTROL_LENGTH.

Referenced by aarch64_stopped_data_address().

static int debug_reg_change_callback ( struct inferior_list_entry entry,
void *  ptr 
) [static]
void init_registers_aarch64 ( void  )

Referenced by initialize_low_arch().

void initialize_low_arch ( void  )

Definition at line 1305 of file linux-aarch64-low.c.

Referenced by initialize_low().

ps_err_e ps_get_thread_area ( const struct ps_prochandle ph,
lwpid_t  lwpid,
int  idx,
void **  base 
)

Definition at line 1091 of file linux-aarch64-low.c.

References PS_ERR, PS_OK, and PTRACE_GETREGSET.

static enum target_point_type Z_packet_to_point_type ( char  type) [static]

Variable Documentation

const unsigned long aarch64_breakpoint = 0x00800011 [static]

Definition at line 341 of file linux-aarch64-low.c.

Referenced by aarch64_breakpoint_at().

int aarch64_num_bp_regs [static]
int aarch64_num_wp_regs [static]
int aarch64_regmap[] [static]
Initial value:
{
  
  
   0*8,  1*8,  2*8,  3*8,  4*8,  5*8,  6*8,  7*8,
   8*8,  9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8,
  16*8, 17*8, 18*8, 19*8, 20*8, 21*8, 22*8, 23*8,
  24*8, 25*8, 26*8, 27*8, 28*8,
  29*8,
  30*8,                         
  31*8,                         
  32*8,                         
  33*8,                         

  
   0*16,  1*16,  2*16,  3*16,  4*16,  5*16,  6*16,  7*16,
   8*16,  9*16, 10*16, 11*16, 12*16, 13*16, 14*16, 15*16,
  16*16, 17*16, 18*16, 19*16, 20*16, 21*16, 22*16, 23*16,
  24*16, 25*16, 26*16, 27*16, 28*16, 29*16, 30*16, 31*16
}

Definition at line 52 of file linux-aarch64-low.c.

struct regset_info aarch64_regsets[] [static]
Initial value:
{
  { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_PRSTATUS,
    sizeof (struct user_pt_regs), GENERAL_REGS,
    aarch64_fill_gregset, aarch64_store_gregset },
  { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_FPREGSET,
    sizeof (struct user_fpsimd_state), FP_REGS,
    aarch64_fill_fpregset, aarch64_store_fpregset
  },
  { 0, 0, 0, -1, -1, NULL, NULL }
}

Definition at line 1240 of file linux-aarch64-low.c.

struct regsets_info aarch64_regsets_info [static]
Initial value:
  {
    aarch64_regsets, 
    0, 
    NULL, 
  }

Definition at line 1252 of file linux-aarch64-low.c.

Initial value:

Definition at line 1259 of file linux-aarch64-low.c.

Definition at line 71 of file server.c.

Referenced by aarch64_get_pc(), add_insns(), arm_get_pc(), attach_thread(), cancel_breakpoint(), cris_get_pc(), delete_fast_tracepoint_jump(), delete_raw_breakpoint(), dequeue_one_deferred_signal(), enqueue_one_deferred_signal(), find_one_thread(), finish_step_over(), gdb_no_commands_at_breakpoint(), get_detach_signal(), get_pc(), get_stop_pc(), handle_accept_event(), handle_monitor_command(), handle_serial_event(), handle_target_event(), handle_tracepoint_bkpts(), handle_tracepoints(), kill_one_lwp_callback(), linux_async(), linux_attach(), linux_attach_lwp_1(), linux_debug(), linux_detach_one_lwp(), linux_kill(), linux_kill_one_lwp(), linux_resume(), linux_resume_one_lwp(), linux_resume_one_thread(), linux_set_resume_request(), linux_stabilize_threads(), linux_wait(), linux_wait_1(), linux_wait_for_event(), linux_wait_for_lwp(), linux_write_memory(), linux_xfer_siginfo(), lynx_debug(), lynx_ptrace(), m32r_get_pc(), main(), maybe_move_out_of_jump_pad(), move_out_of_jump_pad_callback(), need_step_over_p(), nto_trace(), prepare_resume_reply(), proceed_all_lwps(), proceed_one_lwp(), process_point_options(), process_serial_event(), queue_stop_reply_callback(), reinsert_breakpoints_at(), reinsert_fast_tracepoint_jumps_at(), reinsert_raw_breakpoint(), select_event_lwp(), send_sigstop(), set_fast_tracepoint_jump(), set_raw_breakpoint_at(), sigchld_handler(), sparc_get_pc(), start_inferior(), start_step_over(), thread_db_create_event(), thread_db_find_new_threads(), thread_db_load_search(), trace_buffer_alloc(), tracepoint_look_up_symbols(), try_thread_db_load(), try_thread_db_load_1(), uninsert_breakpoints_at(), uninsert_fast_tracepoint_jumps_at(), uninsert_raw_breakpoint(), unstop_all_lwps(), upload_fast_traceframes(), and wait_for_sigstop().

struct regs_info regs_info [static]
Initial value:

Definition at line 1265 of file linux-aarch64-low.c.

Referenced by aarch64_regs_info().

Initial value:

Definition at line 1278 of file linux-aarch64-low.c.

Referenced by add_lwp(), can_hardware_single_step(), cancel_breakpoint(), child_add_thread(), child_fetch_inferior_registers(), child_store_inferior_registers(), do_attach(), do_initial_child_stuff(), get_pc(), get_stop_pc(), get_usrregs_info(), initialize_low(), linux_add_process(), linux_detach_one_lwp(), linux_emit_ops(), linux_fast_tracepoint_collecting(), linux_fetch_registers(), linux_get_min_fast_tracepoint_insn_len(), linux_insert_point(), linux_install_fast_tracepoint_jump_pad(), linux_process_qsupported(), linux_read_pc(), linux_remove_point(), linux_resume_one_lwp(), linux_store_registers(), linux_supports_range_stepping(), linux_supports_tracepoints(), linux_wait_1(), linux_wait_for_lwp(), linux_write_pc(), maybe_move_out_of_jump_pad(), nto_fetch_registers(), nto_store_registers(), nto_x86_arch_setup(), s390_collect_ptrace_register(), s390_fill_gregset(), s390_supply_ptrace_register(), siginfo_fixup(), start_step_over(), supports_breakpoints(), supports_fast_tracepoints(), win32_get_thread_context(), win32_insert_point(), win32_remove_point(), win32_resume(), win32_set_thread_context(), win32_stopped_by_watchpoint(), win32_stopped_data_address(), and x86_arch_setup_process_callback().

 All Classes Files Functions Variables Typedefs Enumerations Enumerator Defines