GDBserver

Classes | Functions | Variables
aarch64-linux-hw-point.c File Reference
`#include "common-defs.h"`
`#include "break-common.h"`
`#include "common-regcache.h"`
`#include "nat/linux-nat.h"`
`#include "aarch64-linux-hw-point.h"`
`#include <sys/uio.h>`
`#include <asm/ptrace.h>`
`#include <sys/ptrace.h>`
`#include <elf.h>`

Go to the source code of this file.

## Classes
struct | aarch64_dr_update_callback_param

## Functions
unsigned int | aarch64_watchpoint_length (unsigned int ctrl)
static unsigned int | aarch64_point_encode_ctrl_reg (enum target_hw_bp_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 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 int | aarch64_dr_state_insert_one_point (struct aarch64_debug_reg_state *state, enum target_hw_bp_type type, CORE_ADDR addr, int len)
static int | aarch64_dr_state_remove_one_point (struct aarch64_debug_reg_state *state, enum target_hw_bp_type type, CORE_ADDR addr, int len)
int | aarch64_handle_breakpoint (enum target_hw_bp_type type, CORE_ADDR addr, int len, int is_insert, struct aarch64_debug_reg_state *state)
static int | aarch64_handle_aligned_watchpoint (enum target_hw_bp_type type, CORE_ADDR addr, int len, int is_insert, struct aarch64_debug_reg_state *state)
static int | aarch64_handle_unaligned_watchpoint (enum target_hw_bp_type type, CORE_ADDR addr, int len, int is_insert, struct aarch64_debug_reg_state *state)
int | aarch64_handle_watchpoint (enum target_hw_bp_type type, CORE_ADDR addr, int len, int is_insert, struct aarch64_debug_reg_state *state)
void | aarch64_linux_set_debug_regs (const struct aarch64_debug_reg_state *state, int tid, int watchpoint)
void | aarch64_show_debug_reg_state (struct aarch64_debug_reg_state *state, const char *func, CORE_ADDR addr, int len, enum target_hw_bp_type type)
void | aarch64_linux_get_debug_reg_capacity (int tid)
int | aarch64_linux_region_ok_for_watchpoint (CORE_ADDR addr, int len)

## Variables
int | aarch64_num_bp_regs
int | aarch64_num_wp_regs

## Function Documentation

## ◆ aarch64_align_watchpoint()

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

Definition at line 183 of file aarch64-linux-hw-point.c.

References AARCH64_HWP_ALIGNMENT, AARCH64_HWP_MAX_LEN_PER_REG, gdb_assert, and offset.

Referenced by aarch64_handle_unaligned_watchpoint().

## ◆ aarch64_dr_state_insert_one_point()

static int aarch64_dr_state_insert_one_point | ( | struct aarch64_debug_reg_state * | state,
|  | enum target_hw_bp_type | type,
|  | CORE_ADDR | addr,
|  | int | len
| ) |  |
| static

Definition at line 331 of file aarch64-linux-hw-point.c.

References aarch64_notify_debug_reg_change(), aarch64_num_bp_regs, aarch64_num_wp_regs, aarch64_point_encode_ctrl_reg(), aarch64_point_is_aligned(), aarch64_debug_reg_state::dr_addr_bp, aarch64_debug_reg_state::dr_addr_wp, aarch64_debug_reg_state::dr_ctrl_bp, aarch64_debug_reg_state::dr_ctrl_wp, aarch64_debug_reg_state::dr_ref_count_bp, aarch64_debug_reg_state::dr_ref_count_wp, gdb_assert, hw_execute, aarch64_dr_update_callback_param::idx, and aarch64_dr_update_callback_param::is_watchpoint.

Referenced by aarch64_handle_aligned_watchpoint(), aarch64_handle_breakpoint(), and aarch64_handle_unaligned_watchpoint().

## ◆ aarch64_dr_state_remove_one_point()

static int aarch64_dr_state_remove_one_point | ( | struct aarch64_debug_reg_state * | state,
|  | enum target_hw_bp_type | type,
|  | CORE_ADDR | addr,
|  | int | len
| ) |  |
| static

Definition at line 404 of file aarch64-linux-hw-point.c.

References aarch64_notify_debug_reg_change(), aarch64_num_bp_regs, aarch64_num_wp_regs, aarch64_point_encode_ctrl_reg(), aarch64_debug_reg_state::dr_addr_bp, aarch64_debug_reg_state::dr_addr_wp, aarch64_debug_reg_state::dr_ctrl_bp, aarch64_debug_reg_state::dr_ctrl_wp, aarch64_debug_reg_state::dr_ref_count_bp, aarch64_debug_reg_state::dr_ref_count_wp, gdb_assert, hw_execute, and aarch64_dr_update_callback_param::is_watchpoint.

Referenced by aarch64_handle_aligned_watchpoint(), aarch64_handle_breakpoint(), and aarch64_handle_unaligned_watchpoint().

## ◆ aarch64_handle_aligned_watchpoint()

static int aarch64_handle_aligned_watchpoint | ( | enum target_hw_bp_type | type,
|  | CORE_ADDR | addr,
|  | int | len,
|  | int | is_insert,
|  | struct aarch64_debug_reg_state * | state
| ) |  |
| static

Definition at line 485 of file aarch64-linux-hw-point.c.

References aarch64_dr_state_insert_one_point(), and aarch64_dr_state_remove_one_point().

Referenced by aarch64_handle_watchpoint().

## ◆ aarch64_handle_breakpoint()

int aarch64_handle_breakpoint | ( | enum target_hw_bp_type | type,
|  | CORE_ADDR | addr,
|  | int | len,
|  | int | is_insert,
|  | struct aarch64_debug_reg_state * | state
| ) |  |

Definition at line 458 of file aarch64-linux-hw-point.c.

References aarch64_dr_state_insert_one_point(), aarch64_dr_state_remove_one_point(), and aarch64_point_is_aligned().

Referenced by aarch64_insert_point(), and aarch64_remove_point().

## ◆ aarch64_handle_unaligned_watchpoint()

static int aarch64_handle_unaligned_watchpoint | ( | enum target_hw_bp_type | type,
|  | CORE_ADDR | addr,
|  | int | len,
|  | int | is_insert,
|  | struct aarch64_debug_reg_state * | state
| ) |  |
| static

Definition at line 503 of file aarch64-linux-hw-point.c.

References aarch64_align_watchpoint(), aarch64_dr_state_insert_one_point(), aarch64_dr_state_remove_one_point(), core_addr_to_string_nz(), debug_printf(), and show_debug_regs.

Referenced by aarch64_handle_watchpoint().

## ◆ aarch64_handle_watchpoint()

int aarch64_handle_watchpoint | ( | enum target_hw_bp_type | type,
|  | CORE_ADDR | addr,
|  | int | len,
|  | int | is_insert,
|  | struct aarch64_debug_reg_state * | state
| ) |  |

Definition at line 539 of file aarch64-linux-hw-point.c.

References aarch64_handle_aligned_watchpoint(), aarch64_handle_unaligned_watchpoint(), and aarch64_point_is_aligned().

Referenced by aarch64_insert_point(), and aarch64_remove_point().

## ◆ aarch64_linux_get_debug_reg_capacity()

void aarch64_linux_get_debug_reg_capacity | ( | int | tid | ) |

Definition at line 623 of file aarch64-linux-hw-point.c.

References _, AARCH64_DEBUG_ARCH, AARCH64_DEBUG_ARCH_V8, AARCH64_DEBUG_ARCH_V8_1, AARCH64_DEBUG_ARCH_V8_2, AARCH64_DEBUG_NUM_SLOTS, AARCH64_HBP_MAX_NUM, AARCH64_HWP_MAX_NUM, aarch64_num_bp_regs, aarch64_num_wp_regs, ptrace(), PTRACE_GETREGSET, and warning().

Referenced by aarch64_arch_setup().

## ◆ aarch64_linux_region_ok_for_watchpoint()

int aarch64_linux_region_ok_for_watchpoint | ( | CORE_ADDR | addr,
|  | int | len
| ) |  |

Definition at line 680 of file aarch64-linux-hw-point.c.

References AARCH64_HWP_MAX_LEN_PER_REG, and aarch64_num_wp_regs.

Referenced by aarch64_insert_point().

## ◆ aarch64_linux_set_debug_regs()

void aarch64_linux_set_debug_regs | ( | const struct aarch64_debug_reg_state * | state,
|  | int | tid,
|  | int | watchpoint
| ) |  |

Definition at line 555 of file aarch64-linux-hw-point.c.

References _, aarch64_num_bp_regs, aarch64_num_wp_regs, aarch64_debug_reg_state::dr_addr_bp, aarch64_debug_reg_state::dr_addr_wp, aarch64_debug_reg_state::dr_ctrl_bp, aarch64_debug_reg_state::dr_ctrl_wp, error(), memset(), ptrace(), and PTRACE_SETREGSET.

Referenced by aarch64_linux_prepare_to_resume().

## ◆ aarch64_notify_debug_reg_change()

static void aarch64_notify_debug_reg_change | ( | const struct aarch64_debug_reg_state * | state,
|  | int | is_watchpoint,
|  | unsigned int | idx
| ) |  |
| static

Definition at line 315 of file aarch64-linux-hw-point.c.

References current_lwp_ptid(), debug_reg_change_callback(), aarch64_dr_update_callback_param::idx, aarch64_dr_update_callback_param::is_watchpoint, iterate_over_lwps(), pid_to_ptid(), and ptid_get_pid().

Referenced by aarch64_dr_state_insert_one_point(), and aarch64_dr_state_remove_one_point().

## ◆ aarch64_point_encode_ctrl_reg()

static unsigned int aarch64_point_encode_ctrl_reg | ( | enum target_hw_bp_type | type,
|  | int | len
| ) |  |
| static

Definition at line 67 of file aarch64-linux-hw-point.c.

References _, hw_access, hw_execute, hw_read, hw_write, and perror_with_name().

Referenced by aarch64_dr_state_insert_one_point(), and aarch64_dr_state_remove_one_point().

## ◆ aarch64_point_is_aligned()

static int aarch64_point_is_aligned | ( | int | is_watchpoint,
|  | CORE_ADDR | addr,
|  | int | len
| ) |  |
| static

Definition at line 114 of file aarch64-linux-hw-point.c.

References AARCH64_HBP_ALIGNMENT, AARCH64_HWP_ALIGNMENT, current_lwp_ptid(), get_thread_regcache_for_ptid(), and regcache_register_size().

Referenced by aarch64_dr_state_insert_one_point(), aarch64_handle_breakpoint(), and aarch64_handle_watchpoint().

## ◆ aarch64_show_debug_reg_state()

void aarch64_show_debug_reg_state | ( | struct aarch64_debug_reg_state * | state,
|  | const char * | func,
|  | CORE_ADDR | addr,
|  | int | len,
|  | enum target_hw_bp_type | type
| ) |  |

Definition at line 589 of file aarch64-linux-hw-point.c.

References aarch64_num_bp_regs, aarch64_num_wp_regs, core_addr_to_string_nz(), debug_printf(), aarch64_debug_reg_state::dr_addr_bp, aarch64_debug_reg_state::dr_addr_wp, aarch64_debug_reg_state::dr_ctrl_bp, aarch64_debug_reg_state::dr_ctrl_wp, aarch64_debug_reg_state::dr_ref_count_bp, aarch64_debug_reg_state::dr_ref_count_wp, hw_access, hw_execute, hw_read, and hw_write.

Referenced by aarch64_insert_point(), and aarch64_remove_point().

## ◆ aarch64_watchpoint_length()

unsigned int aarch64_watchpoint_length | ( | unsigned int | ctrl | ) |

Definition at line 45 of file aarch64-linux-hw-point.c.

References DR_CONTROL_LENGTH.

Referenced by aarch64_stopped_data_address().

## ◆ debug_reg_change_callback()

static int debug_reg_change_callback | ( | struct lwp_info * | lwp,
|  | void * | ptr
| ) |  |
| static

Definition at line 254 of file aarch64-linux-hw-point.c.

References aarch64_num_bp_regs, aarch64_num_wp_regs, debug_printf(), arch_lwp_info::dr_changed_bp, arch_lwp_info::dr_changed_wp, DR_MARK_N_CHANGED, gdb_assert, aarch64_dr_update_callback_param::idx, aarch64_dr_update_callback_param::is_watchpoint, linux_stop_lwp(), lwp_arch_private_info(), lwp_is_stopped(), lwp_set_arch_private_info(), phex(), ptid_get_lwp(), ptid_of_lwp(), show_debug_regs, and XCNEW.

Referenced by aarch64_notify_debug_reg_change().

## Variable Documentation

## ◆ aarch64_num_bp_regs

int aarch64_num_bp_regs

Definition at line 34 of file aarch64-linux-hw-point.c.

Referenced by aarch64_dr_state_insert_one_point(), aarch64_dr_state_remove_one_point(), aarch64_linux_get_debug_reg_capacity(), aarch64_linux_new_thread(), aarch64_linux_set_debug_regs(), aarch64_show_debug_reg_state(), and debug_reg_change_callback().

## ◆ aarch64_num_wp_regs

int aarch64_num_wp_regs

Definition at line 35 of file aarch64-linux-hw-point.c.

Referenced by aarch64_dr_state_insert_one_point(), aarch64_dr_state_remove_one_point(), aarch64_linux_get_debug_reg_capacity(), aarch64_linux_new_thread(), aarch64_linux_region_ok_for_watchpoint(), aarch64_linux_set_debug_regs(), aarch64_show_debug_reg_state(), aarch64_stopped_data_address(), and debug_reg_change_callback().