| GDB (xrefs)
   
    | 
#include "defs.h"#include "i386-nat.h"#include "breakpoint.h"#include "command.h"#include "gdbcmd.h"#include "target.h"#include "gdb_assert.h"#include "inferior.h"Go to the source code of this file.
| Classes | |
| struct | i386_process_info | 
| Defines | |
| #define | TARGET_HAS_DR_LEN_8 (i386_dr_low.debug_register_length == 8) | 
| #define | DR_CONTROL_SHIFT 16 | 
| #define | DR_CONTROL_SIZE 4 | 
| #define | DR_RW_EXECUTE (0x0) /* Break on instruction execution. */ | 
| #define | DR_RW_WRITE (0x1) /* Break on data writes. */ | 
| #define | DR_RW_READ (0x3) /* Break on data reads or writes. */ | 
| #define | DR_RW_IORW (0x2) /* Break on I/O reads or writes. */ | 
| #define | DR_LEN_1 (0x0 << 2) /* 1-byte region watch or breakpoint. */ | 
| #define | DR_LEN_2 (0x1 << 2) /* 2-byte region watch. */ | 
| #define | DR_LEN_4 (0x3 << 2) /* 4-byte region watch. */ | 
| #define | DR_LEN_8 (0x2 << 2) /* 8-byte region watch (AMD64). */ | 
| #define | DR_LOCAL_ENABLE_SHIFT 0 /* Extra shift to the local enable bit. */ | 
| #define | DR_GLOBAL_ENABLE_SHIFT 1 /* Extra shift to the global enable bit. */ | 
| #define | DR_ENABLE_SIZE 2 /* Two enable bits per debug register. */ | 
| #define | DR_LOCAL_SLOWDOWN (0x100) | 
| #define | DR_GLOBAL_SLOWDOWN (0x200) | 
| #define | DR_CONTROL_RESERVED (0xFC00) | 
| #define | I386_DR_CONTROL_MASK (~DR_CONTROL_RESERVED) | 
| #define | I386_DR_VACANT(state, i) (((state)->dr_control_mirror & (3 << (DR_ENABLE_SIZE * (i)))) == 0) | 
| #define | I386_DR_LOCAL_ENABLE(state, i) | 
| #define | I386_DR_GLOBAL_ENABLE(state, i) | 
| #define | I386_DR_DISABLE(state, i) | 
| #define | I386_DR_SET_RW_LEN(state, i, rwlen) | 
| #define | I386_DR_GET_RW_LEN(dr7, i) | 
| #define | I386_DR_WATCH_MASK(i) (1 << (i)) | 
| #define | I386_DR_WATCH_HIT(dr6, i) ((dr6) & (1 << (i))) | 
| #define | ALL_DEBUG_REGISTERS(i) for (i = 0; i < DR_NADDR; i++) | 
| Enumerations | |
| enum | i386_wp_op_t { WP_INSERT, WP_REMOVE, WP_COUNT } | 
| Functions | |
| static struct i386_process_info * | i386_find_process_pid (pid_t pid) | 
| static struct i386_process_info * | i386_add_process (pid_t pid) | 
| static struct i386_process_info * | i386_process_info_get (pid_t pid) | 
| struct i386_debug_reg_state * | i386_debug_reg_state (pid_t pid) | 
| void | i386_forget_process (pid_t pid) | 
| static unsigned | i386_length_and_rw_bits (int len, enum target_hw_bp_type type) | 
| static int | i386_insert_aligned_watchpoint (struct i386_debug_reg_state *state, CORE_ADDR addr, unsigned len_rw_bits) | 
| static int | i386_remove_aligned_watchpoint (struct i386_debug_reg_state *state, CORE_ADDR addr, unsigned len_rw_bits) | 
| static int | i386_handle_nonaligned_watchpoint (struct i386_debug_reg_state *state, i386_wp_op_t what, CORE_ADDR addr, int len, enum target_hw_bp_type type) | 
| void | i386_cleanup_dregs (void) | 
| static void | i386_show_dr (struct i386_debug_reg_state *state, const char *func, CORE_ADDR addr, int len, enum target_hw_bp_type type) | 
| static void | i386_update_inferior_debug_regs (struct i386_debug_reg_state *new_state) | 
| static int | i386_insert_watchpoint (CORE_ADDR addr, int len, int type, struct expression *cond) | 
| static int | i386_remove_watchpoint (CORE_ADDR addr, int len, int type, struct expression *cond) | 
| static int | i386_region_ok_for_watchpoint (CORE_ADDR addr, int len) | 
| static int | i386_stopped_data_address (struct target_ops *ops, CORE_ADDR *addr_p) | 
| static int | i386_stopped_by_watchpoint (void) | 
| static int | i386_insert_hw_breakpoint (struct gdbarch *gdbarch, struct bp_target_info *bp_tgt) | 
| static int | i386_remove_hw_breakpoint (struct gdbarch *gdbarch, struct bp_target_info *bp_tgt) | 
| static int | i386_can_use_hw_breakpoint (int type, int cnt, int othertype) | 
| static void | add_show_debug_regs_command (void) | 
| void | i386_use_watchpoints (struct target_ops *t) | 
| void | i386_set_debug_register_length (int len) | 
| Variables | |
| struct i386_dr_low_type | i386_dr_low | 
| static struct i386_process_info * | i386_process_list = NULL | 
| static int | maint_show_dr | 
| #define ALL_DEBUG_REGISTERS | ( | i | ) | for (i = 0; i < DR_NADDR; i++) | 
Definition at line 154 of file i386-nat.c.
Referenced by i386_insert_aligned_watchpoint(), i386_remove_aligned_watchpoint(), i386_show_dr(), i386_stopped_data_address(), and i386_update_inferior_debug_regs().
| #define DR_CONTROL_RESERVED (0xFC00) | 
Definition at line 100 of file i386-nat.c.
| #define DR_CONTROL_SHIFT 16 | 
Definition at line 49 of file i386-nat.c.
| #define DR_CONTROL_SIZE 4 | 
Definition at line 51 of file i386-nat.c.
| #define DR_ENABLE_SIZE 2 /* Two enable bits per debug register. */ | 
Definition at line 85 of file i386-nat.c.
| #define DR_GLOBAL_ENABLE_SHIFT 1 /* Extra shift to the global enable bit. */ | 
Definition at line 84 of file i386-nat.c.
| #define DR_GLOBAL_SLOWDOWN (0x200) | 
Definition at line 93 of file i386-nat.c.
| #define DR_LEN_1 (0x0 << 2) /* 1-byte region watch or breakpoint. */ | 
Definition at line 67 of file i386-nat.c.
Referenced by i386_length_and_rw_bits().
| #define DR_LEN_2 (0x1 << 2) /* 2-byte region watch. */ | 
Definition at line 68 of file i386-nat.c.
Referenced by i386_length_and_rw_bits().
| #define DR_LEN_4 (0x3 << 2) /* 4-byte region watch. */ | 
Definition at line 69 of file i386-nat.c.
Referenced by i386_length_and_rw_bits().
| #define DR_LEN_8 (0x2 << 2) /* 8-byte region watch (AMD64). */ | 
Definition at line 70 of file i386-nat.c.
Referenced by i386_length_and_rw_bits().
| #define DR_LOCAL_ENABLE_SHIFT 0 /* Extra shift to the local enable bit. */ | 
Definition at line 83 of file i386-nat.c.
| #define DR_LOCAL_SLOWDOWN (0x100) | 
Definition at line 92 of file i386-nat.c.
Referenced by i386_insert_aligned_watchpoint().
| #define DR_RW_EXECUTE (0x0) /* Break on instruction execution. */ | 
Definition at line 54 of file i386-nat.c.
Referenced by i386_length_and_rw_bits().
| #define DR_RW_IORW (0x2) /* Break on I/O reads or writes. */ | 
Definition at line 62 of file i386-nat.c.
Referenced by i386_length_and_rw_bits().
| #define DR_RW_READ (0x3) /* Break on data reads or writes. */ | 
Definition at line 56 of file i386-nat.c.
Referenced by i386_length_and_rw_bits().
| #define DR_RW_WRITE (0x1) /* Break on data writes. */ | 
Definition at line 55 of file i386-nat.c.
Referenced by i386_length_and_rw_bits().
| #define I386_DR_CONTROL_MASK (~DR_CONTROL_RESERVED) | 
Definition at line 105 of file i386-nat.c.
Referenced by i386_insert_aligned_watchpoint().
| #define I386_DR_DISABLE | ( | state, | |
| i | |||
| ) | 
do { \ (state)->dr_control_mirror &= \ ~(3 << (DR_ENABLE_SIZE * (i))); \ } while (0)
Definition at line 127 of file i386-nat.c.
Referenced by i386_remove_aligned_watchpoint().
| #define I386_DR_GET_RW_LEN | ( | dr7, | |
| i | |||
| ) | 
(((dr7) \
    >> (DR_CONTROL_SHIFT + DR_CONTROL_SIZE * (i))) & 0x0f)
Definition at line 143 of file i386-nat.c.
Referenced by i386_insert_aligned_watchpoint(), i386_remove_aligned_watchpoint(), and i386_stopped_data_address().
| #define I386_DR_GLOBAL_ENABLE | ( | state, | |
| i | |||
| ) | 
do { \ (state)->dr_control_mirror |= \ (1 << (DR_GLOBAL_ENABLE_SHIFT + DR_ENABLE_SIZE * (i))); \ } while (0)
Definition at line 120 of file i386-nat.c.
| #define I386_DR_LOCAL_ENABLE | ( | state, | |
| i | |||
| ) | 
do { \ (state)->dr_control_mirror |= \ (1 << (DR_LOCAL_ENABLE_SHIFT + DR_ENABLE_SIZE * (i))); \ } while (0)
Definition at line 113 of file i386-nat.c.
Referenced by i386_insert_aligned_watchpoint().
| #define I386_DR_SET_RW_LEN | ( | state, | |
| i, | |||
| rwlen | |||
| ) | 
do { \ (state)->dr_control_mirror &= \ ~(0x0f << (DR_CONTROL_SHIFT + DR_CONTROL_SIZE * (i))); \ (state)->dr_control_mirror |= \ ((rwlen) << (DR_CONTROL_SHIFT + DR_CONTROL_SIZE * (i))); \ } while (0)
Definition at line 134 of file i386-nat.c.
Referenced by i386_insert_aligned_watchpoint().
| #define I386_DR_VACANT | ( | state, | |
| i | |||
| ) | (((state)->dr_control_mirror & (3 << (DR_ENABLE_SIZE * (i)))) == 0) | 
Definition at line 109 of file i386-nat.c.
Referenced by i386_insert_aligned_watchpoint(), i386_remove_aligned_watchpoint(), and i386_update_inferior_debug_regs().
| #define I386_DR_WATCH_HIT | ( | dr6, | |
| i | |||
| ) | ((dr6) & (1 << (i))) | 
Definition at line 151 of file i386-nat.c.
Referenced by i386_stopped_data_address().
| #define I386_DR_WATCH_MASK | ( | i | ) | (1 << (i)) | 
Definition at line 148 of file i386-nat.c.
| #define TARGET_HAS_DR_LEN_8 (i386_dr_low.debug_register_length == 8) | 
Definition at line 44 of file i386-nat.c.
Referenced by i386_handle_nonaligned_watchpoint(), i386_insert_watchpoint(), i386_length_and_rw_bits(), and i386_remove_watchpoint().
| enum i386_wp_op_t | 
Definition at line 258 of file i386-nat.c.
| static void add_show_debug_regs_command | ( | void | ) |  [static] | 
Definition at line 840 of file i386-nat.c.
References _, add_setshow_boolean_cmd(), class_maintenance, maint_show_dr, maintenance_set_cmdlist, and maintenance_show_cmdlist.
Referenced by i386_set_debug_register_length().
| static struct i386_process_info* i386_add_process | ( | pid_t | pid | ) |  [static, read] | 
Definition at line 193 of file i386-nat.c.
References i386_process_list, i386_process_info::next, i386_process_info::pid, and xcalloc().
Referenced by i386_process_info_get().
| static int i386_can_use_hw_breakpoint | ( | int | type, | 
| int | cnt, | ||
| int | othertype | ||
| ) |  [static] | 
Definition at line 834 of file i386-nat.c.
Referenced by i386_use_watchpoints().
| void i386_cleanup_dregs | ( | void | ) | 
Definition at line 302 of file i386-nat.c.
References i386_forget_process(), inferior_ptid, and ptid_get_pid().
Referenced by amd64_linux_child_post_startup_inferior(), amd64fbsd_mourn_inferior(), go32_mourn_inferior(), i386_linux_child_post_startup_inferior(), windows_detach(), and windows_mourn_inferior().
| struct i386_debug_reg_state* i386_debug_reg_state | ( | pid_t | pid | ) |  [read] | 
Definition at line 224 of file i386-nat.c.
References i386_process_info_get(), and i386_process_info::state.
Referenced by amd64_linux_new_fork(), amd64_linux_prepare_to_resume(), i386_insert_hw_breakpoint(), i386_insert_watchpoint(), i386_linux_new_fork(), i386_linux_prepare_to_resume(), i386_region_ok_for_watchpoint(), i386_remove_hw_breakpoint(), i386_remove_watchpoint(), i386_stopped_data_address(), and i386_update_inferior_debug_regs().
| static struct i386_process_info* i386_find_process_pid | ( | pid_t | pid | ) |  [static, read] | 
Definition at line 178 of file i386-nat.c.
References i386_process_info::next, and i386_process_info::pid.
Referenced by i386_process_info_get().
| void i386_forget_process | ( | pid_t | pid | ) | 
Definition at line 232 of file i386-nat.c.
References i386_process_list, i386_process_info::next, i386_process_info::pid, and xfree().
Referenced by _initialize_amd64_linux_nat(), _initialize_i386_linux_nat(), and i386_cleanup_dregs().
| static int i386_handle_nonaligned_watchpoint | ( | struct i386_debug_reg_state * | state, | 
| i386_wp_op_t | what, | ||
| CORE_ADDR | addr, | ||
| int | len, | ||
| enum target_hw_bp_type | type | ||
| ) |  [static] | 
Definition at line 503 of file i386-nat.c.
References _, i386_insert_aligned_watchpoint(), i386_length_and_rw_bits(), i386_remove_aligned_watchpoint(), internal_error(), size, TARGET_HAS_DR_LEN_8, WP_COUNT, WP_INSERT, and WP_REMOVE.
Referenced by i386_insert_watchpoint(), i386_region_ok_for_watchpoint(), and i386_remove_watchpoint().
| static int i386_insert_aligned_watchpoint | ( | struct i386_debug_reg_state * | state, | 
| CORE_ADDR | addr, | ||
| unsigned | len_rw_bits | ||
| ) |  [static] | 
Definition at line 411 of file i386-nat.c.
References ALL_DEBUG_REGISTERS, i386_debug_reg_state::dr_control_mirror, DR_LOCAL_SLOWDOWN, i386_debug_reg_state::dr_mirror, DR_NADDR, i386_debug_reg_state::dr_ref_count, I386_DR_CONTROL_MASK, I386_DR_GET_RW_LEN, I386_DR_LOCAL_ENABLE, i386_dr_low, I386_DR_SET_RW_LEN, I386_DR_VACANT, i386_dr_low_type::set_addr, and i386_dr_low_type::set_control.
Referenced by i386_handle_nonaligned_watchpoint(), i386_insert_hw_breakpoint(), and i386_insert_watchpoint().
| static int i386_insert_hw_breakpoint | ( | struct gdbarch * | gdbarch, | 
| struct bp_target_info * | bp_tgt | ||
| ) |  [static] | 
Definition at line 768 of file i386-nat.c.
References hw_execute, i386_debug_reg_state(), i386_insert_aligned_watchpoint(), i386_length_and_rw_bits(), i386_show_dr(), i386_update_inferior_debug_regs(), inferior_ptid, maint_show_dr, bp_target_info::placed_address, and ptid_get_pid().
Referenced by i386_use_watchpoints().
| static int i386_insert_watchpoint | ( | CORE_ADDR | addr, | 
| int | len, | ||
| int | type, | ||
| struct expression * | cond | ||
| ) |  [static] | 
Definition at line 592 of file i386-nat.c.
References hw_read, i386_debug_reg_state(), i386_handle_nonaligned_watchpoint(), i386_insert_aligned_watchpoint(), i386_length_and_rw_bits(), i386_show_dr(), i386_update_inferior_debug_regs(), inferior_ptid, maint_show_dr, ptid_get_pid(), TARGET_HAS_DR_LEN_8, and WP_INSERT.
Referenced by i386_use_watchpoints().
| static unsigned i386_length_and_rw_bits | ( | int | len, | 
| enum target_hw_bp_type | type | ||
| ) |  [static] | 
Definition at line 355 of file i386-nat.c.
References _, DR_LEN_1, DR_LEN_2, DR_LEN_4, DR_LEN_8, DR_RW_EXECUTE, DR_RW_IORW, DR_RW_READ, DR_RW_WRITE, hw_access, hw_execute, hw_read, hw_write, internal_error(), and TARGET_HAS_DR_LEN_8.
Referenced by i386_handle_nonaligned_watchpoint(), i386_insert_hw_breakpoint(), i386_insert_watchpoint(), i386_remove_hw_breakpoint(), and i386_remove_watchpoint().
| static struct i386_process_info* i386_process_info_get | ( | pid_t | pid | ) |  [static, read] | 
Definition at line 210 of file i386-nat.c.
References i386_add_process(), and i386_find_process_pid().
Referenced by i386_debug_reg_state().
| static int i386_region_ok_for_watchpoint | ( | CORE_ADDR | addr, | 
| int | len | ||
| ) |  [static] | 
Definition at line 665 of file i386-nat.c.
References DR_NADDR, hw_write, i386_debug_reg_state(), i386_handle_nonaligned_watchpoint(), inferior_ptid, ptid_get_pid(), and WP_COUNT.
Referenced by i386_use_watchpoints().
| static int i386_remove_aligned_watchpoint | ( | struct i386_debug_reg_state * | state, | 
| CORE_ADDR | addr, | ||
| unsigned | len_rw_bits | ||
| ) |  [static] | 
Definition at line 471 of file i386-nat.c.
References ALL_DEBUG_REGISTERS, i386_debug_reg_state::dr_control_mirror, i386_debug_reg_state::dr_mirror, i386_debug_reg_state::dr_ref_count, I386_DR_DISABLE, I386_DR_GET_RW_LEN, and I386_DR_VACANT.
Referenced by i386_handle_nonaligned_watchpoint(), i386_remove_hw_breakpoint(), and i386_remove_watchpoint().
| static int i386_remove_hw_breakpoint | ( | struct gdbarch * | gdbarch, | 
| struct bp_target_info * | bp_tgt | ||
| ) |  [static] | 
Definition at line 794 of file i386-nat.c.
References hw_execute, i386_debug_reg_state(), i386_length_and_rw_bits(), i386_remove_aligned_watchpoint(), i386_show_dr(), i386_update_inferior_debug_regs(), inferior_ptid, maint_show_dr, bp_target_info::placed_address, and ptid_get_pid().
Referenced by i386_use_watchpoints().
| static int i386_remove_watchpoint | ( | CORE_ADDR | addr, | 
| int | len, | ||
| int | type, | ||
| struct expression * | cond | ||
| ) |  [static] | 
Definition at line 630 of file i386-nat.c.
References i386_debug_reg_state(), i386_handle_nonaligned_watchpoint(), i386_length_and_rw_bits(), i386_remove_aligned_watchpoint(), i386_show_dr(), i386_update_inferior_debug_regs(), inferior_ptid, maint_show_dr, ptid_get_pid(), TARGET_HAS_DR_LEN_8, and WP_REMOVE.
Referenced by i386_use_watchpoints().
| void i386_set_debug_register_length | ( | int | len | ) | 
Definition at line 879 of file i386-nat.c.
References add_show_debug_regs_command(), i386_dr_low_type::debug_register_length, gdb_assert, i386_dr_low, and len.
Referenced by _initialize_amd64_linux_nat(), _initialize_amd64_windows_nat(), _initialize_amd64fbsd_nat(), _initialize_i386_linux_nat(), _initialize_i386_windows_nat(), _initialize_i386fbsd_nat(), darwin_complete_target(), and init_go32_ops().
| static void i386_show_dr | ( | struct i386_debug_reg_state * | state, | 
| const char * | func, | ||
| CORE_ADDR | addr, | ||
| int | len, | ||
| enum target_hw_bp_type | type | ||
| ) |  [static] | 
Definition at line 313 of file i386-nat.c.
References ALL_DEBUG_REGISTERS, i386_debug_reg_state::dr_control_mirror, i386_debug_reg_state::dr_mirror, i386_debug_reg_state::dr_ref_count, i386_debug_reg_state::dr_status_mirror, gdbarch_addr_bit(), hw_access, hw_execute, hw_read, hw_write, phex(), printf_unfiltered(), puts_unfiltered(), and target_gdbarch().
Referenced by i386_insert_hw_breakpoint(), i386_insert_watchpoint(), i386_remove_hw_breakpoint(), i386_remove_watchpoint(), and i386_stopped_data_address().
| static int i386_stopped_by_watchpoint | ( | void | ) |  [static] | 
Definition at line 759 of file i386-nat.c.
References current_target, and i386_stopped_data_address().
Referenced by i386_use_watchpoints().
| static int i386_stopped_data_address | ( | struct target_ops * | ops, | 
| CORE_ADDR * | addr_p | ||
| ) |  [static] | 
Definition at line 683 of file i386-nat.c.
References ALL_DEBUG_REGISTERS, i386_dr_low_type::get_addr, i386_dr_low_type::get_control, i386_dr_low_type::get_status, hw_write, i386_debug_reg_state(), I386_DR_GET_RW_LEN, i386_dr_low, I386_DR_WATCH_HIT, i386_show_dr(), inferior_ptid, maint_show_dr, ptid_get_pid(), and exsummary::status.
Referenced by i386_stopped_by_watchpoint(), and i386_use_watchpoints().
| static void i386_update_inferior_debug_regs | ( | struct i386_debug_reg_state * | new_state | ) |  [static] | 
Definition at line 567 of file i386-nat.c.
References ALL_DEBUG_REGISTERS, i386_debug_reg_state::dr_control_mirror, i386_debug_reg_state::dr_mirror, gdb_assert, i386_debug_reg_state(), i386_dr_low, I386_DR_VACANT, inferior_ptid, ptid_get_pid(), i386_dr_low_type::set_addr, and i386_dr_low_type::set_control.
Referenced by i386_insert_hw_breakpoint(), i386_insert_watchpoint(), i386_remove_hw_breakpoint(), and i386_remove_watchpoint().
| void i386_use_watchpoints | ( | struct target_ops * | t | ) | 
Definition at line 861 of file i386-nat.c.
References i386_can_use_hw_breakpoint(), i386_insert_hw_breakpoint(), i386_insert_watchpoint(), i386_region_ok_for_watchpoint(), i386_remove_hw_breakpoint(), i386_remove_watchpoint(), i386_stopped_by_watchpoint(), i386_stopped_data_address(), target_ops::to_can_use_hw_breakpoint, target_ops::to_have_continuable_watchpoint, target_ops::to_insert_hw_breakpoint, target_ops::to_insert_watchpoint, target_ops::to_region_ok_for_hw_watchpoint, target_ops::to_remove_hw_breakpoint, target_ops::to_remove_watchpoint, target_ops::to_stopped_by_watchpoint, and target_ops::to_stopped_data_address.
Referenced by _initialize_amd64_linux_nat(), _initialize_amd64fbsd_nat(), _initialize_i386_linux_nat(), _initialize_i386fbsd_nat(), darwin_complete_target(), init_go32_ops(), and init_windows_ops().
| struct i386_dr_low_type i386_dr_low | 
Definition at line 40 of file i386-nat.c.
Referenced by _initialize_amd64_linux_nat(), _initialize_amd64fbsd_nat(), _initialize_i386_linux_nat(), _initialize_i386fbsd_nat(), darwin_complete_target(), i386_insert_aligned_watchpoint(), i386_set_debug_register_length(), i386_stopped_data_address(), i386_update_inferior_debug_regs(), init_go32_ops(), and init_windows_ops().
| struct i386_process_info* i386_process_list = NULL  [static] | 
Definition at line 173 of file i386-nat.c.
Referenced by i386_add_process(), and i386_forget_process().
| int maint_show_dr  [static] | 
Definition at line 255 of file i386-nat.c.
Referenced by add_show_debug_regs_command(), i386_insert_hw_breakpoint(), i386_insert_watchpoint(), i386_remove_hw_breakpoint(), i386_remove_watchpoint(), and i386_stopped_data_address().
 1.7.6.1
 1.7.6.1