GDBserver
Classes | Macros | Typedefs | Enumerations | Functions | Variables
linux-arm-low.c File Reference
#include "server.h"
#include "linux-low.h"
#include "arch/arm.h"
#include "arch/arm-linux.h"
#include "arch/arm-get-next-pcs.h"
#include "linux-aarch32-low.h"
#include <sys/uio.h>
#include <elf.h>
#include "nat/gdb_ptrace.h"
#include <signal.h>
#include <sys/syscall.h>

Go to the source code of this file.

Classes

struct  arm_linux_hw_breakpoint
 
struct  arch_process_info
 
struct  arch_lwp_info
 

Macros

#define PTRACE_GET_THREAD_AREA   22
 
#define PTRACE_GETWMMXREGS   18
 
#define PTRACE_SETWMMXREGS   19
 
#define PTRACE_GETVFPREGS   27
 
#define PTRACE_SETVFPREGS   28
 
#define PTRACE_GETHBPREGS   29
 
#define PTRACE_SETHBPREGS   30
 
#define MAX_BPTS   32
 
#define MAX_WPTS   32
 
#define HWCAP_VFP   64
 
#define HWCAP_IWMMXT   512
 
#define HWCAP_NEON   4096
 
#define HWCAP_VFPv3   8192
 
#define HWCAP_VFPv3D16   16384
 
#define arm_num_regs   26
 

Typedefs

typedef unsigned int arm_hwbp_control_t
 

Enumerations

enum  arm_hwbp_type { arm_hwbp_break = 0, arm_hwbp_load = 1, arm_hwbp_store = 2, arm_hwbp_access = 3 }
 

Functions

void init_registers_arm (void)
 
void init_registers_arm_with_iwmmxt (void)
 
void init_registers_arm_with_vfpv2 (void)
 
void init_registers_arm_with_vfpv3 (void)
 
static ULONGEST get_next_pcs_read_memory_unsigned_integer (CORE_ADDR memaddr, int len, int byte_order)
 
static CORE_ADDR get_next_pcs_addr_bits_remove (struct arm_get_next_pcs *self, CORE_ADDR val)
 
static CORE_ADDR get_next_pcs_syscall_next_pc (struct arm_get_next_pcs *self)
 
static int get_next_pcs_is_thumb (struct arm_get_next_pcs *self)
 
static int arm_cannot_store_register (int regno)
 
static int arm_cannot_fetch_register (int regno)
 
static void arm_fill_wmmxregset (struct regcache *regcache, void *buf)
 
static void arm_store_wmmxregset (struct regcache *regcache, const void *buf)
 
static void arm_fill_vfpregset (struct regcache *regcache, void *buf)
 
static void arm_store_vfpregset (struct regcache *regcache, const void *buf)
 
ps_err_e ps_get_thread_area (struct ps_prochandle *ph, lwpid_t lwpid, int idx, void **base)
 
static void arm_linux_init_hwbp_cap (int pid)
 
static int arm_linux_get_hw_breakpoint_count (void)
 
static int arm_linux_get_hw_watchpoint_count (void)
 
static int arm_linux_get_hw_watchpoint_max_length (void)
 
static arm_hwbp_control_t arm_hwbp_control_initialize (unsigned byte_address_select, arm_hwbp_type hwbp_type, int enable)
 
static int arm_hwbp_control_is_enabled (arm_hwbp_control_t control)
 
static int arm_hwbp_control_is_initialized (arm_hwbp_control_t control)
 
static arm_hwbp_control_t arm_hwbp_control_disable (arm_hwbp_control_t control)
 
static int arm_linux_hw_breakpoint_equal (const struct arm_linux_hw_breakpoint *p1, const struct arm_linux_hw_breakpoint *p2)
 
static arm_hwbp_type raw_bkpt_type_to_arm_hwbp_type (enum raw_bkpt_type raw_type)
 
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 void update_registers_callback (thread_info *thread, int watch, int i)
 
static int arm_supports_z_point_type (char z_type)
 
static int arm_insert_point (enum raw_bkpt_type type, CORE_ADDR addr, int len, struct raw_breakpoint *bp)
 
static int arm_remove_point (enum raw_bkpt_type type, CORE_ADDR addr, int len, struct raw_breakpoint *bp)
 
static int arm_stopped_by_watchpoint (void)
 
static CORE_ADDR arm_stopped_data_address (void)
 
static struct arch_process_infoarm_new_process (void)
 
static void arm_delete_process (struct arch_process_info *info)
 
static void arm_new_thread (struct lwp_info *lwp)
 
static void arm_delete_thread (struct arch_lwp_info *arch_lwp)
 
static void arm_new_fork (struct process_info *parent, struct process_info *child)
 
static void arm_prepare_to_resume (struct lwp_info *lwp)
 
static CORE_ADDR arm_sigreturn_next_pc (struct regcache *regcache, int svc_number, int *is_thumb)
 
static int arm_get_hwcap (unsigned long *valp)
 
static const struct target_descarm_read_description (void)
 
static void arm_arch_setup (void)
 
static std::vector< CORE_ADDRarm_gdbserver_get_next_pcs (struct regcache *regcache)
 
static int arm_supports_hardware_single_step (void)
 
static void arm_get_syscall_trapinfo (struct regcache *regcache, int *sysno)
 
static const struct regs_infoarm_regs_info (void)
 
void initialize_low_arch (void)
 

Variables

const struct target_desctdesc_arm
 
const struct target_desctdesc_arm_with_iwmmxt
 
const struct target_desctdesc_arm_with_vfpv2
 
const struct target_desctdesc_arm_with_vfpv3
 
struct {
   unsigned char   arch
 
   unsigned char   max_wp_length
 
   unsigned char   wp_count
 
   unsigned char   bp_count
 
arm_linux_hwbp_cap
 
static int arm_regmap []
 
static struct arm_get_next_pcs_ops get_next_pcs_ops
 
static struct regset_info arm_regsets []
 
static struct regsets_info arm_regsets_info
 
static struct usrregs_info arm_usrregs_info
 
static struct regs_info regs_info_arm
 
struct linux_target_ops the_low_target
 

Macro Definition Documentation

◆ arm_num_regs

#define arm_num_regs   26

◆ HWCAP_IWMMXT

#define HWCAP_IWMMXT   512

Definition at line 124 of file linux-arm-low.c.

Referenced by arm_read_description().

◆ HWCAP_NEON

#define HWCAP_NEON   4096

Definition at line 125 of file linux-arm-low.c.

Referenced by arm_read_description().

◆ HWCAP_VFP

#define HWCAP_VFP   64

Definition at line 123 of file linux-arm-low.c.

Referenced by arm_read_description().

◆ HWCAP_VFPv3

#define HWCAP_VFPv3   8192

Definition at line 126 of file linux-arm-low.c.

Referenced by arm_read_description().

◆ HWCAP_VFPv3D16

#define HWCAP_VFPv3D16   16384

Definition at line 127 of file linux-arm-low.c.

Referenced by arm_read_description().

◆ MAX_BPTS

#define MAX_BPTS   32

Definition at line 100 of file linux-arm-low.c.

Referenced by arm_linux_init_hwbp_cap(), arm_new_fork(), and arm_new_thread().

◆ MAX_WPTS

#define MAX_WPTS   32

Definition at line 101 of file linux-arm-low.c.

Referenced by arm_linux_init_hwbp_cap(), arm_new_fork(), and arm_new_thread().

◆ PTRACE_GET_THREAD_AREA

#define PTRACE_GET_THREAD_AREA   22

Definition at line 50 of file linux-arm-low.c.

Referenced by ps_get_thread_area().

◆ PTRACE_GETHBPREGS

#define PTRACE_GETHBPREGS   29

Definition at line 64 of file linux-arm-low.c.

Referenced by arm_linux_init_hwbp_cap().

◆ PTRACE_GETVFPREGS

#define PTRACE_GETVFPREGS   27

Definition at line 59 of file linux-arm-low.c.

Referenced by arm_read_description().

◆ PTRACE_GETWMMXREGS

#define PTRACE_GETWMMXREGS   18

Definition at line 54 of file linux-arm-low.c.

◆ PTRACE_SETHBPREGS

#define PTRACE_SETHBPREGS   30

Definition at line 65 of file linux-arm-low.c.

Referenced by arm_prepare_to_resume().

◆ PTRACE_SETVFPREGS

#define PTRACE_SETVFPREGS   28

Definition at line 60 of file linux-arm-low.c.

◆ PTRACE_SETWMMXREGS

#define PTRACE_SETWMMXREGS   19

Definition at line 55 of file linux-arm-low.c.

Typedef Documentation

◆ arm_hwbp_control_t

typedef unsigned int arm_hwbp_control_t

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

Enumeration Type Documentation

◆ arm_hwbp_type

Enumerator
arm_hwbp_break 
arm_hwbp_load 
arm_hwbp_store 
arm_hwbp_access 

Definition at line 78 of file linux-arm-low.c.

Function Documentation

◆ arm_arch_setup()

static void arm_arch_setup ( void  )
static

◆ arm_cannot_fetch_register()

static int arm_cannot_fetch_register ( int  regno)
static

Definition at line 170 of file linux-arm-low.c.

References arm_num_regs.

◆ arm_cannot_store_register()

static int arm_cannot_store_register ( int  regno)
static

Definition at line 164 of file linux-arm-low.c.

References arm_num_regs.

◆ arm_delete_process()

static void arm_delete_process ( struct arch_process_info info)
static

Definition at line 642 of file linux-arm-low.c.

References xfree().

◆ arm_delete_thread()

static void arm_delete_thread ( struct arch_lwp_info arch_lwp)
static

Definition at line 665 of file linux-arm-low.c.

References xfree().

◆ arm_fill_vfpregset()

static void arm_fill_vfpregset ( struct regcache regcache,
void *  buf 
)
static

◆ arm_fill_wmmxregset()

static void arm_fill_wmmxregset ( struct regcache regcache,
void *  buf 
)
static

◆ arm_gdbserver_get_next_pcs()

static std::vector<CORE_ADDR> arm_gdbserver_get_next_pcs ( struct regcache regcache)
static

Definition at line 941 of file linux-arm-low.c.

References get_next_pcs_ops.

◆ arm_get_hwcap()

static int arm_get_hwcap ( unsigned long *  valp)
static

Definition at line 851 of file linux-arm-low.c.

References alloca(), offset, target_ops::read_auxv, and the_target.

Referenced by arm_read_description().

◆ arm_get_syscall_trapinfo()

static void arm_get_syscall_trapinfo ( struct regcache regcache,
int *  sysno 
)
static

◆ arm_hwbp_control_disable()

static arm_hwbp_control_t arm_hwbp_control_disable ( arm_hwbp_control_t  control)
static

Definition at line 366 of file linux-arm-low.c.

Referenced by arm_remove_point().

◆ arm_hwbp_control_initialize()

static arm_hwbp_control_t arm_hwbp_control_initialize ( unsigned  byte_address_select,
arm_hwbp_type  hwbp_type,
int  enable 
)
static

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

References arm_hwbp_break, and gdb_assert.

Referenced by arm_linux_hw_point_initialize().

◆ arm_hwbp_control_is_enabled()

static int arm_hwbp_control_is_enabled ( arm_hwbp_control_t  control)
static

Definition at line 352 of file linux-arm-low.c.

Referenced by arm_insert_point(), and arm_prepare_to_resume().

◆ arm_hwbp_control_is_initialized()

static int arm_hwbp_control_is_initialized ( arm_hwbp_control_t  control)
static

Definition at line 359 of file linux-arm-low.c.

Referenced by arm_prepare_to_resume().

◆ arm_insert_point()

static int arm_insert_point ( enum raw_bkpt_type  type,
CORE_ADDR  addr,
int  len,
struct raw_breakpoint bp 
)
static

◆ arm_linux_get_hw_breakpoint_count()

static int arm_linux_get_hw_breakpoint_count ( void  )
static

Definition at line 315 of file linux-arm-low.c.

References arm_linux_hwbp_cap.

Referenced by arm_insert_point(), arm_prepare_to_resume(), and arm_remove_point().

◆ arm_linux_get_hw_watchpoint_count()

static int arm_linux_get_hw_watchpoint_count ( void  )
static

◆ arm_linux_get_hw_watchpoint_max_length()

static int arm_linux_get_hw_watchpoint_max_length ( void  )
static

Definition at line 329 of file linux-arm-low.c.

References arm_linux_hwbp_cap.

Referenced by arm_linux_hw_point_initialize().

◆ arm_linux_hw_breakpoint_equal()

static int arm_linux_hw_breakpoint_equal ( const struct arm_linux_hw_breakpoint p1,
const struct arm_linux_hw_breakpoint p2 
)
static

◆ arm_linux_hw_point_initialize()

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

◆ arm_linux_init_hwbp_cap()

static void arm_linux_init_hwbp_cap ( int  pid)
static

◆ arm_new_fork()

static void arm_new_fork ( struct process_info parent,
struct process_info child 
)
static

◆ arm_new_process()

static struct arch_process_info* arm_new_process ( void  )
static

Definition at line 633 of file linux-arm-low.c.

References XCNEW.

◆ arm_new_thread()

static void arm_new_thread ( struct lwp_info lwp)
static

◆ arm_prepare_to_resume()

static void arm_prepare_to_resume ( struct lwp_info lwp)
static

◆ arm_read_description()

static const struct target_desc* arm_read_description ( void  )
static

◆ arm_regs_info()

static const struct regs_info* arm_regs_info ( void  )
static

◆ arm_remove_point()

static int arm_remove_point ( enum raw_bkpt_type  type,
CORE_ADDR  addr,
int  len,
struct raw_breakpoint bp 
)
static

◆ arm_sigreturn_next_pc()

static CORE_ADDR arm_sigreturn_next_pc ( struct regcache regcache,
int  svc_number,
int *  is_thumb 
)
static

◆ arm_stopped_by_watchpoint()

static int arm_stopped_by_watchpoint ( void  )
static

◆ arm_stopped_data_address()

static CORE_ADDR arm_stopped_data_address ( void  )
static

◆ arm_store_vfpregset()

static void arm_store_vfpregset ( struct regcache regcache,
const void *  buf 
)
static

◆ arm_store_wmmxregset()

static void arm_store_wmmxregset ( struct regcache regcache,
const void *  buf 
)
static

◆ arm_supports_hardware_single_step()

static int arm_supports_hardware_single_step ( void  )
static

Definition at line 959 of file linux-arm-low.c.

◆ arm_supports_z_point_type()

static int arm_supports_z_point_type ( char  z_type)
static

◆ get_next_pcs_addr_bits_remove()

static CORE_ADDR get_next_pcs_addr_bits_remove ( struct arm_get_next_pcs *  self,
CORE_ADDR  val 
)
static

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

◆ get_next_pcs_is_thumb()

static int get_next_pcs_is_thumb ( struct arm_get_next_pcs *  self)
static

Definition at line 250 of file linux-arm-low.c.

References arm_is_thumb_mode().

◆ get_next_pcs_read_memory_unsigned_integer()

static ULONGEST get_next_pcs_read_memory_unsigned_integer ( CORE_ADDR  memaddr,
int  len,
int  byte_order 
)
static

Definition at line 259 of file linux-arm-low.c.

References target_read_memory().

◆ get_next_pcs_syscall_next_pc()

static CORE_ADDR get_next_pcs_syscall_next_pc ( struct arm_get_next_pcs *  self)
static

◆ init_registers_arm()

void init_registers_arm ( void  )

Referenced by initialize_low_arch().

◆ init_registers_arm_with_iwmmxt()

void init_registers_arm_with_iwmmxt ( void  )

Referenced by initialize_low_arch().

◆ init_registers_arm_with_vfpv2()

void init_registers_arm_with_vfpv2 ( void  )

Referenced by initialize_low_arch().

◆ init_registers_arm_with_vfpv3()

void init_registers_arm_with_vfpv3 ( void  )

Referenced by initialize_low_arch().

◆ initialize_low_arch()

void initialize_low_arch ( void  )

◆ ps_get_thread_area()

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

Definition at line 274 of file linux-arm-low.c.

References PS_ERR, PS_OK, ptrace(), and PTRACE_GET_THREAD_AREA.

◆ raw_bkpt_type_to_arm_hwbp_type()

static arm_hwbp_type raw_bkpt_type_to_arm_hwbp_type ( enum raw_bkpt_type  raw_type)
static

◆ update_registers_callback()

static void update_registers_callback ( thread_info thread,
int  watch,
int  i 
)
static

Variable Documentation

◆ arch

unsigned char arch

Definition at line 71 of file linux-arm-low.c.

◆ arm_linux_hwbp_cap

struct { ... } arm_linux_hwbp_cap

◆ arm_regmap

int arm_regmap[]
static
Initial value:
= {
0, 4, 8, 12, 16, 20, 24, 28,
32, 36, 40, 44, 48, 52, 56, 60,
-1, -1, -1, -1, -1, -1, -1, -1, -1,
64
}

Definition at line 135 of file linux-arm-low.c.

◆ arm_regsets

struct regset_info arm_regsets[]
static
Initial value:
= {
{ PTRACE_GETREGS, PTRACE_SETREGS, 0, 18 * 4,
GENERAL_REGS,
{ PTRACE_GETWMMXREGS, PTRACE_SETWMMXREGS, 0, 16 * 8 + 6 * 4,
EXTENDED_REGS,
EXTENDED_REGS,
NULL_REGSET
}
void arm_store_gregset(struct regcache *regcache, const void *buf)
static void arm_fill_wmmxregset(struct regcache *regcache, void *buf)
#define PTRACE_GETVFPREGS
Definition: linux-arm-low.c:59
#define PTRACE_GETWMMXREGS
Definition: linux-arm-low.c:54
#define PTRACE_SETWMMXREGS
Definition: linux-arm-low.c:55
void arm_fill_gregset(struct regcache *regcache, void *buf)
static void arm_fill_vfpregset(struct regcache *regcache, void *buf)
static void arm_store_wmmxregset(struct regcache *regcache, const void *buf)
#define PTRACE_SETVFPREGS
Definition: linux-arm-low.c:60
static void arm_store_vfpregset(struct regcache *regcache, const void *buf)

Definition at line 1000 of file linux-arm-low.c.

◆ arm_regsets_info

struct regsets_info arm_regsets_info
static
Initial value:
=
{
0,
NULL,
}
static struct regset_info arm_regsets[]

Definition at line 1013 of file linux-arm-low.c.

Referenced by initialize_low_arch().

◆ arm_usrregs_info

struct usrregs_info arm_usrregs_info
static
Initial value:
=
{
}
#define arm_num_regs
static int arm_regmap[]

Definition at line 1020 of file linux-arm-low.c.

◆ bp_count

unsigned char bp_count

Definition at line 74 of file linux-arm-low.c.

◆ get_next_pcs_ops

struct arm_get_next_pcs_ops get_next_pcs_ops
static
Initial value:
= {
arm_linux_get_next_pcs_fixup,
}
static CORE_ADDR get_next_pcs_syscall_next_pc(struct arm_get_next_pcs *self)
static CORE_ADDR get_next_pcs_addr_bits_remove(struct arm_get_next_pcs *self, CORE_ADDR val)
static ULONGEST get_next_pcs_read_memory_unsigned_integer(CORE_ADDR memaddr, int len, int byte_order)
static int get_next_pcs_is_thumb(struct arm_get_next_pcs *self)

Definition at line 155 of file linux-arm-low.c.

Referenced by arm_gdbserver_get_next_pcs().

◆ max_wp_length

unsigned char max_wp_length

Definition at line 72 of file linux-arm-low.c.

Referenced by arm_linux_hw_point_initialize().

◆ regs_info_arm

struct regs_info regs_info_arm
static
Initial value:
=
{
NULL,
}
static struct usrregs_info arm_usrregs_info
static struct regsets_info arm_regsets_info

Definition at line 1026 of file linux-arm-low.c.

Referenced by arm_regs_info().

◆ tdesc_arm

const struct target_desc* tdesc_arm

Referenced by arm_read_description().

◆ tdesc_arm_with_iwmmxt

const struct target_desc* tdesc_arm_with_iwmmxt

◆ tdesc_arm_with_vfpv2

const struct target_desc* tdesc_arm_with_vfpv2

◆ tdesc_arm_with_vfpv3

const struct target_desc* tdesc_arm_with_vfpv3

◆ the_low_target

struct linux_target_ops the_low_target

Definition at line 1045 of file linux-arm-low.c.

◆ wp_count

unsigned char wp_count

Definition at line 73 of file linux-arm-low.c.